diff options
-rw-r--r-- | ChangeLog | 30 | ||||
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | embed/ephy-embed-utils.c | 2 | ||||
-rw-r--r-- | lib/egg/egg-menu-merge.c | 62 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/ephy-favorites-menu.c | 13 | ||||
-rw-r--r-- | src/ephy-favorites-menu.h | 2 | ||||
-rw-r--r-- | src/ephy-window.c | 18 | ||||
-rwxr-xr-x | src/ppview-toolbar.c | 7 |
9 files changed, 98 insertions, 43 deletions
@@ -1,6 +1,36 @@ 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. + +2003-01-23 Marco Pesenti Gritti <marco@it.gnome.org> + + * TODO: * lib/ephy-autocompletion.c: (ephy_autocompletion_reset), (ephy_autocompletion_set_key), (ephy_autocompletion_update_matches_full): @@ -8,6 +8,11 @@ To do: - temporary bookmarks, maybe an expire checkbox in new bookmark dialog ? - history shows empty hosts sometimes !? +Egg problems: +- popups not working +- idle not removed when finalizing menu merge +- action reffed in menu merge and never unrefed + Done: * simpler crash recover diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c index e119d1f8a..8a8e116f7 100644 --- a/embed/ephy-embed-utils.c +++ b/embed/ephy-embed-utils.c @@ -244,7 +244,7 @@ ephy_embed_utils_build_charsets_submenu (BonoboUIComponent *ui_component, for (gl = groups; gl != NULL; gl = gl->next) { GList *charsets, *cl; - const char *group = (const char *)groups->data; + const char *group = (const char *)gl->data; build_group (xml_string, group, group_index); 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) { diff --git a/src/Makefile.am b/src/Makefile.am index 875926c3b..bf4fdb8a2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -46,6 +46,8 @@ epiphany_SOURCES = \ appearance-prefs.h \ ephy-automation.c \ ephy-automation.h \ + ephy-encoding-menu.c \ + ephy-encoding-menu.h \ ephy-favicon-action.c \ ephy-favicon-action.h \ ephy-favorites-menu.c \ diff --git a/src/ephy-favorites-menu.c b/src/ephy-favorites-menu.c index 4c13072c8..c8be1e816 100644 --- a/src/ephy-favorites-menu.c +++ b/src/ephy-favorites-menu.c @@ -138,6 +138,14 @@ ephy_favorites_menu_finalize_impl (GObject *o) EphyFavoritesMenu *wrhm = EPHY_FAVORITES_MENU (o); EphyFavoritesMenuPrivate *p = wrhm->priv; + if (p->action_group != NULL) + { + egg_menu_merge_remove_action_group + (EGG_MENU_MERGE (p->window->ui_merge), + p->action_group); + g_object_unref (p->action_group); + } + g_free (p); G_OBJECT_CLASS (g_object_class)->finalize (o); @@ -186,9 +194,8 @@ ephy_favorites_menu_new (EphyWindow *window) } static void -ephy_favorites_menu_verb_cb (BonoboUIComponent *uic, - FavoriteData *data, - const char *cname) +ephy_favorites_menu_verb_cb (EggMenuMerge *merge, + FavoriteData *data) { ephy_window_load_url (data->window, data->url); } diff --git a/src/ephy-favorites-menu.h b/src/ephy-favorites-menu.h index 228cbcef8..78bd74193 100644 --- a/src/ephy-favorites-menu.h +++ b/src/ephy-favorites-menu.h @@ -21,8 +21,6 @@ #include "ephy-window.h" -#include <bonobo/bonobo-ui-component.h> - /* object forward declarations */ typedef struct _EphyFavoritesMenu EphyFavoritesMenu; diff --git a/src/ephy-window.c b/src/ephy-window.c index 1da8cc949..ec023ff83 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -31,13 +31,13 @@ #include "ephy-shell.h" #include "eel-gconf-extensions.h" #include "ephy-prefs.h" -#include "ephy-embed-utils.h" #include "ephy-debug.h" #include "ephy-file-helpers.h" #include "statusbar.h" #include "toolbar.h" #include "popup-commands.h" #include "egg-toggle-action.h" +#include "ephy-encoding-menu.h" #include <string.h> #include <libgnome/gnome-i18n.h> @@ -51,18 +51,6 @@ #include "egg-action-group.h" #include "egg-menu-merge.h" -#define CHARSET_MENU_PATH "/menu/View/EncodingMenuPlaceholder" -#define GO_FAVORITES_PATH "/menu/Go/Favorites" - -#define GO_BACK_ACTION "GoBack" -#define GO_FORWARD_ACTION "GoForward" -#define GO_UP_ACTION "GoUp" -#define EDIT_FIND_NEXT_ACTION "EditFindNext" -#define EDIT_FIND_PREV_ACTION "EditFindPrev" -#define VIEW_STATUSBAR_ACTION "ViewStatusbar" -#define VIEW_TOOLBAR_ACTION "ViewToolbar" -#define VIEW_FULLSCREEN_ACTION "ViewFullscreen" - static EggActionGroupEntry ephy_menu_entries [] = { /* Toplevel */ @@ -159,6 +147,7 @@ static EggActionGroupEntry ephy_menu_entries [] = { { "ViewZoomNormal", N_("_Normal Size"), GTK_STOCK_ZOOM_100, NULL, N_("Show the contents at the normal size"), G_CALLBACK (window_cmd_view_zoom_normal), NULL }, + { "ViewEncoding", N_("_Encoding"), NULL, NULL, NULL, NULL, NULL }, { "ViewPageSource", N_("_Page Source"), NULL, NULL, N_("View the source code of the page"), G_CALLBACK (window_cmd_view_page_source), NULL }, @@ -271,6 +260,7 @@ struct EphyWindowPrivate EggActionGroup *action_group; EggActionGroup *popups_action_group; EphyFavoritesMenu *fav_menu; + EphyEncodingMenu *enc_menu; PPViewToolbar *ppview_toolbar; GtkNotebook *notebook; EphyTab *active_tab; @@ -556,6 +546,7 @@ ephy_window_init (EphyWindow *window) setup_window (window); window->priv->fav_menu = ephy_favorites_menu_new (window); + window->priv->enc_menu = ephy_encoding_menu_new (window); /* Setup window contents */ window->priv->notebook = setup_notebook (window); @@ -639,6 +630,7 @@ ephy_window_finalize (GObject *object) } g_object_unref (window->priv->fav_menu); + g_object_unref (window->priv->enc_menu); if (window->priv->toolbar) { diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c index 78b3b33d9..a97765930 100755 --- a/src/ppview-toolbar.c +++ b/src/ppview-toolbar.c @@ -26,10 +26,6 @@ #include <string.h> #include <bonobo/bonobo-i18n.h> -#include <bonobo/bonobo-window.h> -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-ui-toolbar-button-item.h> -#include <bonobo/bonobo-property-bag.h> #include <gtk/gtkentry.h> #include <gtk/gtkmenu.h> @@ -275,7 +271,10 @@ ppview_toolbar_finalize (GObject *object) t = PPVIEW_TOOLBAR (object); g_return_if_fail (t->priv != NULL); + egg_menu_merge_remove_ui (t->priv->ui_merge, t->priv->ui_id); + egg_menu_merge_remove_action_group (t->priv->ui_merge, + t->priv->action_group); g_object_unref (t->priv->action_group); g_free (t->priv); |