diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-09-14 04:46:14 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-09-14 04:46:14 +0800 |
commit | bf60b7ae05e75e10a8f15ec8ca2635874c4dab90 (patch) | |
tree | 141774e6817ed54e8bab9e6a0ea362f3cc19b148 /src | |
parent | 816da20fe31c6186a80ef92fe824ccd9088f9a15 (diff) | |
download | gsoc2013-epiphany-bf60b7ae05e75e10a8f15ec8ca2635874c4dab90.tar gsoc2013-epiphany-bf60b7ae05e75e10a8f15ec8ca2635874c4dab90.tar.gz gsoc2013-epiphany-bf60b7ae05e75e10a8f15ec8ca2635874c4dab90.tar.bz2 gsoc2013-epiphany-bf60b7ae05e75e10a8f15ec8ca2635874c4dab90.tar.lz gsoc2013-epiphany-bf60b7ae05e75e10a8f15ec8ca2635874c4dab90.tar.xz gsoc2013-epiphany-bf60b7ae05e75e10a8f15ec8ca2635874c4dab90.tar.zst gsoc2013-epiphany-bf60b7ae05e75e10a8f15ec8ca2635874c4dab90.zip |
Add ephy_window_get_ui_manager(), and remove the manager from the public
2004-09-13 Christian Persch <chpe@cvs.gnome.org>
* data/art/epiphany-entry.png:
* src/bookmarks/ephy-bookmarks-menu.c:
(ephy_bookmarks_menu_set_window):
* src/bookmarks/ephy-bookmarksbar.c:
(ephy_bookmarksbar_set_window):
* src/bookmarks/ephy-favorites-menu.c: (ephy_favorites_menu_clean),
(ephy_favorites_menu_rebuild):
* src/ephy-encoding-menu.c: (ephy_encoding_menu_set_window):
* src/ephy-tabs-menu.c: (ephy_tabs_menu_set_window),
(ephy_tabs_menu_clean), (ephy_tabs_menu_update):
* src/ephy-window.c: (add_widget), (sync_chromes_visibility),
(ephy_window_key_press_event), (init_menu_updaters),
(setup_ui_manager), (show_embed_popup), (ephy_window_init),
(ephy_window_finalize), (ephy_window_set_print_preview),
(ephy_window_get_ui_manager):
* src/ephy-window.h:
* src/ppview-toolbar.c: (ppview_toolbar_set_window):
* src/toolbar.c: (toolbar_set_window), (toolbar_new):
* src/window-commands.c: (window_cmd_edit_toolbar):
Add ephy_window_get_ui_manager(), and remove the manager
from the public EphyWindow struct.
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks/ephy-bookmarks-menu.c | 2 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarksbar.c | 2 | ||||
-rw-r--r-- | src/bookmarks/ephy-favorites-menu.c | 4 | ||||
-rw-r--r-- | src/ephy-encoding-menu.c | 2 | ||||
-rw-r--r-- | src/ephy-tabs-menu.c | 24 | ||||
-rw-r--r-- | src/ephy-window.c | 58 | ||||
-rw-r--r-- | src/ephy-window.h | 6 | ||||
-rwxr-xr-x | src/ppview-toolbar.c | 2 | ||||
-rwxr-xr-x | src/toolbar.c | 4 | ||||
-rw-r--r-- | src/window-commands.c | 2 |
10 files changed, 59 insertions, 47 deletions
diff --git a/src/bookmarks/ephy-bookmarks-menu.c b/src/bookmarks/ephy-bookmarks-menu.c index 0e06ac199..10e0dc201 100644 --- a/src/bookmarks/ephy-bookmarks-menu.c +++ b/src/bookmarks/ephy-bookmarks-menu.c @@ -523,7 +523,7 @@ ephy_bookmarks_menu_set_window (EphyBookmarksMenu *menu, EphyWindow *window) { menu->priv->window = window; - menu->priv->manager = GTK_UI_MANAGER (window->ui_merge); + menu->priv->manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window)); } static void diff --git a/src/bookmarks/ephy-bookmarksbar.c b/src/bookmarks/ephy-bookmarksbar.c index f6d6a49f3..9e0fecff9 100644 --- a/src/bookmarks/ephy-bookmarksbar.c +++ b/src/bookmarks/ephy-bookmarksbar.c @@ -284,7 +284,7 @@ ephy_bookmarksbar_set_window (EphyBookmarksBar *toolbar, { EggEditableToolbar *eggtoolbar = EGG_EDITABLE_TOOLBAR (toolbar); EggToolbarsModel *model = toolbar->priv->toolbars_model; - GtkUIManager *manager = GTK_UI_MANAGER (window->ui_merge); + GtkUIManager *manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window)); int i, n_toolbars; g_return_if_fail (toolbar->priv->window == NULL); diff --git a/src/bookmarks/ephy-favorites-menu.c b/src/bookmarks/ephy-favorites-menu.c index f2ef1e814..7a30f46a0 100644 --- a/src/bookmarks/ephy-favorites-menu.c +++ b/src/bookmarks/ephy-favorites-menu.c @@ -85,7 +85,7 @@ static void ephy_favorites_menu_clean (EphyFavoritesMenu *menu) { EphyFavoritesMenuPrivate *p = menu->priv; - GtkUIManager *merge = GTK_UI_MANAGER (p->window->ui_merge); + GtkUIManager *merge = GTK_UI_MANAGER (ephy_window_get_ui_manager (p->window)); if (p->ui_id > 0) { @@ -114,7 +114,7 @@ ephy_favorites_menu_rebuild (EphyFavoritesMenu *menu) gint i; EphyNode *fav; GPtrArray *children; - GtkUIManager *merge = GTK_UI_MANAGER (p->window->ui_merge); + GtkUIManager *merge = GTK_UI_MANAGER (ephy_window_get_ui_manager (p->window)); LOG ("Rebuilding favorites menu") diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c index b35ada0e6..dc2197278 100644 --- a/src/ephy-encoding-menu.c +++ b/src/ephy-encoding-menu.c @@ -382,7 +382,7 @@ ephy_encoding_menu_set_window (EphyEncodingMenu *menu, EphyWindow *window) g_return_if_fail (EPHY_IS_WINDOW (window)); menu->priv->window = window; - menu->priv->manager = GTK_UI_MANAGER (window->ui_merge); + menu->priv->manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window)); action_group = gtk_action_group_new ("EncodingActions"); gtk_action_group_set_translation_domain (action_group, NULL); diff --git a/src/ephy-tabs-menu.c b/src/ephy-tabs-menu.c index c780144ea..6d59d2ba8 100644 --- a/src/ephy-tabs-menu.c +++ b/src/ephy-tabs-menu.c @@ -142,13 +142,13 @@ static void ephy_tabs_menu_set_window (EphyTabsMenu *menu, EphyWindow *window) { GtkWidget *notebook; - GtkUIManager *merge; + GtkUIManager *manager; menu->priv->window = window; - merge = GTK_UI_MANAGER (window->ui_merge); + manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window)); menu->priv->action_group = gtk_action_group_new ("TabsActions"); - gtk_ui_manager_insert_action_group (merge, menu->priv->action_group, -1); + gtk_ui_manager_insert_action_group (manager, menu->priv->action_group, -1); g_object_unref (menu->priv->action_group); g_signal_connect (menu->priv->action_group, "connect-proxy", @@ -229,12 +229,12 @@ static void ephy_tabs_menu_clean (EphyTabsMenu *menu) { EphyTabsMenuPrivate *p = menu->priv; - GtkUIManager *merge = GTK_UI_MANAGER (p->window->ui_merge); + GtkUIManager *manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (p->window)); if (p->ui_id > 0) { - gtk_ui_manager_remove_ui (merge, p->ui_id); - gtk_ui_manager_ensure_update (merge); + gtk_ui_manager_remove_ui (manager, p->ui_id); + gtk_ui_manager_ensure_update (manager); p->ui_id = 0; } } @@ -294,17 +294,13 @@ tab_set_action_accelerator (GtkActionGroup *action_group, void ephy_tabs_menu_update (EphyTabsMenu *menu) { - EphyTabsMenuPrivate *p; - GtkUIManager *merge; + EphyTabsMenuPrivate *p = menu->priv; + GtkUIManager *manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (p->window)); EphyTab *tab; GtkAction *action; guint i = 0; GList *tabs = NULL, *l; - g_return_if_fail (EPHY_IS_TABS_MENU (menu)); - p = menu->priv; - merge = GTK_UI_MANAGER (p->window->ui_merge); - LOG ("Rebuilding open tabs menu") START_PROFILER ("Rebuilding tabs menu") @@ -315,7 +311,7 @@ ephy_tabs_menu_update (EphyTabsMenu *menu) if (g_list_length (tabs) == 0) return; - p->ui_id = gtk_ui_manager_new_merge_id (merge); + p->ui_id = gtk_ui_manager_new_merge_id (manager); for (l = tabs; l != NULL; l = l->next) { @@ -329,7 +325,7 @@ ephy_tabs_menu_update (EphyTabsMenu *menu) tab_set_action_accelerator (p->action_group, action, i++); - gtk_ui_manager_add_ui (merge, p->ui_id, + gtk_ui_manager_add_ui (manager, p->ui_id, "/menubar/TabsMenu/TabsOpen", name, action_name, GTK_UI_MANAGER_MENUITEM, FALSE); diff --git a/src/ephy-window.c b/src/ephy-window.c index acc0f8db5..e802aa628 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -342,6 +342,7 @@ struct EphyWindowPrivate Toolbar *toolbar; GtkWidget *bookmarksbar; GtkWidget *statusbar; + GtkUIManager *manager; GtkActionGroup *action_group; GtkActionGroup *popups_action_group; EphyFavoritesMenu *fav_menu; @@ -487,7 +488,9 @@ ephy_window_destroy (GtkObject *gtkobject) } static void -add_widget (GtkUIManager *merge, GtkWidget *widget, EphyWindow *window) +add_widget (GtkUIManager *manager, + GtkWidget *widget, + EphyWindow *window) { gtk_box_pack_start (GTK_BOX (window->priv->menu_dock), widget, FALSE, FALSE, 0); @@ -539,8 +542,7 @@ sync_chromes_visibility (EphyWindow *window) &show_statusbar, &show_toolbar, &show_bookmarksbar); - menubar = gtk_ui_manager_get_widget - (GTK_UI_MANAGER (window->ui_merge), "/menubar"); + menubar = gtk_ui_manager_get_widget (window->priv->manager, "/menubar"); g_assert (menubar != NULL); g_object_set (G_OBJECT (menubar), "visible", show_menubar, NULL); @@ -745,8 +747,7 @@ ephy_window_key_press_event (GtkWidget *widget, /* Show and activate the menubar, if it isn't visible */ if (event->keyval == keyval && (event->state & mask) == (modifier & mask)) { - menubar = gtk_ui_manager_get_widget - (GTK_UI_MANAGER (window->ui_merge), "/menubar"); + menubar = gtk_ui_manager_get_widget (window->priv->manager, "/menubar"); g_return_val_if_fail (menubar != NULL , FALSE); if (!GTK_WIDGET_VISIBLE (menubar)) @@ -917,7 +918,7 @@ init_menu_updaters (EphyWindow *window) GtkWidget *edit_menu_item, *edit_menu; edit_menu_item = gtk_ui_manager_get_widget - (GTK_UI_MANAGER (window->ui_merge), "/menubar/EditMenu"); + (window->priv->manager, "/menubar/EditMenu"); edit_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (edit_menu_item)); g_signal_connect (edit_menu, "show", @@ -1098,7 +1099,7 @@ setup_ui_manager (EphyWindow *window) { GtkActionGroup *action_group; GtkAction *action; - GtkUIManager *merge; + GtkUIManager *manager; GError *err = NULL; window->priv->main_vbox = gtk_vbox_new (FALSE, 0); @@ -1112,11 +1113,11 @@ setup_ui_manager (EphyWindow *window) GTK_WIDGET (window->priv->menu_dock), FALSE, TRUE, 0); - merge = gtk_ui_manager_new (); + manager = gtk_ui_manager_new (); - g_signal_connect (merge, "connect_proxy", + g_signal_connect (manager, "connect_proxy", G_CALLBACK (connect_proxy_cb), window); - g_signal_connect (merge, "disconnect_proxy", + g_signal_connect (manager, "disconnect_proxy", G_CALLBACK (disconnect_proxy_cb), window); action_group = gtk_action_group_new ("WindowActions"); @@ -1127,7 +1128,7 @@ setup_ui_manager (EphyWindow *window) ephy_menu_toggle_entries, ephy_menu_n_toggle_entries, window); - gtk_ui_manager_insert_action_group (merge, action_group, 0); + gtk_ui_manager_insert_action_group (manager, action_group, 0); window->priv->action_group = action_group; action = gtk_action_group_get_action (action_group, "FileOpen"); g_object_set (action, "short_label", _("Open"), NULL); @@ -1156,16 +1157,16 @@ setup_ui_manager (EphyWindow *window) gtk_action_group_set_translation_domain (action_group, NULL); gtk_action_group_add_actions (action_group, ephy_popups_entries, ephy_popups_n_entries, window); - gtk_ui_manager_insert_action_group (merge, action_group, 0); + gtk_ui_manager_insert_action_group (manager, action_group, 0); window->priv->popups_action_group = action_group; - window->ui_merge = G_OBJECT (merge); - g_signal_connect (merge, "add_widget", G_CALLBACK (add_widget), window); + window->priv->manager = manager; + g_signal_connect (manager, "add_widget", G_CALLBACK (add_widget), window); gtk_window_add_accel_group (GTK_WINDOW (window), - gtk_ui_manager_get_accel_group (merge)); + gtk_ui_manager_get_accel_group (manager)); gtk_ui_manager_add_ui_from_file - (merge, ephy_file ("epiphany-ui.xml"), &err); + (manager, ephy_file ("epiphany-ui.xml"), &err); if (err != NULL) { g_warning ("Could not merge epiphany-ui.xml: %s", err->message); @@ -1618,8 +1619,7 @@ show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event) update_edit_actions_sensitivity (window, TRUE); } - widget = gtk_ui_manager_get_widget (GTK_UI_MANAGER (window->ui_merge), - popup); + widget = gtk_ui_manager_get_widget (window->priv->manager, popup); g_return_if_fail (widget != NULL); action_group = window->priv->popups_action_group; @@ -2314,7 +2314,7 @@ ephy_window_init (EphyWindow *window) G_CALLBACK (network_status_changed), window); /* ensure the UI is updated */ - gtk_ui_manager_ensure_update (GTK_UI_MANAGER (window->ui_merge)); + gtk_ui_manager_ensure_update (window->priv->manager); init_menu_updaters (window); } @@ -2356,7 +2356,7 @@ ephy_window_finalize (GObject *object) } g_object_unref (window->priv->action_group); - g_object_unref (window->ui_merge); + g_object_unref (window->priv->manager); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -2408,7 +2408,7 @@ ephy_window_set_print_preview (EphyWindow *window, gboolean enabled) GtkAccelGroup *accel_group; EphyWindowMode mode; - accel_group = gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (window->ui_merge)); + accel_group = gtk_ui_manager_get_accel_group (window->priv->manager); mode = enabled ? EPHY_WINDOW_MODE_PRINT_PREVIEW : EPHY_WINDOW_MODE_NORMAL; @@ -2438,6 +2438,22 @@ ephy_window_set_print_preview (EphyWindow *window, gboolean enabled) } /** + * ephy_window_get_ui_manager: + * @window: an #EphyWindow + * + * Returns this window's UI manager. + * + * Return value: an #GtkUIManager + **/ +GObject * +ephy_window_get_ui_manager (EphyWindow *window) +{ + g_return_val_if_fail (EPHY_IS_WINDOW (window), NULL); + + return G_OBJECT (window->priv->manager); +} + +/** * ephy_window_get_toolbar: * @window: an #EphyWindow * diff --git a/src/ephy-window.h b/src/ephy-window.h index cace444f5..433b44cbb 100644 --- a/src/ephy-window.h +++ b/src/ephy-window.h @@ -45,11 +45,9 @@ typedef struct EphyWindowPrivate EphyWindowPrivate; struct _EphyWindow { GtkWindow parent; + /*< private >*/ EphyWindowPrivate *priv; - - /*< public >*/ - GObject *ui_merge; }; struct EphyWindowClass @@ -69,6 +67,8 @@ EphyWindow *ephy_window_new_with_chrome (EphyEmbedChrome chrome); void ephy_window_set_print_preview (EphyWindow *window, gboolean enabled); +GObject *ephy_window_get_ui_manager (EphyWindow *window); + GtkWidget *ephy_window_get_toolbar (EphyWindow *window); GtkWidget *ephy_window_get_bookmarksbar (EphyWindow *window); diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c index 9c3b70c64..cd1cf81bf 100755 --- a/src/ppview-toolbar.c +++ b/src/ppview-toolbar.c @@ -237,7 +237,7 @@ ppview_toolbar_set_window (PPViewToolbar *t, EphyWindow *window) g_return_if_fail (t->priv->window == NULL); t->priv->window = window; - t->priv->ui_merge = GTK_UI_MANAGER (t->priv->window->ui_merge); + t->priv->ui_merge = GTK_UI_MANAGER (ephy_window_get_ui_manager (t->priv->window)); t->priv->action_group = gtk_action_group_new ("PPViewActions"); gtk_action_group_set_translation_domain (t->priv->action_group, NULL); diff --git a/src/toolbar.c b/src/toolbar.c index 142b92806..a15257599 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -389,7 +389,7 @@ toolbar_set_window (Toolbar *t, EphyWindow *window) g_return_if_fail (t->priv->window == NULL); t->priv->window = window; - manager = GTK_UI_MANAGER (window->ui_merge); + manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window)); toolbar_setup_actions (t); gtk_ui_manager_insert_action_group (manager, @@ -472,7 +472,7 @@ toolbar_new (EphyWindow *window) { return EPHY_TOOLBAR (g_object_new (EPHY_TYPE_TOOLBAR, "window", window, - "ui-manager", window->ui_merge, + "ui-manager", ephy_window_get_ui_manager (window), NULL)); } diff --git a/src/window-commands.c b/src/window-commands.c index 9b87e0a0d..984ca75f4 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -882,7 +882,7 @@ window_cmd_edit_toolbar (GtkAction *action, gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window)); gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE); - editor = egg_toolbar_editor_new (GTK_UI_MANAGER (window->ui_merge), model); + editor = egg_toolbar_editor_new (GTK_UI_MANAGER (ephy_window_get_ui_manager (window)), model); egg_toolbar_editor_load_actions (EGG_TOOLBAR_EDITOR (editor), ephy_file ("epiphany-toolbar.xml")); gtk_container_set_border_width (GTK_CONTAINER (EGG_TOOLBAR_EDITOR (editor)), 5); |