diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-01-23 21:22:17 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-01-23 21:22:17 +0800 |
commit | 2db0d1ed3d15012d2d9c80d8d9499160e1f535dc (patch) | |
tree | d2caa10c004ddf0196656611acd4c3b3e0e05c0c /lib/egg | |
parent | 7fe73f1990a361a3c794ef5517e2cb4d3188466e (diff) | |
download | gsoc2013-epiphany-2db0d1ed3d15012d2d9c80d8d9499160e1f535dc.tar gsoc2013-epiphany-2db0d1ed3d15012d2d9c80d8d9499160e1f535dc.tar.gz gsoc2013-epiphany-2db0d1ed3d15012d2d9c80d8d9499160e1f535dc.tar.bz2 gsoc2013-epiphany-2db0d1ed3d15012d2d9c80d8d9499160e1f535dc.tar.lz gsoc2013-epiphany-2db0d1ed3d15012d2d9c80d8d9499160e1f535dc.tar.xz gsoc2013-epiphany-2db0d1ed3d15012d2d9c80d8d9499160e1f535dc.tar.zst gsoc2013-epiphany-2db0d1ed3d15012d2d9c80d8d9499160e1f535dc.zip |
Reimplement encoding menus. Work around eggmenu finalization problems. Fix
2003-01-23 Marco Pesenti Gritti <marco@it.gnome.org>
* TODO:
* data/ui/epiphany-ui.xml.in:
* embed/ephy-embed-utils.c:
(ephy_embed_utils_build_charsets_submenu):
* lib/egg/egg-menu-merge.c: (egg_menu_merge_finalize),
(egg_menu_merge_class_init), (egg_menu_merge_init),
(egg_menu_merge_node_prepend_uierence),
(egg_menu_merge_node_remove_uierence), (start_element_handler),
(cleanup), (remove_ui), (update_node):
* src/Makefile.am:
* src/ephy-encoding-menu.c: (ephy_encoding_menu_class_init),
(ephy_encoding_menu_init), (ephy_encoding_menu_finalize_impl),
(ephy_encoding_menu_set_property),
(ephy_encoding_menu_get_property), (ephy_encoding_menu_new),
(ephy_encoding_menu_verb_cb), (build_group), (build_charset),
(ephy_encoding_menu_rebuild):
* src/ephy-encoding-menu.h:
* src/ephy-favorites-menu.c: (ephy_favorites_menu_finalize_impl),
(ephy_favorites_menu_verb_cb):
* src/ephy-favorites-menu.h:
* src/ephy-window.c: (ephy_window_init), (ephy_window_finalize):
* src/ppview-toolbar.c: (ppview_toolbar_finalize):
Reimplement encoding menus.
Work around eggmenu finalization problems.
Fix ppvtoolbar/favorites menu to correctly
remove action group on finalize.
Diffstat (limited to 'lib/egg')
-rw-r--r-- | lib/egg/egg-menu-merge.c | 62 |
1 files changed, 42 insertions, 20 deletions
diff --git a/lib/egg/egg-menu-merge.c b/lib/egg/egg-menu-merge.c index 7c5f2f83c..8800e615d 100644 --- a/lib/egg/egg-menu-merge.c +++ b/lib/egg/egg-menu-merge.c @@ -31,10 +31,10 @@ static GNode *egg_menu_merge_get_node (EggMenuMerge *self, gboolean create); static guint egg_menu_merge_next_merge_id (EggMenuMerge *self); -static void egg_menu_merge_node_prepend_ui_reference (EggMenuMergeNode *node, +static void egg_menu_merge_node_prepend_uierence (EggMenuMergeNode *node, guint merge_id, GQuark action_quark); -static void egg_menu_merge_node_remove_ui_reference (EggMenuMergeNode *node, +static void egg_menu_merge_node_remove_uierence (EggMenuMergeNode *node, guint merge_id); enum { @@ -47,6 +47,8 @@ static guint merge_signals[LAST_SIGNAL] = { 0 }; static GMemChunk *merge_node_chunk = NULL; +static GObjectClass *parent_class = NULL; + GType egg_menu_merge_get_type (void) { @@ -76,8 +78,28 @@ egg_menu_merge_get_type (void) } static void +egg_menu_merge_finalize (GObject *object) +{ + EggMenuMerge *self = EGG_MENU_MERGE (object); + + if (self->update_tag != 0) + { + self->update_tag = g_idle_remove_by_data (self); + } + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void egg_menu_merge_class_init (EggMenuMergeClass *class) { + GObjectClass *object_class; + + parent_class = g_type_class_peek_parent (class); + object_class = G_OBJECT_CLASS(class); + + object_class->finalize = egg_menu_merge_finalize; + if (!merge_node_chunk) merge_node_chunk = g_mem_chunk_create(EggMenuMergeNode, 64, G_ALLOC_AND_FREE); @@ -119,10 +141,10 @@ egg_menu_merge_init (EggMenuMerge *self) merge_id = egg_menu_merge_next_merge_id(self); node = get_child_node(self, NULL, "Root", 4, EGG_MENU_MERGE_ROOT, TRUE, FALSE); - egg_menu_merge_node_prepend_ui_reference(NODE_INFO(node), merge_id, 0); + egg_menu_merge_node_prepend_uierence(NODE_INFO(node), merge_id, 0); node = get_child_node(self, self->root_node, "popups", 6, EGG_MENU_MERGE_POPUPS, TRUE, FALSE); - egg_menu_merge_node_prepend_ui_reference(NODE_INFO(node), merge_id, 0); + egg_menu_merge_node_prepend_uierence(NODE_INFO(node), merge_id, 0); } EggMenuMerge * @@ -297,7 +319,7 @@ egg_menu_merge_next_merge_id (EggMenuMerge *self) } static void -egg_menu_merge_node_prepend_ui_reference (EggMenuMergeNode *node, +egg_menu_merge_node_prepend_uierence (EggMenuMergeNode *node, guint merge_id, GQuark action_quark) { NodeUIReference *reference; @@ -313,7 +335,7 @@ egg_menu_merge_node_prepend_ui_reference (EggMenuMergeNode *node, } static void -egg_menu_merge_node_remove_ui_reference (EggMenuMergeNode *node, +egg_menu_merge_node_remove_uierence (EggMenuMergeNode *node, guint merge_id) { GList *p; @@ -413,7 +435,7 @@ start_element_handler (GMarkupParseContext *context, ctx->current = self->root_node; raise_error = FALSE; - egg_menu_merge_node_prepend_ui_reference (NODE_INFO (ctx->current), + egg_menu_merge_node_prepend_uierence (NODE_INFO (ctx->current), ctx->merge_id, verb_quark); } break; @@ -428,7 +450,7 @@ start_element_handler (GMarkupParseContext *context, if (NODE_INFO(ctx->current)->action_name == 0) NODE_INFO(ctx->current)->action_name = verb_quark; - egg_menu_merge_node_prepend_ui_reference (NODE_INFO (ctx->current), + egg_menu_merge_node_prepend_uierence (NODE_INFO (ctx->current), ctx->merge_id, verb_quark); NODE_INFO(ctx->current)->dirty = TRUE; @@ -446,7 +468,7 @@ start_element_handler (GMarkupParseContext *context, if (NODE_INFO(node)->action_name == 0) NODE_INFO(node)->action_name = verb_quark; - egg_menu_merge_node_prepend_ui_reference (NODE_INFO (node), + egg_menu_merge_node_prepend_uierence (NODE_INFO (node), ctx->merge_id, verb_quark); NODE_INFO(node)->dirty = TRUE; @@ -464,7 +486,7 @@ start_element_handler (GMarkupParseContext *context, if (NODE_INFO(ctx->current)->action_name == 0) NODE_INFO(ctx->current)->action_name = verb_quark; - egg_menu_merge_node_prepend_ui_reference (NODE_INFO (ctx->current), + egg_menu_merge_node_prepend_uierence (NODE_INFO (ctx->current), ctx->merge_id, verb_quark); NODE_INFO(ctx->current)->dirty = TRUE; @@ -480,7 +502,7 @@ start_element_handler (GMarkupParseContext *context, EGG_MENU_MERGE_POPUPS, TRUE, FALSE); - egg_menu_merge_node_prepend_ui_reference (NODE_INFO (ctx->current), + egg_menu_merge_node_prepend_uierence (NODE_INFO (ctx->current), ctx->merge_id, verb_quark); NODE_INFO(ctx->current)->dirty = TRUE; @@ -496,7 +518,7 @@ start_element_handler (GMarkupParseContext *context, if (NODE_INFO(ctx->current)->action_name == 0) NODE_INFO(ctx->current)->action_name = verb_quark; - egg_menu_merge_node_prepend_ui_reference (NODE_INFO (ctx->current), + egg_menu_merge_node_prepend_uierence (NODE_INFO (ctx->current), ctx->merge_id, verb_quark); NODE_INFO(ctx->current)->dirty = TRUE; @@ -516,7 +538,7 @@ start_element_handler (GMarkupParseContext *context, EGG_MENU_MERGE_TOOLBAR_PLACEHOLDER, TRUE, top); - egg_menu_merge_node_prepend_ui_reference (NODE_INFO (ctx->current), + egg_menu_merge_node_prepend_uierence (NODE_INFO (ctx->current), ctx->merge_id, verb_quark); NODE_INFO(ctx->current)->dirty = TRUE; @@ -534,7 +556,7 @@ start_element_handler (GMarkupParseContext *context, if (NODE_INFO(ctx->current)->action_name == 0) NODE_INFO(ctx->current)->action_name = verb_quark; - egg_menu_merge_node_prepend_ui_reference (NODE_INFO (ctx->current), + egg_menu_merge_node_prepend_uierence (NODE_INFO (ctx->current), ctx->merge_id, verb_quark); NODE_INFO(ctx->current)->dirty = TRUE; @@ -556,7 +578,7 @@ start_element_handler (GMarkupParseContext *context, if (NODE_INFO(node)->action_name == 0) NODE_INFO(node)->action_name = verb_quark; - egg_menu_merge_node_prepend_ui_reference (NODE_INFO (node), + egg_menu_merge_node_prepend_uierence (NODE_INFO (node), ctx->merge_id, verb_quark); NODE_INFO(node)->dirty = TRUE; @@ -576,7 +598,7 @@ start_element_handler (GMarkupParseContext *context, if (NODE_INFO(node)->action_name == 0) NODE_INFO(node)->action_name = verb_quark; - egg_menu_merge_node_prepend_ui_reference (NODE_INFO (node), + egg_menu_merge_node_prepend_uierence (NODE_INFO (node), ctx->merge_id, verb_quark); NODE_INFO(node)->dirty = TRUE; @@ -672,7 +694,7 @@ cleanup (GMarkupParseContext *context, { ParseContext *ctx = user_data; EggMenuMerge *self = ctx->self; - + g_print ("Cleanup ui\n"); ctx->current = NULL; /* should also walk through the tree and get rid of nodes related to * this UI file's tag */ @@ -749,7 +771,7 @@ remove_ui (GNode *node, gpointer user_data) { guint merge_id = GPOINTER_TO_UINT (user_data); - egg_menu_merge_node_remove_ui_reference (NODE_INFO (node), merge_id); + egg_menu_merge_node_remove_uierence (NODE_INFO (node), merge_id); return FALSE; /* continue */ } @@ -977,8 +999,8 @@ update_node (EggMenuMerge *self, GNode *node) if (info->action) g_object_unref (info->action); info->action = action; - if (info->action) - g_object_ref (info->action); +/* if (info->action) + g_object_ref (info->action);*/ switch (info->type) { |