Redesign the library and related components.

This step is needed, since the current design is quite chaotic
and it would not be possible to finish the application.

There's still a lot to be done.

After this step, it's time to implement the rest of LdLua.
This commit is contained in:
2010-09-30 05:19:31 +02:00
parent 0c9b297e50
commit e0e63649dc
10 changed files with 138 additions and 84 deletions

View File

@@ -27,33 +27,24 @@ G_BEGIN_DECLS
((obj), LD_SYMBOL_CATEGORY, LdSymbolCategoryClass))
typedef struct _LdSymbolCategory LdSymbolCategory;
typedef struct _LdSymbolCategoryPrivate LdSymbolCategoryPrivate;
typedef struct _LdSymbolCategoryClass LdSymbolCategoryClass;
/**
* LdSymbolCategory:
* @parent: The parent object, may be #LdLibrary
* or another #LdSymbolCategory.
* @name: The name of the category.
* @image_path: Path to the image for this category.
* @children: Children of this category.
*/
/* TODO: Make the public fields private and set them as properties
* + implement setters and getters. On change the category
* shall emit a "changed" signal in the Library.
*/
struct _LdSymbolCategory
{
/*< private >*/
GObject parent_instance;
/*< public >*/
gpointer parent;
gchar *name;
gchar *image_path;
GHashTable *children;
LdSymbolCategoryPrivate *priv;
};
/* TODO: If required sometime, categories (and maybe symbols) should implement
* a "changed" signal. This can be somewhat tricky. The library might be
* a good candidate for what they call a proxy. See GtkUIManager.
*/
struct _LdSymbolCategoryClass
{
GObjectClass parent_class;
@@ -62,13 +53,20 @@ struct _LdSymbolCategoryClass
GType ld_symbol_category_get_type (void) G_GNUC_CONST;
LdSymbolCategory *
ld_symbol_category_new (LdLibrary *parent);
LdSymbolCategory *ld_symbol_category_new (const gchar *name);
/* TODO: Methods for inserting and removing children. */
/* TODO: Create a separate ld-symbol-private.h, include it in this ld-s-c.c
* and then assign and ref the parent category here.
*/
/* TODO: Create properties for "name" and "image_path". */
void ld_symbol_category_set_name (LdSymbolCategory *self, const gchar *name);
const gchar *ld_symbol_category_get_name (LdSymbolCategory *self);
void ld_symbol_category_set_image_path (LdSymbolCategory *self,
const gchar *image_path);
const gchar *ld_symbol_category_get_image_path (LdSymbolCategory *self);
/* TODO: Implement. */
void ld_symbol_category_insert_child (LdSymbolCategory *self,
GObject *child, gint pos);
void ld_symbol_category_remove_child (LdSymbolCategory *self,
GObject *child);
GSList *ld_symbol_category_get_children (LdSymbolCategory *self);
G_END_DECLS