aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog192
-rw-r--r--configure.in4
-rw-r--r--data/ui/epiphany-bookmark-editor-ui.xml.in21
-rw-r--r--data/ui/epiphany-history-window-ui.xml.in21
-rw-r--r--data/ui/epiphany-ui.xml.in34
-rw-r--r--lib/egg/Makefile.am26
-rw-r--r--lib/egg/egg-action-group.c294
-rw-r--r--lib/egg/egg-action-group.h71
-rw-r--r--lib/egg/egg-action.c822
-rw-r--r--lib/egg/egg-action.h84
-rwxr-xr-xlib/egg/egg-editable-toolbar.c103
-rwxr-xr-xlib/egg/egg-editable-toolbar.h7
-rw-r--r--lib/egg/egg-menu-merge.c1320
-rw-r--r--lib/egg/egg-menu-merge.h100
-rw-r--r--lib/egg/egg-menu.h11
-rw-r--r--lib/egg/egg-radio-action.c198
-rw-r--r--lib/egg/egg-toggle-action.c197
-rw-r--r--lib/egg/egg-toggle-action.h38
-rwxr-xr-xlib/egg/egg-toolbar-editor.c70
-rwxr-xr-xlib/egg/egg-toolbar-editor.h4
-rwxr-xr-xlib/egg/egg-toolbars-model.c10
-rw-r--r--lib/egg/eggmarshalers.c2
-rw-r--r--lib/egg/eggradiotoolbutton.c149
-rw-r--r--lib/egg/eggseparatortoolitem.c72
-rw-r--r--lib/egg/eggtoggletoolbutton.h67
-rw-r--r--lib/egg/eggtoolbar.c2773
-rw-r--r--lib/egg/eggtoolbar.h255
-rw-r--r--lib/egg/eggtoolitem.c754
-rw-r--r--lib/egg/eggtoolitem.h111
-rw-r--r--lib/egg/eggtreemodelfilter.c2715
-rw-r--r--lib/egg/eggtreemodelfilter.h125
-rw-r--r--lib/egg/prop-editor.h31
-rw-r--r--lib/widgets/ephy-arrow-toolbutton.c10
-rw-r--r--lib/widgets/ephy-arrow-toolbutton.h7
-rw-r--r--lib/widgets/ephy-location-entry.c8
-rw-r--r--lib/widgets/ephy-location-entry.h7
-rw-r--r--lib/widgets/ephy-node-view.c46
-rw-r--r--lib/widgets/ephy-zoom-action.c12
-rw-r--r--lib/widgets/ephy-zoom-action.h6
-rw-r--r--lib/widgets/ephy-zoom-control.c12
-rw-r--r--lib/widgets/ephy-zoom-control.h6
-rw-r--r--src/bookmarks/ephy-bookmark-action.c64
-rw-r--r--src/bookmarks/ephy-bookmark-action.h8
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c217
-rw-r--r--src/bookmarks/ephy-bookmarks-menu.c42
-rw-r--r--src/bookmarks/ephy-topic-action.c69
-rw-r--r--src/ephy-encoding-menu.c32
-rw-r--r--src/ephy-favicon-action.c14
-rw-r--r--src/ephy-favicon-action.h4
-rw-r--r--src/ephy-favorites-menu.c28
-rw-r--r--src/ephy-go-action.c24
-rw-r--r--src/ephy-go-action.h4
-rw-r--r--src/ephy-history-window.c147
-rw-r--r--src/ephy-location-action.c12
-rw-r--r--src/ephy-location-action.h4
-rw-r--r--src/ephy-navigation-action.c10
-rw-r--r--src/ephy-navigation-action.h4
-rw-r--r--src/ephy-spinner-action.c24
-rw-r--r--src/ephy-tab.c6
-rw-r--r--src/ephy-tabs-menu.c40
-rw-r--r--src/ephy-window.c381
-rw-r--r--src/popup-commands.c34
-rw-r--r--src/popup-commands.h43
-rwxr-xr-xsrc/ppview-toolbar.c52
-rwxr-xr-xsrc/toolbar.c86
-rw-r--r--src/window-commands.c96
-rw-r--r--src/window-commands.h95
67 files changed, 1182 insertions, 11153 deletions
diff --git a/ChangeLog b/ChangeLog
index c5939fab0..55749d02a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,195 @@
+2003-08-29 Marco Pesenti Gritti <marco@gnome.org>
+
+ * configure.in:
+ * data/ui/epiphany-bookmark-editor-ui.xml.in:
+ * data/ui/epiphany-history-window-ui.xml.in:
+ * data/ui/epiphany-ui.xml.in:
+ * lib/egg/Makefile.am:
+ * lib/egg/egg-action-group.c:
+ * lib/egg/egg-action-group.h:
+ * lib/egg/egg-action.c:
+ * lib/egg/egg-action.h:
+ * lib/egg/egg-editable-toolbar.c: (find_action),
+ (drag_data_received_cb), (drag_data_delete_cb), (drag_data_get_cb),
+ (create_toolbar), (set_item_drag_source), (create_item),
+ (toolbar_changed_cb), (item_added_cb), (item_removed_cb),
+ (egg_editable_toolbar_construct), (egg_editable_toolbar_set_merge),
+ (egg_editable_toolbar_class_init), (egg_editable_toolbar_new),
+ (egg_editable_toolbar_set_edit_mode),
+ (_egg_editable_toolbar_new_separator_image):
+ * lib/egg/egg-editable-toolbar.h:
+ * lib/egg/egg-menu-merge.c:
+ * lib/egg/egg-menu-merge.h:
+ * lib/egg/egg-menu.h:
+ * lib/egg/egg-radio-action.c:
+ * lib/egg/egg-radio-action.h:
+ * lib/egg/egg-toggle-action.c:
+ * lib/egg/egg-toggle-action.h:
+ * lib/egg/egg-toolbar-editor.c: (find_action),
+ (egg_toolbar_editor_set_merge), (egg_toolbar_editor_class_init),
+ (egg_toolbar_editor_new), (editor_drag_data_received_cb),
+ (editor_drag_data_delete_cb), (drag_data_get_cb),
+ (update_editor_sheet), (egg_toolbar_editor_add_action),
+ (model_has_action), (egg_toolbar_editor_load_actions):
+ * lib/egg/egg-toolbar-editor.h:
+ * lib/egg/egg-toolbars-model.c:
+ * lib/egg/eggmarshalers.c:
+ * lib/egg/eggradiotoolbutton.c:
+ * lib/egg/eggradiotoolbutton.h:
+ * lib/egg/eggseparatortoolitem.c:
+ * lib/egg/eggseparatortoolitem.h:
+ * lib/egg/eggtoggletoolbutton.c:
+ * lib/egg/eggtoggletoolbutton.h:
+ * lib/egg/eggtoolbar.c:
+ * lib/egg/eggtoolbar.h:
+ * lib/egg/eggtoolbutton.c:
+ * lib/egg/eggtoolbutton.h:
+ * lib/egg/eggtoolitem.c:
+ * lib/egg/eggtoolitem.h:
+ * lib/egg/eggtreemodelfilter.c:
+ * lib/egg/eggtreemodelfilter.h:
+ * lib/egg/prop-editor.h:
+ * lib/widgets/ephy-arrow-toolbutton.c:
+ (ephy_arrow_toolbutton_get_type),
+ (ephy_arrow_toolbutton_set_tooltip),
+ (ephy_arrow_toolbutton_class_init), (ephy_arrow_toolbutton_init):
+ * lib/widgets/ephy-arrow-toolbutton.h:
+ * lib/widgets/ephy-location-entry.c:
+ (ephy_location_entry_get_type), (ephy_location_entry_set_tooltip),
+ (ephy_location_entry_class_init), (ephy_location_entry_init):
+ * lib/widgets/ephy-location-entry.h:
+ * lib/widgets/ephy-node-view.c: (get_node_from_path),
+ (ephy_node_view_row_activated_cb), (ephy_node_view_construct),
+ (cell_renderer_edited), (get_selection),
+ (ephy_node_view_get_selection), (ephy_node_view_remove),
+ (ephy_node_view_select_node):
+ * lib/widgets/ephy-zoom-action.c: (ephy_zoom_action_get_type),
+ (sync_zoom_cb), (connect_proxy), (ephy_zoom_action_class_init):
+ * lib/widgets/ephy-zoom-action.h:
+ * lib/widgets/ephy-zoom-control.c: (ephy_zoom_control_get_type),
+ (ephy_zoom_control_create_menu_proxy),
+ (ephy_zoom_control_set_tooltip), (ephy_zoom_control_class_init):
+ * lib/widgets/ephy-zoom-control.h:
+ * src/bookmarks/ephy-bookmark-action.c:
+ (ephy_bookmark_action_get_type), (create_tool_item),
+ (ephy_bookmark_action_sync_smart_url),
+ (ephy_bookmark_action_sync_icon),
+ (ephy_bookmark_action_sync_label), (activate_cb),
+ (create_menu_proxy), (connect_proxy),
+ (ephy_bookmark_action_class_init), (sync_bookmark_properties),
+ (bookmarks_child_changed_cb), (ephy_bookmark_action_new):
+ * src/bookmarks/ephy-bookmark-action.h:
+ * src/bookmarks/ephy-bookmarks-editor.c: (cmd_add_topic),
+ (cmd_close), (cmd_rename), (cmd_show_in_bookmarks_bar),
+ (cmd_open_bookmarks_in_tabs), (cmd_open_bookmarks_in_browser),
+ (cmd_delete), (cmd_bookmarks_import), (cmd_bookmark_properties),
+ (cmd_cut), (cmd_copy), (cmd_paste), (cmd_select_all),
+ (cmd_help_contents), (ephy_bookmarks_editor_finalize),
+ (ephy_bookmarks_editor_update_menu),
+ (ephy_bookmarks_editor_show_popup_cb),
+ (keyword_node_show_popup_cb), (add_widget),
+ (ephy_bookmarks_editor_construct):
+ * src/bookmarks/ephy-bookmarks-menu.c: (ephy_bookmarks_menu_clean),
+ (go_location_cb), (add_bookmarks_menu),
+ (ephy_bookmarks_menu_rebuild), (ephy_bookmarks_menu_finalize):
+ * src/bookmarks/ephy-topic-action.c: (ephy_topic_action_get_type),
+ (create_tool_item), (menu_activate_cb),
+ (ephy_topic_action_sync_label), (create_menu_item),
+ (create_menu_proxy), (connect_proxy),
+ (ephy_topic_action_class_init), (sync_topic_properties),
+ (topic_child_changed_cb), (ephy_topic_action_new):
+ * src/bookmarks/ephy-topic-action.h:
+ * src/ephy-encoding-menu.c: (ephy_encoding_menu_finalize_impl),
+ (ephy_encoding_menu_verb_cb), (build_group), (build_encoding),
+ (ephy_encoding_menu_rebuild):
+ * src/ephy-favicon-action.c: (ephy_favicon_action_get_type),
+ (create_tool_item), (ephy_favicon_action_sync_icon),
+ (connect_proxy), (ephy_favicon_action_class_init):
+ * src/ephy-favicon-action.h:
+ * src/ephy-favorites-menu.c: (ephy_favorites_menu_clean),
+ (go_location_cb), (ephy_favorites_menu_rebuild),
+ (ephy_favorites_menu_finalize):
+ * src/ephy-go-action.c: (ephy_go_action_get_type), (activate_cb),
+ (create_tool_item), (create_menu_item), (create_menu_proxy_cb),
+ (connect_proxy), (ephy_go_action_class_init):
+ * src/ephy-go-action.h:
+ * src/ephy-history-window.c: (cmd_clear), (cmd_close),
+ (cmd_open_bookmarks_in_tabs), (cmd_open_bookmarks_in_browser),
+ (cmd_cut), (cmd_copy), (cmd_paste), (cmd_select_all), (cmd_delete),
+ (cmd_bookmark_link), (cmd_help_contents),
+ (ephy_history_window_finalize), (ephy_history_window_update_menu),
+ (ephy_history_window_show_popup_cb), (add_widget),
+ (ephy_history_window_construct):
+ * src/ephy-location-action.c: (ephy_location_action_get_type),
+ (connect_proxy), (ephy_location_action_class_init),
+ (ephy_location_action_get_widget):
+ * src/ephy-location-action.h:
+ * src/ephy-navigation-action.c: (ephy_navigation_action_get_type),
+ (connect_proxy), (ephy_navigation_action_class_init):
+ * src/ephy-navigation-action.h:
+ * src/ephy-spinner-action.c: (ephy_spinner_action_get_type),
+ (ephy_spinner_action_sync_throbbing), (create_tool_item),
+ (toolbar_style_sync), (item_parent_set_cb), (connect_proxy),
+ (ephy_spinner_action_class_init):
+ * src/ephy-spinner-action.h:
+ * src/ephy-tab.c: (ephy_tab_action_activate_cb), (ephy_tab_init):
+ * src/ephy-tabs-menu.c: (ephy_tabs_menu_clean),
+ (ephy_tabs_menu_finalize_impl), (tab_set_action_accelerator),
+ (ephy_tabs_menu_update):
+ * src/ephy-window.c: (add_widget), (menu_activate_cb),
+ (ephy_window_state_event_cb), (setup_window),
+ (sync_tab_navigation), (sync_tab_stop), (sync_tab_zoom),
+ (show_embed_popup), (update_tabs_menu_sensitivity),
+ (ephy_window_finalize), (update_layout_toggles):
+ * src/popup-commands.c: (popup_cmd_link_in_new_window),
+ (popup_cmd_link_in_new_tab), (popup_cmd_image_in_new_tab),
+ (popup_cmd_image_in_new_window), (popup_cmd_bookmark_link),
+ (popup_cmd_frame_in_new_tab), (popup_cmd_frame_in_new_window),
+ (popup_cmd_copy_link_address), (save_property_url),
+ (popup_cmd_open_link), (popup_cmd_download_link),
+ (popup_cmd_save_image_as), (popup_cmd_set_image_as_background),
+ (popup_cmd_copy_image_location), (popup_cmd_save_background_as),
+ (popup_cmd_open_frame), (popup_cmd_open_image):
+ * src/popup-commands.h:
+ * src/ppview-toolbar.c: (toolbar_update_sensitivity),
+ (ppview_toolbar_set_window), (ppview_toolbar_finalize),
+ (toolbar_cmd_ppv_goto_first), (toolbar_cmd_ppv_goto_last),
+ (toolbar_cmd_ppv_go_back), (toolbar_cmd_ppv_go_forward),
+ (toolbar_cmd_ppv_close):
+ * src/toolbar.c: (go_location_cb), (zoom_to_level_cb),
+ (bookmark_destroy_cb), (toolbar_ensure_action),
+ (toolbar_setup_actions), (get_location_entry),
+ (toolbar_set_window), (toolbar_finalize), (toolbar_spinner_start),
+ (toolbar_spinner_stop), (toolbar_update_favicon),
+ (toolbar_update_navigation_actions), (toolbar_update_zoom):
+ * src/window-commands.c: (window_cmd_edit_find),
+ (window_cmd_file_print), (window_cmd_go_back), (window_cmd_go_up),
+ (window_cmd_file_send_to), (window_cmd_go_forward),
+ (window_cmd_go_home), (window_cmd_go_location),
+ (window_cmd_view_stop), (window_cmd_view_reload),
+ (window_cmd_file_new_window), (window_cmd_file_new_tab),
+ (window_cmd_go_bookmarks), (window_cmd_file_bookmark_page),
+ (window_cmd_file_open), (window_cmd_file_save_as),
+ (window_cmd_file_close_window), (window_cmd_edit_cut),
+ (window_cmd_edit_copy), (window_cmd_edit_paste),
+ (window_cmd_edit_select_all), (window_cmd_edit_find_next),
+ (window_cmd_edit_find_prev), (window_cmd_view_bookmarks_bar),
+ (window_cmd_view_toolbar), (window_cmd_view_statusbar),
+ (window_cmd_view_fullscreen), (window_cmd_view_zoom_in),
+ (window_cmd_view_zoom_out), (window_cmd_view_zoom_normal),
+ (window_cmd_view_page_source), (window_cmd_go_history),
+ (window_cmd_edit_personal_data), (window_cmd_edit_prefs),
+ (window_cmd_edit_toolbar), (window_cmd_help_contents),
+ (window_cmd_help_about), (window_cmd_tabs_next),
+ (window_cmd_tabs_previous), (window_cmd_tabs_move_left),
+ (window_cmd_tabs_move_right), (window_cmd_tabs_detach),
+ (window_cmd_load_location):
+ * src/window-commands.h:
+
+ Part of the gtk 2.3 port. Will finish tomorrow, this break
+ build for now, sorry. If you want a working epiphany
+ use gnome-2-4 branch.
+
2003-08-24 Marco Pesenti Gritti <marco@gnome.org>
* Branched for 2.4
diff --git a/configure.in b/configure.in
index 547541637..98f348a8a 100644
--- a/configure.in
+++ b/configure.in
@@ -14,9 +14,11 @@ AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
dnl put the ACLOCAL flags in the Makefile
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
+GTK_REQUIRED=2.3
LIBBONOBOUI_REQUIRED=2.1.1
AC_SUBST(LIBBONOBOUI_REQUIRED)
+AC_SUBST(GTK_REQUIRED)
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
@@ -64,7 +66,7 @@ fi
AC_MSG_RESULT($enable_nautilus_view)
AM_CONDITIONAL(ENABLE_NAUTILUS_VIEW, test "x$enable_nautilus_view" = "xyes")
-PKG_CHECK_MODULES(EPIPHANY_DEPENDENCY, gtk+-2.0 libxml-2.0 libgnomeui-2.0 libglade-2.0 bonobo-activation-2.0 libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED ORBit-2.0 libglade-2.0 gnome-vfs-2.0 gnome-vfs-module-2.0 gconf-2.0 $nautilusview_pkgs)
+PKG_CHECK_MODULES(EPIPHANY_DEPENDENCY, gtk+-2.0 >= $GTK_REQUIRED libxml-2.0 libgnomeui-2.0 libglade-2.0 bonobo-activation-2.0 libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED ORBit-2.0 libglade-2.0 gnome-vfs-2.0 gnome-vfs-module-2.0 gconf-2.0 $nautilusview_pkgs)
AC_SUBST(EPIPHANY_DEPENDENCY_CFLAGS)
AC_SUBST(EPIPHANY_DEPENDENCY_LIBS)
diff --git a/data/ui/epiphany-bookmark-editor-ui.xml.in b/data/ui/epiphany-bookmark-editor-ui.xml.in
index 00dfac5c3..9d4f99e58 100644
--- a/data/ui/epiphany-bookmark-editor-ui.xml.in
+++ b/data/ui/epiphany-bookmark-editor-ui.xml.in
@@ -1,7 +1,7 @@
-<Root>
-<menu>
+<ui>
+<menubar>
-<submenu name="FileMenu" verb="File">
+<menu name="FileMenu" verb="File">
<menuitem name="FileNewTopic" verb="NewTopic"/>
<separator name="FileSep1"/>
<menuitem name="FileOpenInWindow" verb="OpenInWindow"/>
@@ -16,23 +16,21 @@
<menuitem name="FileImport" verb="Import"/>
<separator name="FileSep5"/>
<menuitem name="FileClose" verb="Close"/>
-</submenu>
+</menu>
-<submenu name="EditMenu" verb="Edit">
+<menu name="EditMenu" verb="Edit">
<menuitem name="EditCut" verb="Cut"/>
<menuitem name="EditCopy" verb="Copy"/>
<menuitem name="EditPaste" verb="Paste"/>
<menuitem name="EditSelectAll" verb="SelectAll"/>
-</submenu>
+</menu>
-<submenu name="HelpMenu" verb="Help">
+<menu name="HelpMenu" verb="Help">
<menuitem name="HelpContents" verb="HelpContents"/>
<menuitem name="HelpAbout" verb="HelpAbout"/>
-</submenu>
-
</menu>
-<popups>
+</menubar>
<popup name="EphyBookmarkEditorPopup" verb="FakeToplevel">
<menuitem name="OpenInWindowBMK" verb="OpenInWindow"/>
@@ -55,5 +53,4 @@
<menuitem name="ShowInBookmarksBarTPC" verb="ShowInBookmarksBar"/>
</popup>
-</popups>
-</Root>
+</ui>
diff --git a/data/ui/epiphany-history-window-ui.xml.in b/data/ui/epiphany-history-window-ui.xml.in
index d716f0bd5..fc184f208 100644
--- a/data/ui/epiphany-history-window-ui.xml.in
+++ b/data/ui/epiphany-history-window-ui.xml.in
@@ -1,7 +1,7 @@
-<Root>
-<menu>
+<ui>
+<menubar>
-<submenu name="FileMenu" verb="File">
+<menu name="FileMenu" verb="File">
<menuitem name="FileOpenInWindow" verb="OpenInWindow"/>
<menuitem name="FileOpenInTab" verb="OpenInTab"/>
<separator name="FileSep1"/>
@@ -9,25 +9,23 @@
<menuitem name="FileDelete" verb="Delete"/>
<separator name="FileSep2"/>
<menuitem name="FileClose" verb="Close"/>
-</submenu>
+</menu>
-<submenu name="EditMenu" verb="Edit">
+<menu name="EditMenu" verb="Edit">
<menuitem name="EditCut" verb="Cut"/>
<menuitem name="EditCopy" verb="Copy"/>
<menuitem name="EditPaste" verb="Paste"/>
<menuitem name="EditSelectAll" verb="SelectAll"/>
<separator name="EditSep1"/>
<menuitem name="EditClear" verb="Clear"/>
-</submenu>
+</menu>
-<submenu name="HelpMenu" verb="Help">
+<menu name="HelpMenu" verb="Help">
<menuitem name="HelpContents" verb="HelpContents"/>
<menuitem name="HelpAbout" verb="HelpAbout"/>
-</submenu>
-
</menu>
-<popups>
+</menu>
<popup name="EphyHistoryWindowPopup" verb="FakeToplevel">
<menuitem name="OpenInWindowHST" verb="OpenInWindow"/>
@@ -39,5 +37,4 @@
<menuitem name="DeleteHST" verb="Delete"/>
</popup>
-</popups>
-</Root>
+</ui>
diff --git a/data/ui/epiphany-ui.xml.in b/data/ui/epiphany-ui.xml.in
index 1a2c44eaa..e97e0b364 100644
--- a/data/ui/epiphany-ui.xml.in
+++ b/data/ui/epiphany-ui.xml.in
@@ -1,6 +1,6 @@
<Root>
-<menu>
-<submenu name="FileMenu" verb="File">
+<menubar>
+<menu name="FileMenu" verb="File">
<menuitem name="FileNewWindowMenu" verb="FileNewWindow"/>
<menuitem name="FileNewTabMenu" verb="FileNewTab"/>
<menuitem name="FileOpenMenu" verb="FileOpen"/>
@@ -11,9 +11,9 @@
<menuitem name="FileSendToMenu" verb="FileSendTo"/>
<separator name="FileSep3"/>
<menuitem name="FileCloseWindowMenu" verb="FileCloseWindow"/>
-</submenu>
+</menu>
-<submenu name="EditMenu" verb="Edit">
+<menu name="EditMenu" verb="Edit">
<menuitem name="EditCutMenu" verb="EditCut"/>
<menuitem name="EditCopyMenu" verb="EditCopy"/>
<menuitem name="EditPasteMenu" verb="EditPaste"/>
@@ -27,9 +27,9 @@
<menuitem name="EditPersonalDataMenu" verb="EditPersonalData"/>
<menuitem name="EditToolbarMenu" verb="EditToolbar"/>
<menuitem name="EditPrefsMenu" verb="EditPrefs"/>
-</submenu>
+</menu>
-<submenu name="ViewMenu" verb="View">
+<menu name="ViewMenu" verb="View">
<menuitem name="ViewToolbarMenu" verb="ViewToolbar"/>
<menuitem name="ViewBookmarksBarMenu" verb="ViewBookmarksBar"/>
<menuitem name="ViewStatusbarMenu" verb="ViewStatusbar"/>
@@ -44,9 +44,9 @@
<separator name="ViewSep3"/>
<menuitem name="ViewStopMenu" verb="ViewStop"/>
<menuitem name="ViewReloadMenu" verb="ViewReload"/>
-</submenu>
+</menu>
-<submenu name="GoMenu" verb="Go">
+<menu name="GoMenu" verb="Go">
<menuitem name="GoBackMenu" verb="GoBack"/>
<menuitem name="GoForwardMenu" verb="GoForward"/>
<menuitem name="GoUpMenu" verb="GoUp"/>
@@ -56,15 +56,15 @@
<separator name="GoSep2"/>
<menuitem name="GoLocationMenu" verb="GoLocation"/>
<placeholder name="GoFavorites"/>
-</submenu>
+</menu>
-<submenu name="BookmarksMenu" verb="Bookmarks">
+<menu name="BookmarksMenu" verb="Bookmarks">
<menuitem name="BookmarksAddBookmarkMenu" verb="FileBookmarkPage"/>
<menuitem name="BookmarksEditMenu" verb="GoBookmarks"/>
<placeholder name="BookmarksTree"/>
-</submenu>
+</menu>
-<submenu name="TabsMenu" verb="Tabs">
+<menu name="TabsMenu" verb="Tabs">
<menuitem name="TabsPreviousMenu" verb="TabsPrevious"/>
<menuitem name="TabsNextMenu" verb="TabsNext"/>
<separator name="TabsSep1"/>
@@ -74,15 +74,14 @@
<placeholder name="TabsOpen">
<separator name="TabsSep2"/>
</placeholder>
-</submenu>
+</menu>
-<submenu name="HelpMenu" verb="Help">
+<menu name="HelpMenu" verb="Help">
<menuitem name="HelpContentsMenu" verb="HelpContents"/>
<menuitem name="HelpAboutMenu" verb="HelpAbout"/>
-</submenu>
</menu>
+</menubar>
-<popups>
<popup name="EphyInputPopup" verb="FakeToplevel">
<menuitem name="EditCutIP" verb="EditCut"/>
<menuitem name="EditCopyIP" verb="EditCopy"/>
@@ -157,5 +156,4 @@
<menuitem name="CopyImageLocationILP" verb="CopyImageLocation"/>
</popup>
-</popups>
-</Root>
+</ui>
diff --git a/lib/egg/Makefile.am b/lib/egg/Makefile.am
index eca7c0b14..9f55158f9 100644
--- a/lib/egg/Makefile.am
+++ b/lib/egg/Makefile.am
@@ -1,5 +1,6 @@
INCLUDES = \
$(EPIPHANY_DEPENDENCY_CFLAGS) \
+ $(WARN_CFLAGS) \
-DGTK_DISABLE_DEPRECATED \
-DGDK_DISABLE_DEPRECATED \
-DG_DISABLE_DEPRECATED
@@ -7,19 +8,7 @@ INCLUDES = \
noinst_LTLIBRARIES = libegg.la
EGGSOURCES = \
- egg-action.c \
- egg-action-group.c \
- egg-toggle-action.c \
- eggtreemodelfilter.c \
eggtreemultidnd.c \
- egg-radio-action.c \
- egg-menu-merge.c \
- eggradiotoolbutton.c \
- eggtoggletoolbutton.c \
- eggtoolitem.c \
- eggseparatortoolitem.c \
- eggtoolbar.c \
- eggtoolbutton.c \
egg-editable-toolbar.c \
egg-toolbars-model.c \
egg-toolbar-editor.c
@@ -29,20 +18,7 @@ libegg_la_SOURCES = \
eggmarshalers.c
EGGHEADERS = \
- eggtreemodelfilter.h \
eggtreemultidnd.h \
- egg-menu.h \
- egg-action.h \
- egg-action-group.h \
- egg-toggle-action.h \
- egg-radio-action.h \
- egg-menu-merge.h \
- eggradiotoolbutton.h \
- eggtoggletoolbutton.h \
- eggtoolitem.h \
- eggseparatortoolitem.h \
- eggtoolbar.h \
- eggtoolbutton.h \
egg-editable-toolbar.h \
egg-toolbars-model.h \
egg-toolbar-editor.h
diff --git a/lib/egg/egg-action-group.c b/lib/egg/egg-action-group.c
deleted file mode 100644
index 42d95aabb..000000000
--- a/lib/egg/egg-action-group.c
+++ /dev/null
@@ -1,294 +0,0 @@
-#include "egg-action-group.h"
-#include "egg-toggle-action.h"
-#include "egg-radio-action.h"
-#include "eggintl.h"
-
-static void egg_action_group_init (EggActionGroup *self);
-static void egg_action_group_class_init (EggActionGroupClass *class);
-
-GType
-egg_action_group_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- static const GTypeInfo type_info =
- {
- sizeof (EggActionGroupClass),
- (GBaseInitFunc) egg_action_group_init,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) egg_action_group_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
-
- sizeof (EggActionGroup),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_action_group_init,
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "EggActionGroup",
- &type_info, 0);
- }
-
- return type;
-}
-
-static GObjectClass *parent_class = NULL;
-static void egg_action_group_finalize (GObject *object);
-static EggAction *egg_action_group_real_get_action (EggActionGroup *self,
- const gchar *name);
-
-static void
-egg_action_group_class_init (EggActionGroupClass *class)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (class);
- parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = egg_action_group_finalize;
- class->get_action = egg_action_group_real_get_action;
-}
-
-static void
-egg_action_group_init (EggActionGroup *self)
-{
- self->name = NULL;
- self->actions = g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify) g_free,
- (GDestroyNotify) g_object_unref);
-}
-
-/**
- * egg_action_group_new:
- * @name: the name of the action group
- *
- * Creates a new EggActionGroup object.
- *
- * Returns: the new EggActionGroup
- */
-EggActionGroup *
-egg_action_group_new(const gchar *name)
-{
- EggActionGroup *self;
-
- self = g_object_new (EGG_TYPE_ACTION_GROUP, NULL);
- self->name = g_strdup (name);
-
- return self;
-}
-
-static void
-egg_action_group_finalize (GObject *object)
-{
- EggActionGroup *self;
-
- self = EGG_ACTION_GROUP (object);
-
- g_free (self->name);
- self->name = NULL;
-
- g_hash_table_destroy (self->actions);
- self->actions = NULL;
-
- if (parent_class->finalize)
- (* parent_class->finalize) (object);
-}
-
-static EggAction *
-egg_action_group_real_get_action (EggActionGroup *self,
- const gchar *action_name)
-{
- return g_hash_table_lookup (self->actions, action_name);
-}
-
-/**
- * egg_action_group_get_name:
- * @action_group: the action group
- *
- * Returns: the name of the EggActionGroup
- */
-const gchar *
-egg_action_group_get_name (EggActionGroup *action_group)
-{
- g_return_val_if_fail (EGG_IS_ACTION_GROUP (action_group), NULL);
-
- return action_group->name;
-}
-
-/**
- * egg_action_group_get_action:
- * @action_group: the action group
- * @action_name: the name of the action
- *
- * This function looks up an action in the action group by name.
- *
- * Returns: the action, or NULL if no action by that name exists
- */
-EggAction *
-egg_action_group_get_action (EggActionGroup *action_group,
- const gchar *action_name)
-{
- g_return_val_if_fail (EGG_IS_ACTION_GROUP (action_group), NULL);
- g_return_val_if_fail (EGG_ACTION_GROUP_GET_CLASS (action_group)->get_action != NULL, NULL);
-
- return (* EGG_ACTION_GROUP_GET_CLASS (action_group)->get_action)
- (action_group, action_name);
-}
-
-/**
- * egg_action_group_add_action:
- * @action_group: the action group
- * @action: an action
- *
- * This function adds an action object to the action group.
- */
-void
-egg_action_group_add_action (EggActionGroup *action_group,
- EggAction *action)
-{
- g_return_if_fail (EGG_IS_ACTION_GROUP (action_group));
- g_return_if_fail (EGG_IS_ACTION (action));
- g_return_if_fail (action->name != NULL);
-
- g_hash_table_insert (action_group->actions, g_strdup (action->name),
- g_object_ref (action));
-}
-
-/**
- * egg_action_group_removes_action:
- * @action_group: the action group
- * @action: an action
- *
- * This function removes an action object to the action group.
- */
-void
-egg_action_group_remove_action (EggActionGroup *action_group,
- EggAction *action)
-{
- g_return_if_fail (EGG_IS_ACTION_GROUP (action_group));
- g_return_if_fail (EGG_IS_ACTION (action));
- g_return_if_fail (action->name != NULL);
-
- /* extra protection to make sure action->name is valid */
- g_object_ref (action);
- g_hash_table_remove (action_group->actions, action->name);
- g_object_unref (action);
-}
-
-static void
-add_single_action (gpointer key, gpointer value, gpointer user_data)
-{
- GList **list = user_data;
-
- *list = g_list_prepend (*list, value);
-}
-
-/**
- * egg_action_group_list_actions:
- * @action_group: the action group
- *
- * Lists the actions in the action group.
- *
- * Returns: an allocated list of the action objects in the action group
- */
-GList *
-egg_action_group_list_actions (EggActionGroup *action_group)
-{
- GList *actions = NULL;
-
- g_hash_table_foreach (action_group->actions, add_single_action, &actions);
-
- return g_list_reverse (actions);
-}
-
-
-/**
- * egg_action_group_add_actions:
- * @action_group: the action group
- * @entries: an array of action descriptions
- * @n_entries: the number of entries
- *
- * This is a convenience routine to create a number of actions and add
- * them to the action group. Each member of the array describes an
- * action to create.
- */
-void
-egg_action_group_add_actions (EggActionGroup *action_group,
- EggActionGroupEntry *entries,
- guint n_entries)
-{
- guint i;
-
- for (i = 0; i < n_entries; i++)
- {
- EggAction *action;
- GType action_type;
- gchar *accel_path;
-
- switch (entries[i].entry_type) {
- case NORMAL_ACTION:
- action_type = EGG_TYPE_ACTION;
- break;
- case TOGGLE_ACTION:
- action_type = EGG_TYPE_TOGGLE_ACTION;
- break;
- case RADIO_ACTION:
- action_type = EGG_TYPE_RADIO_ACTION;
- break;
- default:
- g_warning ("unsupported action type");
- action_type = EGG_TYPE_ACTION;
- }
-
- action = g_object_new (action_type,
- "name", entries[i].name,
- "label", _(entries[i].label),
- "tooltip", _(entries[i].tooltip),
- "stock_id", entries[i].stock_id,
- NULL);
-
- if (entries[i].entry_type == RADIO_ACTION &&
- entries[i].extra_data != NULL)
- {
- EggAction *radio_action;
- GSList *group;
-
- radio_action =
- egg_action_group_get_action (EGG_ACTION_GROUP (action_group),
- entries[i].extra_data);
- if (radio_action)
- {
- group = egg_radio_action_get_group (EGG_RADIO_ACTION (radio_action));
- egg_radio_action_set_group (EGG_RADIO_ACTION (action), group);
- }
- else
- g_warning (G_STRLOC " could not look up `%s'", entries[i].extra_data);
- }
-
- if (entries[i].callback)
- g_signal_connect (action, "activate",
- entries[i].callback, entries[i].user_data);
-
- /* set the accel path for the menu item */
- accel_path = g_strconcat ("<Actions>/", action_group->name, "/",
- entries[i].name, NULL);
- if (entries[i].accelerator)
- {
- guint accel_key = 0;
- GdkModifierType accel_mods;
-
- gtk_accelerator_parse (entries[i].accelerator, &accel_key,
- &accel_mods);
- if (accel_key)
- gtk_accel_map_add_entry (accel_path, accel_key, accel_mods);
- }
-
- egg_action_set_accel_path (action, accel_path);
- g_free(accel_path);
-
- egg_action_group_add_action (action_group, action);
- g_object_unref (action);
- }
-}
diff --git a/lib/egg/egg-action-group.h b/lib/egg/egg-action-group.h
deleted file mode 100644
index 2ee05dcec..000000000
--- a/lib/egg/egg-action-group.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef EGG_ACTION_GROUP_H
-#define EGG_ACTION_GROUP_H
-
-#include <gtk/gtk.h>
-#include <egg-action.h>
-
-#define EGG_TYPE_ACTION_GROUP (egg_action_group_get_type ())
-#define EGG_ACTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_ACTION_GROUP, EggActionGroup))
-#define EGG_ACTION_GROUP_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), EGG_TYPE_ACTION_GROUP, EggActionGroupClass))
-#define EGG_IS_ACTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_ACTION_GROUP))
-#define EGG_IS_ACTION_GROUP_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), EGG_TYPE_ACTION_GROUP))
-#define EGG_ACTION_GROUP_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), EGG_TYPE_ACTION_GROUP, EggActionGroupClass))
-
-typedef struct _EggActionGroup EggActionGroup;
-typedef struct _EggActionGroupClass EggActionGroupClass;
-typedef struct _EggActionGroupEntry EggActionGroupEntry;
-
-struct _EggActionGroup
-{
- GObject parent;
-
- gchar *name;
- GHashTable *actions;
-};
-
-struct _EggActionGroupClass
-{
- GObjectClass parent_class;
-
- EggAction *(* get_action) (EggActionGroup *action_group,
- const gchar *action_name);
-};
-
-typedef enum {
- NORMAL_ACTION,
- TOGGLE_ACTION,
- RADIO_ACTION
-} EggActionGroupEntryType;
-
-struct _EggActionGroupEntry {
- gchar *name;
- gchar *label;
- gchar *stock_id;
- gchar *accelerator;
- gchar *tooltip;
-
- GCallback callback;
- gpointer user_data;
-
- EggActionGroupEntryType entry_type;
- gchar *extra_data;
-};
-
-GType egg_action_group_get_type (void);
-
-EggActionGroup *egg_action_group_new (const gchar *name);
-
-const gchar *egg_action_group_get_name (EggActionGroup *action_group);
-EggAction *egg_action_group_get_action (EggActionGroup *action_group,
- const gchar *action_name);
-GList *egg_action_group_list_actions (EggActionGroup *action_group);
-void egg_action_group_add_action (EggActionGroup *action_group,
- EggAction *action);
-void egg_action_group_remove_action (EggActionGroup *action_group,
- EggAction *action);
-
-void egg_action_group_add_actions (EggActionGroup *action_group,
- EggActionGroupEntry *entries,
- guint n_entries);
-
-#endif
diff --git a/lib/egg/egg-action.c b/lib/egg/egg-action.c
deleted file mode 100644
index 4efcbac6b..000000000
--- a/lib/egg/egg-action.c
+++ /dev/null
@@ -1,822 +0,0 @@
-#include "egg-action.h"
-#include "eggtoolbutton.h"
-#include "eggtoolbar.h"
-#include "eggintl.h"
-
-enum {
- ACTIVATE,
- LAST_SIGNAL
-};
-
-enum {
- PROP_0,
- PROP_NAME,
- PROP_LABEL,
- PROP_SHORT_LABEL,
- PROP_TOOLTIP,
- PROP_STOCK_ID,
- PROP_SENSITIVE,
- PROP_VISIBLE,
- PROP_IMPORTANT
-};
-
-static void egg_action_init (EggAction *action);
-static void egg_action_class_init (EggActionClass *class);
-
-static GQuark accel_path_id = 0;
-static const gchar *accel_path_key = "EggAction::accel_path";
-
-GType
-egg_action_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GTypeInfo type_info =
- {
- sizeof (EggActionClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) egg_action_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
-
- sizeof (EggAction),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_action_init,
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EggAction",
- &type_info, 0);
- }
- return type;
-}
-
-static void egg_action_finalize (GObject *object);
-static void egg_action_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void egg_action_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-static GtkWidget *create_menu_item (EggAction *action);
-static GtkWidget *create_tool_item (EggAction *action);
-static void connect_proxy (EggAction *action,
- GtkWidget *proxy);
-static void disconnect_proxy (EggAction *action,
- GtkWidget *proxy);
-
-static GObjectClass *parent_class = NULL;
-static guint action_signals[LAST_SIGNAL] = { 0 };
-
-
-static void
-egg_action_class_init (EggActionClass *class)
-{
- GObjectClass *object_class;
-
- accel_path_id = g_quark_from_static_string(accel_path_key);
-
- parent_class = g_type_class_peek_parent (class);
- object_class = G_OBJECT_CLASS(class);
-
- object_class->finalize = egg_action_finalize;
- object_class->set_property = egg_action_set_property;
- object_class->get_property = egg_action_get_property;
-
- class->activate = NULL;
-
- class->create_menu_item = create_menu_item;
- class->create_tool_item = create_tool_item;
- class->connect_proxy = connect_proxy;
- class->disconnect_proxy = disconnect_proxy;
-
- class->menu_item_type = GTK_TYPE_IMAGE_MENU_ITEM;
- class->toolbar_item_type = EGG_TYPE_TOOL_BUTTON;
-
- g_object_class_install_property (object_class,
- PROP_NAME,
- g_param_spec_string ("name",
- _("Name"),
- _("A unique name for the action."),
- NULL,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (object_class,
- PROP_LABEL,
- g_param_spec_string ("label",
- _("Label"),
- _("The label used for menu items and buttons that activate this action."),
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_SHORT_LABEL,
- g_param_spec_string ("short_label",
- _("Short label"),
- _("A shorter label that may be used on toolbar buttons."),
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_TOOLTIP,
- g_param_spec_string ("tooltip",
- _("Tooltip"),
- _("A tooltip for this action."),
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_STOCK_ID,
- g_param_spec_string ("stock_id",
- _("Stock Icon"),
- _("The stock icon displayed in widgets representing this action."),
- NULL,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_SENSITIVE,
- g_param_spec_boolean ("sensitive",
- _("Sensitive"),
- _("Whether the action is enabled."),
- TRUE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_IMPORTANT,
- g_param_spec_boolean ("important",
- _("Important"),
- _("Important."),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_VISIBLE,
- g_param_spec_boolean ("visible",
- _("Visible"),
- _("Whether the action is visible."),
- TRUE,
- G_PARAM_READWRITE));
-
- action_signals[ACTIVATE] =
- g_signal_new ("activate",
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (EggActionClass, activate), NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-
-static void
-egg_action_init (EggAction *action)
-{
- static GtkTooltips *egg_action_tooltips = NULL;
-
- action->name = NULL;
- action->label = NULL;
- action->short_label = NULL;
- action->tooltip = NULL;
- action->stock_id = NULL;
-
- action->sensitive = TRUE;
- action->visible = TRUE;
- action->important = FALSE;
-
- action->label_set = FALSE;
- action->short_label_set = FALSE;
-
- action->accel_quark = 0;
-
- action->proxies = NULL;
-
- if (egg_action_tooltips == NULL)
- {
- egg_action_tooltips = gtk_tooltips_new ();
- action->tooltips = g_object_ref (egg_action_tooltips);
- gtk_object_sink (GTK_OBJECT (egg_action_tooltips));
- }
- else
- {
- action->tooltips = g_object_ref (egg_action_tooltips);
- }
-}
-
-static void
-egg_action_finalize (GObject *object)
-{
- EggAction *action;
-
- action = EGG_ACTION (object);
-
- g_object_unref (action->tooltips);
-
- g_free (action->name);
- g_free (action->label);
- g_free (action->short_label);
- g_free (action->tooltip);
- g_free (action->stock_id);
-}
-
-static void
-egg_action_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EggAction *action;
-
- action = EGG_ACTION (object);
-
- switch (prop_id)
- {
- case PROP_NAME:
- g_free (action->name);
- action->name = g_value_dup_string (value);
- break;
- case PROP_LABEL:
- g_free (action->label);
- action->label = g_value_dup_string (value);
- action->label_set = (action->label != NULL);
- /* if label is unset, then use the label from the stock item */
- if (!action->label_set && action->stock_id)
- {
- GtkStockItem stock_item;
-
- if (gtk_stock_lookup(action->stock_id, &stock_item))
- action->label = g_strdup(stock_item.label);
- }
- /* if short_label is unset, set short_label=label */
- if (!action->short_label_set)
- {
- g_free(action->short_label);
- action->short_label = g_strdup(action->label);
- g_object_notify(object, "short_label");
- }
- break;
- case PROP_SHORT_LABEL:
- g_free (action->short_label);
- action->short_label = g_value_dup_string (value);
- action->short_label_set = (action->short_label != NULL);
- /* if short_label is unset, then use the value of label */
- if (!action->short_label_set)
- {
- action->short_label = g_strdup(action->label);
- }
- break;
- case PROP_TOOLTIP:
- g_free (action->tooltip);
- action->tooltip = g_value_dup_string (value);
- break;
- case PROP_STOCK_ID:
- g_free (action->stock_id);
- action->stock_id = g_value_dup_string (value);
- /* update label and short_label if appropriate */
- if (!action->label_set)
- {
- GtkStockItem stock_item;
-
- g_free(action->label);
- if (gtk_stock_lookup(action->stock_id, &stock_item))
- action->label = g_strdup(stock_item.label);
- else
- action->label = NULL;
- g_object_notify(object, "label");
- }
- if (!action->short_label_set)
- {
- g_free(action->short_label);
- action->short_label = g_strdup(action->label);
- g_object_notify(object, "short_label");
- }
- break;
- case PROP_SENSITIVE:
- action->sensitive = g_value_get_boolean (value);
- break;
- case PROP_VISIBLE:
- action->visible = g_value_get_boolean (value);
- break;
- case PROP_IMPORTANT:
- action->important = g_value_get_boolean (value);
- g_object_notify(object, "important");
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-egg_action_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EggAction *action;
-
- action = EGG_ACTION (object);
-
- switch (prop_id)
- {
- case PROP_NAME:
- g_value_set_string (value, action->name);
- break;
- case PROP_LABEL:
- g_value_set_string (value, action->label);
- break;
- case PROP_SHORT_LABEL:
- g_value_set_string (value, action->short_label);
- break;
- case PROP_TOOLTIP:
- g_value_set_string (value, action->tooltip);
- break;
- case PROP_STOCK_ID:
- g_value_set_string (value, action->stock_id);
- break;
- case PROP_SENSITIVE:
- g_value_set_boolean (value, action->sensitive);
- break;
- case PROP_VISIBLE:
- g_value_set_boolean (value, action->visible);
- break;
- case PROP_IMPORTANT:
- g_value_set_boolean (value, action->important);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static GtkWidget *
-create_menu_item (EggAction *action)
-{
- GType menu_item_type;
-
- menu_item_type = EGG_ACTION_GET_CLASS (action)->menu_item_type;
-
- return g_object_new (menu_item_type, NULL);
-}
-
-static GtkWidget *
-create_tool_item (EggAction *action)
-{
- GType toolbar_item_type;
-
- toolbar_item_type = EGG_ACTION_GET_CLASS (action)->toolbar_item_type;
-
- return g_object_new (toolbar_item_type, NULL);
-}
-
-static void
-egg_action_remove_proxy (GtkWidget *widget, EggAction *action)
-{
- action->proxies = g_slist_remove (action->proxies, widget);
-}
-
-static void
-egg_action_sync_property (EggAction *action, GParamSpec *pspec,
- GtkWidget *proxy)
-{
- const gchar *property;
- GValue value = { 0, };
-
- property = g_param_spec_get_name (pspec);
-
- g_value_init(&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
- g_object_get_property (G_OBJECT (action), property, &value);
-
- g_object_set_property (G_OBJECT (proxy), property, &value);
- g_value_unset (&value);
-}
-
-static void
-egg_action_sync_important (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
-{
- egg_tool_item_set_is_important (EGG_TOOL_ITEM (proxy), action->important);
-}
-
-static void
-egg_action_sync_tooltip (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
-{
- if (action->tooltip != NULL)
- {
- egg_tool_item_set_tooltip (EGG_TOOL_ITEM (proxy),
- action->tooltips,
- action->tooltip,
- NULL);
- }
-}
-
-static void
-egg_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
-{
- GtkWidget *label = NULL;
-
- g_return_if_fail (GTK_IS_MENU_ITEM (proxy));
- label = GTK_BIN(proxy)->child;
-
- if (GTK_IS_LABEL (label))
- gtk_label_set_label (GTK_LABEL (label), action->label);
-}
-
-static void
-egg_action_sync_short_label (EggAction *action, GParamSpec *pspec,
- GtkWidget *proxy)
-{
- GValue value = { 0, };
-
- g_value_init(&value, G_TYPE_STRING);
- g_object_get_property (G_OBJECT (action), "short_label", &value);
-
- g_object_set_property (G_OBJECT (proxy), "label", &value);
- g_value_unset (&value);
-}
-
-static void
-egg_action_sync_stock_id (EggAction *action, GParamSpec *pspec,
- GtkWidget *proxy)
-{
- GtkWidget *image = NULL;
-
- if (GTK_IS_IMAGE_MENU_ITEM (proxy))
- {
- image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (proxy));
-
- if (GTK_IS_IMAGE (image))
- gtk_image_set_from_stock (GTK_IMAGE (image),
- action->stock_id, GTK_ICON_SIZE_MENU);
- }
-}
-
-static gboolean
-egg_action_create_menu_proxy (EggToolItem *tool_item, EggAction *action)
-{
- GtkWidget *menu_item = egg_action_create_menu_item (action);
-
- g_object_ref (menu_item);
- gtk_object_sink (GTK_OBJECT (menu_item));
-
- egg_tool_item_set_proxy_menu_item (tool_item, "egg-action-menu-item", menu_item);
- g_object_unref (menu_item);
-
- return TRUE;
-}
-
-static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
-{
- g_object_ref (action);
- g_object_set_data_full (G_OBJECT (proxy), "egg-action", action,
- g_object_unref);
-
- /* add this widget to the list of proxies */
- action->proxies = g_slist_prepend (action->proxies, proxy);
- g_signal_connect (proxy, "destroy",
- G_CALLBACK (egg_action_remove_proxy), action);
-
- g_signal_connect_object (action, "notify::sensitive",
- G_CALLBACK (egg_action_sync_property), proxy, 0);
- gtk_widget_set_sensitive (proxy, action->sensitive);
-
- g_signal_connect_object (action, "notify::visible",
- G_CALLBACK (egg_action_sync_property), proxy, 0);
- if (action->visible)
- gtk_widget_show (proxy);
- else
- gtk_widget_hide (proxy);
-
- if (GTK_IS_MENU_ITEM (proxy))
- {
- GtkWidget *label;
- /* menu item specific synchronisers ... */
-
- label = GTK_BIN (proxy)->child;
-
- /* make sure label is a label */
- if (label && !GTK_IS_LABEL (label))
- {
- gtk_container_remove (GTK_CONTAINER(proxy), label);
- label = NULL;
- }
- if (!label)
- {
- label = g_object_new (GTK_TYPE_ACCEL_LABEL,
- "use_underline", TRUE,
- "xalign", 0.0,
- "visible", TRUE,
- "parent", proxy,
- "accel_widget", proxy,
- NULL);
- }
- gtk_label_set_label (GTK_LABEL (label), action->label);
- g_signal_connect_object (action, "notify::label",
- G_CALLBACK (egg_action_sync_label), proxy, 0);
-
- if (GTK_IS_IMAGE_MENU_ITEM (proxy))
- {
- GtkWidget *image;
-
- image = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (proxy));
- if (image && !GTK_IS_IMAGE(image))
- {
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy),NULL);
- image = NULL;
- }
- if (!image)
- {
- image = gtk_image_new_from_stock (NULL,
- GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy),
- image);
- gtk_widget_show (image);
- }
- gtk_image_set_from_stock (GTK_IMAGE (image),
- action->stock_id, GTK_ICON_SIZE_MENU);
- g_signal_connect_object (action, "notify::stock_id",
- G_CALLBACK (egg_action_sync_stock_id),
- proxy, 0);
- }
-
- if (action->accel_quark)
- {
- gtk_menu_item_set_accel_path (GTK_MENU_ITEM (proxy),
- g_quark_to_string (action->accel_quark));
- }
-
- g_signal_connect_object (proxy, "activate",
- G_CALLBACK (egg_action_activate), action,
- G_CONNECT_SWAPPED);
- }
- else if (EGG_IS_TOOL_BUTTON (proxy))
- {
- /* toolbar button specific synchronisers ... */
-
- /* synchronise the label */
- g_object_set (G_OBJECT (proxy),
- "label", action->short_label,
- "use_underline", TRUE,
- NULL);
- g_signal_connect_object (action, "notify::short_label",
- G_CALLBACK (egg_action_sync_short_label),
- proxy, 0);
-
- egg_action_sync_important (action, NULL, proxy);
- g_signal_connect_object (action, "notify::important",
- G_CALLBACK (egg_action_sync_important), proxy, 0);
-
- g_object_set (G_OBJECT (proxy), "stock_id", action->stock_id, NULL);
- g_signal_connect_object (action, "notify::stock_id",
- G_CALLBACK (egg_action_sync_property), proxy, 0);
-
- g_signal_connect_object (proxy, "create_menu_proxy",
- G_CALLBACK (egg_action_create_menu_proxy),
- action, 0);
-
- g_signal_connect_object (proxy, "clicked",
- G_CALLBACK (egg_action_activate), action,
- G_CONNECT_SWAPPED);
- }
-
- if (EGG_IS_TOOL_ITEM (proxy))
- {
- egg_action_sync_tooltip (action, NULL, proxy);
- g_signal_connect_object (action, "notify::tooltip",
- G_CALLBACK (egg_action_sync_tooltip),
- proxy, 0);
- }
-}
-
-static void
-disconnect_proxy (EggAction *action, GtkWidget *proxy)
-{
- static guint notify_id = 0;
-
- if (!notify_id)
- notify_id = g_signal_lookup ("notify", G_TYPE_OBJECT);
-
- g_object_set_data (G_OBJECT (proxy), "egg-action", NULL);
-
- /* remove proxy from list of proxies */
- g_signal_handlers_disconnect_by_func (proxy,
- G_CALLBACK (egg_action_remove_proxy),
- action);
- egg_action_remove_proxy (proxy, action);
-
- /* disconnect the activate handler */
- g_signal_handlers_disconnect_by_func (proxy,
- G_CALLBACK (egg_action_activate),
- action);
-
- /* disconnect handlers for notify::* signals */
- g_signal_handlers_disconnect_by_func (proxy,
- G_CALLBACK (egg_action_sync_property),
- action);
-
- g_signal_handlers_disconnect_by_func (action,
- G_CALLBACK (egg_action_sync_stock_id), proxy);
-
- g_signal_handlers_disconnect_by_func (proxy,
- G_CALLBACK (egg_action_sync_tooltip),
- action);
-
- /* menu item specific synchronisers ... */
- g_signal_handlers_disconnect_by_func (action,
- G_CALLBACK (egg_action_sync_label),
- proxy);
-
- gtk_menu_item_set_accel_path (GTK_MENU_ITEM (proxy), NULL);
-
- /* toolbar button specific synchronisers ... */
- g_signal_handlers_disconnect_by_func (action,
- G_CALLBACK (egg_action_sync_short_label),
- proxy);
- g_signal_handlers_disconnect_by_func (proxy,
- G_CALLBACK (egg_action_create_menu_proxy),
- action);
-}
-
-/**
- * egg_action_activate:
- * @action: the action object
- *
- * Calling this function will emit the "activate" signal on the
- * specified action. It gets called by the proxy widgets when they
- * get activated.
- *
- * It can also be used to manually activate an action.
- */
-void
-egg_action_activate (EggAction *action)
-{
- g_signal_emit (action, action_signals[ACTIVATE], 0);
-}
-
-/**
- * egg_action_create_icon:
- * @action: the action object
- * @icon_size: the size of the icon that should be created.
- *
- * This function is intended for use by action implementations to
- * create icons displayed in the proxy widgets.
- *
- * Returns: a widget that displays the icon for this action.
- */
-GtkWidget *
-egg_action_create_icon (EggAction *action, GtkIconSize icon_size)
-{
- if (action->stock_id)
- return gtk_image_new_from_stock (action->stock_id, icon_size);
- else
- return NULL;
-}
-
-/**
- * egg_action_create_menu_item:
- * @action: the action object
- *
- * This function creates a menu item widget that proxies for the given
- * action.
- *
- * Returns: a menu item connected to the action.
- */
-GtkWidget *
-egg_action_create_menu_item (EggAction *action)
-{
- GtkWidget *menu_item;
-
- menu_item = (* EGG_ACTION_GET_CLASS (action)->create_menu_item) (action);
-
- (* EGG_ACTION_GET_CLASS (action)->connect_proxy) (action, menu_item);
-
- return menu_item;
-}
-
-/**
- * egg_action_create_tool_item:
- * @action: the action object
- *
- * This function creates a toolbar item widget that proxies for the
- * given action.
- *
- * Returns: a toolbar item connected to the action.
- */
-GtkWidget *
-egg_action_create_tool_item (EggAction *action)
-{
- GtkWidget *button;
-
- button = (* EGG_ACTION_GET_CLASS (action)->create_tool_item) (action);
-
- (* EGG_ACTION_GET_CLASS (action)->connect_proxy) (action, button);
-
- return button;
-}
-
-/**
- * egg_action_connect_proxy:
- * @action: the action object
- * @proxy: the proxy widget
- *
- * This function connects a widget to an action object as a proxy. It
- * will synchronise various properties of the action with the widget
- * (such as label text, icon, tooltip, etc), and attaches a callback
- * so that the action gets activated when the proxy widget does.
- *
- * If the widget is already connected to an action, it is disconnected
- * first.
- */
-void
-egg_action_connect_proxy (EggAction *action,
- GtkWidget *proxy)
-{
- EggAction *prev_action;
-
- g_return_if_fail (EGG_IS_ACTION (action));
- g_return_if_fail (GTK_IS_WIDGET (proxy));
-
- prev_action = g_object_get_data (G_OBJECT (proxy), "egg-action");
-
- if (prev_action)
- {
- (* EGG_ACTION_GET_CLASS (action)->disconnect_proxy) (action, proxy);
- }
-
- (* EGG_ACTION_GET_CLASS (action)->connect_proxy) (action, proxy);
-}
-
-/**
- * egg_action_disconnect_proxy:
- * @action: the action object
- * @proxy: the proxy widget
- *
- * This disconnects a proxy widget from an action. It does not
- * destroy the widget, however.
- */
-void
-egg_action_disconnect_proxy (EggAction *action,
- GtkWidget *proxy)
-{
- g_return_if_fail (EGG_IS_ACTION (action));
- g_return_if_fail (GTK_IS_WIDGET (proxy));
-
- g_return_if_fail (g_object_get_data (G_OBJECT (proxy), "egg-action") != action);
-
- (* EGG_ACTION_GET_CLASS (action)->disconnect_proxy) (action, proxy);
-}
-
-/**
- * egg_action_block_activate_from:
- * @action: the action object
- * @proxy: a proxy widget
- *
- * Calling this function disables calls to the egg_action_activate()
- * function by signals on the given proxy widget. This is used to
- * break notification loops for things like check or radio actions.
- *
- * This function is intended for use by action implementations.
- */
-void
-egg_action_block_activate_from (EggAction *action, GtkWidget *proxy)
-{
- g_return_if_fail (EGG_IS_ACTION (action));
-
- g_signal_handlers_block_by_func (proxy, G_CALLBACK (egg_action_activate),
- action);
-}
-
-/**
- * egg_action_unblock_activate_from:
- * @action: the action object
- * @proxy: a proxy widget
- *
- * Calling this function re-enables calls to the egg_action_activate()
- * function by signals on the given proxy widget. This undoes the
- * blocking done by egg_action_block_activate_from().
- *
- * This function is intended for use by action implementations.
- */
-void
-egg_action_unblock_activate_from (EggAction *action, GtkWidget *proxy)
-{
- g_return_if_fail (EGG_IS_ACTION (action));
-
- g_signal_handlers_unblock_by_func (proxy, G_CALLBACK (egg_action_activate),
- action);
-}
-
-/**
- * egg_action_set_accel_path:
- * @action: the action object
- * @accel_path: the accelerator path
- *
- * Sets the accel path for this action. All proxy widgets associated
- * with the action will have this accel path, so that their
- * accelerators are consistent.
- */
-void
-egg_action_set_accel_path (EggAction *action, const gchar *accel_path)
-{
- action->accel_quark = g_quark_from_string(accel_path);
-}
diff --git a/lib/egg/egg-action.h b/lib/egg/egg-action.h
deleted file mode 100644
index 994d4f846..000000000
--- a/lib/egg/egg-action.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef EGG_ACTION_H
-#define EGG_ACTION_H
-
-#include <gtk/gtk.h>
-
-#define EGG_TYPE_ACTION (egg_action_get_type ())
-#define EGG_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_ACTION, EggAction))
-#define EGG_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_ACTION, EggActionClass))
-#define EGG_IS_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_ACTION))
-#define EGG_IS_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EGG_TYPE_ACTION))
-#define EGG_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EGG_TYPE_ACTION, EggActionClass))
-
-typedef struct _EggAction EggAction;
-typedef struct _EggActionClass EggActionClass;
-
-struct _EggAction
-{
- GObject object;
-
- gchar *name;
- gchar *label;
- gchar *short_label;
- gchar *tooltip;
- gchar *stock_id; /* icon */
-
- guint important : 1;
- guint sensitive : 1;
- guint visible : 1;
- guint label_set : 1; /* these two used so we can set label */
- guint short_label_set : 1; /* based on stock id */
-
- /* accelerator */
- GQuark accel_quark;
-
- /* list of proxy widgets */
- GSList *proxies;
-
- GtkTooltips *tooltips;
-};
-
-struct _EggActionClass
-{
- GObjectClass parent_class;
-
- /* activation signal */
- void (* activate) (EggAction *action);
-
- GType menu_item_type;
- GType toolbar_item_type;
-
- /* widget creation routines (not signals) */
- GtkWidget *(* create_menu_item) (EggAction *action);
- GtkWidget *(* create_tool_item) (EggAction *action);
- void (* connect_proxy) (EggAction *action,
- GtkWidget *proxy);
- void (* disconnect_proxy) (EggAction *action,
- GtkWidget *proxy);
-};
-
-GType egg_action_get_type (void);
-
-void egg_action_activate (EggAction *action);
-
-GtkWidget *egg_action_create_icon (EggAction *action,
- GtkIconSize icon_size);
-GtkWidget *egg_action_create_menu_item (EggAction *action);
-GtkWidget *egg_action_create_tool_item (EggAction *action);
-void egg_action_connect_proxy (EggAction *action,
- GtkWidget *proxy);
-void egg_action_disconnect_proxy (EggAction *action,
- GtkWidget *proxy);
-
-/* protected ... for use by child actions */
-void egg_action_block_activate_from (EggAction *action,
- GtkWidget *proxy);
-void egg_action_unblock_activate_from (EggAction *action,
- GtkWidget *proxy);
-
-/* protected ... for use by action groups */
-void egg_action_set_accel_path (EggAction *action,
- const gchar *accel_path);
-
-
-#endif
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c
index 2fc401cde..2a3db3e49 100755
--- a/lib/egg/egg-editable-toolbar.c
+++ b/lib/egg/egg-editable-toolbar.c
@@ -18,11 +18,20 @@
#include "egg-editable-toolbar.h"
#include "egg-toolbars-model.h"
-#include "eggtoolbar.h"
-#include "eggtoolitem.h"
-#include "eggseparatortoolitem.h"
-#include "eggintl.h"
+#include <gtk/gtkvseparator.h>
+#include <gtk/gtkiconfactory.h>
+#include <gtk/gtkwindow.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtkdnd.h>
+#include <gtk/gtkimage.h>
+#include <gtk/gtkimagemenuitem.h>
+#include <gtk/gtkmenu.h>
+#include <gtk/gtkstock.h>
+#include <gtk/gtktoolbar.h>
+#include <gtk/gtktoolitem.h>
+#include <gtk/gtkseparatortoolitem.h>
+#include <bonobo/bonobo-i18n.h>
#include <string.h>
static void egg_editable_toolbar_class_init (EggEditableToolbarClass *klass);
@@ -60,7 +69,7 @@ static GObjectClass *parent_class = NULL;
struct EggEditableToolbarPrivate
{
- EggMenuMerge *merge;
+ GtkUIManager *merge;
EggToolbarsModel *model;
gboolean edit_mode;
GtkWidget *selected_toolbar;
@@ -133,21 +142,23 @@ get_toolbar_nth (EggEditableToolbar *etoolbar,
return result;
}
-static EggAction *
+static GtkAction *
find_action (EggEditableToolbar *t,
const char *name)
{
- GList *l = t->priv->merge->action_groups;
- EggAction *action = NULL;
+ GList *l;
+ GtkAction *action = NULL;
+
+ l = gtk_ui_manager_get_action_groups (t->priv->merge);
g_return_val_if_fail (IS_EGG_EDITABLE_TOOLBAR (t), NULL);
g_return_val_if_fail (name != NULL, NULL);
for (; l != NULL; l = l->next)
{
- EggAction *tmp;
+ GtkAction *tmp;
- tmp = egg_action_group_get_action (EGG_ACTION_GROUP (l->data), name);
+ tmp = gtk_action_group_get_action (GTK_ACTION_GROUP (l->data), name);
if (tmp)
action = tmp;
}
@@ -169,7 +180,7 @@ drag_data_received_cb (GtkWidget *widget,
g_return_if_fail (IS_EGG_EDITABLE_TOOLBAR (etoolbar));
- pos = egg_toolbar_get_drop_index (EGG_TOOLBAR (widget), x, y);
+ pos = gtk_toolbar_get_drop_index (GTK_TOOLBAR (widget), x, y);
toolbar_pos = get_toolbar_position (etoolbar, widget);
if (strcmp (selection_data->data, "separator") == 0)
@@ -203,8 +214,8 @@ drag_data_delete_cb (GtkWidget *widget,
g_return_if_fail (IS_EGG_EDITABLE_TOOLBAR (etoolbar));
- pos = egg_toolbar_get_item_index (EGG_TOOLBAR (widget->parent),
- EGG_TOOL_ITEM (widget));
+ pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (widget->parent),
+ GTK_TOOL_ITEM (widget));
toolbar_pos = get_toolbar_position (etoolbar, widget->parent);
egg_toolbars_model_remove_item (etoolbar->priv->model,
@@ -219,16 +230,16 @@ drag_data_get_cb (GtkWidget *widget,
guint32 time,
EggEditableToolbar *etoolbar)
{
- EggAction *action;
+ GtkAction *action;
const char *target;
g_return_if_fail (IS_EGG_EDITABLE_TOOLBAR (etoolbar));
- action = EGG_ACTION (g_object_get_data (G_OBJECT (widget), "egg-action"));
+ action = GTK_ACTION (g_object_get_data (G_OBJECT (widget), "egg-action"));
if (action)
{
- target = action->name;
+ target = gtk_action_get_name (action);
}
else
{
@@ -293,8 +304,8 @@ create_toolbar (EggEditableToolbar *t)
{
GtkWidget *toolbar;
- toolbar = egg_toolbar_new ();
- egg_toolbar_set_show_arrow (EGG_TOOLBAR (toolbar), TRUE);
+ toolbar = gtk_toolbar_new ();
+ gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE);
gtk_widget_show (toolbar);
gtk_drag_dest_set (toolbar, GTK_DEST_DEFAULT_DROP,
dest_drag_types, n_dest_drag_types,
@@ -309,7 +320,7 @@ create_toolbar (EggEditableToolbar *t)
static void
set_item_drag_source (GtkWidget *item,
- EggAction *action,
+ GtkAction *action,
gboolean is_separator)
{
gtk_drag_source_set (item, GDK_BUTTON1_MASK,
@@ -327,8 +338,16 @@ set_item_drag_source (GtkWidget *item,
}
else
{
+ const char *stock_id;
+ GValue value = { 0, };
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (G_OBJECT (action), "stock_id", &value);
+
+ stock_id = g_value_get_string (&value);
gtk_drag_source_set_icon_stock
- (item, action->stock_id ? action->stock_id : GTK_STOCK_DND);
+ (item, stock_id ? stock_id : GTK_STOCK_DND);
+ g_value_unset (&value);
}
}
@@ -341,7 +360,7 @@ create_item (EggEditableToolbar *t,
GtkWidget *item;
const char *action_name;
gboolean is_separator;
- EggAction *action;
+ GtkAction *action;
action_name = egg_toolbars_model_item_nth
(model, toolbar_position, position,
@@ -349,7 +368,7 @@ create_item (EggEditableToolbar *t,
if (is_separator)
{
- item = GTK_WIDGET (egg_separator_tool_item_new ());
+ item = GTK_WIDGET (gtk_separator_tool_item_new ());
action = NULL;
}
else
@@ -357,7 +376,7 @@ create_item (EggEditableToolbar *t,
g_signal_emit (G_OBJECT (t), egg_editable_toolbar_signals[ACTION_REQUEST],
0, action_name);
action = find_action (t, action_name);
- item = egg_action_create_tool_item (action);
+ item = gtk_action_create_tool_item (action);
gtk_widget_set_sensitive (item, TRUE);
}
@@ -370,7 +389,7 @@ create_item (EggEditableToolbar *t,
if (t->priv->edit_mode)
{
set_item_drag_source (item, action, is_separator);
- egg_tool_item_set_use_drag_window (EGG_TOOL_ITEM (item), TRUE);
+ gtk_tool_item_set_use_drag_window (GTK_TOOL_ITEM (item), TRUE);
}
return item;
@@ -389,11 +408,11 @@ toolbar_changed_cb (EggToolbarsModel *model,
if (flags & EGG_TB_MODEL_ICONS_ONLY)
{
- egg_toolbar_set_style (EGG_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
+ gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
}
else
{
- egg_toolbar_unset_style (EGG_TOOLBAR (toolbar));
+ gtk_toolbar_unset_style (GTK_TOOLBAR (toolbar));
}
}
@@ -434,8 +453,8 @@ item_added_cb (EggToolbarsModel *model,
toolbar = get_toolbar_nth (t, toolbar_position);
gtk_widget_set_size_request (toolbar, -1, -1);
item = create_item (t, model, toolbar_position, position);
- egg_toolbar_insert (EGG_TOOLBAR (toolbar),
- EGG_TOOL_ITEM (item), position);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
+ GTK_TOOL_ITEM (item), position);
}
static void
@@ -448,8 +467,8 @@ item_removed_cb (EggToolbarsModel *model,
GtkWidget *item;
toolbar = get_toolbar_nth (t, toolbar_position);
- item = GTK_WIDGET (egg_toolbar_get_nth_item
- (EGG_TOOLBAR (toolbar), position));
+ item = GTK_WIDGET (gtk_toolbar_get_nth_item
+ (GTK_TOOLBAR (toolbar), position));
gtk_container_remove (GTK_CONTAINER (toolbar), item);
if (egg_toolbars_model_n_items (model, toolbar_position) == 0)
@@ -503,8 +522,8 @@ egg_editable_toolbar_construct (EggEditableToolbar *t)
GtkWidget *item;
item = create_item (t, model, i, l);
- egg_toolbar_insert (EGG_TOOLBAR (toolbar),
- EGG_TOOL_ITEM (item), l);
+ gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
+ GTK_TOOL_ITEM (item), l);
}
if (n_items == 0)
@@ -516,9 +535,9 @@ egg_editable_toolbar_construct (EggEditableToolbar *t)
static void
egg_editable_toolbar_set_merge (EggEditableToolbar *t,
- EggMenuMerge *merge)
+ GtkUIManager *merge)
{
- g_return_if_fail (EGG_IS_MENU_MERGE (merge));
+ g_return_if_fail (GTK_IS_UI_MANAGER (merge));
g_return_if_fail (IS_EGG_EDITABLE_TOOLBAR (t));
t->priv->merge = merge;
@@ -588,7 +607,7 @@ egg_editable_toolbar_class_init (EggEditableToolbarClass *klass)
g_param_spec_object ("MenuMerge",
"MenuMerge",
"Menu merge",
- EGG_TYPE_MENU_MERGE,
+ GTK_TYPE_UI_MANAGER,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_TOOLBARS_MODEL,
@@ -622,7 +641,7 @@ egg_editable_toolbar_finalize (GObject *object)
}
GtkWidget *
-egg_editable_toolbar_new (EggMenuMerge *merge,
+egg_editable_toolbar_new (GtkUIManager *merge,
EggToolbarsModel *model)
{
EggEditableToolbar *t;
@@ -650,21 +669,21 @@ egg_editable_toolbar_set_edit_mode (EggEditableToolbar *etoolbar,
GtkWidget *toolbar;
toolbar = get_toolbar_nth (etoolbar, i);
- n_items = egg_toolbar_get_n_items (EGG_TOOLBAR (toolbar));
+ n_items = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar));
for (l = 0; l < n_items; l++)
{
- EggToolItem *item;
+ GtkToolItem *item;
const char *action_name;
gboolean is_separator;
- EggAction *action;
+ GtkAction *action;
action_name = egg_toolbars_model_item_nth
(etoolbar->priv->model, i, l,
&is_separator);
action = find_action (etoolbar, action_name);
- item = egg_toolbar_get_nth_item (EGG_TOOLBAR (toolbar), l);
- egg_tool_item_set_use_drag_window (item, mode);
+ item = gtk_toolbar_get_nth_item (GTK_TOOLBAR (toolbar), l);
+ gtk_tool_item_set_use_drag_window (item, mode);
if (mode)
{
@@ -881,7 +900,7 @@ style_set_cb (GtkWidget *widget,
}
GtkWidget *
-_egg_editable_toolbar_new_separator_image ()
+_egg_editable_toolbar_new_separator_image (void)
{
GtkWidget *image = gtk_image_new ();
update_separator_image (GTK_IMAGE (image));
diff --git a/lib/egg/egg-editable-toolbar.h b/lib/egg/egg-editable-toolbar.h
index 6460d724a..577d6ab93 100755
--- a/lib/egg/egg-editable-toolbar.h
+++ b/lib/egg/egg-editable-toolbar.h
@@ -20,8 +20,9 @@
#define EGG_EDITABLE_TOOLBAR_H
#include "egg-toolbars-model.h"
-#include "egg-menu-merge.h"
+#include <gtk/gtkuimanager.h>
+#include <gtk/gtkselection.h>
#include <gtk/gtkvbox.h>
G_BEGIN_DECLS
@@ -54,7 +55,7 @@ struct EggEditableToolbarClass
};
GType egg_editable_toolbar_get_type (void);
-GtkWidget *egg_editable_toolbar_new (EggMenuMerge *merge,
+GtkWidget *egg_editable_toolbar_new (GtkUIManager *merge,
EggToolbarsModel *model);
void egg_editable_toolbar_set_edit_mode (EggEditableToolbar *etoolbar,
gboolean mode);
@@ -69,7 +70,7 @@ void egg_editable_toolbar_set_drag_dest (EggEditableToolbar *etoolbar,
/* Private Functions */
-GtkWidget *_egg_editable_toolbar_new_separator_image ();
+GtkWidget *_egg_editable_toolbar_new_separator_image (void);
G_END_DECLS
diff --git a/lib/egg/egg-menu-merge.c b/lib/egg/egg-menu-merge.c
deleted file mode 100644
index cc39fe9d5..000000000
--- a/lib/egg/egg-menu-merge.c
+++ /dev/null
@@ -1,1320 +0,0 @@
-#include <string.h>
-#include "egg-menu-merge.h"
-#include "eggtoolbar.h"
-#include "eggseparatortoolitem.h"
-#include "eggintl.h"
-
-#define NODE_INFO(node) ((EggMenuMergeNode *)node->data)
-
-typedef struct {
- guint merge_id;
- GQuark action_quark;
-} NodeUIReference;
-
-static void egg_menu_merge_class_init (EggMenuMergeClass *class);
-static void egg_menu_merge_init (EggMenuMerge *merge);
-
-static void egg_menu_merge_queue_update (EggMenuMerge *self);
-static void egg_menu_merge_dirty_all (EggMenuMerge *self);
-
-static GNode *get_child_node (EggMenuMerge *self, GNode *parent,
- const gchar *childname,
- gint childname_length,
- EggMenuMergeNodeType node_type,
- gboolean create, gboolean top);
-static GNode *egg_menu_merge_get_node (EggMenuMerge *self,
- const gchar *path,
- EggMenuMergeNodeType node_type,
- gboolean create);
-static guint egg_menu_merge_next_merge_id (EggMenuMerge *self);
-
-static void egg_menu_merge_node_prepend_ui_reference (EggMenuMergeNode *node,
- guint merge_id,
- GQuark action_quark);
-static void egg_menu_merge_node_remove_ui_reference (EggMenuMergeNode *node,
- guint merge_id);
-
-enum {
- ADD_WIDGET,
- REMOVE_WIDGET,
- LAST_SIGNAL
-};
-
-static guint merge_signals[LAST_SIGNAL] = { 0 };
-
-static GMemChunk *merge_node_chunk = NULL;
-
-GType
-egg_menu_merge_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GTypeInfo type_info =
- {
- sizeof (EggMenuMergeClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) egg_menu_merge_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
-
- sizeof (EggMenuMerge),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_menu_merge_init,
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "EggMenuMerge",
- &type_info, 0);
- }
- return type;
-}
-
-static GObjectClass *parent_class = NULL;
-
-static void
-egg_menu_merge_finalize (GObject *object)
-{
- EggMenuMerge *merge;
-
- merge = EGG_MENU_MERGE (object);
- if (merge->update_tag != 0)
- {
- g_source_remove(merge->update_tag);
- }
-}
-
-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);
-
- merge_signals[ADD_WIDGET] =
- g_signal_new ("add_widget",
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (EggMenuMergeClass, add_widget), NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
- merge_signals[REMOVE_WIDGET] =
- g_signal_new ("remove_widget",
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (EggMenuMergeClass, remove_widget), NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
-
-}
-
-
-static void
-egg_menu_merge_init (EggMenuMerge *self)
-{
- guint merge_id;
- GNode *node;
-
- self->accel_group = gtk_accel_group_new();
-
- self->root_node = NULL;
- self->action_groups = NULL;
-
- self->last_merge_id = 0;
-
-
- 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);
- 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);
-}
-
-EggMenuMerge *
-egg_menu_merge_new (void)
-{
- return g_object_new(EGG_TYPE_MENU_MERGE, NULL);
-}
-
-void
-egg_menu_merge_insert_action_group (EggMenuMerge *self,
- EggActionGroup *action_group, gint pos)
-{
- g_return_if_fail (EGG_IS_MENU_MERGE(self));
- g_return_if_fail (EGG_IS_ACTION_GROUP(action_group));
- g_return_if_fail (g_list_find(self->action_groups, action_group) == NULL);
-
- g_object_ref(action_group);
- self->action_groups = g_list_insert(self->action_groups, action_group, pos);
-
- /* dirty all nodes, as action bindings may change */
- egg_menu_merge_dirty_all(self);
-}
-
-void
-egg_menu_merge_remove_action_group (EggMenuMerge *self,
- EggActionGroup *action_group)
-{
- g_return_if_fail (EGG_IS_MENU_MERGE(self));
- g_return_if_fail (EGG_IS_ACTION_GROUP(action_group));
- g_return_if_fail (g_list_find(self->action_groups, action_group) != NULL);
-
- self->action_groups = g_list_remove(self->action_groups, action_group);
- g_object_unref(action_group);
-
- /* dirty all nodes, as action bindings may change */
- egg_menu_merge_dirty_all(self);
-}
-
-GtkWidget *
-egg_menu_merge_get_widget (EggMenuMerge *self, const gchar *path)
-{
- GNode *node;
-
- /* ensure that there are no pending updates before we get the
- * widget */
- egg_menu_merge_ensure_update(self);
-
- node = egg_menu_merge_get_node(self, path, EGG_MENU_MERGE_UNDECIDED, FALSE);
- return NODE_INFO(node)->proxy;
-}
-
-static GNode *
-get_child_node(EggMenuMerge *self, GNode *parent,
- const gchar *childname, gint childname_length,
- EggMenuMergeNodeType node_type,
- gboolean create, gboolean top)
-{
- GNode *child = NULL;
-
- g_return_val_if_fail(parent == NULL ||
- (NODE_INFO(parent)->type != EGG_MENU_MERGE_MENUITEM &&
- NODE_INFO(parent)->type != EGG_MENU_MERGE_TOOLITEM), NULL);
-
- if (parent)
- {
- if (childname)
- {
- for (child = parent->children; child != NULL; child = child->next)
- {
- if (strlen(NODE_INFO(child)->name) == childname_length &&
- !strncmp(NODE_INFO(child)->name, childname, childname_length))
- {
- /* if undecided about node type, set it */
- if (NODE_INFO(child)->type == EGG_MENU_MERGE_UNDECIDED)
- NODE_INFO(child)->type = node_type;
- return child;
- }
- }
- }
- if (!child && create)
- {
- EggMenuMergeNode *mnode;
-
- mnode = g_chunk_new0(EggMenuMergeNode, merge_node_chunk);
- mnode->type = node_type;
- mnode->name = g_strndup(childname, childname_length);
- mnode->dirty = TRUE;
-
- if (top)
- child = g_node_prepend_data(parent, mnode);
- else
- child = g_node_append_data(parent, mnode);
- }
- }
- else
- {
- /* handle root node */
- if (self->root_node)
- {
- child = self->root_node;
- if (strncmp(NODE_INFO(child)->name, childname, childname_length) !=0)
- g_warning("root node name '%s' doesn't match '%s'",
- childname, NODE_INFO(child)->name);
- if (NODE_INFO(child)->type != EGG_MENU_MERGE_ROOT)
- g_warning("base element must be of type ROOT");
- }
- else if (create)
- {
- EggMenuMergeNode *mnode;
-
- mnode = g_chunk_new0(EggMenuMergeNode, merge_node_chunk);
- mnode->type = node_type;
- mnode->name = g_strndup(childname, childname_length);
- mnode->dirty = TRUE;
-
- child = self->root_node = g_node_new(mnode);
- }
- }
-
- return child;
-}
-
-static GNode *
-egg_menu_merge_get_node(EggMenuMerge *self, const gchar *path,
- EggMenuMergeNodeType node_type, gboolean create)
-{
- const gchar *pos, *end;
- GNode *parent, *node;
-
- end = path + strlen(path);
- pos = path;
- parent = node = NULL;
- while (pos < end)
- {
- const gchar *slash;
- gsize length;
-
- slash = strchr(pos, '/');
- if (slash)
- length = slash - pos;
- else
- length = strlen(pos);
-
- node = get_child_node(self, parent, pos, length, EGG_MENU_MERGE_UNDECIDED,
- create, FALSE);
- if (!node)
- return NULL;
-
- pos += length + 1; /* move past the node name and the slash too */
- parent = node;
- }
-
- if (NODE_INFO(node)->type == EGG_MENU_MERGE_UNDECIDED)
- NODE_INFO(node)->type = node_type;
- return node;
-}
-
-static guint
-egg_menu_merge_next_merge_id (EggMenuMerge *self)
-{
- self->last_merge_id++;
-
- return self->last_merge_id;
-}
-
-static void
-egg_menu_merge_node_prepend_ui_reference (EggMenuMergeNode *node,
- guint merge_id, GQuark action_quark)
-{
- NodeUIReference *reference;
-
- reference = g_new (NodeUIReference, 1);
- reference->action_quark = action_quark;
- reference->merge_id = merge_id;
-
- /* Prepend the reference */
- node->uifiles = g_list_prepend (node->uifiles, reference);
-
- node->dirty = TRUE;
-}
-
-static void
-egg_menu_merge_node_remove_ui_reference (EggMenuMergeNode *node,
- guint merge_id)
-{
- GList *p;
-
- for (p = node->uifiles; p != NULL; p = p->next)
- {
- NodeUIReference *reference = p->data;
-
- if (reference->merge_id == merge_id)
- {
- node->uifiles = g_list_remove_link (node->uifiles, p);
- node->dirty = TRUE;
- g_free (reference);
-
- break;
- }
- }
-}
-
-/* -------------------- The UI file parser -------------------- */
-
-typedef enum {
- STATE_START,
- STATE_ROOT,
- STATE_MENU,
- STATE_TOOLBAR,
- STATE_POPUPS,
- STATE_MENUITEM,
- STATE_TOOLITEM,
- STATE_END
-} ParseState;
-
-typedef struct _ParseContext ParseContext;
-struct _ParseContext
-{
- ParseState state;
- ParseState prev_state;
-
- EggMenuMerge *self;
-
- GNode *current;
-
- guint merge_id;
-};
-
-static void
-start_element_handler (GMarkupParseContext *context,
- const gchar *element_name,
- const gchar **attribute_names,
- const gchar **attribute_values,
- gpointer user_data,
- GError **error)
-{
- ParseContext *ctx = user_data;
- EggMenuMerge *self = ctx->self;
-
- gint i;
- const gchar *node_name;
- GQuark verb_quark;
- gboolean top;
-
- gboolean raise_error = TRUE;
- gchar *error_attr = NULL;
-
- //g_message("starting element %s", element_name);
-
- /* work out a name for this node. Either the name attribute, or
- * element name */
- node_name = element_name;
- verb_quark = 0;
- top = FALSE;
- for (i = 0; attribute_names[i] != NULL; i++)
- {
- if (!strcmp(attribute_names[i], "name"))
- {
- node_name = attribute_values[i];
- }
- else if (!strcmp(attribute_names[i], "verb"))
- {
- verb_quark = g_quark_from_string(attribute_values[i]);
- }
- else if (!strcmp(attribute_names[i], "pos"))
- {
- top = !strcmp(attribute_values[i], "top");
- }
- }
- /* if no verb, then set it to the node's name */
- if (verb_quark == 0)
- verb_quark = g_quark_from_string(node_name);
-
- switch (element_name[0])
- {
- case 'R':
- if (ctx->state == STATE_START && !strcmp(element_name, "Root"))
- {
- ctx->state = STATE_ROOT;
- ctx->current = self->root_node;
- raise_error = FALSE;
-
- egg_menu_merge_node_prepend_ui_reference (NODE_INFO (ctx->current),
- ctx->merge_id, verb_quark);
- }
- break;
- case 'm':
- if (ctx->state == STATE_ROOT && !strcmp(element_name, "menu"))
- {
- ctx->state = STATE_MENU;
- ctx->current = get_child_node(self, ctx->current,
- node_name, strlen(node_name),
- EGG_MENU_MERGE_MENUBAR,
- TRUE, FALSE);
- 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),
- ctx->merge_id, verb_quark);
- NODE_INFO(ctx->current)->dirty = TRUE;
-
- raise_error = FALSE;
- }
- else if (ctx->state == STATE_MENU && !strcmp(element_name, "menuitem"))
- {
- GNode *node;
-
- ctx->state = STATE_MENUITEM;
- node = get_child_node(self, ctx->current,
- node_name, strlen(node_name),
- EGG_MENU_MERGE_MENUITEM,
- TRUE, top);
- if (NODE_INFO(node)->action_name == 0)
- NODE_INFO(node)->action_name = verb_quark;
-
- egg_menu_merge_node_prepend_ui_reference (NODE_INFO (node),
- ctx->merge_id, verb_quark);
- NODE_INFO(node)->dirty = TRUE;
-
- raise_error = FALSE;
- }
- break;
- case 'd':
- if (ctx->state == STATE_ROOT && !strcmp(element_name, "dockitem"))
- {
- ctx->state = STATE_TOOLBAR;
- ctx->current = get_child_node(self, ctx->current,
- node_name, strlen(node_name),
- EGG_MENU_MERGE_TOOLBAR,
- TRUE, FALSE);
- 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),
- ctx->merge_id, verb_quark);
- NODE_INFO(ctx->current)->dirty = TRUE;
-
- raise_error = FALSE;
- }
- break;
- case 'p':
- if (ctx->state == STATE_ROOT && !strcmp(element_name, "popups"))
- {
- ctx->state = STATE_POPUPS;
- ctx->current = get_child_node(self, ctx->current,
- node_name, strlen(node_name),
- EGG_MENU_MERGE_POPUPS,
- TRUE, FALSE);
-
- egg_menu_merge_node_prepend_ui_reference (NODE_INFO (ctx->current),
- ctx->merge_id, verb_quark);
- NODE_INFO(ctx->current)->dirty = TRUE;
-
- raise_error = FALSE;
- }
- else if (ctx->state == STATE_POPUPS && !strcmp(element_name, "popup"))
- {
- ctx->state = STATE_MENU;
- ctx->current = get_child_node(self, ctx->current,
- node_name, strlen(node_name),
- EGG_MENU_MERGE_MENU,
- TRUE, FALSE);
- 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),
- ctx->merge_id, verb_quark);
- NODE_INFO(ctx->current)->dirty = TRUE;
-
- raise_error = FALSE;
- }
- else if ((ctx->state == STATE_MENU || ctx->state == STATE_TOOLBAR) &&
- !strcmp(element_name, "placeholder"))
- {
- if (ctx->state == STATE_MENU)
- ctx->current = get_child_node(self, ctx->current,
- node_name, strlen(node_name),
- EGG_MENU_MERGE_MENU_PLACEHOLDER,
- TRUE, top);
- else
- ctx->current = get_child_node(self, ctx->current,
- node_name, strlen(node_name),
- EGG_MENU_MERGE_TOOLBAR_PLACEHOLDER,
- TRUE, top);
-
- egg_menu_merge_node_prepend_ui_reference (NODE_INFO (ctx->current),
- ctx->merge_id, verb_quark);
- NODE_INFO(ctx->current)->dirty = TRUE;
-
- raise_error = FALSE;
- }
- break;
- case 's':
- if (ctx->state == STATE_MENU && !strcmp(element_name, "submenu"))
- {
- ctx->state = STATE_MENU;
- ctx->current = get_child_node(self, ctx->current,
- node_name, strlen(node_name),
- EGG_MENU_MERGE_MENU,
- TRUE, top);
- 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),
- ctx->merge_id, verb_quark);
- NODE_INFO(ctx->current)->dirty = TRUE;
-
- raise_error = FALSE;
- }
- else if ((ctx->state == STATE_MENU || ctx->state == STATE_TOOLBAR) &&
- !strcmp(element_name, "separator"))
- {
- GNode *node;
-
- if (ctx->state == STATE_MENU)
- ctx->state = STATE_MENUITEM;
- else
- ctx->state = STATE_TOOLITEM;
- node = get_child_node(self, ctx->current,
- node_name, strlen(node_name),
- EGG_MENU_MERGE_SEPARATOR,
- TRUE, top);
- if (NODE_INFO(node)->action_name == 0)
- NODE_INFO(node)->action_name = verb_quark;
-
- egg_menu_merge_node_prepend_ui_reference (NODE_INFO (node),
- ctx->merge_id, verb_quark);
- NODE_INFO(node)->dirty = TRUE;
-
- raise_error = FALSE;
- }
- break;
- case 't':
- if (ctx->state == STATE_TOOLBAR && !strcmp(element_name, "toolitem"))
- {
- GNode *node;
-
- ctx->state = STATE_TOOLITEM;
- node = get_child_node(self, ctx->current,
- node_name, strlen(node_name),
- EGG_MENU_MERGE_TOOLITEM,
- TRUE, top);
- if (NODE_INFO(node)->action_name == 0)
- NODE_INFO(node)->action_name = verb_quark;
-
- egg_menu_merge_node_prepend_ui_reference (NODE_INFO (node),
- ctx->merge_id, verb_quark);
- NODE_INFO(node)->dirty = TRUE;
-
- raise_error = FALSE;
- }
- break;
- default:
- break;
- }
- if (raise_error)
- {
- gint line_number, char_number;
-
- g_markup_parse_context_get_position (context,
- &line_number, &char_number);
- if (error_attr)
- g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
- _("Unknown attribute '%s' on line %d char %d"),
- error_attr,
- line_number, char_number);
- else
- g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_UNKNOWN_ELEMENT,
- _("Unknown tag '%s' on line %d char %d"),
- element_name,
- line_number, char_number);
- }
-}
-
-static void
-end_element_handler (GMarkupParseContext *context,
- const gchar *element_name,
- gpointer user_data,
- GError **error)
-{
- ParseContext *ctx = user_data;
- EggMenuMerge *self = ctx->self;
-
- //g_message("ending element %s (state=%d)", element_name, ctx->state);
-
- switch (ctx->state)
- {
- case STATE_START:
- g_warning("shouldn't get any end tags in start state");
- /* should we GError here? */
- break;
- case STATE_ROOT:
- if (ctx->current != self->root_node)
- g_warning("we are in STATE_ROOT, but the current node isn't the root");
- ctx->current = NULL;
- ctx->state = STATE_END;
- break;
- case STATE_MENU:
- ctx->current = ctx->current->parent;
- if (NODE_INFO(ctx->current)->type == EGG_MENU_MERGE_ROOT) /* menubar */
- ctx->state = STATE_ROOT;
- else if (NODE_INFO(ctx->current)->type == EGG_MENU_MERGE_POPUPS) /* popup */
- ctx->state = STATE_POPUPS;
- /* else, stay in STATE_MENU state */
- break;
- case STATE_TOOLBAR:
- ctx->current = ctx->current->parent;
- /* we conditionalise this test, in case we are closing off a
- * placeholder */
- if (NODE_INFO(ctx->current)->type == EGG_MENU_MERGE_ROOT)
- ctx->state = STATE_ROOT;
- /* else, stay in STATE_TOOLBAR state */
- break;
- case STATE_POPUPS:
- ctx->current = ctx->current->parent;
- ctx->state = STATE_ROOT;
- break;
- case STATE_MENUITEM:
- ctx->state = STATE_MENU;
- break;
- case STATE_TOOLITEM:
- ctx->state = STATE_TOOLBAR;
- break;
- case STATE_END:
- g_warning("shouldn't get any end tags at this point");
- /* should do an error here */
- break;
- }
-}
-
-static void
-cleanup (GMarkupParseContext *context,
- GError *error,
- gpointer user_data)
-{
- ParseContext *ctx = user_data;
- EggMenuMerge *self = ctx->self;
-
- ctx->current = NULL;
- /* should also walk through the tree and get rid of nodes related to
- * this UI file's tag */
-
- egg_menu_merge_remove_ui (self, ctx->merge_id);
-}
-
-static GMarkupParser ui_parser = {
- start_element_handler,
- end_element_handler,
- NULL,
- NULL,
- cleanup
-};
-
-guint
-egg_menu_merge_add_ui_from_string (EggMenuMerge *self,
- const gchar *buffer, size_t length,
- GError **error)
-{
- ParseContext ctx = { 0 };
- GMarkupParseContext *context;
- gboolean res = TRUE;
-
- g_return_val_if_fail(EGG_IS_MENU_MERGE(self), FALSE);
- g_return_val_if_fail(buffer != NULL, FALSE);
-
- ctx.state = STATE_START;
- ctx.self = self;
- ctx.current = NULL;
- ctx.merge_id = egg_menu_merge_next_merge_id (self);
-
- context = g_markup_parse_context_new(&ui_parser, 0, &ctx, NULL);
- if (length < 0)
- length = strlen(buffer);
-
- if (g_markup_parse_context_parse(context, buffer, length, error))
- {
- if (!g_markup_parse_context_end_parse(context, error))
- res = FALSE;
- }
- else
- res = FALSE;
-
- g_markup_parse_context_free (context);
-
- egg_menu_merge_queue_update(self);
-
- if (res)
- return ctx.merge_id;
- return 0;
-}
-
-guint
-egg_menu_merge_add_ui_from_file (EggMenuMerge *self,
- const gchar *filename,
- GError **error)
-{
- gchar *buffer;
- size_t length;
- guint res;
-
- if (!g_file_get_contents (filename, &buffer, &length, error))
- return 0;
-
- res = egg_menu_merge_add_ui_from_string(self, buffer, length, error);
- g_free(buffer);
-
- return res;
-}
-
-static gboolean
-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);
-
- return FALSE; /* continue */
-}
-
-void
-egg_menu_merge_remove_ui (EggMenuMerge *self, guint merge_id)
-{
- g_node_traverse(self->root_node, G_POST_ORDER, G_TRAVERSE_ALL, -1,
- remove_ui, GUINT_TO_POINTER (merge_id));
-
- egg_menu_merge_queue_update(self);
-}
-
-/* -------------------- Updates -------------------- */
-
-
-static EggAction *
-get_action_by_name (EggMenuMerge *merge, const char *action_name)
-{
- GList *tmp;
-
- if (!action_name)
- return NULL;
-
- /* lookup name */
- for (tmp = merge->action_groups; tmp != NULL; tmp = tmp->next)
- {
- EggActionGroup *action_group = tmp->data;
- EggAction *action;
-
- action = egg_action_group_get_action (action_group, action_name);
-
- if (action)
- return action;
- }
-
- return NULL;
-}
-
-static gboolean
-find_menu_position (GNode *node, GtkWidget **menushell_p, gint *pos_p)
-{
- GtkWidget *menushell;
- gint pos;
-
- g_return_val_if_fail(node != NULL, FALSE);
- g_return_val_if_fail(NODE_INFO(node)->type == EGG_MENU_MERGE_MENU ||
- NODE_INFO(node)->type == EGG_MENU_MERGE_MENU_PLACEHOLDER ||
- NODE_INFO(node)->type == EGG_MENU_MERGE_MENUITEM ||
- NODE_INFO(node)->type == EGG_MENU_MERGE_SEPARATOR,
- FALSE);
-
- /* first sibling -- look at parent */
- if (node->prev == NULL)
- {
- GNode *parent;
-
- parent = node->parent;
- switch (NODE_INFO(parent)->type)
- {
- case EGG_MENU_MERGE_MENUBAR:
- menushell = NODE_INFO(parent)->proxy;
- pos = 0;
- break;
- case EGG_MENU_MERGE_MENU:
- menushell = NODE_INFO(parent)->proxy;
- if (GTK_IS_MENU_ITEM(menushell))
- menushell = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menushell));
- pos = 0;
- break;
- case EGG_MENU_MERGE_MENU_PLACEHOLDER:
- menushell = gtk_widget_get_parent(NODE_INFO(parent)->proxy);
- g_return_val_if_fail(GTK_IS_MENU_SHELL(menushell), FALSE);
- pos = g_list_index(GTK_MENU_SHELL(menushell)->children,
- NODE_INFO(parent)->proxy) + 1;
- break;
- default:
- g_warning("%s: bad parent node type %d", G_STRLOC,
- NODE_INFO(parent)->type);
- return FALSE;
- }
- }
- else
- {
- GtkWidget *prev_child;
- GNode *sibling;
-
- sibling = node->prev;
- if (NODE_INFO(sibling)->type == EGG_MENU_MERGE_MENU_PLACEHOLDER)
- prev_child = NODE_INFO(sibling)->extra; /* second Separator */
- else
- prev_child = NODE_INFO(sibling)->proxy;
-
- g_return_val_if_fail(GTK_IS_WIDGET(prev_child), FALSE);
- menushell = gtk_widget_get_parent(prev_child);
- g_return_val_if_fail(GTK_IS_MENU_SHELL(menushell), FALSE);
-
- pos = g_list_index(GTK_MENU_SHELL(menushell)->children, prev_child) + 1;
- }
-
- if (menushell_p)
- *menushell_p = menushell;
- if (pos_p)
- *pos_p = pos;
-
- return TRUE;
-}
-
-static gboolean
-find_toolbar_position (GNode *node, GtkWidget **toolbar_p, gint *pos_p)
-{
- GtkWidget *toolbar;
- gint pos;
-
- g_return_val_if_fail(node != NULL, FALSE);
- g_return_val_if_fail(NODE_INFO(node)->type == EGG_MENU_MERGE_TOOLBAR ||
- NODE_INFO(node)->type == EGG_MENU_MERGE_TOOLBAR_PLACEHOLDER ||
- NODE_INFO(node)->type == EGG_MENU_MERGE_TOOLITEM ||
- NODE_INFO(node)->type == EGG_MENU_MERGE_SEPARATOR,
- FALSE);
-
- /* first sibling -- look at parent */
- if (node->prev == NULL)
- {
- GNode *parent;
-
- parent = node->parent;
- switch (NODE_INFO(parent)->type)
- {
- case EGG_MENU_MERGE_TOOLBAR:
- toolbar = NODE_INFO(parent)->proxy;
- pos = 0;
- break;
- case EGG_MENU_MERGE_TOOLBAR_PLACEHOLDER:
- toolbar = gtk_widget_get_parent(NODE_INFO(parent)->proxy);
- g_return_val_if_fail(EGG_IS_TOOLBAR(toolbar), FALSE);
- pos = egg_toolbar_get_item_index (EGG_TOOLBAR(toolbar),
- EGG_TOOL_ITEM (NODE_INFO(parent)->proxy)) + 1;
- break;
- default:
- g_warning("%s: bad parent node type %d", G_STRLOC,
- NODE_INFO(parent)->type);
- return FALSE;
- }
- }
- else
- {
- GtkWidget *prev_child;
- GNode *sibling;
-
- sibling = node->prev;
- if (NODE_INFO(sibling)->type == EGG_MENU_MERGE_TOOLBAR_PLACEHOLDER)
- prev_child = NODE_INFO(sibling)->extra; /* second Separator */
- else
- prev_child = NODE_INFO(sibling)->proxy;
-
- g_return_val_if_fail(GTK_IS_WIDGET(prev_child), FALSE);
- toolbar = gtk_widget_get_parent(prev_child);
- g_return_val_if_fail(EGG_IS_TOOLBAR(toolbar), FALSE);
-
- pos = egg_toolbar_get_item_index (EGG_TOOLBAR(toolbar),
- EGG_TOOL_ITEM (prev_child)) + 1;
- }
-
- if (toolbar_p)
- *toolbar_p = toolbar;
- if (pos_p)
- *pos_p = pos;
-
- return TRUE;
-}
-
-static void
-update_node (EggMenuMerge *self, GNode *node)
-{
- EggMenuMergeNode *info;
- GNode *child;
- EggAction *action;
-
- g_return_if_fail (node != NULL);
- g_return_if_fail (NODE_INFO(node) != NULL);
-
- info = NODE_INFO(node);
-
- if (NODE_INFO(node)->dirty)
- {
- const gchar *action_name;
- NodeUIReference *ref;
-
- if (info->uifiles == NULL) {
- /* We may need to remove this node.
- * This must be done in post order
- */
- goto recurse_children;
- }
-
- ref = info->uifiles->data;
- action_name = g_quark_to_string (ref->action_quark);
- action = get_action_by_name (self, action_name);
-
- NODE_INFO(node)->dirty = FALSE;
-
- /* Check if the node doesn't have an action and must have an action */
- if (action == NULL &&
- info->type != EGG_MENU_MERGE_MENUBAR &&
- info->type != EGG_MENU_MERGE_TOOLBAR &&
- info->type != EGG_MENU_MERGE_SEPARATOR &&
- info->type != EGG_MENU_MERGE_MENU_PLACEHOLDER &&
- info->type != EGG_MENU_MERGE_TOOLBAR_PLACEHOLDER)
- {
- /* FIXME: Should we warn here? */
- goto recurse_children;
- }
-
- /* If the widget already has a proxy and the action hasn't changed, then
- * we don't have to do anything.
- */
- if (info->proxy != NULL &&
- action == info->action)
- {
- goto recurse_children;
- }
-
- info->action = action;
-
- switch (info->type)
- {
- case EGG_MENU_MERGE_MENUBAR:
- if (info->proxy == NULL)
- {
- info->proxy = gtk_menu_bar_new ();
- gtk_widget_show (info->proxy);
- g_signal_emit (self, merge_signals[ADD_WIDGET], 0, info->proxy);
- }
- break;
- case EGG_MENU_MERGE_MENU:
- {
- GtkWidget *prev_submenu = NULL;
- /* remove the proxy if it is of the wrong type ... */
- if (info->proxy && G_OBJECT_TYPE(info->proxy) !=
- EGG_ACTION_GET_CLASS(info->action)->menu_item_type)
- {
- prev_submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(info->proxy));
- if (prev_submenu)
- {
- g_object_ref (prev_submenu);
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(info->proxy),NULL);
- }
- gtk_container_remove(GTK_CONTAINER(info->proxy->parent),
- info->proxy);
- info->proxy = NULL;
- }
- /* create proxy if needed ... */
- if (info->proxy == NULL)
- {
- GtkWidget *menushell;
- gint pos;
- GNode *parent;
-
- parent = node->parent;
-
- if (parent && NODE_INFO (parent)->type == EGG_MENU_MERGE_POPUPS)
- {
- info->proxy = gtk_menu_new();
- }
- else if (find_menu_position(node, &menushell, &pos))
- {
- GtkWidget *menu;
- info->proxy = egg_action_create_menu_item (info->action);
- menu = gtk_menu_new();
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(info->proxy), menu);
- gtk_menu_set_accel_group (GTK_MENU (menu), self->accel_group);
- gtk_menu_shell_insert (GTK_MENU_SHELL (menushell),
- info->proxy, pos);
- }
- }
- else
- {
- egg_action_connect_proxy (info->action, info->proxy);
- }
- if (prev_submenu)
- {
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy),
- prev_submenu);
- g_object_unref (prev_submenu);
- }
- }
- break;
- case EGG_MENU_MERGE_UNDECIDED:
- g_warning("found 'undecided node!");
- break;
- case EGG_MENU_MERGE_ROOT:
- break;
- case EGG_MENU_MERGE_TOOLBAR:
- if (info->proxy == NULL)
- {
- info->proxy = egg_toolbar_new ();
- gtk_widget_show (info->proxy);
- g_signal_emit (self, merge_signals[ADD_WIDGET], 0, info->proxy);
- }
- break;
- case EGG_MENU_MERGE_MENU_PLACEHOLDER:
- /* create menu items for placeholders if necessary ... */
- if (!GTK_IS_SEPARATOR_MENU_ITEM (info->proxy) ||
- !GTK_IS_SEPARATOR_MENU_ITEM (info->extra))
- {
- if (info->proxy)
- gtk_container_remove(GTK_CONTAINER(info->proxy->parent),
- info->proxy);
- if (info->extra)
- gtk_container_remove(GTK_CONTAINER(info->extra->parent),
- info->extra);
- info->proxy = NULL;
- info->extra = NULL;
- }
- if (info->proxy == NULL)
- {
- GtkWidget *menushell;
- gint pos;
-
- if (find_menu_position(node, &menushell, &pos))
- {
- NODE_INFO(node)->proxy = gtk_separator_menu_item_new();
- gtk_menu_shell_insert(GTK_MENU_SHELL(menushell),
- NODE_INFO(node)->proxy, pos);
- //gtk_widget_show(NODE_INFO(node)->proxy);
-
- NODE_INFO(node)->extra = gtk_separator_menu_item_new();
- gtk_menu_shell_insert(GTK_MENU_SHELL(menushell),
- NODE_INFO(node)->extra, pos+1);
- //gtk_widget_show(NODE_INFO(node)->extra);
- }
- }
- break;
- case EGG_MENU_MERGE_TOOLBAR_PLACEHOLDER:
- /* create toolbar items for placeholders if necessary ... */
- if (!EGG_IS_SEPARATOR_TOOL_ITEM (info->proxy) ||
- !EGG_IS_SEPARATOR_TOOL_ITEM (info->extra))
- {
- if (info->proxy)
- gtk_container_remove(GTK_CONTAINER(info->proxy->parent),
- info->proxy);
- if (info->extra)
- gtk_container_remove(GTK_CONTAINER(info->extra->parent),
- info->extra);
- info->proxy = NULL;
- info->extra = NULL;
- }
- if (info->proxy == NULL)
- {
- GtkWidget *toolbar;
- gint pos;
-
- if (find_toolbar_position(node, &toolbar, &pos))
- {
- EggToolItem *item;
-
- item = egg_separator_tool_item_new();
- egg_toolbar_insert(EGG_TOOLBAR(toolbar), item, pos);
- NODE_INFO(node)->proxy = GTK_WIDGET (item);
- //gtk_widget_show(NODE_INFO(node)->proxy);
-
- item = egg_separator_tool_item_new();
- egg_toolbar_insert(EGG_TOOLBAR(toolbar), item, pos+1);
- NODE_INFO(node)->extra = GTK_WIDGET (item);
- //gtk_widget_show(NODE_INFO(node)->extra);
- }
- }
- break;
- case EGG_MENU_MERGE_POPUPS:
- break;
- case EGG_MENU_MERGE_MENUITEM:
- /* remove the proxy if it is of the wrong type ... */
- if (info->proxy && G_OBJECT_TYPE(info->proxy) !=
- EGG_ACTION_GET_CLASS(info->action)->menu_item_type)
- {
- gtk_container_remove(GTK_CONTAINER(info->proxy->parent),
- info->proxy);
- info->proxy = NULL;
- }
- /* create proxy if needed ... */
- if (info->proxy == NULL)
- {
- GtkWidget *menushell;
- gint pos;
-
- if (find_menu_position(node, &menushell, &pos))
- {
- info->proxy = egg_action_create_menu_item (info->action);
-
- gtk_menu_shell_insert (GTK_MENU_SHELL (menushell),
- info->proxy, pos);
- }
- }
- else
- {
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(info->proxy), NULL);
- egg_action_connect_proxy (info->action, info->proxy);
- }
- break;
- case EGG_MENU_MERGE_TOOLITEM:
- /* remove the proxy if it is of the wrong type ... */
- if (info->proxy && G_OBJECT_TYPE(info->proxy) !=
- EGG_ACTION_GET_CLASS(info->action)->toolbar_item_type)
- {
- gtk_container_remove(GTK_CONTAINER(info->proxy->parent),
- info->proxy);
- info->proxy = NULL;
- }
- /* create proxy if needed ... */
- if (info->proxy == NULL)
- {
- GtkWidget *toolbar;
- gint pos;
-
- if (find_toolbar_position(node, &toolbar, &pos))
- {
- info->proxy = egg_action_create_tool_item (info->action);
-
- egg_toolbar_insert (EGG_TOOLBAR (toolbar),
- EGG_TOOL_ITEM (info->proxy), pos);
- }
- }
- else
- {
- egg_action_connect_proxy (info->action, info->proxy);
- }
- break;
- case EGG_MENU_MERGE_SEPARATOR:
- if (NODE_INFO (node->parent)->type == EGG_MENU_MERGE_TOOLBAR ||
- NODE_INFO (node->parent)->type == EGG_MENU_MERGE_TOOLBAR_PLACEHOLDER)
- {
- GtkWidget *toolbar;
- gint pos;
-
- if (EGG_IS_SEPARATOR_TOOL_ITEM(info->proxy))
- {
- gtk_container_remove(GTK_CONTAINER(info->proxy->parent),
- info->proxy);
- info->proxy = NULL;
- }
-
- if (find_toolbar_position(node, &toolbar, &pos))
- {
- EggToolItem *item = egg_separator_tool_item_new();
- egg_toolbar_insert (EGG_TOOLBAR (toolbar), item, pos);
- info->proxy = GTK_WIDGET (item);
- gtk_widget_show(info->proxy);
- }
- }
- else
- {
- GtkWidget *menushell;
- gint pos;
-
- if (GTK_IS_SEPARATOR_MENU_ITEM(info->proxy))
- {
- gtk_container_remove(GTK_CONTAINER(info->proxy->parent),
- info->proxy);
- info->proxy = NULL;
- }
-
- if (find_menu_position(node, &menushell, &pos))
- {
- info->proxy = gtk_separator_menu_item_new();
- gtk_menu_shell_insert (GTK_MENU_SHELL (menushell),
- info->proxy, pos);
- gtk_widget_show(info->proxy);
- }
- }
- break;
- }
-
- /* if this node has a widget, but it is the wrong type, remove it */
- }
-
- recurse_children:
- /* process children */
- child = node->children;
- while (child)
- {
- GNode *current;
-
- current = child;
- child = current->next;
- update_node (self, current);
- }
-
- /* handle cleanup of dead nodes */
- if (node->children == NULL && NODE_INFO(node)->uifiles == NULL)
- {
- if (NODE_INFO(node)->proxy)
- gtk_widget_destroy(NODE_INFO(node)->proxy);
- if ((NODE_INFO(node)->type == EGG_MENU_MERGE_MENU_PLACEHOLDER ||
- NODE_INFO(node)->type == EGG_MENU_MERGE_TOOLBAR_PLACEHOLDER) &&
- NODE_INFO(node)->extra)
- gtk_widget_destroy(NODE_INFO(node)->extra);
- g_free (NODE_INFO(node)->name);
- g_chunk_free(NODE_INFO(node), merge_node_chunk);
- g_node_destroy(node);
- }
-}
-
-static gboolean
-do_updates(EggMenuMerge *self)
-{
- /* this function needs to check through the tree for dirty nodes.
- * For such nodes, it needs to do the following:
- *
- * 1) check if they are referenced by any loaded UI files anymore.
- * In which case, the proxy widget should be destroyed, unless
- * there are any subnodes.
- *
- * 2) lookup the action for this node again. If it is different to
- * the current one (or if no previous action has been looked up),
- * the proxy is reconnected to the new action (or a new proxy widget
- * is created and added to the parent container).
- */
-
- update_node (self, self->root_node);
-
- self->update_tag = 0;
- return FALSE;
-}
-
-static void
-egg_menu_merge_queue_update (EggMenuMerge *self)
-{
- if (self->update_tag != 0)
- return;
-
- self->update_tag = g_idle_add((GSourceFunc)do_updates, self);
-}
-
-void
-egg_menu_merge_ensure_update (EggMenuMerge *self)
-{
- if (self->update_tag != 0)
- {
- g_source_remove(self->update_tag);
- do_updates(self);
- }
-}
-
-static gboolean
-dirty_traverse_func (GNode *node, gpointer data)
-{
- NODE_INFO(node)->dirty = TRUE;
- return FALSE;
-}
-
-static void
-egg_menu_merge_dirty_all (EggMenuMerge *self)
-{
- g_node_traverse(self->root_node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
- dirty_traverse_func, NULL);
- egg_menu_merge_queue_update(self);
-}
diff --git a/lib/egg/egg-menu-merge.h b/lib/egg/egg-menu-merge.h
deleted file mode 100644
index 6607b0ff3..000000000
--- a/lib/egg/egg-menu-merge.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef EGG_MENU_MERGE_H
-#define EGG_MENU_MERGE_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <egg-action.h>
-#include <egg-action-group.h>
-
-#define EGG_TYPE_MENU_MERGE (egg_menu_merge_get_type ())
-#define EGG_MENU_MERGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_MENU_MERGE, EggMenuMerge))
-#define EGG_MENU_MERGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_MENU_MERGE, EggMenuMergeClass))
-#define EGG_IS_MENU_MERGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_MENU_MERGE))
-#define EGG_IS_MENU_MERGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EGG_TYPE_MENU_MERGE))
-#define EGG_MENU_MERGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EGG_TYPE_MENU_MERGE, EggMenuMergeClass))
-
-typedef struct _EggMenuMerge EggMenuMerge;
-typedef struct _EggMenuMergeClass EggMenuMergeClass;
-typedef struct _EggMenuMergeNode EggMenuMergeNode;
-
-typedef enum {
- EGG_MENU_MERGE_UNDECIDED,
- EGG_MENU_MERGE_ROOT,
- EGG_MENU_MERGE_MENUBAR,
- EGG_MENU_MERGE_MENU,
- EGG_MENU_MERGE_TOOLBAR,
- EGG_MENU_MERGE_MENU_PLACEHOLDER,
- EGG_MENU_MERGE_TOOLBAR_PLACEHOLDER,
- EGG_MENU_MERGE_POPUPS,
- EGG_MENU_MERGE_MENUITEM,
- EGG_MENU_MERGE_TOOLITEM,
- EGG_MENU_MERGE_SEPARATOR,
-} EggMenuMergeNodeType;
-
-struct _EggMenuMerge {
- GObject parent;
-
- GtkAccelGroup *accel_group;
-
- GNode *root_node;
- GList *action_groups;
-
- guint last_merge_id;
-
- guint update_tag;
-};
-
-struct _EggMenuMergeClass {
- GObjectClass parent_class;
-
- void (* add_widget) (EggMenuMerge *merge, GtkWidget *widget);
- void (* remove_widget) (EggMenuMerge *merge, GtkWidget *widget);
-};
-
-struct _EggMenuMergeNode {
- EggMenuMergeNodeType type;
-
- gchar *name;
-
- GQuark action_name;
- EggAction *action;
- GtkWidget *proxy;
- GtkWidget *extra; /*GtkMenu for submenus, second separator for placeholders*/
-
- GList *uifiles;
-
- guint dirty : 1;
-};
-
-GType egg_menu_merge_get_type (void);
-EggMenuMerge *egg_menu_merge_new (void);
-
-/* these two functions will dirty all merge nodes, as they may need to
- * be connected up to different actions */
-void egg_menu_merge_insert_action_group (EggMenuMerge *self,
- EggActionGroup *action_group,
- gint pos);
-void egg_menu_merge_remove_action_group (EggMenuMerge *self,
- EggActionGroup*action_group);
-
-
-GtkWidget *egg_menu_merge_get_widget (EggMenuMerge *self,
- const gchar *path);
-
-/* these two functions are for adding UI elements to the merged user
- * interface */
-guint egg_menu_merge_add_ui_from_string (EggMenuMerge *self,
- const gchar *buffer,
- size_t length,
- GError **error);
-guint egg_menu_merge_add_ui_from_file (EggMenuMerge *self,
- const gchar *filename,
- GError **error);
-void egg_menu_merge_remove_ui (EggMenuMerge *self,
- guint merge_id);
-
-void egg_menu_merge_ensure_update (EggMenuMerge *self);
-
-
-#endif /* EGG_MENU_MERGE_H */
diff --git a/lib/egg/egg-menu.h b/lib/egg/egg-menu.h
deleted file mode 100644
index ed6727944..000000000
--- a/lib/egg/egg-menu.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef EGG_MENU_H
-#define EGG_MENU_H
-
-#include <libegg/menu/egg-action.h>
-#include <libegg/menu/egg-toggle-action.h>
-#include <libegg/menu/egg-radio-action.h>
-#include <libegg/menu/egg-action-group.h>
-
-#include <libegg/menu/egg-menu-merge.h>
-
-#endif
diff --git a/lib/egg/egg-radio-action.c b/lib/egg/egg-radio-action.c
deleted file mode 100644
index 66dd9530b..000000000
--- a/lib/egg/egg-radio-action.c
+++ /dev/null
@@ -1,198 +0,0 @@
-#include "egg-radio-action.h"
-#include "eggradiotoolbutton.h"
-
-static void egg_radio_action_init (EggRadioAction *action);
-static void egg_radio_action_class_init (EggRadioActionClass *class);
-
-GType
-egg_radio_action_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GTypeInfo type_info =
- {
- sizeof (EggRadioActionClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) egg_radio_action_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
-
- sizeof (EggRadioAction),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_radio_action_init,
- };
-
- type = g_type_register_static (EGG_TYPE_TOGGLE_ACTION,
- "EggRadioAction",
- &type_info, 0);
- }
- return type;
-}
-
-static void egg_radio_action_finalize (GObject *object);
-static void egg_radio_action_activate (EggAction *action);
-
-static GObjectClass *parent_class = NULL;
-
-static void
-egg_radio_action_class_init (EggRadioActionClass *class)
-{
- GObjectClass *object_class;
- EggActionClass *action_class;
-
- parent_class = g_type_class_peek_parent (class);
- object_class = G_OBJECT_CLASS (class);
- action_class = EGG_ACTION_CLASS (class);
-
- action_class->menu_item_type = GTK_TYPE_RADIO_MENU_ITEM;
- action_class->toolbar_item_type = EGG_TYPE_RADIO_TOOL_BUTTON;
-
- object_class->finalize = egg_radio_action_finalize;
-
- action_class->activate = egg_radio_action_activate;
-}
-
-static void
-egg_radio_action_init (EggRadioAction *action)
-{
- action->group = g_slist_prepend (NULL, action);
-}
-
-static void
-egg_radio_action_finalize (GObject *object)
-{
- EggRadioAction *action;
- GSList *tmp_list;
-
- g_return_if_fail (EGG_IS_RADIO_ACTION (object));
-
- action = EGG_RADIO_ACTION (object);
-
- action->group = g_slist_remove (action->group, action);
-
- tmp_list = action->group;
-
- while (tmp_list)
- {
- EggRadioAction *tmp_action = tmp_list->data;
-
- tmp_list = tmp_list->next;
- tmp_action->group = action->group;
- }
-
- if (parent_class->finalize)
- (* parent_class->finalize) (object);
-}
-
-static void
-egg_radio_action_activate (EggAction *action)
-{
- EggRadioAction *radio_action;
- EggToggleAction *toggle_action;
- EggToggleAction *tmp_action;
- GSList *tmp_list;
-
- g_return_if_fail (EGG_IS_RADIO_ACTION (action));
-
- radio_action = EGG_RADIO_ACTION (action);
- toggle_action = EGG_TOGGLE_ACTION (action);
-
- if (toggle_action->active)
- {
- tmp_list = radio_action->group;
-
- while (tmp_list)
- {
- tmp_action = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (tmp_action->active && (tmp_action != toggle_action))
- {
- toggle_action->active = !toggle_action->active;
- break;
- }
- }
- }
- else
- {
- toggle_action->active = !toggle_action->active;
-
- tmp_list = radio_action->group;
- while (tmp_list)
- {
- tmp_action = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (tmp_action->active && (tmp_action != toggle_action))
- {
- egg_action_activate (EGG_ACTION (tmp_action));
- break;
- }
- }
- }
-
- egg_toggle_action_toggled (toggle_action);
-}
-
-/**
- * egg_radio_action_get_group:
- * @action: the action object
- *
- * Returns: the list representing the radio group for this object
- */
-GSList *
-egg_radio_action_get_group (EggRadioAction *action)
-{
- g_return_val_if_fail (EGG_IS_RADIO_ACTION (action), NULL);
-
- return action->group;
-}
-
-/**
- * egg_radio_action_set_group:
- * @action: the action object
- * @group: a list representing a radio group
- *
- * Sets the radio group for the radio action object.
- */
-void
-egg_radio_action_set_group (EggRadioAction *action, GSList *group)
-{
- g_return_if_fail (EGG_IS_RADIO_ACTION (action));
- g_return_if_fail (!g_slist_find (group, action));
-
- if (action->group)
- {
- GSList *slist;
-
- action->group = g_slist_remove (action->group, action);
-
- for (slist = action->group; slist; slist = slist->next)
- {
- EggRadioAction *tmp_action = slist->data;
-
- tmp_action->group = action->group;
- }
- }
-
- action->group = g_slist_prepend (group, action);
-
- if (group)
- {
- GSList *slist;
-
- for (slist = action->group; slist; slist = slist->next)
- {
- EggRadioAction *tmp_action = slist->data;
-
- tmp_action->group = action->group;
- }
- }
- else
- {
- EGG_TOGGLE_ACTION (action)->active = TRUE;
- }
-}
diff --git a/lib/egg/egg-toggle-action.c b/lib/egg/egg-toggle-action.c
deleted file mode 100644
index 6c0c0b442..000000000
--- a/lib/egg/egg-toggle-action.c
+++ /dev/null
@@ -1,197 +0,0 @@
-#include "egg-toggle-action.h"
-#include "eggtoggletoolbutton.h"
-
-enum {
- TOGGLED,
- LAST_SIGNAL
-};
-
-static void egg_toggle_action_init (EggToggleAction *action);
-static void egg_toggle_action_class_init (EggToggleActionClass *class);
-
-GType
-egg_toggle_action_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GTypeInfo type_info =
- {
- sizeof (EggToggleActionClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) egg_toggle_action_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
-
- sizeof (EggToggleAction),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_toggle_action_init,
- };
-
- type = g_type_register_static (EGG_TYPE_ACTION,
- "EggToggleAction",
- &type_info, 0);
- }
- return type;
-}
-
-static void egg_toggle_action_activate (EggAction *action);
-static void egg_toggle_action_real_toggled (EggToggleAction *action);
-static void connect_proxy (EggAction *action,
- GtkWidget *proxy);
-static void disconnect_proxy (EggAction *action,
- GtkWidget *proxy);
-
-static GObjectClass *parent_class = NULL;
-static guint action_signals[LAST_SIGNAL] = { 0 };
-
-static void
-egg_toggle_action_class_init (EggToggleActionClass *class)
-{
- EggActionClass *action_class;
-
- parent_class = g_type_class_peek_parent (class);
- action_class = EGG_ACTION_CLASS (class);
-
- action_class->activate = egg_toggle_action_activate;
- action_class->connect_proxy = connect_proxy;
- action_class->disconnect_proxy = disconnect_proxy;
-
- action_class->menu_item_type = GTK_TYPE_CHECK_MENU_ITEM;
- action_class->toolbar_item_type = EGG_TYPE_TOGGLE_TOOL_BUTTON;
-
- class->toggled = egg_toggle_action_real_toggled;
-
- action_signals[TOGGLED] =
- g_signal_new ("toggled",
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EggToggleActionClass, toggled),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-static void
-egg_toggle_action_init (EggToggleAction *action)
-{
- action->active = FALSE;
-}
-
-static void
-egg_toggle_action_activate (EggAction *action)
-{
- EggToggleAction *toggle_action;
-
- g_return_if_fail (EGG_IS_TOGGLE_ACTION (action));
-
- toggle_action = EGG_TOGGLE_ACTION (action);
-
- toggle_action->active = !toggle_action->active;
-
- egg_toggle_action_toggled (toggle_action);
-}
-
-static void
-egg_toggle_action_real_toggled (EggToggleAction *action)
-{
- GSList *slist;
-
- g_return_if_fail (EGG_IS_TOGGLE_ACTION (action));
-
- for (slist = EGG_ACTION (action)->proxies; slist; slist = slist->next)
- {
- GtkWidget *proxy = slist->data;
-
- egg_action_block_activate_from (EGG_ACTION (action), proxy);
- if (GTK_IS_CHECK_MENU_ITEM (proxy))
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (proxy),
- action->active);
- else if (EGG_IS_TOGGLE_TOOL_BUTTON (proxy))
- egg_toggle_tool_button_set_active (EGG_TOGGLE_TOOL_BUTTON (proxy),
- action->active);
- else {
- g_warning ("Don't know how to toggle `%s' widgets",
- G_OBJECT_TYPE_NAME (proxy));
- }
- egg_action_unblock_activate_from (EGG_ACTION (action), proxy);
- }
-}
-
-static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
-{
- EggToggleAction *toggle_action;
-
- toggle_action = EGG_TOGGLE_ACTION (action);
-
- /* do this before hand, so that we don't call the "activate" handler */
- if (GTK_IS_MENU_ITEM (proxy))
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (proxy),
- toggle_action->active);
- else if (EGG_IS_TOGGLE_TOOL_BUTTON (proxy))
- egg_toggle_tool_button_set_active (EGG_TOGGLE_TOOL_BUTTON (proxy),
- toggle_action->active);
-
- (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
-}
-
-static void
-disconnect_proxy (EggAction *action, GtkWidget *proxy)
-{
- EggToggleAction *toggle_action;
-
- toggle_action = EGG_TOGGLE_ACTION (action);
-
- (* EGG_ACTION_CLASS (parent_class)->disconnect_proxy) (action, proxy);
-}
-
-/**
- * egg_toggle_action_toggled:
- * @action: the action object
- *
- * Emits the "toggled" signal on the toggle action.
- */
-void
-egg_toggle_action_toggled (EggToggleAction *action)
-{
- g_return_if_fail (EGG_IS_TOGGLE_ACTION (action));
-
- g_signal_emit (action, action_signals[TOGGLED], 0);
-}
-
-/**
- * egg_toggle_action_set_active:
- * @action: the action object
- * @is_active: whether the action should be checked or not
- *
- * Sets the checked state on the toggle action.
- */
-void
-egg_toggle_action_set_active (EggToggleAction *action, gboolean is_active)
-{
- g_return_if_fail (EGG_IS_TOGGLE_ACTION (action));
-
- is_active = is_active != 0;
-
- if (action->active != is_active)
- {
- egg_action_activate (EGG_ACTION (action));
- }
-}
-
-/**
- * egg_toggle_action_get_active:
- * @action: the action object
- *
- * Returns: the checked state of the toggle action
- */
-gboolean
-egg_toggle_action_get_active (EggToggleAction *action)
-{
- g_return_val_if_fail (EGG_IS_TOGGLE_ACTION (action), FALSE);
-
- return action->active;
-}
diff --git a/lib/egg/egg-toggle-action.h b/lib/egg/egg-toggle-action.h
deleted file mode 100644
index 4a5293bfe..000000000
--- a/lib/egg/egg-toggle-action.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef EGG_TOGGLE_ACTION_H
-#define EGG_TOGGLE_ACTION_H
-
-#include <gtk/gtk.h>
-#include <egg-action.h>
-
-#define EGG_TYPE_TOGGLE_ACTION (egg_toggle_action_get_type ())
-#define EGG_TOGGLE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TOGGLE_ACTION, EggToggleAction))
-#define EGG_TOGGLE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TOGGLE_ACTION, EggToggleActionClass))
-#define EGG_IS_TOGGLE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TOGGLE_ACTION))
-#define EGG_IS_TOGGLE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EGG_TYPE_TOGGLE_ACTION))
-#define EGG_TOGGLE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EGG_TYPE_TOGGLE_ACTION, EggToggleActionClass))
-
-typedef struct _EggToggleAction EggToggleAction;
-typedef struct _EggToggleActionClass EggToggleActionClass;
-
-struct _EggToggleAction
-{
- EggAction parent;
-
- guint active : 1;
-};
-
-struct _EggToggleActionClass
-{
- EggActionClass parent_class;
-
- void (* toggled) (EggToggleAction *action);
-};
-
-GType egg_toggle_action_get_type (void);
-
-void egg_toggle_action_toggled (EggToggleAction *action);
-void egg_toggle_action_set_active (EggToggleAction *action,
- gboolean is_active);
-gboolean egg_toggle_action_get_active (EggToggleAction *action);
-
-#endif
diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c
index 2813d992b..7cf431350 100755
--- a/lib/egg/egg-toolbar-editor.c
+++ b/lib/egg/egg-toolbar-editor.c
@@ -22,6 +22,14 @@
#include <string.h>
#include <libxml/tree.h>
+#include <gtk/gtkimage.h>
+#include <gtk/gtkeventbox.h>
+#include <gtk/gtkdnd.h>
+#include <gtk/gtkscrolledwindow.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtktable.h>
+#include <gtk/gtkstock.h>
+#include <gtk/gtkhbox.h>
static GtkTargetEntry dest_drag_types[] = {
{EGG_TOOLBAR_ITEM_TYPE, 0, 0},
@@ -49,7 +57,7 @@ static GObjectClass *parent_class = NULL;
struct EggToolbarEditorPrivate
{
- EggMenuMerge *merge;
+ GtkUIManager *merge;
EggToolbarsModel *model;
GtkWidget *table;
@@ -86,21 +94,23 @@ egg_toolbar_editor_get_type (void)
return egg_toolbar_editor_type;
}
-static EggAction *
+static GtkAction *
find_action (EggToolbarEditor *t,
const char *name)
{
- GList *l = t->priv->merge->action_groups;
- EggAction *action = NULL;
+ GList *l;
+ GtkAction *action = NULL;
+
+ l = gtk_ui_manager_get_action_groups (t->priv->merge);
g_return_val_if_fail (IS_EGG_TOOLBAR_EDITOR (t), NULL);
g_return_val_if_fail (name != NULL, NULL);
for (; l != NULL; l = l->next)
{
- EggAction *tmp;
+ GtkAction *tmp;
- tmp = egg_action_group_get_action (EGG_ACTION_GROUP (l->data), name);
+ tmp = gtk_action_group_get_action (GTK_ACTION_GROUP (l->data), name);
if (tmp)
action = tmp;
}
@@ -110,9 +120,9 @@ find_action (EggToolbarEditor *t,
static void
egg_toolbar_editor_set_merge (EggToolbarEditor *t,
- EggMenuMerge *merge)
+ GtkUIManager *merge)
{
- g_return_if_fail (EGG_IS_MENU_MERGE (merge));
+ g_return_if_fail (GTK_IS_UI_MANAGER (merge));
g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (t));
t->priv->merge = merge;
@@ -181,7 +191,7 @@ egg_toolbar_editor_class_init (EggToolbarEditorClass *klass)
g_param_spec_object ("MenuMerge",
"MenuMerge",
"Menu merge",
- EGG_TYPE_MENU_MERGE,
+ GTK_TYPE_UI_MANAGER,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_TOOLBARS_MODEL,
@@ -206,7 +216,7 @@ egg_toolbar_editor_finalize (GObject *object)
}
GtkWidget *
-egg_toolbar_editor_new (EggMenuMerge *merge,
+egg_toolbar_editor_new (GtkUIManager *merge,
EggToolbarsModel *model)
{
EggToolbarEditor *t;
@@ -231,7 +241,7 @@ editor_drag_data_received_cb (GtkWidget *widget,
guint time_,
EggToolbarEditor *editor)
{
- EggAction *action;
+ GtkAction *action;
g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (editor));
g_return_if_fail (selection_data != NULL);
@@ -253,10 +263,10 @@ editor_drag_data_delete_cb (GtkWidget *widget,
GdkDragContext *context,
EggToolbarEditor *editor)
{
- EggAction *action;
+ GtkAction *action;
g_return_if_fail (IS_EGG_TOOLBAR_EDITOR (editor));
- action = EGG_ACTION (g_object_get_data (G_OBJECT (widget), "egg-action"));
+ action = GTK_ACTION (g_object_get_data (G_OBJECT (widget), "egg-action"));
if (action)
{
editor->priv->actions_list = g_list_remove
@@ -274,14 +284,14 @@ drag_data_get_cb (GtkWidget *widget,
guint32 time,
EggToolbarEditor *editor)
{
- EggAction *action;
+ GtkAction *action;
const char *target;
- action = EGG_ACTION (g_object_get_data (G_OBJECT (widget), "egg-action"));
+ action = GTK_ACTION (g_object_get_data (G_OBJECT (widget), "egg-action"));
if (action)
{
- target = action->name;
+ target = gtk_action_get_name (action);
}
else
{
@@ -405,12 +415,24 @@ update_editor_sheet (EggToolbarEditor *editor)
for (l = to_drag; l != NULL; l = l->next)
{
- EggAction *action = (l->data);
+ GtkAction *action = (l->data);
+ const char *stock_id, *short_label;
+ GValue value = { 0, };
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (G_OBJECT (action), "stock_id", &value);
+ stock_id = g_value_get_string (&value);
icon = gtk_image_new_from_stock
- (action->stock_id ? action->stock_id : GTK_STOCK_DND,
+ (stock_id ? stock_id : GTK_STOCK_DND,
GTK_ICON_SIZE_LARGE_TOOLBAR);
+ g_value_unset (&value);
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (G_OBJECT (action), "short_label", &value);
+ short_label = g_value_get_string (&value);
item = editor_create_item (editor, GTK_IMAGE (icon),
- action->short_label, GDK_ACTION_MOVE);
+ short_label, GDK_ACTION_MOVE);
+ g_value_unset (&value);
g_object_set_data (G_OBJECT (item), "egg-action", action);
gtk_table_attach_defaults (GTK_TABLE (editor->priv->table),
item, x, x + 1, y, y + 1);
@@ -477,7 +499,7 @@ static void
egg_toolbar_editor_add_action (EggToolbarEditor *editor,
const char *action_name)
{
- EggAction *action;
+ GtkAction *action;
action = find_action (editor, action_name);
g_return_if_fail (action != NULL);
@@ -505,7 +527,7 @@ parse_item_list (EggToolbarEditor *t,
}
static gboolean
-model_has_action (EggToolbarsModel *model, EggAction *action)
+model_has_action (EggToolbarsModel *model, GtkAction *action)
{
int i, l, n_items, n_toolbars;
@@ -516,10 +538,12 @@ model_has_action (EggToolbarsModel *model, EggAction *action)
for (l = 0; l < n_items; l++)
{
const char *name;
+ const char *action_name;
gboolean sep;
name = egg_toolbars_model_item_nth (model, i, l, &sep);
- if (!sep && strcmp (name, action->name) == 0) return TRUE;
+ action_name = gtk_action_get_name (action);
+ if (!sep && strcmp (name, action_name) == 0) return TRUE;
}
}
@@ -554,7 +578,7 @@ egg_toolbar_editor_load_actions (EggToolbarEditor *editor,
editor->priv->actions_list = g_list_copy (editor->priv->default_actions_list);
for (l = editor->priv->default_actions_list; l != NULL; l = l->next)
{
- EggAction *action = EGG_ACTION (l->data);
+ GtkAction *action = GTK_ACTION (l->data);
if (model_has_action (editor->priv->model, action))
{
diff --git a/lib/egg/egg-toolbar-editor.h b/lib/egg/egg-toolbar-editor.h
index b351fcb89..72f58f449 100755
--- a/lib/egg/egg-toolbar-editor.h
+++ b/lib/egg/egg-toolbar-editor.h
@@ -20,8 +20,8 @@
#define EGG_TOOLBAR_EDITOR_H
#include <gtk/gtkvbox.h>
+#include <gtk/gtkuimanager.h>
-#include "egg-menu-merge.h"
#include "egg-toolbars-model.h"
G_BEGIN_DECLS
@@ -52,7 +52,7 @@ struct EggToolbarEditorClass
GType egg_toolbar_editor_get_type (void);
-GtkWidget *egg_toolbar_editor_new (EggMenuMerge *merge,
+GtkWidget *egg_toolbar_editor_new (GtkUIManager *merge,
EggToolbarsModel *model);
void egg_toolbar_editor_load_actions (EggToolbarEditor *editor,
const char *xml_file);
diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c
index 60423b8b7..85ed145ab 100755
--- a/lib/egg/egg-toolbars-model.c
+++ b/lib/egg/egg-toolbars-model.c
@@ -135,7 +135,7 @@ egg_toolbars_model_to_xml (EggToolbarsModel *t)
return doc;
}
-gboolean
+static gboolean
safe_save_xml (const char *xml_file, xmlDocPtr doc)
{
char *tmp_file;
@@ -314,7 +314,7 @@ egg_toolbars_model_add_separator (EggToolbarsModel *t,
toolbar_position, real_position);
}
-gboolean
+static gboolean
impl_add_item (EggToolbarsModel *t,
int toolbar_position,
int position,
@@ -441,7 +441,7 @@ egg_toolbars_model_load (EggToolbarsModel *t,
xmlFreeDoc (doc);
}
-char *
+static char *
impl_get_item_id (EggToolbarsModel *t,
const char *type,
const char *name)
@@ -454,7 +454,7 @@ impl_get_item_id (EggToolbarsModel *t,
return NULL;
}
-char *
+static char *
impl_get_item_name (EggToolbarsModel *t,
const char *type,
const char *id)
@@ -467,7 +467,7 @@ impl_get_item_name (EggToolbarsModel *t,
return NULL;
}
-char *
+static char *
impl_get_item_type (EggToolbarsModel *t,
GdkAtom type)
{
diff --git a/lib/egg/eggmarshalers.c b/lib/egg/eggmarshalers.c
index 347cbfc5e..02862ec00 100644
--- a/lib/egg/eggmarshalers.c
+++ b/lib/egg/eggmarshalers.c
@@ -1,4 +1,4 @@
-
+#include "eggmarshalers.h"
#include <glib-object.h>
diff --git a/lib/egg/eggradiotoolbutton.c b/lib/egg/eggradiotoolbutton.c
deleted file mode 100644
index ac1397338..000000000
--- a/lib/egg/eggradiotoolbutton.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* eggradiotoolbutton.c
- *
- * Copyright (C) 2002 Anders Carlsson <andersca@codefactory.se>
- * Copyright (C) 2002 James Henstridge <james@daa.com.au>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "eggradiotoolbutton.h"
-#include <gtk/gtkradiobutton.h>
-
-#ifndef _
-# define _(s) (s)
-#endif
-
-static void egg_radio_tool_button_init (EggRadioToolButton *button);
-static void egg_radio_tool_button_class_init (EggRadioToolButtonClass *klass);
-
-GType
-egg_radio_tool_button_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- static const GTypeInfo type_info =
- {
- sizeof (EggRadioToolButtonClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) egg_radio_tool_button_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
- sizeof (EggRadioToolButton),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_radio_tool_button_init
- };
-
- type = g_type_register_static (EGG_TYPE_TOGGLE_TOOL_BUTTON,
- "EggRadioToolButton", &type_info, 0);
- }
- return type;
-}
-
-
-static void
-egg_radio_tool_button_class_init (EggRadioToolButtonClass *klass)
-{
- EggToolButtonClass *toolbutton_class;
-
- toolbutton_class = (EggToolButtonClass *)klass;
-
- toolbutton_class->button_type = GTK_TYPE_RADIO_BUTTON;
-}
-
-static void
-egg_radio_tool_button_init (EggRadioToolButton *button)
-{
- gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (EGG_TOOL_BUTTON (button)->button), FALSE);
-}
-
-EggToolItem *
-egg_radio_tool_button_new (GSList *group)
-{
- EggRadioToolButton *button;
-
- button = g_object_new (EGG_TYPE_RADIO_TOOL_BUTTON,
- NULL);
-
- egg_radio_tool_button_set_group (button, group);
-
- return EGG_TOOL_ITEM (button);
-}
-
-EggToolItem *
-egg_radio_tool_button_new_from_stock (GSList *group,
- const gchar *stock_id)
-{
- EggRadioToolButton *button;
-
- g_return_val_if_fail (stock_id != NULL, NULL);
-
- button = g_object_new (EGG_TYPE_RADIO_TOOL_BUTTON,
- "stock_id", stock_id,
- NULL);
-
-
- egg_radio_tool_button_set_group (button, group);
-
- return EGG_TOOL_ITEM (button);
-}
-
-EggToolItem *
-egg_radio_tool_button_new_from_widget (GtkWidget *group,
- const gchar *stock_id)
-{
- GSList *list = NULL;
-
- g_return_val_if_fail (EGG_IS_RADIO_TOOL_BUTTON (group), NULL);
-
- if (group)
- list = egg_radio_tool_button_get_group (EGG_RADIO_TOOL_BUTTON (group));
-
- return egg_radio_tool_button_new_from_stock (list, stock_id);
-}
-
-EggToolItem *
-egg_radio_tool_button_new_with_stock_from_widget (GtkWidget *group)
-{
- GSList *list = NULL;
-
- g_return_val_if_fail (EGG_IS_RADIO_TOOL_BUTTON (group), NULL);
-
- if (group)
- list = egg_radio_tool_button_get_group (EGG_RADIO_TOOL_BUTTON (group));
-
- return egg_radio_tool_button_new (list);
-}
-
-GSList *
-egg_radio_tool_button_get_group (EggRadioToolButton *button)
-{
- g_return_val_if_fail (EGG_IS_RADIO_TOOL_BUTTON (button), NULL);
-
- return gtk_radio_button_get_group (GTK_RADIO_BUTTON (EGG_TOOL_BUTTON (button)->button));
-}
-
-void
-egg_radio_tool_button_set_group (EggRadioToolButton *button,
- GSList *group)
-{
- g_return_if_fail (EGG_IS_RADIO_TOOL_BUTTON (button));
-
- gtk_radio_button_set_group (GTK_RADIO_BUTTON (EGG_TOOL_BUTTON (button)->button), group);
-}
-
diff --git a/lib/egg/eggseparatortoolitem.c b/lib/egg/eggseparatortoolitem.c
deleted file mode 100644
index 90b8e5204..000000000
--- a/lib/egg/eggseparatortoolitem.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <gtk/gtkseparatormenuitem.h>
-#include "eggseparatortoolitem.h"
-
-#ifndef _
-# define _(s) (s)
-#endif
-
-static void egg_separator_tool_item_class_init (EggSeparatorToolItemClass*class);
-
-static void egg_separator_tool_item_add (GtkContainer *container,
- GtkWidget *child);
-
-static GObjectClass *parent_class = NULL;
-
-
-GType
-egg_separator_tool_item_get_type (void)
-{
- static GType type = 0;
-
- if (!type)
- {
- static const GTypeInfo type_info =
- {
- sizeof (EggSeparatorToolItemClass),
- (GBaseInitFunc) 0,
- (GBaseFinalizeFunc) 0,
- (GClassInitFunc) egg_separator_tool_item_class_init,
- (GClassFinalizeFunc) 0,
- NULL,
- sizeof (EggSeparatorToolItem),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- type = g_type_register_static (EGG_TYPE_TOOL_ITEM,
- "EggSeparatorToolItem", &type_info, 0);
- }
- return type;
-}
-
-
-static void
-egg_separator_tool_item_class_init (EggSeparatorToolItemClass *class)
-{
- GtkContainerClass *container_class;
- EggToolItemClass *toolitem_class;
-
- parent_class = g_type_class_peek_parent (class);
- container_class = (GtkContainerClass *)class;
- toolitem_class = (EggToolItemClass *)class;
-
- container_class->add = egg_separator_tool_item_add;
-}
-
-static void
-egg_separator_tool_item_add (GtkContainer *container,
- GtkWidget *child)
-{
- g_warning("attempt to add a child to an EggSeparatorToolItem");
-}
-
-EggToolItem *
-egg_separator_tool_item_new (void)
-{
- EggToolItem *self;
-
- self = g_object_new (EGG_TYPE_SEPARATOR_TOOL_ITEM,
- NULL);
-
- return self;
-}
diff --git a/lib/egg/eggtoggletoolbutton.h b/lib/egg/eggtoggletoolbutton.h
deleted file mode 100644
index 798280496..000000000
--- a/lib/egg/eggtoggletoolbutton.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* eggtoggletoolbutton.h
- *
- * Copyright (C) 2002 Anders Carlsson <andersca@codefactory.se>
- * Copyright (C) 2002 James Henstridge <james@daa.com.au>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __EGG_TOGGLE_TOOL_BUTTON_H__
-#define __EGG_TOGGLE_TOOL_BUTTON_H__
-
-#include "eggtoolbutton.h"
-
-G_BEGIN_DECLS
-
-#define EGG_TYPE_TOGGLE_TOOL_BUTTON (egg_toggle_tool_button_get_type ())
-#define EGG_TOGGLE_TOOL_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TOGGLE_TOOL_BUTTON, EggToggleToolButton))
-#define EGG_TOGGLE_TOOL_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TOGGLE_TOOL_BUTTON, EggToggleToolButtonClass))
-#define EGG_IS_TOGGLE_TOOL_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TOGGLE_TOOL_BUTTON))
-#define EGG_IS_TOGGLE_TOOL_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EGG_TYPE_TOGGLE_TOOL_BUTTON))
-#define EGG_TOGGLE_TOOL_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EGG_TYPE_TOGGLE_TOOL_BUTTON, EggToggleToolButtonClass))
-
-typedef struct _EggToggleToolButton EggToggleToolButton;
-typedef struct _EggToggleToolButtonClass EggToggleToolButtonClass;
-
-struct _EggToggleToolButton
-{
- EggToolButton parent;
-
- /*< private >*/
- GtkWidget *menu_item;
-
- guint active : 1;
-};
-
-struct _EggToggleToolButtonClass
-{
- EggToolButtonClass parent_class;
-
- /* signal */
- void (* toggled) (EggToggleToolButton *button);
-};
-
-GType egg_toggle_tool_button_get_type (void) G_GNUC_CONST;
-EggToolItem *egg_toggle_tool_button_new (void);
-EggToolItem *egg_toggle_tool_button_new_from_stock (const gchar *stock_id);
-
-void egg_toggle_tool_button_set_active (EggToggleToolButton *button,
- gboolean is_active);
-gboolean egg_toggle_tool_button_get_active (EggToggleToolButton *button);
-
-G_END_DECLS
-
-#endif /* __EGG_TOGGLE_TOOL_BUTTON_H__ */
diff --git a/lib/egg/eggtoolbar.c b/lib/egg/eggtoolbar.c
deleted file mode 100644
index dcad2f9f6..000000000
--- a/lib/egg/eggtoolbar.c
+++ /dev/null
@@ -1,2773 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * GtkToolbar copyright (C) Federico Mena
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#undef GTK_DISABLE_DEPRECATED
-
-#include <gtk/gtkarrow.h>
-#include "eggtoolbar.h"
-#include "eggradiotoolbutton.h"
-#include "eggseparatortoolitem.h"
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtktoolbar.h>
-#include <gtk/gtkbindings.h>
-#include <gdk/gdkkeysyms.h>
-#include "eggmarshalers.h"
-#include <gtk/gtkmain.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkprivate.h>
-#include <string.h>
-
-#define DEFAULT_IPADDING 0
-#define DEFAULT_SPACE_SIZE 5
-#define DEFAULT_SPACE_STYLE GTK_TOOLBAR_SPACE_LINE
-
-#define DEFAULT_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
-#define DEFAULT_TOOLBAR_STYLE GTK_TOOLBAR_BOTH
-
-#define SPACE_LINE_DIVISION 10
-#define SPACE_LINE_START 3
-#define SPACE_LINE_END 7
-
-#ifndef _
-# define _(s) (s)
-#endif
-
-enum {
- PROP_0,
- PROP_ORIENTATION,
- PROP_TOOLBAR_STYLE,
- PROP_SHOW_ARROW
-};
-
-enum {
- CHILD_PROP_0,
- CHILD_PROP_EXPAND,
- CHILD_PROP_HOMOGENEOUS,
- CHILD_PROP_PACK_END,
-};
-
-enum {
- ORIENTATION_CHANGED,
- STYLE_CHANGED,
- POPUP_CONTEXT_MENU,
- MOVE_FOCUS,
- FOCUS_ENDS,
- LAST_SIGNAL
-};
-
-static void egg_toolbar_init (EggToolbar *toolbar);
-static void egg_toolbar_finalize (GObject *object);
-static void egg_toolbar_class_init (EggToolbarClass *klass);
-
-static void egg_toolbar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void egg_toolbar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-static gint egg_toolbar_expose (GtkWidget *widget,
- GdkEventExpose *event);
-static void egg_toolbar_realize (GtkWidget *widget);
-static void egg_toolbar_unrealize (GtkWidget *widget);
-static void egg_toolbar_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void egg_toolbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void egg_toolbar_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
-static void egg_toolbar_direction_changed (GtkWidget *widget,
- GtkTextDirection previous_direction);
-static gboolean egg_toolbar_focus (GtkWidget *widget,
- GtkDirectionType dir);
-static void egg_toolbar_screen_changed (GtkWidget *widget,
- GdkScreen *previous_screen);
-static void egg_toolbar_map (GtkWidget *widget);
-static void egg_toolbar_unmap (GtkWidget *widget);
-
-static void egg_toolbar_drag_leave (GtkWidget *widget,
- GdkDragContext *context,
- guint time_);
-static gboolean egg_toolbar_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time_);
-static void egg_toolbar_set_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void egg_toolbar_get_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void egg_toolbar_add (GtkContainer *container,
- GtkWidget *widget);
-static void egg_toolbar_remove (GtkContainer *container,
- GtkWidget *widget);
-static void egg_toolbar_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data);
-static GType egg_toolbar_child_type (GtkContainer *container);
-
-static void egg_toolbar_real_orientation_changed (EggToolbar *toolbar,
- GtkOrientation orientation);
-static void egg_toolbar_real_style_changed (EggToolbar *toolbar,
- GtkToolbarStyle style);
-
-static gboolean egg_toolbar_move_focus (EggToolbar *toolbar,
- GtkDirectionType dir);
-static gboolean egg_toolbar_focus_ends (EggToolbar *toolbar,
- gboolean home);
-
-static gboolean egg_toolbar_button_press (GtkWidget *toolbar,
- GdkEventButton *event);
-static gboolean egg_toolbar_arrow_button_press (GtkWidget *button,
- GdkEventButton *event,
- EggToolbar *toolbar);
-static void egg_toolbar_arrow_button_clicked (GtkWidget *button,
- EggToolbar *toolbar);
-static void egg_toolbar_update_button_relief (EggToolbar *toolbar);
-static GtkReliefStyle get_button_relief (EggToolbar *toolbar);
-static gint get_space_size (EggToolbar *toolbar);
-static EggToolbarSpaceStyle get_space_style (EggToolbar *toolbar);
-static gint get_internal_padding (EggToolbar *toolbar);
-static void egg_toolbar_remove_tool_item (EggToolbar *toolbar,
- EggToolItem *item);
-
-static GtkWidget *egg_toolbar_internal_insert_element (EggToolbar *toolbar,
- EggToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data,
- gint position,
- gboolean use_stock);
-
-
-#define PRIVATE_KEY "egg-toolbar-private"
-
-#define EGG_TOOLBAR_GET_PRIVATE(toolbar) (g_object_get_data (G_OBJECT (toolbar), PRIVATE_KEY))
-
-typedef enum {
- DONT_KNOW,
- OLD_API,
- NEW_API
-} ApiMode;
-
-typedef struct
-{
- GList *items;
-
- GtkWidget *arrow;
- GtkWidget *arrow_button;
-
- gboolean show_arrow;
-
- gint drop_index;
- GdkWindow *drag_highlight;
- GtkMenu *menu;
-
- GdkWindow *event_window;
- ApiMode api_mode;
-} EggToolbarPrivate;
-
-static GtkContainerClass *parent_class = NULL;
-static guint toolbar_signals [LAST_SIGNAL] = { 0 };
-
-GType
-egg_toolbar_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GTypeInfo type_info =
- {
- sizeof (EggToolbarClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) egg_toolbar_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
- sizeof (EggToolbar),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_toolbar_init,
- };
-
- type = g_type_register_static (GTK_TYPE_CONTAINER,
- "EggToolbar",
- &type_info, 0);
- }
-
- return type;
-}
-
-static void
-add_arrow_bindings (GtkBindingSet *binding_set,
- guint keysym,
- GtkDirectionType dir)
-{
- guint keypad_keysym = keysym - GDK_Left + GDK_KP_Left;
-
- gtk_binding_entry_add_signal (binding_set, keysym, 0,
- "move_focus", 1,
- GTK_TYPE_DIRECTION_TYPE, dir);
- gtk_binding_entry_add_signal (binding_set, keypad_keysym, 0,
- "move_focus", 1,
- GTK_TYPE_DIRECTION_TYPE, dir);
-}
-
-static void
-add_ctrl_tab_bindings (GtkBindingSet *binding_set,
- GdkModifierType modifiers,
- GtkDirectionType direction)
-{
- gtk_binding_entry_add_signal (binding_set,
- GDK_Tab, GDK_CONTROL_MASK | modifiers,
- "move_focus", 1,
- GTK_TYPE_DIRECTION_TYPE, direction);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KP_Tab, GDK_CONTROL_MASK | modifiers,
- "move_focus", 1,
- GTK_TYPE_DIRECTION_TYPE, direction);
-}
-
-static void
-egg_toolbar_class_init (EggToolbarClass *klass)
-{
- GObjectClass *gobject_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
- GtkBindingSet *binding_set;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class = (GObjectClass *)klass;
- widget_class = (GtkWidgetClass *)klass;
- container_class = (GtkContainerClass *)klass;
-
- gobject_class->set_property = egg_toolbar_set_property;
- gobject_class->get_property = egg_toolbar_get_property;
- gobject_class->finalize = egg_toolbar_finalize;
-
- widget_class->button_press_event = egg_toolbar_button_press;
- widget_class->expose_event = egg_toolbar_expose;
- widget_class->size_request = egg_toolbar_size_request;
- widget_class->size_allocate = egg_toolbar_size_allocate;
- widget_class->style_set = egg_toolbar_style_set;
- widget_class->direction_changed = egg_toolbar_direction_changed;
- widget_class->focus = egg_toolbar_focus;
- widget_class->screen_changed = egg_toolbar_screen_changed;
- widget_class->realize = egg_toolbar_realize;
- widget_class->unrealize = egg_toolbar_unrealize;
- widget_class->map = egg_toolbar_map;
- widget_class->unmap = egg_toolbar_unmap;
-
- widget_class->drag_leave = egg_toolbar_drag_leave;
- widget_class->drag_motion = egg_toolbar_drag_motion;
-
- container_class->add = egg_toolbar_add;
- container_class->remove = egg_toolbar_remove;
- container_class->forall = egg_toolbar_forall;
- container_class->child_type = egg_toolbar_child_type;
- container_class->get_child_property = egg_toolbar_get_child_property;
- container_class->set_child_property = egg_toolbar_set_child_property;
-
- klass->orientation_changed = egg_toolbar_real_orientation_changed;
- klass->style_changed = egg_toolbar_real_style_changed;
- klass->move_focus = egg_toolbar_move_focus;
- klass->focus_ends = egg_toolbar_focus_ends;
-
- toolbar_signals[ORIENTATION_CHANGED] =
- g_signal_new ("orientation_changed",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EggToolbarClass, orientation_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__ENUM,
- G_TYPE_NONE, 1,
- GTK_TYPE_ORIENTATION);
- toolbar_signals[STYLE_CHANGED] =
- g_signal_new ("style_changed",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EggToolbarClass, style_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__ENUM,
- G_TYPE_NONE, 1,
- GTK_TYPE_TOOLBAR_STYLE);
- toolbar_signals[POPUP_CONTEXT_MENU] =
- g_signal_new ("popup_context_menu",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EggToolbarClass, popup_context_menu),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- toolbar_signals[MOVE_FOCUS] =
- g_signal_new ("move_focus",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (EggToolbarClass, move_focus),
- NULL, NULL,
- _egg_marshal_BOOLEAN__ENUM,
- G_TYPE_BOOLEAN, 1,
- GTK_TYPE_DIRECTION_TYPE);
- toolbar_signals[FOCUS_ENDS] =
- g_signal_new ("focus_ends",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (EggToolbarClass, focus_ends),
- NULL, NULL,
- _egg_marshal_BOOLEAN__BOOLEAN,
- G_TYPE_BOOLEAN, 1,
- G_TYPE_BOOLEAN);
-
- /* properties */
- g_object_class_install_property (gobject_class,
- PROP_ORIENTATION,
- g_param_spec_enum ("orientation",
- _("Orientation"),
- _("The orientation of the toolbar"),
- GTK_TYPE_ORIENTATION,
- GTK_ORIENTATION_HORIZONTAL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class,
- PROP_TOOLBAR_STYLE,
- g_param_spec_enum ("toolbar_style",
- _("Toolbar Style"),
- _("How to draw the toolbar"),
- GTK_TYPE_TOOLBAR_STYLE,
- GTK_TOOLBAR_ICONS,
- G_PARAM_READWRITE));
- g_object_class_install_property (gobject_class,
- PROP_SHOW_ARROW,
- g_param_spec_boolean ("show_arrow",
- _("Show Arrow"),
- _("If an arrow should be shown if the toolbar doesn't fit"),
- FALSE,
- G_PARAM_READWRITE));
-
- /* child properties */
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_EXPAND,
- g_param_spec_boolean ("expand",
- _("Expand"),
- _("Whether the item should receive extra space when the toolbar grows"),
- TRUE,
- G_PARAM_READWRITE));
-
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_HOMOGENEOUS,
- g_param_spec_boolean ("homogeneous",
- _("Homogeneous"),
- _("Whether the item should be the same size as other homogeneous items"),
- TRUE,
- G_PARAM_READWRITE));
-
- gtk_container_class_install_child_property (container_class,
- CHILD_PROP_PACK_END,
- g_param_spec_uint ("pack_end",
- _("Pack End"),
- _("Whether the item is positioned at the end of the toolbar"),
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- /* style properties */
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("space_size",
- _("Spacer size"),
- _("Size of spacers"),
- 0,
- G_MAXINT,
- DEFAULT_SPACE_SIZE,
- G_PARAM_READABLE));
-
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("internal_padding",
- _("Internal padding"),
- _("Amount of border space between the toolbar shadow and the buttons"),
- 0,
- G_MAXINT,
- DEFAULT_IPADDING,
- G_PARAM_READABLE));
-
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_enum ("space_style",
- _("Space style"),
- _("Whether spacers are vertical lines or just blank"),
- GTK_TYPE_TOOLBAR_SPACE_STYLE,
- DEFAULT_SPACE_STYLE,
- G_PARAM_READABLE));
-
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_enum ("button_relief",
- _("Button relief"),
- _("Type of bevel around toolbar buttons"),
- GTK_TYPE_RELIEF_STYLE,
- GTK_RELIEF_NONE,
- G_PARAM_READABLE));
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_enum ("shadow_type",
- _("Shadow type"),
- _("Style of bevel around the toolbar"),
- GTK_TYPE_SHADOW_TYPE,
- GTK_SHADOW_OUT,
- G_PARAM_READABLE));
-
- gtk_settings_install_property (g_param_spec_enum ("gtk-toolbar-style",
- _("Toolbar style"),
- _("Whether default toolbars have text only, text and icons, icons only, etc."),
- GTK_TYPE_TOOLBAR_STYLE,
- DEFAULT_TOOLBAR_STYLE,
- G_PARAM_READWRITE));
-
- gtk_settings_install_property (g_param_spec_enum ("gtk-toolbar-icon-size",
- _("Toolbar icon size"),
- _("Size of icons in default toolbars"),
- GTK_TYPE_ICON_SIZE,
- DEFAULT_ICON_SIZE,
- G_PARAM_READWRITE));
-
- binding_set = gtk_binding_set_by_class (klass);
-
- add_arrow_bindings (binding_set, GDK_Left, GTK_DIR_LEFT);
- add_arrow_bindings (binding_set, GDK_Right, GTK_DIR_RIGHT);
- add_arrow_bindings (binding_set, GDK_Up, GTK_DIR_UP);
- add_arrow_bindings (binding_set, GDK_Down, GTK_DIR_DOWN);
-
- gtk_binding_entry_add_signal (binding_set, GDK_KP_Home, 0,
- "focus_ends", 1,
- G_TYPE_BOOLEAN, TRUE);
- gtk_binding_entry_add_signal (binding_set, GDK_Home, 0,
- "focus_ends", 1,
- G_TYPE_BOOLEAN, TRUE);
- gtk_binding_entry_add_signal (binding_set, GDK_KP_End, 0,
- "focus_ends", 1,
- G_TYPE_BOOLEAN, FALSE);
- gtk_binding_entry_add_signal (binding_set, GDK_End, 0,
- "focus_ends", 1,
- G_TYPE_BOOLEAN, FALSE);
-
- add_ctrl_tab_bindings (binding_set, 0, GTK_DIR_RIGHT);
- add_ctrl_tab_bindings (binding_set, GDK_SHIFT_MASK, GTK_DIR_LEFT);
-}
-
-static void
-egg_toolbar_finalize (GObject *object)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (object);
- EggToolbarPrivate *priv;
-
- if (toolbar->tooltips)
- g_object_unref (GTK_OBJECT (toolbar->tooltips));
-
- priv = g_object_get_data (object, PRIVATE_KEY);
- g_free (priv);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-egg_toolbar_init (EggToolbar *toolbar)
-{
- EggToolbarPrivate *priv;
-
- GTK_WIDGET_UNSET_FLAGS (toolbar, GTK_CAN_FOCUS);
- GTK_WIDGET_SET_FLAGS (toolbar, GTK_NO_WINDOW);
-
- priv = g_new0 (EggToolbarPrivate, 1);
- g_object_set_data (G_OBJECT (toolbar), PRIVATE_KEY, priv);
-
- toolbar->orientation = GTK_ORIENTATION_HORIZONTAL;
- toolbar->style = DEFAULT_TOOLBAR_STYLE;
- toolbar->icon_size = DEFAULT_ICON_SIZE;
- toolbar->tooltips = gtk_tooltips_new ();
- g_object_ref (toolbar->tooltips);
- gtk_object_sink (GTK_OBJECT (toolbar->tooltips));
-
- priv->arrow_button = gtk_toggle_button_new ();
- g_signal_connect (priv->arrow_button, "button_press_event",
- G_CALLBACK (egg_toolbar_arrow_button_press), toolbar);
- g_signal_connect (priv->arrow_button, "clicked",
- G_CALLBACK (egg_toolbar_arrow_button_clicked), toolbar);
- gtk_button_set_relief (GTK_BUTTON (priv->arrow_button),
- get_button_relief (toolbar));
-
- priv->api_mode = DONT_KNOW;
-
-#if 0
- /* FIXME: enable this when we can depend on gtk+ 2.3.0 */
- gtk_button_set_focus_on_click (GTK_BUTTON (priv->arrow_button), FALSE);
-#endif
-
- priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
- gtk_widget_show (priv->arrow);
- gtk_container_add (GTK_CONTAINER (priv->arrow_button), priv->arrow);
-
- gtk_widget_set_parent (priv->arrow_button, GTK_WIDGET (toolbar));
-
- /* which child position a drop will occur at */
- priv->drop_index = -1;
- priv->drag_highlight = NULL;
-
- priv->menu = NULL;
-}
-
-static gboolean
-toolbar_item_visible (EggToolbar *toolbar,
- EggToolItem *item)
-{
- if (GTK_WIDGET_VISIBLE (item) &&
- ((toolbar->orientation == GTK_ORIENTATION_HORIZONTAL && item->visible_horizontal) ||
- (toolbar->orientation == GTK_ORIENTATION_VERTICAL && item->visible_vertical)))
- {
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- /* With the old toolbar you could hide a button by calling gtk_widget_hide()
- * on it. This doesn't work with the new API because the EggToolItem will not be
- * hidden.
- */
- if (priv->api_mode == OLD_API)
- {
- GtkWidget *bin_child = GTK_BIN (item)->child;
-
- if (bin_child && !GTK_WIDGET_VISIBLE (bin_child))
- return FALSE;
- }
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-toolbar_item_is_homogeneous (EggToolbar *toolbar,
- EggToolItem *item)
-{
- gboolean result = FALSE;
-
- if (item->homogeneous && !EGG_IS_SEPARATOR_TOOL_ITEM (item))
- result = TRUE;
-
- if (item->is_important &&
- toolbar->style == GTK_TOOLBAR_BOTH_HORIZ &&
- toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- result = FALSE;
- }
-
- return result;
-}
-
-static void
-egg_toolbar_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (object);
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- egg_toolbar_set_orientation (toolbar, g_value_get_enum (value));
- break;
- case PROP_TOOLBAR_STYLE:
- egg_toolbar_set_style (toolbar, g_value_get_enum (value));
- break;
- case PROP_SHOW_ARROW:
- egg_toolbar_set_show_arrow (toolbar, g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-egg_toolbar_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (object);
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- switch (prop_id)
- {
- case PROP_ORIENTATION:
- g_value_set_enum (value, toolbar->orientation);
- break;
- case PROP_TOOLBAR_STYLE:
- g_value_set_enum (value, toolbar->style);
- break;
- case PROP_SHOW_ARROW:
- g_value_set_boolean (value, priv->show_arrow);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-egg_toolbar_map (GtkWidget *widget)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (widget);
-
- GTK_WIDGET_CLASS (parent_class)->map (widget);
-
- if (priv->event_window)
- gdk_window_show_unraised (priv->event_window);
-}
-
-static void
-egg_toolbar_unmap (GtkWidget *widget)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (widget);
-
- if (priv->event_window)
- gdk_window_hide (priv->event_window);
-
- GTK_WIDGET_CLASS (parent_class)->unmap (widget);
-}
-
-static void
-egg_toolbar_paint_space_line (GtkWidget *widget,
- GdkRectangle *area,
- EggToolItem *item)
-{
- EggToolbar *toolbar;
- GtkAllocation *allocation;
- gint space_size;
-
- g_return_if_fail (GTK_BIN (item)->child == NULL);
-
- toolbar = EGG_TOOLBAR (widget);
-
- allocation = &GTK_WIDGET (item)->allocation;
- space_size = get_space_size (toolbar);
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_paint_vline (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), area, widget,
- "toolbar",
- allocation->y + allocation->height *
- SPACE_LINE_START / SPACE_LINE_DIVISION,
- allocation->y + allocation->height *
- SPACE_LINE_END / SPACE_LINE_DIVISION,
- allocation->x + (space_size-widget->style->xthickness)/2);
- else if (toolbar->orientation == GTK_ORIENTATION_VERTICAL)
- gtk_paint_hline (widget->style, widget->window,
- GTK_WIDGET_STATE (widget), area, widget,
- "toolbar",
- allocation->x + allocation->width *
- SPACE_LINE_START / SPACE_LINE_DIVISION,
- allocation->x + allocation->width *
- SPACE_LINE_END / SPACE_LINE_DIVISION,
- allocation->y + (space_size-widget->style->ythickness)/2);
-}
-
-static void
-egg_toolbar_realize (GtkWidget *widget)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (widget);
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- GdkWindowAttr attributes;
- gint attributes_mask;
- gint border_width;
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- border_width = GTK_CONTAINER (widget)->border_width;
-
- attributes.wclass = GDK_INPUT_ONLY;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x + border_width;
- attributes.y = widget->allocation.y + border_width;
- attributes.width = widget->allocation.width - border_width * 2;
- attributes.height = widget->allocation.height - border_width * 2;
- attributes.event_mask = gtk_widget_get_events (widget);
- /* FIXME: does GDK_EXPOSURE_MASK make sense for an input-only window?
- * If it doesn't, then it should be removed here and in gtkbutton.c,
- * gtkmenuitem.c, and maybe other places
- */
- attributes.event_mask |= (GDK_EXPOSURE_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_ENTER_NOTIFY_MASK |
- GDK_LEAVE_NOTIFY_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y;
-
- widget->window = gtk_widget_get_parent_window (widget);
- g_object_ref (widget->window);
-
- priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (priv->event_window, toolbar);
-}
-
-static void
-egg_toolbar_unrealize (GtkWidget *widget)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (widget);
-
- if (priv->drag_highlight)
- {
- gdk_window_set_user_data (priv->drag_highlight, NULL);
- gdk_window_destroy (priv->drag_highlight);
- priv->drag_highlight = NULL;
- }
-
- if (priv->event_window)
- {
- gdk_window_set_user_data (priv->event_window, NULL);
- gdk_window_destroy (priv->event_window);
- priv->event_window = NULL;
- }
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-static gint
-egg_toolbar_expose (GtkWidget *widget,
- GdkEventExpose *event)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (widget);
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- GList *items;
- gint border_width;
-
- border_width = GTK_CONTAINER (widget)->border_width;
-
- if (GTK_WIDGET_DRAWABLE (widget))
- {
- GtkShadowType shadow_type;
-
- gtk_widget_style_get (widget, "shadow_type", &shadow_type, NULL);
-
- gtk_paint_box (widget->style,
- widget->window,
- GTK_WIDGET_STATE (widget),
- shadow_type,
- &event->area, widget, "toolbar",
- border_width + widget->allocation.x,
- border_width + widget->allocation.y,
- widget->allocation.width - 2 * border_width,
- widget->allocation.height - 2 * border_width);
- }
-
- items = priv->items;
- while (items)
- {
- EggToolItem *item = EGG_TOOL_ITEM (items->data);
-
- if (GTK_BIN (item)->child)
- gtk_container_propagate_expose (GTK_CONTAINER (widget),
- GTK_WIDGET (item),
- event);
- else if (GTK_WIDGET_MAPPED (item) && get_space_style (toolbar) == GTK_TOOLBAR_SPACE_LINE)
- egg_toolbar_paint_space_line (widget, &event->area, item);
-
- items = items->next;
- }
-
- gtk_container_propagate_expose (GTK_CONTAINER (widget),
- priv->arrow_button,
- event);
-
- return FALSE;
-}
-
-static void
-egg_toolbar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (widget);
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- gint space_size = get_space_size (toolbar);
- GList *list;
- gint max_child_height;
- gint max_child_width;
- gint max_homogeneous_child_width;
- gint max_homogeneous_child_height;
- gint homogeneous_size;
- gint long_req;
- gint pack_end_size;
- gint pack_front_size;
- gint ipadding;
- GtkRequisition arrow_requisition;
-
- max_homogeneous_child_width = 0;
- max_homogeneous_child_height = 0;
- max_child_width = 0;
- max_child_height = 0;
- for (list = priv->items; list != NULL; list = list->next)
- {
- GtkRequisition requisition;
- EggToolItem *item = list->data;
-
- if (!toolbar_item_visible (toolbar, item))
- continue;
-
- gtk_widget_size_request (GTK_WIDGET (item), &requisition);
-
- max_child_width = MAX (max_child_width, requisition.width);
- max_child_height = MAX (max_child_height, requisition.height);
-
- if (toolbar_item_is_homogeneous (toolbar, item) && GTK_BIN (item)->child)
- {
- max_homogeneous_child_width = MAX (max_homogeneous_child_width, requisition.width);
- max_homogeneous_child_height = MAX (max_homogeneous_child_height, requisition.height);
- }
- }
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- homogeneous_size = max_homogeneous_child_width;
- else
- homogeneous_size = max_homogeneous_child_height;
-
- pack_end_size = 0;
- pack_front_size = 0;
- for (list = priv->items; list != NULL; list = list->next)
- {
- EggToolItem *item = list->data;
- guint size;
-
- if (!toolbar_item_visible (toolbar, item))
- continue;
-
- if (!GTK_BIN (item)->child)
- {
- size = space_size;
- }
- else if (item->homogeneous)
- {
- size = homogeneous_size;
- }
- else
- {
- GtkRequisition requisition;
-
- gtk_widget_size_request (GTK_WIDGET (item), &requisition);
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- size = requisition.width;
- else
- size = requisition.height;
- }
-
- if (item->pack_end)
- pack_end_size += size;
- else
- pack_front_size += size;
- }
-
- if (priv->show_arrow)
- {
- gtk_widget_size_request (priv->arrow_button, &arrow_requisition);
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- long_req = arrow_requisition.width;
- else
- long_req = arrow_requisition.height;
-
- /* There is no point requesting space for the arrow if that would take
- * up more space than all the items combined
- */
- long_req = MIN (long_req, pack_front_size + pack_end_size);
- }
- else
- {
- arrow_requisition.height = 0;
- arrow_requisition.width = 0;
-
- long_req = pack_end_size + pack_front_size;
- }
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- requisition->width = long_req;
- requisition->height = MAX (max_child_height, arrow_requisition.height);
- }
- else
- {
- requisition->height = long_req;
- requisition->width = MAX (max_child_width, arrow_requisition.width);
- }
-
- /* Extra spacing */
- ipadding = get_internal_padding (toolbar);
-
- requisition->width += 2 * (ipadding + GTK_CONTAINER (toolbar)->border_width);
- requisition->height += 2 * (ipadding + GTK_CONTAINER (toolbar)->border_width);
-
- toolbar->button_maxw = max_homogeneous_child_width;
- toolbar->button_maxh = max_homogeneous_child_height;
-}
-
-static void
-fixup_allocation_for_rtl (gint total_size,
- GtkAllocation *allocation)
-{
- allocation->x += (total_size - (2 * allocation->x + allocation->width));
-}
-
-static void
-fixup_allocation_for_vertical (GtkAllocation *allocation)
-{
- gint tmp;
-
- tmp = allocation->x;
- allocation->x = allocation->y;
- allocation->y = tmp;
-
- tmp = allocation->width;
- allocation->width = allocation->height;
- allocation->height = tmp;
-}
-
-static gint
-get_item_size (EggToolbar *toolbar,
- GtkWidget *child)
-{
- GtkRequisition requisition;
- EggToolItem *item = EGG_TOOL_ITEM (child);
-
- if (!GTK_BIN (item)->child)
- return get_space_size (toolbar);
-
- gtk_widget_get_child_requisition (child, &requisition);
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- if (toolbar_item_is_homogeneous (toolbar, item))
- return toolbar->button_maxw;
- else
- return requisition.width;
- }
- else
- {
- if (toolbar_item_is_homogeneous (toolbar, item))
- return toolbar->button_maxh;
- else
- return requisition.height;
- }
-}
-
-static void
-egg_toolbar_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (widget);
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- gint space_size;
- GtkAllocation *allocations;
- GtkAllocation arrow_allocation;
- gint arrow_size;
- gint size, pos, short_size;
- GList *list;
- gint i;
- gboolean need_arrow;
- gint n_expand_items;
- gint border_width;
- gint available_size;
- gint n_items;
- gint needed_size;
- GList *items;
- GtkRequisition arrow_requisition;
-
- widget->allocation = *allocation;
-
- space_size = get_space_size (toolbar);
-
- border_width = GTK_CONTAINER (toolbar)->border_width;
-
- if (GTK_WIDGET_REALIZED (widget))
- {
- gdk_window_move_resize (priv->event_window,
- allocation->x + border_width,
- allocation->y + border_width,
- allocation->width - border_width * 2,
- allocation->height - border_width * 2);
- }
-
- border_width += get_internal_padding (toolbar);
-
- gtk_widget_get_child_requisition (GTK_WIDGET (priv->arrow_button),
- &arrow_requisition);
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- available_size = size = allocation->width - 2 * border_width;
- short_size = allocation->height - 2 * border_width;
- arrow_size = arrow_requisition.width;
- }
- else
- {
- available_size = size = allocation->height - 2 * border_width;
- short_size = allocation->width - 2 * border_width;
- arrow_size = arrow_requisition.height;
- }
-
- n_items = g_list_length (priv->items);
- allocations = g_new0 (GtkAllocation, n_items);
-
- needed_size = 0;
- for (list = priv->items; list != NULL; list = list->next)
- {
- EggToolItem *item = list->data;
-
- if (toolbar_item_visible (toolbar, item))
- needed_size += get_item_size (toolbar, GTK_WIDGET (item));
- }
-
- need_arrow = (needed_size > available_size) && priv->show_arrow;
-
- if (need_arrow)
- size = available_size - arrow_size;
- else
- size = available_size;
-
- items = g_list_copy (priv->items);
-
- /* calculate widths of pack end items */
- for (list = g_list_last (items), i = 0; list != NULL; list = list->prev, ++i)
- {
- EggToolItem *item = list->data;
- GtkAllocation *allocation = &(allocations[n_items - i - 1]);
- gint item_size;
-
- if (!item->pack_end || !toolbar_item_visible (toolbar, item))
- continue;
-
- item_size = get_item_size (toolbar, GTK_WIDGET (item));
- if (item_size <= size)
- {
- size -= item_size;
- allocation->width = item_size;
- item->overflow_item = FALSE;
- }
- else
- {
- while (list)
- {
- item = list->data;
- if (item->pack_end)
- item->overflow_item = TRUE;
-
- list = list->prev;
- }
- break;
- }
- }
-
- /* calculate widths of pack front items */
- for (list = items, i = 0; list != NULL; list = list->next, ++i)
- {
- EggToolItem *item = list->data;
- gint item_size;
-
- if (item->pack_end || !toolbar_item_visible (toolbar, item))
- continue;
-
- item_size = get_item_size (toolbar, GTK_WIDGET (item));
- if (item_size <= size)
- {
- size -= item_size;
- allocations[i].width = item_size;
- item->overflow_item = FALSE;
- }
- else
- {
- while (list)
- {
- item = list->data;
- if (!item->pack_end)
- item->overflow_item = TRUE;
- list = list->next;
- }
- break;
- }
- }
-
- if (need_arrow)
- {
- arrow_allocation.width = arrow_size;
- arrow_allocation.height = short_size;
- }
-
- /* expand expandable items */
- n_expand_items = 0;
- for (list = priv->items; list != NULL; list = list->next)
- {
- EggToolItem *item = list->data;
-
- if (toolbar_item_visible (toolbar, item) && item->expand &&
- !item->overflow_item && GTK_BIN (item)->child)
- {
- n_expand_items++;
- }
- }
-
- for (list = items, i = 0; list != NULL; list = list->next, ++i)
- {
- EggToolItem *item = list->data;
-
- if (toolbar_item_visible (toolbar, item) && item->expand &&
- !item->overflow_item && GTK_BIN (item)->child)
- {
- gint extra = size / n_expand_items;
- if (size % n_expand_items != 0)
- extra++;
-
- allocations[i].width += extra;
- size -= extra;
- n_expand_items--;
- }
- }
-
- g_assert (n_expand_items == 0);
-
- /* position pack front items */
- pos = border_width;
- for (list = items, i = 0; list != NULL; list = list->next, ++i)
- {
- EggToolItem *item = list->data;
-
- if (toolbar_item_visible (toolbar, item) && !item->overflow_item && !item->pack_end)
- {
- allocations[i].x = pos;
- allocations[i].y = border_width;
- allocations[i].height = short_size;
-
- pos += allocations[i].width;
- }
- }
-
- /* position pack end items */
- pos = available_size + border_width;
- for (list = g_list_last (items), i = 0; list != NULL; list = list->prev, ++i)
- {
- EggToolItem *item = list->data;
-
- if (toolbar_item_visible (toolbar, item) && !item->overflow_item && item->pack_end)
- {
- GtkAllocation *allocation = &(allocations[n_items - i - 1]);
-
- allocation->x = pos - allocation->width;
- allocation->y = border_width;
- allocation->height = short_size;
-
- pos -= allocation->width;
- }
- }
-
- /* position arrow */
- if (need_arrow)
- {
- arrow_allocation.x = pos - arrow_allocation.width;
- arrow_allocation.y = border_width;
- }
-
- /* fix up allocations in the vertical or RTL cases */
- if (toolbar->orientation == GTK_ORIENTATION_VERTICAL)
- {
- for (i = 0; i < n_items; ++i)
- fixup_allocation_for_vertical (&(allocations[i]));
-
- if (need_arrow)
- fixup_allocation_for_vertical (&arrow_allocation);
- }
- else if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_RTL)
- {
- for (i = 0; i < n_items; ++i)
- fixup_allocation_for_rtl (available_size, &(allocations[i]));
-
- if (need_arrow)
- fixup_allocation_for_rtl (available_size, &arrow_allocation);
- }
-
- /* translate the items by allocation->(x,y) */
- for (i = 0; i < n_items; ++i)
- {
- allocations[i].x += allocation->x;
- allocations[i].y += allocation->y;
- }
-
- if (need_arrow)
- {
- arrow_allocation.x += allocation->x;
- arrow_allocation.y += allocation->y;
- }
-
- /* finally allocate the items */
- for (list = items, i = 0; list != NULL; list = list->next, i++)
- {
- EggToolItem *item = list->data;
-
- if (toolbar_item_visible (toolbar, item) && !item->overflow_item)
- {
- gtk_widget_size_allocate (GTK_WIDGET (item), &(allocations[i]));
- gtk_widget_set_child_visible (GTK_WIDGET (item), TRUE);
- }
- else
- {
- gtk_widget_set_child_visible (GTK_WIDGET (item), FALSE);
- }
- }
-
- if (need_arrow)
- {
- gtk_widget_size_allocate (GTK_WIDGET (priv->arrow_button),
- &arrow_allocation);
- gtk_widget_show (GTK_WIDGET (priv->arrow_button));
- }
- else
- {
- gtk_widget_hide (GTK_WIDGET (priv->arrow_button));
- }
-
- g_free (allocations);
- g_list_free (items);
-}
-
-static void
-egg_toolbar_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
-{
- if (GTK_WIDGET_REALIZED (widget))
- gtk_style_set_background (widget->style, widget->window, widget->state);
-
- if (prev_style)
- egg_toolbar_update_button_relief (EGG_TOOLBAR (widget));
-}
-
-static void
-egg_toolbar_direction_changed (GtkWidget *widget,
- GtkTextDirection previous_dir)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (widget);
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- if (toolbar->orientation == GTK_ORIENTATION_VERTICAL)
- {
- if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
- gtk_arrow_set (GTK_ARROW (priv->arrow), GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
- else
- gtk_arrow_set (GTK_ARROW (priv->arrow), GTK_ARROW_LEFT, GTK_SHADOW_NONE);
- }
-
- GTK_WIDGET_CLASS (parent_class)->direction_changed (widget, previous_dir);
-}
-
-static GList *
-egg_toolbar_list_children_in_focus_order (EggToolbar *toolbar,
- GtkDirectionType dir)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- GList *result = NULL;
- GList *list;
-
- for (list = priv->items; list != NULL; list = list->next)
- {
- EggToolItem *item = list->data;
- if (!item->pack_end)
- result = g_list_prepend (result, item);
- }
-
- for (list = priv->items; list != NULL; list = list->next)
- {
- EggToolItem *item = list->data;
-
- if (item->pack_end)
- result = g_list_prepend (result, item);
- }
-
- result = g_list_prepend (result, priv->arrow_button);
-
- if (dir == GTK_DIR_RIGHT || dir == GTK_DIR_DOWN || dir == GTK_DIR_TAB_FORWARD)
- result = g_list_reverse (result);
-
- if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_RTL)
- result = g_list_reverse (result);
-
- return result;
-}
-
-static gboolean
-egg_toolbar_focus_ends (EggToolbar *toolbar,
- gboolean home)
-{
- GList *children, *list;
- GtkDirectionType dir = home? GTK_DIR_RIGHT : GTK_DIR_LEFT;
-
- children = egg_toolbar_list_children_in_focus_order (toolbar, dir);
-
- if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_RTL)
- {
- children = g_list_reverse (children);
- if (dir == GTK_DIR_RIGHT)
- dir = GTK_DIR_LEFT;
- else
- dir = GTK_DIR_RIGHT;
- }
-
- for (list = children; list != NULL; list = list->next)
- {
- GtkWidget *child = list->data;
-
- if (GTK_CONTAINER (toolbar)->focus_child == child)
- break;
-
- if (GTK_WIDGET_MAPPED (child) && gtk_widget_child_focus (child, dir))
- break;
- }
-
- g_list_free (children);
-
- return TRUE;
-}
-
-static gboolean
-egg_toolbar_move_focus (EggToolbar *toolbar,
- GtkDirectionType dir)
-{
- GList *list;
- gboolean try_focus = FALSE;
- GList *children = egg_toolbar_list_children_in_focus_order (toolbar, dir);
-
- for (list = children; list != NULL; list = list->next)
- {
- GtkWidget *child = list->data;
-
- if (try_focus && GTK_WIDGET_MAPPED (child) && gtk_widget_child_focus (child, dir))
- break;
-
- if (child == GTK_CONTAINER (toolbar)->focus_child)
- try_focus = TRUE;
- }
-
- g_list_free (children);
-
- return TRUE;
-}
-
-/* The focus handler for the toolbar. It called when the user presses TAB or otherwise
- * tries to focus the toolbar.
- */
-static gboolean
-egg_toolbar_focus (GtkWidget *widget,
- GtkDirectionType dir)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (widget);
- GList *children, *list;
-
- /* if focus is already somewhere inside the toolbar then return FALSE.
- * The only way focus can stay inside the toolbar is when the user presses
- * arrow keys or Ctrl TAB (both of which are handled by the
- * egg_toolbar_move_focus() keybinding function.
- */
- if (GTK_CONTAINER (widget)->focus_child)
- return FALSE;
-
- children = egg_toolbar_list_children_in_focus_order (toolbar, dir);
-
- for (list = children; list != NULL; list = list->next)
- {
- GtkWidget *child = list->data;
-
- if (GTK_WIDGET_MAPPED (child) && gtk_widget_child_focus (child, dir))
- return TRUE;
- }
-
- g_list_free (children);
-
- return FALSE;
-}
-
-static void
-style_change_notify (EggToolbar *toolbar)
-{
- if (!toolbar->style_set)
- {
- /* pretend it was set, then unset, thus reverting to new default */
- toolbar->style_set = TRUE;
- egg_toolbar_unset_style (toolbar);
- }
-}
-
-static void
-icon_size_change_notify (EggToolbar *toolbar)
-{
- if (!toolbar->icon_size_set)
- {
- /* pretend it was set, then unset, thus reverting to new default */
- toolbar->icon_size_set = TRUE;
- egg_toolbar_unset_icon_size (toolbar);
- }
-}
-
-static GtkSettings *
-toolbar_get_settings (EggToolbar *toolbar)
-{
- return g_object_get_data (G_OBJECT (toolbar), "egg-toolbar-settings");
-}
-
-static void
-egg_toolbar_screen_changed (GtkWidget *widget,
- GdkScreen *previous_screen)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (widget);
- GtkSettings *old_settings = toolbar_get_settings (toolbar);
- GtkSettings *settings;
-
- if (gtk_widget_has_screen (GTK_WIDGET (toolbar)))
- settings = gtk_widget_get_settings (GTK_WIDGET (toolbar));
- else
- settings = NULL;
-
- if (settings == old_settings)
- return;
-
- if (old_settings)
- {
- g_signal_handler_disconnect (old_settings, toolbar->style_set_connection);
- g_signal_handler_disconnect (old_settings, toolbar->icon_size_connection);
-
- g_object_unref (old_settings);
- }
-
- if (settings)
- {
- toolbar->style_set_connection =
- g_signal_connect_swapped (settings,
- "notify::gtk-toolbar-style",
- G_CALLBACK (style_change_notify),
- toolbar);
- toolbar->icon_size_connection =
- g_signal_connect_swapped (settings,
- "notify::gtk-toolbar-icon-size",
- G_CALLBACK (icon_size_change_notify),
- toolbar);
-
- g_object_ref (settings);
- g_object_set_data (G_OBJECT (toolbar), "egg-toolbar-settings", settings);
- }
- else
- g_object_set_data (G_OBJECT (toolbar), "egg-toolbar-settings", NULL);
-
- style_change_notify (toolbar);
- icon_size_change_notify (toolbar);
-}
-
-static void
-find_drop_pos (EggToolbar *toolbar,
- gint x,
- gint y,
- gint *drop_index,
- gint *drop_pos)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- GtkOrientation orientation;
- GtkTextDirection direction;
- GList *items;
- EggToolItem *item;
- gint border_width;
- gint best_distance, best_pos, best_index, index;
-
- orientation = toolbar->orientation;
- direction = gtk_widget_get_direction (GTK_WIDGET (toolbar));
- border_width = GTK_CONTAINER (toolbar)->border_width + get_internal_padding (toolbar);
-
- items = priv->items;
- if (!items)
- {
- *drop_index = 0;
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- if (direction == GTK_TEXT_DIR_LTR)
- *drop_pos = border_width;
- else
- *drop_pos = GTK_WIDGET (toolbar)->allocation.width - border_width;
- }
- else
- {
- *drop_pos = border_width;
- }
- return;
- }
-
- /* initial conditions */
- item = EGG_TOOL_ITEM (items->data);
- best_index = 0;
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- if (direction == GTK_TEXT_DIR_LTR)
- best_pos = GTK_WIDGET (item)->allocation.x;
- else
- best_pos = GTK_WIDGET (item)->allocation.x +
- GTK_WIDGET (item)->allocation.width;
- best_distance = ABS (best_pos - x);
- }
- else
- {
- best_pos = GTK_WIDGET (item)->allocation.y;
- best_distance = ABS (best_pos - y);
- }
-
- index = 0;
- while (items)
- {
- item = EGG_TOOL_ITEM (items->data);
- index++;
- if (GTK_WIDGET_DRAWABLE (item) && !item->pack_end)
- {
- gint pos, distance;
-
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- if (direction == GTK_TEXT_DIR_LTR)
- pos = GTK_WIDGET (item)->allocation.x +
- GTK_WIDGET (item)->allocation.width;
- else
- pos = GTK_WIDGET (item)->allocation.x;
- distance = ABS (pos - x);
- }
- else
- {
- pos = GTK_WIDGET (item)->allocation.y +
- GTK_WIDGET (item)->allocation.height;
- distance = ABS (pos - y);
- }
- if (distance < best_distance)
- {
- best_index = index;
- best_pos = pos;
- best_distance = distance;
- }
- }
- items = items->next;
- }
- *drop_index = best_index;
- *drop_pos = best_pos;
-}
-
-static void
-egg_toolbar_drag_leave (GtkWidget *widget,
- GdkDragContext *context,
- guint time_)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (widget);
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- if (priv->drag_highlight)
- {
- gdk_window_set_user_data (priv->drag_highlight, NULL);
- gdk_window_destroy (priv->drag_highlight);
- priv->drag_highlight = NULL;
- }
-
- priv->drop_index = -1;
-}
-
-static gboolean
-egg_toolbar_drag_motion (GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time_)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (widget);
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- gint new_index, new_pos;
-
- find_drop_pos(toolbar, x, y, &new_index, &new_pos);
-
- if (!priv->drag_highlight)
- {
- GdkWindowAttr attributes;
- guint attributes_mask;
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
- attributes.width = 1;
- attributes.height = 1;
- attributes_mask = GDK_WA_VISUAL | GDK_WA_COLORMAP;
- priv->drag_highlight = gdk_window_new (widget->window,
- &attributes, attributes_mask);
- gdk_window_set_user_data (priv->drag_highlight, widget);
- gdk_window_set_background (priv->drag_highlight,
- &widget->style->fg[widget->state]);
- }
-
- if (priv->drop_index < 0 ||
- priv->drop_index != new_index)
- {
- gint border_width = GTK_CONTAINER (toolbar)->border_width;
- priv->drop_index = new_index;
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- gdk_window_move_resize (priv->drag_highlight,
- widget->allocation.x + new_pos - 1,
- widget->allocation.y + border_width,
- 2, widget->allocation.height-border_width*2);
- }
- else
- {
- gdk_window_move_resize (priv->drag_highlight,
- widget->allocation.x + border_width,
- widget->allocation.y + new_pos - 1,
- widget->allocation.width-border_width*2, 2);
- }
- }
-
- gdk_window_show (priv->drag_highlight);
-
- gdk_drag_status (context, context->suggested_action, time_);
-
- return TRUE;
-}
-
-static void
-egg_toolbar_get_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EggToolItem *item = EGG_TOOL_ITEM (child);
-
- switch (property_id)
- {
- case CHILD_PROP_PACK_END:
- g_value_set_boolean (value, item->pack_end);
- break;
-
- case CHILD_PROP_HOMOGENEOUS:
- g_value_set_boolean (value, item->homogeneous);
- break;
-
- case CHILD_PROP_EXPAND:
- g_value_set_boolean (value, item->expand);
- break;
-
- default:
- GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
- break;
- }
-}
-
-static void
-egg_toolbar_set_child_property (GtkContainer *container,
- GtkWidget *child,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id)
- {
- case CHILD_PROP_PACK_END:
- egg_tool_item_set_pack_end (EGG_TOOL_ITEM (child), g_value_get_boolean (value));
- break;
-
- case CHILD_PROP_HOMOGENEOUS:
- egg_tool_item_set_homogeneous (EGG_TOOL_ITEM (child), g_value_get_boolean (value));
- break;
-
- case CHILD_PROP_EXPAND:
- egg_tool_item_set_homogeneous (EGG_TOOL_ITEM (child), g_value_get_boolean (value));
- break;
-
- default:
- GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
- break;
- }
-}
-
-static void
-egg_toolbar_add (GtkContainer *container,
- GtkWidget *widget)
-{
- EggToolbar *toolbar;
-
- g_return_if_fail (EGG_IS_TOOLBAR (container));
- g_return_if_fail (widget != NULL);
-
- toolbar = EGG_TOOLBAR (container);
-
- if (EGG_IS_TOOL_ITEM (widget))
- egg_toolbar_insert (toolbar, EGG_TOOL_ITEM (widget), 0);
- else
- egg_toolbar_append_widget (toolbar, widget, NULL, NULL);
-}
-
-static void
-egg_toolbar_remove (GtkContainer *container,
- GtkWidget *widget)
-{
- EggToolbar *toolbar;
- EggToolItem *item = NULL;
-
- g_return_if_fail (EGG_IS_TOOLBAR (container));
-
- toolbar = EGG_TOOLBAR (container);
-
- if (EGG_IS_TOOL_ITEM (widget))
- {
- item = EGG_TOOL_ITEM (widget);
- }
- else
- {
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- GList *list;
-
- for (list = priv->items; list != NULL; list = list->next)
- {
- if (GTK_BIN (list->data)->child == widget)
- {
- item = list->data;
- break;
- }
- }
- }
-
- g_return_if_fail (item != NULL);
-
- egg_toolbar_remove_tool_item (EGG_TOOLBAR (container), item);
-}
-
-static void
-egg_toolbar_forall (GtkContainer *container,
- gboolean include_internals,
- GtkCallback callback,
- gpointer callback_data)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (container);
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- GList *items;
-
- g_return_if_fail (callback != NULL);
-
- items = priv->items;
-
- while (items)
- {
- EggToolItem *item = EGG_TOOL_ITEM (items->data);
-
- items = items->next;
-
- (*callback) (GTK_WIDGET (item), callback_data);
- }
-
- if (include_internals)
- (* callback) (priv->arrow_button, callback_data);
-}
-
-static GType
-egg_toolbar_child_type (GtkContainer *container)
-{
- return EGG_TYPE_TOOL_ITEM;
-}
-
-static void
-egg_toolbar_reconfigured (EggToolbar *toolbar)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- GList *items;
-
- items = priv->items;
- while (items)
- {
- EggToolItem *item = EGG_TOOL_ITEM (items->data);
-
- egg_tool_item_toolbar_reconfigured (item);
-
- items = items->next;
- }
-}
-
-static void
-egg_toolbar_real_orientation_changed (EggToolbar *toolbar,
- GtkOrientation orientation)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- if (toolbar->orientation != orientation)
- {
- toolbar->orientation = orientation;
-
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_arrow_set (GTK_ARROW (priv->arrow), GTK_ARROW_DOWN, GTK_SHADOW_NONE);
- else if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_LTR)
- gtk_arrow_set (GTK_ARROW (priv->arrow), GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
- else
- gtk_arrow_set (GTK_ARROW (priv->arrow), GTK_ARROW_LEFT, GTK_SHADOW_NONE);
-
- egg_toolbar_reconfigured (toolbar);
-
- gtk_widget_queue_resize (GTK_WIDGET (toolbar));
- g_object_notify (G_OBJECT (toolbar), "orientation");
- }
-}
-
-static void
-egg_toolbar_real_style_changed (EggToolbar *toolbar,
- GtkToolbarStyle style)
-{
- if (toolbar->style != style)
- {
- toolbar->style = style;
-
- egg_toolbar_reconfigured (toolbar);
-
- gtk_widget_queue_resize (GTK_WIDGET (toolbar));
- g_object_notify (G_OBJECT (toolbar), "toolbar_style");
- }
-}
-
-static void
-menu_position_func (GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- gpointer user_data)
-{
- EggToolbar *toolbar = EGG_TOOLBAR (user_data);
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- GtkRequisition req;
- GtkRequisition menu_req;
-
- gdk_window_get_origin (GTK_BUTTON (priv->arrow_button)->event_window, x, y);
- gtk_widget_size_request (priv->arrow_button, &req);
- gtk_widget_size_request (GTK_WIDGET (menu), &menu_req);
-
- if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- *y += priv->arrow_button->allocation.height;
- if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_LTR)
- *x += priv->arrow_button->allocation.width - req.width;
- else
- *x += req.width - menu_req.width;
- }
- else
- {
- if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_LTR)
- *x += priv->arrow_button->allocation.width;
- else
- *x -= menu_req.width;
- *y += priv->arrow_button->allocation.height - req.height;
- }
-
- *push_in = TRUE;
-}
-
-static void
-menu_deactivated (GtkWidget *menu,
- EggToolbar *toolbar)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->arrow_button), FALSE);
-}
-
-static void
-remove_item (GtkWidget *menu_item,
- gpointer data)
-{
- gtk_container_remove (GTK_CONTAINER (menu_item->parent), menu_item);
-}
-
-static void
-show_menu (EggToolbar *toolbar,
- GdkEventButton *event)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- GList *list;
-
- if (priv->menu)
- {
- gtk_container_foreach (GTK_CONTAINER (priv->menu), remove_item, NULL);
- gtk_widget_destroy (GTK_WIDGET (priv->menu));
- }
-
- priv->menu = GTK_MENU (gtk_menu_new ());
- g_signal_connect (priv->menu, "deactivate", G_CALLBACK (menu_deactivated), toolbar);
-
- for (list = priv->items; list != NULL; list = list->next)
- {
- EggToolItem *item = list->data;
-
- if (toolbar_item_visible (toolbar, item) && item->overflow_item)
- {
- GtkWidget *menu_item = egg_tool_item_retrieve_proxy_menu_item (item);
-
- if (menu_item)
- {
- g_assert (GTK_IS_MENU_ITEM (menu_item));
- gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), menu_item);
- }
- }
- }
-
- gtk_widget_show_all (GTK_WIDGET (priv->menu));
-
- gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL,
- menu_position_func, toolbar,
- event? event->button : 0, event? event->time : gtk_get_current_event_time());
-}
-
-static void
-egg_toolbar_arrow_button_clicked (GtkWidget *button,
- EggToolbar *toolbar)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->arrow_button)) &&
- (!priv->menu || !GTK_WIDGET_VISIBLE (GTK_WIDGET (priv->menu))))
- {
- /* We only get here when the button is clicked with the keybaord,
- * because mouse button presses result in the menu being shown so
- * that priv->menu would be non-NULL and visible.
- */
- show_menu (toolbar, NULL);
- gtk_menu_shell_select_first (GTK_MENU_SHELL (priv->menu), FALSE);
- }
-}
-
-static gboolean
-egg_toolbar_arrow_button_press (GtkWidget *button,
- GdkEventButton *event,
- EggToolbar *toolbar)
-{
- show_menu (toolbar, event);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
-
- return TRUE;
-}
-
-static gboolean
-egg_toolbar_button_press (GtkWidget *toolbar,
- GdkEventButton *event)
-{
- if (event->button == 3)
- g_signal_emit (toolbar, toolbar_signals[POPUP_CONTEXT_MENU], 0, NULL);
-
- return FALSE;
-}
-
-static void
-egg_toolbar_update_button_relief (EggToolbar *toolbar)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- egg_toolbar_reconfigured (toolbar);
-
- gtk_button_set_relief (GTK_BUTTON (priv->arrow_button), get_button_relief (toolbar));
-}
-
-static GtkReliefStyle
-get_button_relief (EggToolbar *toolbar)
-{
- GtkReliefStyle button_relief = GTK_RELIEF_NORMAL;
-
- gtk_widget_ensure_style (GTK_WIDGET (toolbar));
-
- gtk_widget_style_get (GTK_WIDGET (toolbar),
- "button_relief", &button_relief,
- NULL);
-
- return button_relief;
-}
-
-static gint
-get_space_size (EggToolbar *toolbar)
-{
- gint space_size = DEFAULT_SPACE_SIZE;
-
- gtk_widget_style_get (GTK_WIDGET (toolbar),
- "space_size", &space_size,
- NULL);
-
- return space_size;
-}
-
-static EggToolbarSpaceStyle
-get_space_style (EggToolbar *toolbar)
-{
- EggToolbarSpaceStyle space_style = DEFAULT_SPACE_STYLE;
-
- gtk_widget_style_get (GTK_WIDGET (toolbar),
- "space_style", &space_style,
- NULL);
-
-
- return space_style;
-}
-
-static gint
-get_internal_padding (EggToolbar *toolbar)
-{
- gint ipadding = 0;
-
- gtk_widget_style_get (GTK_WIDGET (toolbar),
- "internal_padding", &ipadding,
- NULL);
-
- return ipadding;
-}
-
-static gboolean
-egg_toolbar_check_old_api (EggToolbar *toolbar)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- if (priv->api_mode == NEW_API)
- {
- g_warning ("mixing deprecated and non-deprecated EggToolbar API is not allowed");
- return FALSE;
- }
-
- priv->api_mode = OLD_API;
- return TRUE;
-}
-
-static gboolean
-egg_toolbar_check_new_api (EggToolbar *toolbar)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- if (priv->api_mode == OLD_API)
- {
- g_warning ("mixing deprecated and non-deprecated EggToolbar API is not allowed");
- return FALSE;
- }
-
- priv->api_mode = NEW_API;
- return TRUE;
-}
-
-static void
-egg_toolbar_insert_tool_item (EggToolbar *toolbar,
- EggToolItem *item,
- gint pos)
-{
- EggToolbarPrivate *priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- priv->items = g_list_insert (priv->items, item, pos);
- toolbar->num_children++;
-
- gtk_widget_set_parent (GTK_WIDGET (item), GTK_WIDGET (toolbar));
-}
-
-static void
-egg_toolbar_remove_tool_item (EggToolbar *toolbar,
- EggToolItem *item)
-{
- EggToolbarPrivate *priv;
- GList *tmp;
-
- g_return_if_fail (EGG_IS_TOOLBAR (toolbar));
- g_return_if_fail (EGG_IS_TOOL_ITEM (item));
-
- priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- for (tmp = priv->items; tmp != NULL; tmp = tmp->next)
- {
- GtkWidget *child = tmp->data;
-
- if (child == GTK_WIDGET (item))
- {
- gboolean was_visible;
-
- was_visible = GTK_WIDGET_VISIBLE (item);
- gtk_widget_unparent (GTK_WIDGET (item));
-
- priv->items = g_list_remove_link (priv->items, tmp);
- toolbar->num_children--;
-
- if (was_visible && GTK_WIDGET_VISIBLE (toolbar))
- gtk_widget_queue_resize (GTK_WIDGET (toolbar));
-
- break;
- }
- }
-}
-
-GtkWidget *
-egg_toolbar_new (void)
-{
- EggToolbar *toolbar;
-
- toolbar = g_object_new (EGG_TYPE_TOOLBAR, NULL);
-
- return GTK_WIDGET (toolbar);
-}
-
-void
-egg_toolbar_insert (EggToolbar *toolbar,
- EggToolItem *item,
- gint pos)
-{
- g_return_if_fail (EGG_IS_TOOLBAR (toolbar));
- g_return_if_fail (EGG_IS_TOOL_ITEM (item));
-
- if (!egg_toolbar_check_new_api (toolbar))
- return;
-
- egg_toolbar_insert_tool_item (toolbar, item, pos);
-}
-
-gint
-egg_toolbar_get_item_index (EggToolbar *toolbar,
- EggToolItem *item)
-{
- EggToolbarPrivate *priv;
-
- g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), -1);
- g_return_val_if_fail (EGG_IS_TOOL_ITEM (item), -1);
-
- if (!egg_toolbar_check_new_api (toolbar))
- return -1;
-
- priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- g_return_val_if_fail (g_list_find (priv->items, item) != NULL, -1);
-
- return g_list_index (priv->items, item);
-}
-
-void
-egg_toolbar_set_orientation (EggToolbar *toolbar,
- GtkOrientation orientation)
-{
- g_return_if_fail (EGG_IS_TOOLBAR (toolbar));
-
- g_signal_emit (toolbar, toolbar_signals[ORIENTATION_CHANGED], 0, orientation);
-}
-
-GtkOrientation
-egg_toolbar_get_orientation (EggToolbar *toolbar)
-{
- g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), GTK_ORIENTATION_HORIZONTAL);
-
- return toolbar->orientation;
-}
-
-void
-egg_toolbar_set_style (EggToolbar *toolbar,
- GtkToolbarStyle style)
-{
- g_return_if_fail (EGG_IS_TOOLBAR (toolbar));
-
- toolbar->style_set = TRUE;
- g_signal_emit (toolbar, toolbar_signals[STYLE_CHANGED], 0, style);
-
-
-}
-
-GtkToolbarStyle
-egg_toolbar_get_style (EggToolbar *toolbar)
-{
- g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), DEFAULT_TOOLBAR_STYLE);
-
- return toolbar->style;
-}
-
-void
-egg_toolbar_unset_style (EggToolbar *toolbar)
-{
- GtkToolbarStyle style;
-
- g_return_if_fail (EGG_IS_TOOLBAR (toolbar));
-
- if (toolbar->style_set)
- {
- GtkSettings *settings = toolbar_get_settings (toolbar);
-
- if (settings)
- g_object_get (settings,
- "gtk-toolbar-style", &style,
- NULL);
- else
- style = DEFAULT_TOOLBAR_STYLE;
-
- if (style != toolbar->style)
- g_signal_emit (toolbar, toolbar_signals[STYLE_CHANGED], 0, style);
-
- toolbar->style_set = FALSE;
- }
-}
-
-void
-egg_toolbar_set_tooltips (EggToolbar *toolbar,
- gboolean enable)
-{
- g_return_if_fail (EGG_IS_TOOLBAR (toolbar));
-
- if (enable)
- gtk_tooltips_enable (toolbar->tooltips);
- else
- gtk_tooltips_disable (toolbar->tooltips);
-}
-
-gboolean
-egg_toolbar_get_tooltips (EggToolbar *toolbar)
-{
- g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), FALSE);
-
- return toolbar->tooltips->enabled;
-}
-
-gint
-egg_toolbar_get_n_items (EggToolbar *toolbar)
-{
- EggToolbarPrivate *priv;
-
- g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), -1);
-
- if (!egg_toolbar_check_new_api (toolbar))
- return -1;
-
- priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- return g_list_length (priv->items);
-}
-
-/*
- * returns NULL if n is out of range
- */
-EggToolItem *
-egg_toolbar_get_nth_item (EggToolbar *toolbar,
- gint n)
-{
- EggToolbarPrivate *priv;
-
- g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), NULL);
-
- if (!egg_toolbar_check_new_api (toolbar))
- return NULL;
-
- priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- return g_list_nth_data (priv->items, n);
-}
-
-void
-egg_toolbar_set_icon_size (EggToolbar *toolbar,
- GtkIconSize icon_size)
-{
- g_return_if_fail (EGG_IS_TOOLBAR (toolbar));
-
- toolbar->icon_size_set = TRUE;
-
- if (toolbar->icon_size == icon_size)
- return;
-
- toolbar->icon_size = icon_size;
-
- egg_toolbar_reconfigured (toolbar);
-
- gtk_widget_queue_resize (GTK_WIDGET (toolbar));
-}
-
-GtkIconSize
-egg_toolbar_get_icon_size (EggToolbar *toolbar)
-{
- g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), DEFAULT_ICON_SIZE);
-
- return toolbar->icon_size;
-}
-
-GtkReliefStyle
-egg_toolbar_get_relief_style (EggToolbar *toolbar)
-{
- g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), GTK_RELIEF_NONE);
-
- return get_button_relief (toolbar);
-}
-
-void
-egg_toolbar_unset_icon_size (EggToolbar *toolbar)
-{
- GtkIconSize size;
-
- g_return_if_fail (EGG_IS_TOOLBAR (toolbar));
-
- if (toolbar->icon_size_set)
- {
- GtkSettings *settings = toolbar_get_settings (toolbar);
-
- if (settings)
- {
- g_object_get (settings,
- "gtk-toolbar-icon-size", &size,
- NULL);
- }
- else
- size = DEFAULT_ICON_SIZE;
-
- if (size != toolbar->icon_size)
- egg_toolbar_set_icon_size (toolbar, size);
-
- toolbar->icon_size_set = FALSE;
- }
-}
-
-void
-egg_toolbar_set_show_arrow (EggToolbar *toolbar,
- gboolean show_arrow)
-{
- EggToolbarPrivate *priv;
-
- g_return_if_fail (EGG_IS_TOOLBAR (toolbar));
-
- priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
- show_arrow = show_arrow != FALSE;
-
- if (priv->show_arrow != show_arrow)
- {
- priv->show_arrow = show_arrow;
-
- if (!priv->show_arrow)
- gtk_widget_hide (priv->arrow_button);
-
- gtk_widget_queue_resize (GTK_WIDGET (toolbar));
- g_object_notify (G_OBJECT (toolbar), "show_arrow");
- }
-}
-
-gboolean
-egg_toolbar_get_show_arrow (EggToolbar *toolbar)
-{
- EggToolbarPrivate *priv;
-
- g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), FALSE);
-
- if (!egg_toolbar_check_new_api (toolbar))
- return FALSE;
-
- priv = EGG_TOOLBAR_GET_PRIVATE (toolbar);
-
- return priv->show_arrow;
-}
-
-gint
-egg_toolbar_get_drop_index (EggToolbar *toolbar,
- gint x,
- gint y)
-{
- gint drop_index, drop_pos;
-
- g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), FALSE);
-
- if (!egg_toolbar_check_new_api (toolbar))
- return -1;
-
- find_drop_pos (toolbar, x, y, &drop_index, &drop_pos);
-
- return drop_index;
-}
-
-GtkWidget *
-egg_toolbar_append_item (EggToolbar *toolbar,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data)
-{
- return egg_toolbar_insert_element (toolbar, EGG_TOOLBAR_CHILD_BUTTON,
- NULL, text,
- tooltip_text, tooltip_private_text,
- icon, callback, user_data,
- toolbar->num_children);
-}
-
-GtkWidget *
-egg_toolbar_prepend_item (EggToolbar *toolbar,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data)
-{
- return egg_toolbar_insert_element (toolbar, EGG_TOOLBAR_CHILD_BUTTON,
- NULL, text,
- tooltip_text, tooltip_private_text,
- icon, callback, user_data,
- 0);
-}
-
-GtkWidget *
-egg_toolbar_insert_item (EggToolbar *toolbar,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data,
- gint position)
-{
- return egg_toolbar_insert_element (toolbar, EGG_TOOLBAR_CHILD_BUTTON,
- NULL, text,
- tooltip_text, tooltip_private_text,
- icon, callback, user_data,
- position);
-}
-
-GtkWidget*
-egg_toolbar_insert_stock (EggToolbar *toolbar,
- const gchar *stock_id,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkSignalFunc callback,
- gpointer user_data,
- gint position)
-{
- return egg_toolbar_internal_insert_element (toolbar, EGG_TOOLBAR_CHILD_BUTTON,
- NULL, stock_id,
- tooltip_text, tooltip_private_text,
- NULL, callback, user_data,
- position, TRUE);
-}
-
-void
-egg_toolbar_append_space (EggToolbar *toolbar)
-{
- egg_toolbar_insert_element (toolbar, EGG_TOOLBAR_CHILD_SPACE,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL, NULL,
- toolbar->num_children);
-}
-
-void
-egg_toolbar_prepend_space (EggToolbar *toolbar)
-{
- egg_toolbar_insert_element (toolbar, EGG_TOOLBAR_CHILD_SPACE,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL, NULL,
- 0);
-}
-
-void
-egg_toolbar_insert_space (EggToolbar *toolbar,
- gint position)
-{
- egg_toolbar_insert_element (toolbar, EGG_TOOLBAR_CHILD_SPACE,
- NULL, NULL,
- NULL, NULL,
- NULL, NULL, NULL,
- position);
-}
-
-void
-egg_toolbar_remove_space (EggToolbar *toolbar,
- gint position)
-{
- EggToolItem *item;
-
- g_return_if_fail (EGG_IS_TOOLBAR (toolbar));
-
- if (!egg_toolbar_check_old_api (toolbar))
- return;
-
- item = g_list_nth_data (toolbar->children, position);
-
- if (!item)
- {
- g_warning ("Toolbar position %d doesn't exist", position);
- return;
- }
-
- if (GTK_BIN (item)->child)
- {
- g_warning ("Toolbar position %d is not a space", position);
- }
-
- egg_toolbar_remove_tool_item (toolbar, item);
-}
-
-void
-egg_toolbar_append_widget (EggToolbar *toolbar,
- GtkWidget *widget,
- const gchar *tooltip_text,
- const gchar *tooltip_private_text)
-{
- egg_toolbar_insert_element (toolbar, EGG_TOOLBAR_CHILD_WIDGET,
- widget, NULL,
- tooltip_text, tooltip_private_text,
- NULL, NULL, NULL,
- toolbar->num_children);
-}
-
-void
-egg_toolbar_prepend_widget (EggToolbar *toolbar,
- GtkWidget *widget,
- const gchar *tooltip_text,
- const gchar *tooltip_private_text)
-{
- egg_toolbar_insert_element (toolbar, EGG_TOOLBAR_CHILD_WIDGET,
- widget, NULL,
- tooltip_text, tooltip_private_text,
- NULL, NULL, NULL,
- 0);
-}
-
-void
-egg_toolbar_insert_widget (EggToolbar *toolbar,
- GtkWidget *widget,
- const char *tooltip_text,
- const char *tooltip_private_text,
- gint position)
-{
- egg_toolbar_insert_element (toolbar, EGG_TOOLBAR_CHILD_WIDGET,
- widget, NULL,
- tooltip_text, tooltip_private_text,
- NULL, NULL, NULL,
- position);
-}
-
-GtkWidget*
-egg_toolbar_append_element (EggToolbar *toolbar,
- GtkToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data)
-{
- return egg_toolbar_insert_element (toolbar, type, widget, text,
- tooltip_text, tooltip_private_text,
- icon, callback, user_data,
- toolbar->num_children);
-}
-
-GtkWidget *
-egg_toolbar_prepend_element (EggToolbar *toolbar,
- GtkToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data)
-{
- return egg_toolbar_insert_element (toolbar, type, widget, text,
- tooltip_text, tooltip_private_text,
- icon, callback, user_data, 0);
-}
-
-GtkWidget *
-egg_toolbar_insert_element (EggToolbar *toolbar,
- EggToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data,
- gint position)
-{
- return egg_toolbar_internal_insert_element (toolbar, type, widget, text,
- tooltip_text, tooltip_private_text,
- icon, callback, user_data, position, FALSE);
-}
-
-static gchar *
-elide_underscores (const gchar *original)
-{
- gchar *q, *result;
- const gchar *p;
- gboolean last_underscore;
-
- q = result = g_malloc (strlen (original) + 1);
- last_underscore = FALSE;
-
- for (p = original; *p; p++)
- {
- if (!last_underscore && *p == '_')
- last_underscore = TRUE;
- else
- {
- last_underscore = FALSE;
- *q++ = *p;
- }
- }
-
- *q = '\0';
-
- return result;
-}
-
-static GtkWidget *
-egg_toolbar_internal_insert_element (EggToolbar *toolbar,
- EggToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data,
- gint position,
- gboolean use_stock)
-{
- EggToolbarChild *child;
- EggToolItem *item = NULL;
-
- g_return_val_if_fail (EGG_IS_TOOLBAR (toolbar), NULL);
-
- if (!egg_toolbar_check_old_api (toolbar))
- return NULL;
-
- if (type == EGG_TOOLBAR_CHILD_WIDGET)
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
- else if (type != EGG_TOOLBAR_CHILD_RADIOBUTTON)
- g_return_val_if_fail (widget == NULL, NULL);
-
- child = g_new (EggToolbarChild, 1);
-
- child->type = type;
- child->icon = NULL;
- child->label = NULL;
-
- switch (type)
- {
- case EGG_TOOLBAR_CHILD_SPACE:
- item = egg_separator_tool_item_new ();
- child->widget = NULL;
- break;
-
- case EGG_TOOLBAR_CHILD_WIDGET:
- item = egg_tool_item_new ();
- child->widget = widget;
- gtk_container_add (GTK_CONTAINER (item), child->widget);
- break;
-
- case EGG_TOOLBAR_CHILD_BUTTON:
- item = egg_tool_button_new ();
- child->widget = EGG_TOOL_BUTTON (item)->button;
- break;
-
- case EGG_TOOLBAR_CHILD_TOGGLEBUTTON:
- item = egg_toggle_tool_button_new ();
- child->widget = EGG_TOOL_BUTTON (item)->button;
- break;
-
- case EGG_TOOLBAR_CHILD_RADIOBUTTON:
- item = egg_radio_tool_button_new (widget
- ? gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget))
- : NULL);
- child->widget = EGG_TOOL_BUTTON (item)->button;
- break;
- }
-
- gtk_widget_show (GTK_WIDGET (item));
-
- if (type == EGG_TOOLBAR_CHILD_BUTTON ||
- type == EGG_TOOLBAR_CHILD_RADIOBUTTON ||
- type == EGG_TOOLBAR_CHILD_TOGGLEBUTTON)
- {
- if (text)
- {
- if (use_stock)
- {
- GtkStockItem stock_item;
- gchar *label_text;
-
- egg_tool_button_set_stock_id (EGG_TOOL_BUTTON (item), text);
-
- gtk_stock_lookup (text, &stock_item);
- label_text = elide_underscores (stock_item.label);
- child->label = GTK_WIDGET (gtk_label_new (label_text));
- g_free (label_text);
- }
- else
- {
- child->label = gtk_label_new (text);
- }
- egg_tool_button_set_label_widget (EGG_TOOL_BUTTON (item), child->label);
- gtk_widget_show (child->label);
- }
-
- if (icon)
- {
- child->icon = icon;
- egg_tool_button_set_icon_widget (EGG_TOOL_BUTTON (item), icon);
-
- /* Applications depend on the toolbar showing the widget for them */
- gtk_widget_show (GTK_WIDGET (icon));
- }
-
- /*
- * We need to connect to the button's clicked callback because some
- * programs may rely on that the widget in the callback is a GtkButton
- */
- if (callback)
- g_signal_connect (child->widget, "clicked",
- callback, user_data);
- }
-
- if ((type != GTK_TOOLBAR_CHILD_SPACE) && tooltip_text)
- egg_tool_item_set_tooltip (item, toolbar->tooltips,
- tooltip_text, tooltip_private_text);
-
- toolbar->children = g_list_insert (toolbar->children, child, position);
-
- egg_toolbar_insert_tool_item (toolbar, item, position);
-
- return child->widget;
-}
diff --git a/lib/egg/eggtoolbar.h b/lib/egg/eggtoolbar.h
deleted file mode 100644
index a83a5da49..000000000
--- a/lib/egg/eggtoolbar.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * GtkToolbar copyright (C) Federico Mena
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __EGG_TOOLBAR_H__
-#define __EGG_TOOLBAR_H__
-
-#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtktooltips.h>
-
-#include "eggtoolitem.h"
-
-#ifndef GTK_DISABLE_DEPRECATED
-
-/* Not needed, retained for compatibility -Yosh */
-#include <gtk/gtkpixmap.h>
-#include <gtk/gtksignal.h>
-
-#endif
-
-G_BEGIN_DECLS
-
-#define EGG_TYPE_TOOLBAR (egg_toolbar_get_type ())
-#define EGG_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TOOLBAR, EggToolbar))
-#define EGG_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TOOLBAR, EggToolbarClass))
-#define EGG_IS_TOOLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TOOLBAR))
-#define EGG_IS_TOOLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EGG_TYPE_TOOLBAR))
-#define EGG_TOOLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TOOLBAR, EggToolbarClass))
-
-#ifndef EGG_DISABLE_DEPRECATED
-typedef enum
-{
- EGG_TOOLBAR_CHILD_SPACE,
- EGG_TOOLBAR_CHILD_BUTTON,
- EGG_TOOLBAR_CHILD_TOGGLEBUTTON,
- EGG_TOOLBAR_CHILD_RADIOBUTTON,
- EGG_TOOLBAR_CHILD_WIDGET
-} EggToolbarChildType;
-
-typedef struct _EggToolbarChild EggToolbarChild;
-
-struct _EggToolbarChild
-{
- EggToolbarChildType type;
- GtkWidget *widget;
- GtkWidget *icon;
- GtkWidget *label;
-};
-
-typedef enum
-{
- EGG_TOOLBAR_SPACE_EMPTY,
- EGG_TOOLBAR_SPACE_LINE
-} EggToolbarSpaceStyle;
-
-#endif /* EGG_DISABLE_DEPRECATED */
-
-typedef struct _EggToolbar EggToolbar;
-typedef struct _EggToolbarClass EggToolbarClass;
-
-struct _EggToolbar
-{
- GtkContainer container;
-
- gint num_children;
- GList *children;
- GtkOrientation orientation;
- GtkToolbarStyle style;
- GtkIconSize icon_size;
-
- GtkTooltips *tooltips;
-
- gint button_maxw; /* maximum width of homogeneous children */
- gint button_maxh; /* maximum height of homogeneous children */
-
- guint style_set_connection;
- guint icon_size_connection;
-
- guint style_set : 1;
- guint icon_size_set : 1;
-};
-
-struct _EggToolbarClass
-{
- GtkContainerClass parent_class;
-
- /* signals */
- void (* orientation_changed) (EggToolbar *toolbar,
- GtkOrientation orientation);
- void (* style_changed) (EggToolbar *toolbar,
- GtkToolbarStyle style);
- void (* popup_context_menu) (EggToolbar *toolbar);
-
- /* keybinding signals -- these should go away/become padding when we become part of gtk+ */
- gboolean (* move_focus) (EggToolbar *toolbar,
- GtkDirectionType dir);
- gboolean (* focus_ends) (EggToolbar *toolbar,
- gboolean home);
-
- /* Padding for future expansion */
- void (*_gtk_reserved1) (void);
-};
-
-GType egg_toolbar_get_type (void) G_GNUC_CONST;
-GtkWidget* egg_toolbar_new (void);
-
-void egg_toolbar_insert (EggToolbar *toolbar,
- EggToolItem *item,
- gint pos);
-gint egg_toolbar_get_item_index (EggToolbar *toolbar,
- EggToolItem *item);
-gint egg_toolbar_get_n_items (EggToolbar *toolbar);
-EggToolItem * egg_toolbar_get_nth_item (EggToolbar *toolbar,
- gint n);
-gint egg_toolbar_get_drop_index (EggToolbar *toolbar,
- gint x,
- gint y);
-void egg_toolbar_set_show_arrow (EggToolbar *toolbar,
- gboolean show_arrow);
-void egg_toolbar_set_orientation (EggToolbar *toolbar,
- GtkOrientation orientation);
-void egg_toolbar_set_tooltips (EggToolbar *toolbar,
- gboolean enable);
-void egg_toolbar_unset_icon_size (EggToolbar *toolbar);
-gboolean egg_toolbar_get_show_arrow (EggToolbar *toolbar);
-GtkOrientation egg_toolbar_get_orientation (EggToolbar *toolbar);
-GtkToolbarStyle egg_toolbar_get_style (EggToolbar *toolbar);
-GtkIconSize egg_toolbar_get_icon_size (EggToolbar *toolbar);
-gboolean egg_toolbar_get_tooltips (EggToolbar *toolbar);
-GtkReliefStyle egg_toolbar_get_relief_style (EggToolbar *toolbar);
-
-#ifndef EGG_DISABLE_DEPRECATED
-/* Simple button items */
-void egg_toolbar_set_style (EggToolbar *toolbar,
- GtkToolbarStyle style);
-void egg_toolbar_set_icon_size (EggToolbar *toolbar,
- GtkIconSize icon_size);
-void egg_toolbar_unset_style (EggToolbar *toolbar);
-GtkWidget* egg_toolbar_append_item (EggToolbar *toolbar,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data);
-GtkWidget* egg_toolbar_prepend_item (EggToolbar *toolbar,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data);
-GtkWidget* egg_toolbar_insert_item (EggToolbar *toolbar,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data,
- gint position);
-
-/* Stock Items */
-GtkWidget* egg_toolbar_insert_stock (EggToolbar *toolbar,
- const gchar *stock_id,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkSignalFunc callback,
- gpointer user_data,
- gint position);
-
-/* Space Items */
-void egg_toolbar_append_space (EggToolbar *toolbar);
-void egg_toolbar_prepend_space (EggToolbar *toolbar);
-void egg_toolbar_insert_space (EggToolbar *toolbar,
- gint position);
-void egg_toolbar_remove_space (EggToolbar *toolbar,
- gint position);
-/* Any element type */
-GtkWidget* egg_toolbar_append_element (EggToolbar *toolbar,
- EggToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data);
-
-GtkWidget* egg_toolbar_prepend_element (EggToolbar *toolbar,
- EggToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data);
-
-GtkWidget* egg_toolbar_insert_element (EggToolbar *toolbar,
- EggToolbarChildType type,
- GtkWidget *widget,
- const char *text,
- const char *tooltip_text,
- const char *tooltip_private_text,
- GtkWidget *icon,
- GtkSignalFunc callback,
- gpointer user_data,
- gint position);
-
-/* Generic Widgets */
-void egg_toolbar_append_widget (EggToolbar *toolbar,
- GtkWidget *widget,
- const char *tooltip_text,
- const char *tooltip_private_text);
-void egg_toolbar_prepend_widget (EggToolbar *toolbar,
- GtkWidget *widget,
- const char *tooltip_text,
- const char *tooltip_private_text);
-void egg_toolbar_insert_widget (EggToolbar *toolbar,
- GtkWidget *widget,
- const char *tooltip_text,
- const char *tooltip_private_text,
- gint position);
-
-#endif /* EGG_DISABLE_DEPRECATED */
-
-
-G_END_DECLS
-
-#endif /* __EGG_TOOLBAR_H__ */
diff --git a/lib/egg/eggtoolitem.c b/lib/egg/eggtoolitem.c
deleted file mode 100644
index 85b32e7c6..000000000
--- a/lib/egg/eggtoolitem.c
+++ /dev/null
@@ -1,754 +0,0 @@
-/* eggtoolitem.c
- *
- * Copyright (C) 2002 Anders Carlsson <andersca@codefactory.se>
- * Copyright (C) 2002 James Henstridge <james@daa.com.au>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "eggtoolitem.h"
-#include "eggmarshalers.h"
-#include "eggtoolbar.h"
-#include <gtk/gtkseparatormenuitem.h>
-#include <string.h>
-
-#ifndef _
-# define _(s) (s)
-#endif
-
-#define MENU_ID "egg-tool-item-menu-id"
-
-enum {
- CREATE_MENU_PROXY,
- TOOLBAR_RECONFIGURED,
- SET_TOOLTIP,
- LAST_SIGNAL
-};
-
-enum {
- PROP_0,
- PROP_VISIBLE_HORIZONTAL,
- PROP_VISIBLE_VERTICAL,
- PROP_IS_IMPORTANT
-};
-
-static void egg_tool_item_init (EggToolItem *toolitem);
-static void egg_tool_item_class_init (EggToolItemClass *class);
-static void egg_tool_item_finalize (GObject *object);
-static void egg_tool_item_parent_set (GtkWidget *toolitem,
- GtkWidget *parent);
-static void egg_tool_item_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void egg_tool_item_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-static void egg_tool_item_realize (GtkWidget *widget);
-static void egg_tool_item_unrealize (GtkWidget *widget);
-static void egg_tool_item_map (GtkWidget *widget);
-static void egg_tool_item_unmap (GtkWidget *widget);
-static void egg_tool_item_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void egg_tool_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static gboolean egg_tool_item_real_set_tooltip (EggToolItem *tool_item,
- GtkTooltips *tooltips,
- const gchar *tip_text,
- const gchar *tip_private);
-
-static gboolean egg_tool_item_create_menu_proxy (EggToolItem *item);
-
-
-static GObjectClass *parent_class = NULL;
-static guint toolitem_signals[LAST_SIGNAL] = { 0 };
-
-GType
-egg_tool_item_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GTypeInfo type_info =
- {
- sizeof (EggToolItemClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) egg_tool_item_class_init,
- (GClassFinalizeFunc) NULL,
- NULL,
-
- sizeof (EggToolItem),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_tool_item_init,
- };
-
- type = g_type_register_static (GTK_TYPE_BIN,
- "EggToolItem",
- &type_info, 0);
- }
- return type;
-}
-
-static gboolean
-egg_boolean_handled_accumulator (GSignalInvocationHint *ihint,
- GValue *return_accu,
- const GValue *handler_return,
- gpointer dummy)
-{
- gboolean continue_emission;
- gboolean signal_handled;
-
- signal_handled = g_value_get_boolean (handler_return);
- g_value_set_boolean (return_accu, signal_handled);
- continue_emission = !signal_handled;
-
- return continue_emission;
-}
-
-static void
-egg_tool_item_class_init (EggToolItemClass *klass)
-{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- parent_class = g_type_class_peek_parent (klass);
- object_class = (GObjectClass *)klass;
- widget_class = (GtkWidgetClass *)klass;
-
- object_class->set_property = egg_tool_item_set_property;
- object_class->get_property = egg_tool_item_get_property;
- object_class->finalize = egg_tool_item_finalize;
-
- widget_class->realize = egg_tool_item_realize;
- widget_class->unrealize = egg_tool_item_unrealize;
- widget_class->map = egg_tool_item_map;
- widget_class->unmap = egg_tool_item_unmap;
- widget_class->size_request = egg_tool_item_size_request;
- widget_class->size_allocate = egg_tool_item_size_allocate;
- widget_class->parent_set = egg_tool_item_parent_set;
-
- klass->create_menu_proxy = egg_tool_item_create_menu_proxy;
- klass->set_tooltip = egg_tool_item_real_set_tooltip;
-
- g_object_class_install_property (object_class,
- PROP_VISIBLE_HORIZONTAL,
- g_param_spec_boolean ("visible_horizontal",
- _("Visible when horizontal"),
- _("Whether the toolbar item is visible when the toolbar is in a horizontal orientation."),
- TRUE,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_VISIBLE_VERTICAL,
- g_param_spec_boolean ("visible_vertical",
- _("Visible when vertical"),
- _("Whether the toolbar item is visible when the toolbar is in a vertical orientation."),
- TRUE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class,
- PROP_IS_IMPORTANT,
- g_param_spec_boolean ("is_important",
- _("Is important"),
- _("Whether the toolbar item is considered important. When TRUE, toolbar buttons show text in GTK_TOOLBAR_BOTH_HORIZ mode"),
- FALSE,
- G_PARAM_READWRITE));
-
- toolitem_signals[CREATE_MENU_PROXY] =
- g_signal_new ("create_menu_proxy",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggToolItemClass, create_menu_proxy),
- egg_boolean_handled_accumulator, NULL, /* FIXME: use gtk_boolean_handled() when
- * we are added to gtk+
- */
- _egg_marshal_BOOLEAN__VOID,
- G_TYPE_BOOLEAN, 0);
- toolitem_signals[TOOLBAR_RECONFIGURED] =
- g_signal_new ("toolbar_reconfigured",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggToolItemClass, toolbar_reconfigured),
- NULL, NULL,
- _egg_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- toolitem_signals[SET_TOOLTIP] =
- g_signal_new ("set_tooltip",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EggToolItemClass, set_tooltip),
- egg_boolean_handled_accumulator, NULL, /* FIXME: use gtk_boolean_handled() when
- * we are added to gtk+
- */
- _egg_marshal_BOOLEAN__OBJECT_STRING_STRING,
- G_TYPE_BOOLEAN, 3,
- GTK_TYPE_TOOLTIPS,
- G_TYPE_STRING,
- G_TYPE_STRING);
-}
-
-static void
-egg_tool_item_init (EggToolItem *toolitem)
-{
- GTK_WIDGET_UNSET_FLAGS (toolitem, GTK_CAN_FOCUS);
-
- toolitem->visible_horizontal = TRUE;
- toolitem->visible_vertical = TRUE;
- toolitem->homogeneous = FALSE;
- toolitem->expand = FALSE;
-}
-
-static void
-egg_tool_item_finalize (GObject *object)
-{
- EggToolItem *item = EGG_TOOL_ITEM (object);
-
- if (item->menu_item)
- g_object_unref (item->menu_item);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-egg_tool_item_parent_set (GtkWidget *toolitem,
- GtkWidget *prev_parent)
-{
- egg_tool_item_toolbar_reconfigured (EGG_TOOL_ITEM (toolitem));
-}
-
-gboolean
-egg_tool_item_get_is_important (EggToolItem *tool_item)
-{
- g_return_val_if_fail (EGG_IS_TOOL_ITEM (tool_item), FALSE);
-
- return tool_item->is_important;
-}
-
-void
-egg_tool_item_set_is_important (EggToolItem *tool_item, gboolean is_important)
-{
- g_return_if_fail (EGG_IS_TOOL_ITEM (tool_item));
-
- is_important = is_important != FALSE;
-
- if (is_important != tool_item->is_important)
- {
- tool_item->is_important = is_important;
-
- gtk_widget_queue_resize (GTK_WIDGET (tool_item));
-
- g_object_notify (G_OBJECT (tool_item), "is_important");
- }
-}
-
-static void
-egg_tool_item_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EggToolItem *toolitem = EGG_TOOL_ITEM (object);
-
- switch (prop_id)
- {
- case PROP_VISIBLE_HORIZONTAL:
- egg_tool_item_set_visible_horizontal (toolitem, g_value_get_boolean (value));
- break;
- case PROP_VISIBLE_VERTICAL:
- egg_tool_item_set_visible_horizontal (toolitem, g_value_get_boolean (value));
- break;
- case PROP_IS_IMPORTANT:
- egg_tool_item_set_is_important (toolitem, g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-egg_tool_item_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EggToolItem *toolitem = EGG_TOOL_ITEM (object);
-
- switch (prop_id)
- {
- case PROP_VISIBLE_HORIZONTAL:
- g_value_set_boolean (value, toolitem->visible_horizontal);
- break;
- case PROP_VISIBLE_VERTICAL:
- g_value_set_boolean (value, toolitem->visible_vertical);
- break;
- case PROP_IS_IMPORTANT:
- g_value_set_boolean (value, toolitem->is_important);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
-}
-
-static void
-create_drag_window (EggToolItem *toolitem)
-{
- GtkWidget *widget;
- GdkWindowAttr attributes;
- gint attributes_mask, border_width;
-
- g_return_if_fail (toolitem->use_drag_window == TRUE);
-
- widget = GTK_WIDGET (toolitem);
- border_width = GTK_CONTAINER (toolitem)->border_width;
-
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x + border_width;
- attributes.y = widget->allocation.y + border_width;
- attributes.width = widget->allocation.width - border_width * 2;
- attributes.height = widget->allocation.height - border_width * 2;
- attributes.wclass = GDK_INPUT_ONLY;
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= (GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
-
- attributes_mask = GDK_WA_X | GDK_WA_Y;
-
- toolitem->drag_window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (toolitem->drag_window, toolitem);
-}
-
-static void
-egg_tool_item_realize (GtkWidget *widget)
-{
- EggToolItem *toolitem;
-
- toolitem = EGG_TOOL_ITEM (widget);
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
- widget->window = gtk_widget_get_parent_window (widget);
- g_object_ref (widget->window);
-
- if (toolitem->use_drag_window)
- create_drag_window(toolitem);
-
- widget->style = gtk_style_attach (widget->style, widget->window);
-}
-
-static void
-destroy_drag_window (EggToolItem *toolitem)
-{
- if (toolitem->drag_window)
- {
- gdk_window_set_user_data (toolitem->drag_window, NULL);
- gdk_window_destroy (toolitem->drag_window);
- toolitem->drag_window = NULL;
- }
-}
-
-static void
-egg_tool_item_unrealize (GtkWidget *widget)
-{
- EggToolItem *toolitem;
-
- toolitem = EGG_TOOL_ITEM (widget);
-
- destroy_drag_window (toolitem);
-
- GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
-}
-
-static void
-egg_tool_item_map (GtkWidget *widget)
-{
- EggToolItem *toolitem;
-
- toolitem = EGG_TOOL_ITEM (widget);
- GTK_WIDGET_CLASS (parent_class)->map (widget);
- if (toolitem->drag_window)
- gdk_window_show (toolitem->drag_window);
-}
-
-static void
-egg_tool_item_unmap (GtkWidget *widget)
-{
- EggToolItem *toolitem;
-
- toolitem = EGG_TOOL_ITEM (widget);
- if (toolitem->drag_window)
- gdk_window_hide (toolitem->drag_window);
- GTK_WIDGET_CLASS (parent_class)->unmap (widget);
-}
-
-static void
-egg_tool_item_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- GtkWidget *child = GTK_BIN (widget)->child;
- gint xthickness = widget->style->xthickness;
- gint ythickness = widget->style->ythickness;
-
- if (child && GTK_WIDGET_VISIBLE (child))
- {
- gtk_widget_size_request (child, requisition);
- }
- else
- {
- requisition->height = 0;
- requisition->width = 0;
- }
-
- requisition->width += (xthickness + GTK_CONTAINER (widget)->border_width) * 2;
- requisition->height += (ythickness + GTK_CONTAINER (widget)->border_width) * 2;
-}
-
-static void
-egg_tool_item_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
-{
- EggToolItem *toolitem = EGG_TOOL_ITEM (widget);
- GtkAllocation child_allocation;
- gint border_width;
- GtkWidget *child = GTK_BIN (widget)->child;
-
- widget->allocation = *allocation;
- border_width = GTK_CONTAINER (widget)->border_width;
-
- if (toolitem->drag_window)
- gdk_window_move_resize (toolitem->drag_window,
- widget->allocation.x + border_width,
- widget->allocation.y + border_width,
- widget->allocation.width - border_width * 2,
- widget->allocation.height - border_width * 2);
-
- if (child && GTK_WIDGET_VISIBLE (child))
- {
- gint xthickness = widget->style->xthickness;
- gint ythickness = widget->style->ythickness;
-
- child_allocation.x = allocation->x + border_width + xthickness;
- child_allocation.y = allocation->y + border_width + ythickness;
- child_allocation.width = allocation->width - 2 * (xthickness + border_width);
- child_allocation.height = allocation->height - 2 * (ythickness + border_width);
-
- gtk_widget_size_allocate (child, &child_allocation);
- }
-}
-
-static gboolean
-egg_tool_item_create_menu_proxy (EggToolItem *item)
-{
- if (!GTK_BIN (item)->child)
- {
- GtkWidget *menu_item = NULL;
-
- menu_item = gtk_separator_menu_item_new();
-
- egg_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-EggToolItem *
-egg_tool_item_new (void)
-{
- EggToolItem *item;
-
- item = g_object_new (EGG_TYPE_TOOL_ITEM, NULL);
-
- return item;
-}
-
-GtkIconSize
-egg_tool_item_get_icon_size (EggToolItem *tool_item)
-{
- GtkWidget *parent;
-
- g_return_val_if_fail (EGG_IS_TOOL_ITEM (tool_item), GTK_ICON_SIZE_LARGE_TOOLBAR);
-
- parent = GTK_WIDGET (tool_item)->parent;
- if (!parent || !EGG_IS_TOOLBAR (parent))
- return GTK_ICON_SIZE_LARGE_TOOLBAR;
-
- return egg_toolbar_get_icon_size (EGG_TOOLBAR (parent));
-}
-
-GtkOrientation
-egg_tool_item_get_orientation (EggToolItem *tool_item)
-{
- GtkWidget *parent;
-
- g_return_val_if_fail (EGG_IS_TOOL_ITEM (tool_item), GTK_ORIENTATION_HORIZONTAL);
-
- parent = GTK_WIDGET (tool_item)->parent;
- if (!parent || !EGG_IS_TOOLBAR (parent))
- return GTK_ORIENTATION_HORIZONTAL;
-
- return egg_toolbar_get_orientation (EGG_TOOLBAR (parent));
-}
-
-GtkToolbarStyle
-egg_tool_item_get_toolbar_style (EggToolItem *tool_item)
-{
- GtkWidget *parent;
-
- g_return_val_if_fail (EGG_IS_TOOL_ITEM (tool_item), GTK_TOOLBAR_ICONS);
-
- parent = GTK_WIDGET (tool_item)->parent;
- if (!parent || !EGG_IS_TOOLBAR (parent))
- return GTK_TOOLBAR_ICONS;
-
- return egg_toolbar_get_style (EGG_TOOLBAR (parent));
-}
-
-GtkReliefStyle
-egg_tool_item_get_relief_style (EggToolItem *tool_item)
-{
- GtkWidget *parent;
-
- g_return_val_if_fail (EGG_IS_TOOL_ITEM (tool_item), GTK_RELIEF_NONE);
-
- parent = GTK_WIDGET (tool_item)->parent;
- if (!parent || !EGG_IS_TOOLBAR (parent))
- return GTK_RELIEF_NONE;
-
- return egg_toolbar_get_relief_style (EGG_TOOLBAR (parent));
-}
-
-void
-egg_tool_item_toolbar_reconfigured (EggToolItem *tool_item)
-{
- g_return_if_fail (EGG_IS_TOOL_ITEM (tool_item));
-
- g_signal_emit (tool_item, toolitem_signals[TOOLBAR_RECONFIGURED], 0);
-}
-
-void
-egg_tool_item_set_expand (EggToolItem *tool_item,
- gboolean expand)
-{
- g_return_if_fail (EGG_IS_TOOL_ITEM (tool_item));
-
- expand = expand != FALSE;
-
- if (tool_item->expand != expand)
- {
- tool_item->expand = expand;
- gtk_widget_child_notify (GTK_WIDGET (tool_item), "expand");
- gtk_widget_queue_resize (GTK_WIDGET (tool_item));
- }
-}
-
-void
-egg_tool_item_set_pack_end (EggToolItem *tool_item,
- gboolean pack_end)
-{
- g_return_if_fail (EGG_IS_TOOL_ITEM (tool_item));
-
- pack_end = pack_end != FALSE;
-
- if (tool_item->pack_end != pack_end)
- {
- tool_item->pack_end = pack_end;
- gtk_widget_child_notify (GTK_WIDGET (tool_item), "pack_end");
- gtk_widget_queue_resize (GTK_WIDGET (tool_item));
- }
-}
-
-void
-egg_tool_item_set_homogeneous (EggToolItem *tool_item,
- gboolean homogeneous)
-{
- g_return_if_fail (EGG_IS_TOOL_ITEM (tool_item));
-
- homogeneous = homogeneous != FALSE;
-
- if (tool_item->homogeneous != homogeneous)
- {
- tool_item->homogeneous = homogeneous;
- gtk_widget_child_notify (GTK_WIDGET (tool_item), "homogeneous");
- gtk_widget_queue_resize (GTK_WIDGET (tool_item));
- }
-}
-
-static gboolean
-egg_tool_item_real_set_tooltip (EggToolItem *tool_item,
- GtkTooltips *tooltips,
- const gchar *tip_text,
- const gchar *tip_private)
-{
- GtkWidget *child = GTK_BIN (tool_item)->child;
-
- if (!child)
- return FALSE;
-
- gtk_tooltips_set_tip (tooltips, child, tip_text, tip_private);
-
- return TRUE;
-}
-
-void
-egg_tool_item_set_tooltip (EggToolItem *tool_item,
- GtkTooltips *tooltips,
- const gchar *tip_text,
- const gchar *tip_private)
-{
- gboolean retval;
-
- g_return_if_fail (EGG_IS_TOOL_ITEM (tool_item));
-
- g_signal_emit (tool_item, toolitem_signals[SET_TOOLTIP], 0,
- tooltips, tip_text, tip_private, &retval);
-}
-
-void
-egg_tool_item_set_use_drag_window (EggToolItem *toolitem,
- gboolean use_drag_window)
-{
- g_return_if_fail (EGG_IS_TOOL_ITEM (toolitem));
-
- use_drag_window = use_drag_window != FALSE;
-
- if (toolitem->use_drag_window != use_drag_window)
- {
- toolitem->use_drag_window = use_drag_window;
-
- if (use_drag_window)
- {
- if (!toolitem->drag_window && GTK_WIDGET_REALIZED (toolitem))
- {
- create_drag_window(toolitem);
- if (GTK_WIDGET_MAPPED (toolitem))
- gdk_window_show (toolitem->drag_window);
- }
- }
- else
- {
- destroy_drag_window (toolitem);
- }
- }
-}
-
-void
-egg_tool_item_set_visible_horizontal (EggToolItem *toolitem,
- gboolean visible_horizontal)
-{
- g_return_if_fail (EGG_IS_TOOL_ITEM (toolitem));
-
- visible_horizontal = visible_horizontal != FALSE;
-
- if (toolitem->visible_horizontal != visible_horizontal)
- {
- toolitem->visible_horizontal = visible_horizontal;
-
- g_object_notify (G_OBJECT (toolitem), "visible_horizontal");
-
- gtk_widget_queue_resize (GTK_WIDGET (toolitem));
- }
-}
-
-gboolean
-egg_tool_item_get_visible_horizontal (EggToolItem *toolitem)
-{
- g_return_val_if_fail (EGG_IS_TOOL_ITEM (toolitem), FALSE);
-
- return toolitem->visible_horizontal;
-}
-
-void
-egg_tool_item_set_visible_vertical (EggToolItem *toolitem,
- gboolean visible_vertical)
-{
- g_return_if_fail (EGG_IS_TOOL_ITEM (toolitem));
-
- visible_vertical = visible_vertical != FALSE;
-
- if (toolitem->visible_vertical != visible_vertical)
- {
- toolitem->visible_vertical = visible_vertical;
-
- g_object_notify (G_OBJECT (toolitem), "visible_vertical");
-
- gtk_widget_queue_resize (GTK_WIDGET (toolitem));
- }
-}
-
-gboolean
-egg_tool_item_get_visible_vertical (EggToolItem *toolitem)
-{
- g_return_val_if_fail (EGG_IS_TOOL_ITEM (toolitem), FALSE);
-
- return toolitem->visible_vertical;
-}
-
-GtkWidget *
-egg_tool_item_retrieve_proxy_menu_item (EggToolItem *tool_item)
-{
- gboolean retval;
-
- g_return_val_if_fail (EGG_IS_TOOL_ITEM (tool_item), NULL);
-
- g_signal_emit (tool_item, toolitem_signals[CREATE_MENU_PROXY], 0, &retval);
-
- return tool_item->menu_item;
-}
-
-GtkWidget *
-egg_tool_item_get_proxy_menu_item (EggToolItem *tool_item,
- const gchar *menu_item_id)
-{
- g_return_val_if_fail (EGG_IS_TOOL_ITEM (tool_item), NULL);
- g_return_val_if_fail (menu_item_id != NULL, NULL);
-
- if (tool_item->menu_item_id && strcmp (tool_item->menu_item_id, menu_item_id) == 0)
- return tool_item->menu_item;
-
- return NULL;
-}
-
-void
-egg_tool_item_set_proxy_menu_item (EggToolItem *tool_item,
- const gchar *menu_item_id,
- GtkWidget *menu_item)
-{
- g_return_if_fail (EGG_IS_TOOL_ITEM (tool_item));
- g_return_if_fail (menu_item == NULL || GTK_IS_MENU_ITEM (menu_item));
- g_return_if_fail (menu_item_id != NULL);
-
- if (tool_item->menu_item_id)
- g_free (tool_item->menu_item_id);
-
- tool_item->menu_item_id = g_strdup (menu_item_id);
-
- if (tool_item->menu_item != menu_item)
- {
- if (tool_item->menu_item)
- g_object_unref (G_OBJECT (tool_item->menu_item));
-
- if (menu_item)
- {
- g_object_ref (menu_item);
- gtk_object_sink (GTK_OBJECT (menu_item));
- }
-
- tool_item->menu_item = menu_item;
- }
-}
diff --git a/lib/egg/eggtoolitem.h b/lib/egg/eggtoolitem.h
deleted file mode 100644
index 97a725638..000000000
--- a/lib/egg/eggtoolitem.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* eggtoolitem.c
- *
- * Copyright (C) 2002 Anders Carlsson <andersca@codefactory.se>
- * Copyright (C) 2002 James Henstridge <james@daa.com.au>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __EGG_TOOL_ITEM_H__
-#define __EGG_TOOL_ITEM_H__
-
-#include <gtk/gtkbin.h>
-#include <gtk/gtktooltips.h>
-#include <gtk/gtkmenuitem.h>
-
-#define EGG_TYPE_TOOL_ITEM (egg_tool_item_get_type ())
-#define EGG_TOOL_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TOOL_ITEM, EggToolItem))
-#define EGG_TOOL_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EGG_TYPE_TOOL_ITEM, EggToolItemClass))
-#define EGG_IS_TOOL_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TOOL_ITEM))
-#define EGG_IS_TOOL_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), EGG_TYPE_TOOL_ITEM))
-#define EGG_TOOL_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EGG_TYPE_TOOL_ITEM, EggToolItemClass))
-
-typedef struct _EggToolItem EggToolItem;
-typedef struct _EggToolItemClass EggToolItemClass;
-
-struct _EggToolItem
-{
- GtkBin parent;
-
- gchar *tip_text;
- gchar *tip_private;
-
- GdkWindow *drag_window;
-
- guint visible_horizontal : 1;
- guint visible_vertical : 1;
- guint homogeneous : 1;
- guint expand : 1;
- guint pack_end : 1;
- guint use_drag_window : 1;
- guint overflow_item : 1;
- guint is_important : 1;
-
- GtkWidget *menu_item;
- gchar *menu_item_id;
-};
-
-struct _EggToolItemClass
-{
- GtkBinClass parent_class;
-
- /* signals */
- gboolean (* create_menu_proxy) (EggToolItem *tool_item);
- void (* toolbar_reconfigured) (EggToolItem *tool_item);
- gboolean (* set_tooltip) (EggToolItem *tool_item,
- GtkTooltips *tooltips,
- const gchar *tip_text,
- const gchar *tip_private);
-};
-
-GType egg_tool_item_get_type (void);
-EggToolItem *egg_tool_item_new (void);
-
-void egg_tool_item_toolbar_reconfigured (EggToolItem *tool_item);
-void egg_tool_item_set_homogeneous (EggToolItem *tool_item,
- gboolean homogeneous);
-void egg_tool_item_set_expand (EggToolItem *tool_item,
- gboolean expand);
-void egg_tool_item_set_pack_end (EggToolItem *tool_item,
- gboolean pack_end);
-void egg_tool_item_set_tooltip (EggToolItem *tool_item,
- GtkTooltips *tooltips,
- const gchar *tip_text,
- const gchar *tip_private);
-void egg_tool_item_set_use_drag_window (EggToolItem *toolitem,
- gboolean use_drag_window);
-void egg_tool_item_set_visible_horizontal (EggToolItem *toolitem,
- gboolean visible_horizontal);
-gboolean egg_tool_item_get_visible_horizontal (EggToolItem *toolitem);
-void egg_tool_item_set_visible_vertical (EggToolItem *toolitem,
- gboolean visible_horizontal);
-gboolean egg_tool_item_get_visible_vertical (EggToolItem *toolitem);
-GtkIconSize egg_tool_item_get_icon_size (EggToolItem *tool_item);
-GtkOrientation egg_tool_item_get_orientation (EggToolItem *tool_item);
-GtkToolbarStyle egg_tool_item_get_toolbar_style (EggToolItem *tool_item);
-GtkReliefStyle egg_tool_item_get_relief_style (EggToolItem *tool_item);
-GtkWidget * egg_tool_item_retrieve_proxy_menu_item (EggToolItem *tool_item);
-GtkWidget * egg_tool_item_get_proxy_menu_item (EggToolItem *tool_item,
- const gchar *menu_item_id);
-void egg_tool_item_set_proxy_menu_item (EggToolItem *tool_item,
- const gchar *menu_item_id,
- GtkWidget *menu_item);
-gboolean egg_tool_item_get_is_important (EggToolItem *tool_item);
-void egg_tool_item_set_is_important (EggToolItem *tool_item,
- gboolean is_important);
-
-
-#endif /* __EGG_TOOL_ITEM_H__ */
diff --git a/lib/egg/eggtreemodelfilter.c b/lib/egg/eggtreemodelfilter.c
deleted file mode 100644
index 924f6938e..000000000
--- a/lib/egg/eggtreemodelfilter.c
+++ /dev/null
@@ -1,2715 +0,0 @@
-/* eggtreemodelfilter.c
- * Copyright (C) 2000,2001 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
- * Copyright (C) 2001,2002 Kristian Rietveld <kris@gtk.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "eggtreemodelfilter.h"
-#include <gtk/gtksignal.h>
-#include <string.h>
-
-/* FIXME: remove this when we move it to GTK+ */
-#include "eggintl.h"
-
-/* ITER FORMAT:
- *
- * iter->stamp = filter->stamp
- * iter->user_data = FilterLevel
- * iter->user_data2 = FilterElt
- */
-
-/* all paths, iters, etc prefixed with c_ are paths, iters, etc relative to the
- * child model.
- */
-
-typedef struct _FilterElt FilterElt;
-typedef struct _FilterLevel FilterLevel;
-
-struct _FilterElt
-{
- GtkTreeIter iter;
- FilterLevel *children;
- gint offset;
- gint ref_count;
- gint zero_ref_count;
- gboolean visible;
-};
-
-struct _FilterLevel
-{
- GArray *array;
- gint ref_count;
-
- FilterElt *parent_elt;
- FilterLevel *parent_level;
-};
-
-/* properties */
-enum
-{
- PROP_0,
- PROP_CHILD_MODEL,
- PROP_VIRTUAL_ROOT
-};
-
-#define EGG_TREE_MODEL_FILTER_CACHE_CHILD_ITERS(filter) \
- (((EggTreeModelFilter *)filter)->child_flags & GTK_TREE_MODEL_ITERS_PERSIST)
-
-#define FILTER_ELT(filter_elt) ((FilterElt *)filter_elt)
-#define FILTER_LEVEL(filter_level) ((FilterLevel *)filter_level)
-
-/* general code (object/interface init, properties, etc) */
-static void egg_tree_model_filter_init (EggTreeModelFilter *filter);
-static void egg_tree_model_filter_class_init (EggTreeModelFilterClass *filter_class);
-static void egg_tree_model_filter_tree_model_init (GtkTreeModelIface *iface);
-static void egg_tree_model_filter_finalize (GObject *object);
-static void egg_tree_model_filter_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void egg_tree_model_filter_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-/* signal handlers */
-static void egg_tree_model_filter_row_changed (GtkTreeModel *c_model,
- GtkTreePath *c_path,
- GtkTreeIter *c_iter,
- gpointer data);
-static void egg_tree_model_filter_row_inserted (GtkTreeModel *c_model,
- GtkTreePath *c_path,
- GtkTreeIter *c_iter,
- gpointer data);
-static void egg_tree_model_filter_row_has_child_toggled (GtkTreeModel *c_model,
- GtkTreePath *c_path,
- GtkTreeIter *c_iter,
- gpointer data);
-static void egg_tree_model_filter_row_deleted (GtkTreeModel *c_model,
- GtkTreePath *c_path,
- gpointer data);
-static void egg_tree_model_filter_rows_reordered (GtkTreeModel *c_model,
- GtkTreePath *c_path,
- GtkTreeIter *c_iter,
- gint *new_order,
- gpointer data);
-
-/* GtkTreeModel interface */
-static guint egg_tree_model_filter_get_flags (GtkTreeModel *model);
-static gint egg_tree_model_filter_get_n_columns (GtkTreeModel *model);
-static GType egg_tree_model_filter_get_column_type (GtkTreeModel *model,
- gint index);
-static gboolean egg_tree_model_filter_get_iter (GtkTreeModel *model,
- GtkTreeIter *iter,
- GtkTreePath *path);
-static GtkTreePath *egg_tree_model_filter_get_path (GtkTreeModel *model,
- GtkTreeIter *iter);
-static void egg_tree_model_filter_get_value (GtkTreeModel *model,
- GtkTreeIter *iter,
- gint column,
- GValue *value);
-static gboolean egg_tree_model_filter_iter_next (GtkTreeModel *model,
- GtkTreeIter *iter);
-static gboolean egg_tree_model_filter_iter_children (GtkTreeModel *model,
- GtkTreeIter *iter,
- GtkTreeIter *parent);
-static gboolean egg_tree_model_filter_iter_has_child (GtkTreeModel *model,
- GtkTreeIter *iter);
-static gint egg_tree_model_filter_iter_n_children (GtkTreeModel *model,
- GtkTreeIter *iter);
-static gboolean egg_tree_model_filter_iter_nth_child (GtkTreeModel *model,
- GtkTreeIter *iter,
- GtkTreeIter *parent,
- gint n);
-static gboolean egg_tree_model_filter_iter_parent (GtkTreeModel *model,
- GtkTreeIter *iter,
- GtkTreeIter *child);
-static void egg_tree_model_filter_ref_node (GtkTreeModel *model,
- GtkTreeIter *iter);
-static void egg_tree_model_filter_unref_node (GtkTreeModel *model,
- GtkTreeIter *iter);
-
-
-
-/* private functions */
-static void egg_tree_model_filter_build_level (EggTreeModelFilter *filter,
- FilterLevel *parent_level,
- FilterElt *parent_elt);
-static void egg_tree_model_filter_free_level (EggTreeModelFilter *filter,
- FilterLevel *filter_level);
-
-static GtkTreePath *egg_tree_model_filter_elt_get_path (FilterLevel *level,
- FilterElt *elt,
- GtkTreePath *root);
-
-static GtkTreePath *egg_tree_model_filter_add_root (GtkTreePath *src,
- GtkTreePath *root);
-static GtkTreePath *egg_tree_model_filter_remove_root (GtkTreePath *src,
- GtkTreePath *root);
-
-static void egg_tree_model_filter_increment_stamp (EggTreeModelFilter *filter);
-
-static gboolean egg_tree_model_filter_visible (EggTreeModelFilter *filter,
- GtkTreeIter *child_iter);
-static void egg_tree_model_filter_clear_cache_helper (EggTreeModelFilter *filter,
- FilterLevel *level);
-
-static void egg_tree_model_filter_real_unref_node (GtkTreeModel *model,
- GtkTreeIter *iter,
- gboolean propagate_unref);
-
-static void egg_tree_model_filter_set_model (EggTreeModelFilter *filter,
- GtkTreeModel *child_model);
-static void egg_tree_model_filter_set_root (EggTreeModelFilter *filter,
- GtkTreePath *root);
-
-static GtkTreePath *egg_real_tree_model_filter_convert_child_path_to_path (EggTreeModelFilter *filter,
- GtkTreePath *child_path,
- gboolean build_levels,
- gboolean fetch_childs);
-
-static FilterElt *egg_tree_model_filter_fetch_child (EggTreeModelFilter *filter,
- FilterLevel *level,
- gint offset,
- gint *index);
-static void egg_tree_model_filter_remove_node (EggTreeModelFilter *filter,
- GtkTreeIter *iter,
- gboolean emit_signal);
-static void egg_tree_model_filter_update_childs (EggTreeModelFilter *filter,
- FilterLevel *level,
- FilterElt *elt);
-static FilterElt *bsearch_elt_with_offset (GArray *array,
- gint offset,
- gint *index);
-
-
-static GObjectClass *parent_class = NULL;
-
-GType
-egg_tree_model_filter_get_type (void)
-{
- static GType tree_model_filter_type = 0;
-
- if (!tree_model_filter_type)
- {
- static const GTypeInfo tree_model_filter_info =
- {
- sizeof (EggTreeModelFilterClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) egg_tree_model_filter_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EggTreeModelFilter),
- 0, /* n_preallocs */
- (GInstanceInitFunc) egg_tree_model_filter_init
- };
-
- static const GInterfaceInfo tree_model_info =
- {
- (GInterfaceInitFunc) egg_tree_model_filter_tree_model_init,
- NULL,
- NULL
- };
-
- tree_model_filter_type = g_type_register_static (G_TYPE_OBJECT,
- "EggTreeModelFilter",
- &tree_model_filter_info, 0);
-
- g_type_add_interface_static (tree_model_filter_type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
- }
-
- return tree_model_filter_type;
-}
-
-static void
-egg_tree_model_filter_init (EggTreeModelFilter *filter)
-{
- filter->visible_column = -1;
- filter->zero_ref_count = 0;
- filter->visible_method_set = FALSE;
- filter->modify_func_set = FALSE;
-}
-
-static void
-egg_tree_model_filter_class_init (EggTreeModelFilterClass *filter_class)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) filter_class;
- parent_class = g_type_class_peek_parent (filter_class);
-
- object_class->set_property = egg_tree_model_filter_set_property;
- object_class->get_property = egg_tree_model_filter_get_property;
-
- object_class->finalize = egg_tree_model_filter_finalize;
-
- /* Properties -- FIXME: write a better description ... */
- g_object_class_install_property (object_class,
- PROP_CHILD_MODEL,
- g_param_spec_object ("child_model",
- _("The child model"),
- _("The model for the filtermodel to filter"),
- GTK_TYPE_TREE_MODEL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
- g_object_class_install_property (object_class,
- PROP_VIRTUAL_ROOT,
- g_param_spec_boxed ("virtual_root",
- _("The virtual root"),
- _("The virtual root (relative to the child model) for this filtermodel"),
- GTK_TYPE_TREE_PATH,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-}
-
-static void
-egg_tree_model_filter_tree_model_init (GtkTreeModelIface *iface)
-{
- iface->get_flags = egg_tree_model_filter_get_flags;
- iface->get_n_columns = egg_tree_model_filter_get_n_columns;
- iface->get_column_type = egg_tree_model_filter_get_column_type;
- iface->get_iter = egg_tree_model_filter_get_iter;
- iface->get_path = egg_tree_model_filter_get_path;
- iface->get_value = egg_tree_model_filter_get_value;
- iface->iter_next = egg_tree_model_filter_iter_next;
- iface->iter_children = egg_tree_model_filter_iter_children;
- iface->iter_has_child = egg_tree_model_filter_iter_has_child;
- iface->iter_n_children = egg_tree_model_filter_iter_n_children;
- iface->iter_nth_child = egg_tree_model_filter_iter_nth_child;
- iface->iter_parent = egg_tree_model_filter_iter_parent;
- iface->ref_node = egg_tree_model_filter_ref_node;
- iface->unref_node = egg_tree_model_filter_unref_node;
-}
-
-
-static void
-egg_tree_model_filter_finalize (GObject *object)
-{
- EggTreeModelFilter *filter = (EggTreeModelFilter *) object;
-
- egg_tree_model_filter_set_model (filter, NULL);
-
- if (filter->virtual_root)
- gtk_tree_path_free (filter->virtual_root);
-
- if (filter->root)
- egg_tree_model_filter_free_level (filter, filter->root);
-
- if (filter->modify_types)
- g_free (filter->modify_types);
-
- /* must chain up */
- parent_class->finalize (object);
-}
-
-static void
-egg_tree_model_filter_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EggTreeModelFilter *filter = EGG_TREE_MODEL_FILTER (object);
-
- switch (prop_id)
- {
- case PROP_CHILD_MODEL:
- egg_tree_model_filter_set_model (filter, g_value_get_object (value));
- break;
- case PROP_VIRTUAL_ROOT:
- egg_tree_model_filter_set_root (filter, g_value_get_boxed (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-egg_tree_model_filter_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EggTreeModelFilter *filter = EGG_TREE_MODEL_FILTER (object);
-
- switch (prop_id)
- {
- case PROP_CHILD_MODEL:
- g_value_set_object (value, filter->child_model);
- break;
- case PROP_VIRTUAL_ROOT:
- g_value_set_boxed (value, filter->virtual_root);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* helpers */
-
-static void
-egg_tree_model_filter_build_level (EggTreeModelFilter *filter,
- FilterLevel *parent_level,
- FilterElt *parent_elt)
-{
- GtkTreeIter iter;
- GtkTreeIter root;
- FilterLevel *new_level;
- gint length = 0;
- gint i;
-
- g_assert (filter->child_model != NULL);
-
- if (!parent_level)
- {
- if (filter->virtual_root)
- {
- if (gtk_tree_model_get_iter (filter->child_model, &root, filter->virtual_root) == FALSE)
- return;
- length = gtk_tree_model_iter_n_children (filter->child_model, &root);
-
- if (gtk_tree_model_iter_children (filter->child_model, &iter, &root) == FALSE)
- return;
- }
- else
- {
- if (!gtk_tree_model_get_iter_first (filter->child_model, &iter))
- return;
- length = gtk_tree_model_iter_n_children (filter->child_model, NULL);
- }
- }
- else
- {
- GtkTreeIter parent_iter;
- GtkTreeIter child_parent_iter;
-
- parent_iter.stamp = filter->stamp;
- parent_iter.user_data = parent_level;
- parent_iter.user_data2 = parent_elt;
-
- egg_tree_model_filter_convert_iter_to_child_iter (filter,
- &child_parent_iter,
- &parent_iter);
- if (gtk_tree_model_iter_children (filter->child_model, &iter, &child_parent_iter) == FALSE)
- return;
-
- /* stamp may have changed */
- egg_tree_model_filter_convert_iter_to_child_iter (filter,
- &child_parent_iter,
- &parent_iter);
- length = gtk_tree_model_iter_n_children (filter->child_model, &child_parent_iter);
- }
-
- g_return_if_fail (length > 0);
-
- new_level = g_new (FilterLevel, 1);
- new_level->array = g_array_sized_new (FALSE, FALSE,
- sizeof (FilterElt),
- length);
- new_level->ref_count = 0;
- new_level->parent_elt = parent_elt;
- new_level->parent_level = parent_level;
-
- if (parent_elt)
- parent_elt->children = new_level;
- else
- filter->root = new_level;
-
- /* increase the count of zero ref_counts */
- while (parent_level)
- {
- parent_elt->zero_ref_count++;
-
- parent_elt = parent_level->parent_elt;
- parent_level = parent_level->parent_level;
- }
- filter->zero_ref_count++;
-
- i = 0;
-
- if (!new_level->parent_level)
- filter->root_level_visible = 0;
-
- do
- {
- if (egg_tree_model_filter_visible (filter, &iter))
- {
- FilterElt filter_elt;
-
- filter_elt.offset = i;
- filter_elt.zero_ref_count = 0;
- filter_elt.ref_count = 0;
- filter_elt.children = NULL;
- filter_elt.visible = TRUE;
-
- if (EGG_TREE_MODEL_FILTER_CACHE_CHILD_ITERS (filter))
- filter_elt.iter = iter;
-
- g_array_append_val (new_level->array, filter_elt);
-
- if (!new_level->parent_level)
- filter->root_level_visible++;
- }
- i++;
- }
- while (gtk_tree_model_iter_next (filter->child_model, &iter));
-}
-
-static void
-egg_tree_model_filter_free_level (EggTreeModelFilter *filter,
- FilterLevel *filter_level)
-{
- gint i;
-
- g_assert (filter_level);
-
- if (filter_level->ref_count == 0)
- {
- FilterLevel *parent_level = filter_level->parent_level;
- FilterElt *parent_elt = filter_level->parent_elt;
-
- do
- {
- if (parent_elt)
- parent_elt->zero_ref_count--;
-
- if (parent_level)
- {
- parent_elt = parent_level->parent_elt;
- parent_level = parent_level->parent_level;
- }
- }
- while (parent_level);
- filter->zero_ref_count--;
- }
-
- for (i = 0; i < filter_level->array->len; i++)
- {
- if (g_array_index (filter_level->array, FilterElt, i).children)
- egg_tree_model_filter_free_level (filter,
- FILTER_LEVEL (g_array_index (filter_level->array, FilterElt, i).children));
- }
-
- if (!filter_level->parent_level)
- filter->root_level_visible = 0;
-
- if (filter_level->parent_elt)
- filter_level->parent_elt->children = NULL;
- else
- filter->root = NULL;
-
- g_array_free (filter_level->array, TRUE);
- filter_level->array = NULL;
-
- g_free (filter_level);
- filter_level = NULL;
-}
-
-static GtkTreePath *
-egg_tree_model_filter_elt_get_path (FilterLevel *level,
- FilterElt *elt,
- GtkTreePath *root)
-{
- FilterLevel *walker = level;
- FilterElt *walker2 = elt;
- GtkTreePath *path;
- GtkTreePath *real_path;
-
- g_return_val_if_fail (level != NULL, NULL);
- g_return_val_if_fail (elt != NULL, NULL);
-
- path = gtk_tree_path_new ();
-
- while (walker)
- {
- gtk_tree_path_prepend_index (path, walker2->offset);
-
- walker2 = walker->parent_elt;
- walker = walker->parent_level;
- }
-
- if (root)
- {
- real_path = gtk_tree_path_copy (root);
-
- egg_tree_model_filter_add_root (real_path, path);
- gtk_tree_path_free (path);
- return real_path;
- }
-
- return path;
-}
-
-static GtkTreePath *
-egg_tree_model_filter_add_root (GtkTreePath *src,
- GtkTreePath *root)
-{
- GtkTreePath *retval;
- gint i;
-
- retval = gtk_tree_path_copy (root);
-
- for (i = 0; i < gtk_tree_path_get_depth (src); i++)
- gtk_tree_path_append_index (retval, gtk_tree_path_get_indices (src)[i]);
-
- return retval;
-}
-
-static GtkTreePath *
-egg_tree_model_filter_remove_root (GtkTreePath *src,
- GtkTreePath *root)
-{
- GtkTreePath *retval;
- gint i;
- gint depth;
- gint *indices;
-
- if (gtk_tree_path_get_depth (src) <= gtk_tree_path_get_depth (root))
- return NULL;
-
- depth = gtk_tree_path_get_depth (src);
- indices = gtk_tree_path_get_indices (src);
-
- for (i = 0; i < gtk_tree_path_get_depth (root); i++)
- if (indices[i] != gtk_tree_path_get_indices (root)[i])
- return NULL;
-
- retval = gtk_tree_path_new ();
-
- for (; i < depth; i++)
- gtk_tree_path_append_index (retval, indices[i]);
-
- return retval;
-}
-
-static void
-egg_tree_model_filter_increment_stamp (EggTreeModelFilter *filter)
-{
- do
- {
- filter->stamp++;
- }
- while (filter->stamp == 0);
-
- egg_tree_model_filter_clear_cache (filter);
-}
-
-static gboolean
-egg_tree_model_filter_visible (EggTreeModelFilter *filter,
- GtkTreeIter *child_iter)
-{
- if (filter->visible_func)
- {
- return (filter->visible_func (filter->child_model,
- child_iter,
- filter->visible_data));
- }
- else if (filter->visible_column >= 0)
- {
- GValue val = {0, };
-
- gtk_tree_model_get_value (filter->child_model, child_iter,
- filter->visible_column, &val);
-
- if (g_value_get_boolean (&val))
- {
- g_value_unset (&val);
- return TRUE;
- }
-
- g_value_unset (&val);
- return FALSE;
- }
-
- /* no filter thing set, so always visible */
- return TRUE;
-}
-
-static void
-egg_tree_model_filter_clear_cache_helper (EggTreeModelFilter *filter,
- FilterLevel *level)
-{
- gint i;
-
- g_assert (level);
-
- for (i = 0; i < level->array->len; i++)
- {
- if (g_array_index (level->array, FilterElt, i).zero_ref_count > 0)
- egg_tree_model_filter_clear_cache_helper (filter, g_array_index (level->array, FilterElt, i).children);
- }
-
- if (level->ref_count == 0 && level != filter->root)
- {
- egg_tree_model_filter_free_level (filter, level);
- return;
- }
-}
-
-static FilterElt *
-egg_tree_model_filter_fetch_child (EggTreeModelFilter *filter,
- FilterLevel *level,
- gint offset,
- gint *index)
-{
- gint i = 0;
- gint start, middle, end;
- gint len;
- GtkTreePath *c_path = NULL;
- GtkTreeIter c_iter;
- GtkTreePath *c_parent_path = NULL;
- GtkTreeIter c_parent_iter;
- FilterElt elt;
-
- /* check if child exists and is visible */
- if (level->parent_elt)
- {
- c_parent_path =
- egg_tree_model_filter_elt_get_path (level->parent_level,
- level->parent_elt,
- filter->virtual_root);
- if (!c_parent_path)
- return NULL;
- }
- else
- {
- if (filter->virtual_root)
- c_parent_path = gtk_tree_path_copy (filter->virtual_root);
- else
- c_parent_path = NULL;
- }
-
- if (c_parent_path)
- {
- gtk_tree_model_get_iter (filter->child_model,
- &c_parent_iter,
- c_parent_path);
- len = gtk_tree_model_iter_n_children (filter->child_model,
- &c_parent_iter);
-
- c_path = gtk_tree_path_copy (c_parent_path);
- gtk_tree_path_free (c_parent_path);
- }
- else
- {
- len = gtk_tree_model_iter_n_children (filter->child_model, NULL);
- c_path = gtk_tree_path_new ();
- }
-
- gtk_tree_path_append_index (c_path, offset);
- gtk_tree_model_get_iter (filter->child_model, &c_iter, c_path);
- gtk_tree_path_free (c_path);
-
- if (offset >= len || !egg_tree_model_filter_visible (filter, &c_iter))
- return NULL;
-
- /* add child */
- elt.offset = offset;
- elt.zero_ref_count = 0;
- elt.ref_count = 0;
- elt.children = NULL;
- /* visibility should be FALSE as we don't emit row_inserted */
- elt.visible = FALSE;
-
- if (EGG_TREE_MODEL_FILTER_CACHE_CHILD_ITERS (filter))
- elt.iter = c_iter;
-
- /* find index (binary search on offset) */
- start = 0;
- end = level->array->len;
-
- if (start != end)
- {
- while (start != end)
- {
- middle = (start + end) / 2;
-
- if (g_array_index (level->array, FilterElt, middle).offset <= offset)
- start = middle + 1;
- else
- end = middle;
- }
-
- if (g_array_index (level->array, FilterElt, middle).offset <= offset)
- i = middle + 1;
- else
- i = middle;
- }
- else
- i = 0;
-
- g_array_insert_val (level->array, i, elt);
- *index = i;
-
- for (i = MAX (--i, 0); i < level->array->len; i++)
- {
- FilterElt *e = &(g_array_index (level->array, FilterElt, i));
- if (e->children)
- e->children->parent_elt = e;
- }
-
- return &g_array_index (level->array, FilterElt, *index);
-}
-
-static void
-egg_tree_model_filter_remove_node (EggTreeModelFilter *filter,
- GtkTreeIter *iter,
- gboolean emit_signal)
-{
- FilterElt *elt, *parent;
- FilterLevel *level, *parent_level;
- gint offset, i, length, level_refcount;
-
- /* FIXME: this function is very ugly. I need to rethink and
- * rewrite it someday.
- */
-
- level = FILTER_LEVEL (iter->user_data);
- elt = FILTER_ELT (iter->user_data2);
-
- parent = level->parent_elt;
- parent_level = level->parent_level;
- length = level->array->len;
- offset = elt->offset;
-
- /* ref counting */
- while (elt->ref_count > 0)
- egg_tree_model_filter_real_unref_node (GTK_TREE_MODEL (filter),
- iter, FALSE);
-
- level_refcount = level->ref_count;
-
- /* do the ref counting first! this touches the stamp */
- if (emit_signal)
- {
- GtkTreePath *path;
-
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (filter), iter);
- egg_tree_model_filter_increment_stamp (filter);
- gtk_tree_model_row_deleted (GTK_TREE_MODEL (filter), path);
- gtk_tree_path_free (path);
- }
-
- if ((length == 1 || level_refcount == 0) &&
- emit_signal && iter->user_data != filter->root)
- {
- /* above code destroyed the level */
- goto emit_has_child_toggled;
- }
-
- if (length == 1)
- {
- /* kill the level */
- egg_tree_model_filter_free_level (filter, level);
-
- if (!filter->root)
- /* we killed the root */
- return;
- }
- else
- {
- FilterElt *tmp;
-
- /* remove the node */
- tmp = bsearch_elt_with_offset (level->array, elt->offset, &i);
-
- if (tmp)
- {
- g_array_remove_index (level->array, i);
-
- for (i = MAX (--i, 0); i < level->array->len; i++)
- {
- /* NOTE: here we do *not* decrease offsets, because the node was
- * not removed from the child model
- */
- elt = &g_array_index (level->array, FilterElt, i);
- if (elt->children)
- elt->children->parent_elt = elt;
- }
- }
- }
-
-emit_has_child_toggled:
- /* children are being handled first, so we can check it this way
- *
- * yes this if-statement is ugly
- */
- if ((parent && parent->children && parent->children->array->len <= 1) ||
- (length == 1 && emit_signal && iter->user_data != filter->root))
- {
- /* latest child has been removed, level has been destroyed */
- GtkTreeIter piter;
- GtkTreePath *ppath;
-
- piter.stamp = filter->stamp;
- piter.user_data = parent_level;
- piter.user_data2 = parent;
-
- ppath = gtk_tree_model_get_path (GTK_TREE_MODEL (filter), &piter);
-
- gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (filter),
- ppath, &piter);
- gtk_tree_path_free (ppath);
- }
-}
-
-static void
-egg_tree_model_filter_update_childs (EggTreeModelFilter *filter,
- FilterLevel *level,
- FilterElt *elt)
-{
- GtkTreeIter c_iter;
- GtkTreeIter iter;
-
- if (!elt->visible)
- return;
-
- iter.stamp = filter->stamp;
- iter.user_data = level;
- iter.user_data2 = elt;
-
- egg_tree_model_filter_convert_iter_to_child_iter (filter, &c_iter, &iter);
-
- if (gtk_tree_model_iter_has_child (filter->child_model, &c_iter))
- {
- GtkTreePath *path = gtk_tree_model_get_path (GTK_TREE_MODEL (filter),
- &iter);
- gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (filter),
- path,
- &iter);
- if (path)
- gtk_tree_path_free (path);
- }
-}
-
-static FilterElt *
-bsearch_elt_with_offset (GArray *array,
- gint offset,
- gint *index)
-{
- gint start, middle, end;
- FilterElt *elt;
-
- start = 0;
- end = array->len;
-
- if (array->len < 1)
- return NULL;
-
- if (start == end)
- {
- elt = &g_array_index (array, FilterElt, 0);
-
- if (elt->offset == offset)
- {
- *index = 0;
- return elt;
- }
- else
- return NULL;
- }
-
- while (start != end)
- {
- middle = (start + end) / 2;
-
- elt = &g_array_index (array, FilterElt, middle);
-
- if (elt->offset < offset)
- start = middle + 1;
- else if (elt->offset > offset)
- end = middle;
- else
- break;
- }
-
- if (elt->offset == offset)
- {
- *index = middle;
- return elt;
- }
-
- return NULL;
-}
-
-/* TreeModel signals */
-static void
-egg_tree_model_filter_row_changed (GtkTreeModel *c_model,
- GtkTreePath *c_path,
- GtkTreeIter *c_iter,
- gpointer data)
-{
- EggTreeModelFilter *filter = EGG_TREE_MODEL_FILTER (data);
- GtkTreeIter iter;
- GtkTreeIter childs;
- GtkTreeIter real_c_iter;
- GtkTreePath *path = NULL;
-
- FilterElt *elt;
- FilterLevel *level;
-
- gboolean requested_state;
- gboolean current_state;
- gboolean free_c_path = FALSE;
-
- g_return_if_fail (c_path != NULL || c_iter != NULL);
-
- if (!c_path)
- {
- c_path = gtk_tree_model_get_path (c_model, c_iter);
- free_c_path = TRUE;
- }
-
- if (c_iter)
- real_c_iter = *c_iter;
- else
- gtk_tree_model_get_iter (c_model, &real_c_iter, c_path);
-
- /* what's the requested state? */
- requested_state = egg_tree_model_filter_visible (filter, &real_c_iter);
-
- /* now, let's see whether the item is there */
- path = egg_real_tree_model_filter_convert_child_path_to_path (filter,
- c_path,
- FALSE,
- FALSE);
-
- if (path)
- {
- gtk_tree_model_get_iter (GTK_TREE_MODEL (filter), &iter, path);
- current_state = FILTER_ELT (iter.user_data2)->visible;
- }
- else
- current_state = FALSE;
-
- if (current_state == FALSE && requested_state == FALSE)
- /* no changes required */
- goto done;
-
- if (current_state == TRUE && requested_state == FALSE)
- {
- /* get rid of this node */
- gtk_tree_model_get_iter (GTK_TREE_MODEL (filter), &iter, path);
- egg_tree_model_filter_remove_node (filter, &iter, TRUE);
-
- level = FILTER_LEVEL (iter.user_data);
-
- if (!level->parent_level)
- filter->root_level_visible--;
-
- goto done;
- }
-
- if (current_state == TRUE && requested_state == TRUE)
- {
- /* progate the signal */
- gtk_tree_model_get_iter (GTK_TREE_MODEL (filter), &iter, path);
- gtk_tree_model_row_changed (GTK_TREE_MODEL (filter), path, &iter);
-
- level = FILTER_LEVEL (iter.user_data);
- elt = FILTER_ELT (iter.user_data2);
-
- /* and update the childs */
- if (gtk_tree_model_iter_children (c_model, &childs, &real_c_iter))
- egg_tree_model_filter_update_childs (filter, level, elt);
-
- goto done;
- }
-
- /* only current == FALSE and requested == TRUE is left,
- * pull in the child
- */
- g_return_if_fail (current_state == FALSE && requested_state == TRUE);
-
- /* make sure the new item has been pulled in */
- if (!filter->root)
- {
- gint i;
- FilterLevel *root;
-
- egg_tree_model_filter_build_level (filter, NULL, NULL);
-
- root = FILTER_LEVEL (filter->root);
-
- if (root)
- {
- for (i = 0; i < root->array->len; i++)
- g_array_index (root->array, FilterElt, i).visible = FALSE;
- filter->root_level_visible = 0;
- }
- }
-
- if (!path)
- path = egg_real_tree_model_filter_convert_child_path_to_path (filter,
- c_path,
- FALSE,
- TRUE);
-
- g_return_if_fail (path != NULL);
-
- egg_tree_model_filter_increment_stamp (filter);
- gtk_tree_model_get_iter (GTK_TREE_MODEL (filter), &iter, path);
-
- level = FILTER_LEVEL (iter.user_data);
- elt = FILTER_ELT (iter.user_data2);
-
- elt->visible = TRUE;
-
- if (!level->parent_level)
- filter->root_level_visible++;
-
- /* update stamp */
- gtk_tree_model_row_inserted (GTK_TREE_MODEL (filter), path, &iter);
-
- if (gtk_tree_model_iter_children (c_model, &childs, c_iter))
- egg_tree_model_filter_update_childs (filter, level, elt);
-
-done:
- if (path)
- gtk_tree_path_free (path);
-
- if (free_c_path)
- gtk_tree_path_free (c_path);
-}
-
-static void
-egg_tree_model_filter_row_inserted (GtkTreeModel *c_model,
- GtkTreePath *c_path,
- GtkTreeIter *c_iter,
- gpointer data)
-{
- EggTreeModelFilter *filter = EGG_TREE_MODEL_FILTER (data);
- GtkTreePath *path;
- GtkTreePath *real_path = NULL;
- GtkTreeIter iter;
-
- GtkTreeIter real_c_iter;
-
- FilterElt *elt;
- FilterLevel *level;
- FilterLevel *parent_level;
-
- gint i = 0, offset, index = -1;
-
- gboolean free_c_path = FALSE;
-
- g_return_if_fail (c_path != NULL || c_iter != NULL);
-
- if (!c_path)
- {
- c_path = gtk_tree_model_get_path (c_model, c_iter);
- free_c_path = TRUE;
- }
-
- if (c_iter)
- real_c_iter = *c_iter;
- else
- gtk_tree_model_get_iter (c_model, &real_c_iter, c_path);
-
- /* the row has already been inserted. so we need to fixup the
- * virtual root here first
- */
- if (filter->virtual_root)
- {
- if (gtk_tree_path_get_depth (filter->virtual_root) >=
- gtk_tree_path_get_depth (c_path))
- {
- gint level;
- gint *v_indices, *c_indices;
-
- level = gtk_tree_path_get_depth (c_path) - 1;
- v_indices = gtk_tree_path_get_indices (filter->virtual_root);
- c_indices = gtk_tree_path_get_indices (c_path);
-
- if (v_indices[level] >= c_indices[level])
- (v_indices[level])++;
- }
- }
-
- if (!filter->root)
- {
- egg_tree_model_filter_build_level (filter, NULL, NULL);
- /* that already put the inserted iter in the level */
-
- goto done_and_emit;
- }
-
- parent_level = level = FILTER_LEVEL (filter->root);
-
- /* subtract virtual root if necessary */
- if (filter->virtual_root)
- {
- real_path = egg_tree_model_filter_remove_root (c_path,
- filter->virtual_root);
- /* not our kiddo */
- if (!real_path)
- goto done;
- }
- else
- real_path = gtk_tree_path_copy (c_path);
-
- if (gtk_tree_path_get_depth (real_path) - 1 >= 1)
- {
- /* find the parent level */
- while (i < gtk_tree_path_get_depth (real_path) - 1)
- {
- gint j;
-
- if (!level)
- /* we don't cover this signal */
- goto done;
-
- elt = bsearch_elt_with_offset (level->array,
- gtk_tree_path_get_indices (real_path)[i],
- &j);
-
- if (!elt)
- /* parent is probably being filtered out */
- goto done;
-
- if (!elt->children)
- {
- GtkTreePath *tmppath;
- GtkTreeIter tmpiter;
-
- tmpiter.stamp = filter->stamp;
- tmpiter.user_data = level;
- tmpiter.user_data2 = elt;
-
- tmppath = gtk_tree_model_get_path (GTK_TREE_MODEL (data),
- &tmpiter);
-
- if (tmppath)
- {
- gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (data),
- tmppath, &tmpiter);
- gtk_tree_path_free (tmppath);
- }
-
- /* not covering this signal */
- goto done;
- }
-
- level = elt->children;
- parent_level = level;
- i++;
- }
- }
-
- if (!parent_level)
- goto done;
-
- /* let's try to insert the value */
- offset = gtk_tree_path_get_indices (real_path)[gtk_tree_path_get_depth (real_path) - 1];
-
- /* update the offsets, yes if we didn't insert the node above, there will
- * be a gap here. This will be filled with the node (via fetch_child) when
- * it becomes visible
- */
- for (i = 0; i < level->array->len; i++)
- {
- FilterElt *e = &g_array_index (level->array, FilterElt, i);
- if ((e->offset >= offset))
- e->offset++;
- }
-
- /* only insert when visible */
- if (egg_tree_model_filter_visible (filter, &real_c_iter))
- {
- FilterElt felt;
-
- if (EGG_TREE_MODEL_FILTER_CACHE_CHILD_ITERS (filter))
- felt.iter = real_c_iter;
-
- felt.offset = offset;
- felt.zero_ref_count = 0;
- felt.ref_count = 0;
- felt.visible = TRUE;
- felt.children = NULL;
-
- for (i = 0; i < level->array->len; i++)
- if (g_array_index (level->array, FilterElt, i).offset > offset)
- break;
-
- g_array_insert_val (level->array, i, felt);
- index = i;
-
- if (!level->parent_level)
- filter->root_level_visible++;
- }
-
- /* another iteration to update the references of childs to parents. */
- for (i = 0; i < level->array->len; i++)
- {
- FilterElt *e = &g_array_index (level->array, FilterElt, i);
- if (e->children)
- e->children->parent_elt = e;
- }
-
- /* don't emit the signal if we aren't visible */
- if (!egg_tree_model_filter_visible (filter, &real_c_iter))
- goto done;
-
-done_and_emit:
- /* NOTE: pass c_path here and NOT real_path. This function does
- * root subtraction itself
- */
- path = egg_real_tree_model_filter_convert_child_path_to_path (filter,
- c_path,
- FALSE, TRUE);
-
- if (!path)
- goto done;
-
- egg_tree_model_filter_increment_stamp (filter);
-
- gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
- gtk_tree_model_row_inserted (GTK_TREE_MODEL (data), path, &iter);
-
- gtk_tree_path_free (path);
-
-done:
- if (real_path)
- gtk_tree_path_free (real_path);
-
- if (free_c_path)
- gtk_tree_path_free (c_path);
-}
-
-static void
-egg_tree_model_filter_row_has_child_toggled (GtkTreeModel *c_model,
- GtkTreePath *c_path,
- GtkTreeIter *c_iter,
- gpointer data)
-{
- EggTreeModelFilter *filter = EGG_TREE_MODEL_FILTER (data);
- GtkTreePath *path;
- GtkTreeIter iter;
-
- g_return_if_fail (c_path != NULL && c_iter != NULL);
-
- /* FIXME: does this code work? */
-
- if (!egg_tree_model_filter_visible (filter, c_iter))
- return;
-
- path = egg_real_tree_model_filter_convert_child_path_to_path (filter,
- c_path,
- FALSE,
- TRUE);
- if (!path)
- return;
-
- gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
- gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (data), path, &iter);
-
- gtk_tree_path_free (path);
-}
-
-static void
-egg_tree_model_filter_row_deleted (GtkTreeModel *c_model,
- GtkTreePath *c_path,
- gpointer data)
-{
- EggTreeModelFilter *filter = EGG_TREE_MODEL_FILTER (data);
- GtkTreePath *path;
- GtkTreeIter iter;
- FilterElt *elt;
- FilterLevel *level;
- gint offset;
- gboolean emit_signal = TRUE;
- gint i;
-
- g_return_if_fail (c_path != NULL);
-
- /* special case the deletion of an ancestor of the virtual root */
- if (filter->virtual_root &&
- (gtk_tree_path_is_ancestor (c_path, filter->virtual_root) ||
- !gtk_tree_path_compare (c_path, filter->virtual_root)))
- {
- gint i;
- GtkTreePath *path;
- FilterLevel *level = FILTER_LEVEL (filter->root);
-
- if (!level)
- return;
-
- /* remove everything in the filter model
- *
- * For now, we just iterate over the root level and emit a
- * row_deleted for each FilterElt. Not sure if this is correct.
- */
-
- egg_tree_model_filter_increment_stamp (filter);
- path = gtk_tree_path_new ();
- gtk_tree_path_append_index (path, 0);
-
- for (i = 0; i < level->array->len; i++)
- gtk_tree_model_row_deleted (GTK_TREE_MODEL (data), path);
-
- gtk_tree_path_free (path);
- egg_tree_model_filter_free_level (filter, filter->root);
-
- return;
- }
-
- /* fixup virtual root */
- if (filter->virtual_root)
- {
- if (gtk_tree_path_get_depth (filter->virtual_root) >=
- gtk_tree_path_get_depth (c_path))
- {
- gint level;
- gint *v_indices, *c_indices;
-
- level = gtk_tree_path_get_depth (c_path) - 1;
- v_indices = gtk_tree_path_get_indices (filter->virtual_root);
- c_indices = gtk_tree_path_get_indices (c_path);
-
- if (v_indices[level] > c_indices[level])
- (v_indices[level])--;
- }
- }
-
- path = egg_real_tree_model_filter_convert_child_path_to_path (filter,
- c_path,
- FALSE,
- FALSE);
- if (!path)
- {
- path = egg_real_tree_model_filter_convert_child_path_to_path (filter,
- c_path,
- FALSE,
- TRUE);
-
- if (!path)
- {
- /* fixup the offsets */
- GtkTreePath *real_path;
-
- if (!filter->root)
- return;
-
- level = FILTER_LEVEL (filter->root);
-
- /* subtract vroot if necessary */
- if (filter->virtual_root)
- {
- real_path = egg_tree_model_filter_remove_root (c_path,
- filter->virtual_root);
- /* we don't handle this */
- if (!real_path)
- return;
- }
- else
- real_path = gtk_tree_path_copy (c_path);
-
- i = 0;
- if (gtk_tree_path_get_depth (real_path) - 1 >= 1)
- {
- while (i < gtk_tree_path_get_depth (real_path) - 1)
- {
- gint j;
-
- if (!level)
- {
- /* we don't cover this */
- gtk_tree_path_free (real_path);
- return;
- }
-
- elt = bsearch_elt_with_offset (level->array,
- gtk_tree_path_get_indices (real_path)[i],
- &j);
-
-
- if (!elt || !elt->children)
- {
- /* parent is filtered out, so no level */
- gtk_tree_path_free (real_path);
- return;
- }
-
- level = elt->children;
- i++;
- }
- }
-
- offset = gtk_tree_path_get_indices (real_path)[gtk_tree_path_get_depth (real_path) - 1];
- gtk_tree_path_free (real_path);
-
- if (!level)
- return;
-
- /* we need:
- * - the offset of the removed item
- * - the level
- */
- for (i = 0; i < level->array->len; i++)
- {
- elt = &g_array_index (level->array, FilterElt, i);
- if (elt->offset > offset)
- elt->offset--;
- if (elt->children)
- elt->children->parent_elt = elt;
- }
-
- return;
- }
-
- emit_signal = FALSE;
- }
-
- gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
-
- level = FILTER_LEVEL (iter.user_data);
- elt = FILTER_ELT (iter.user_data2);
- offset = elt->offset;
-
- if (!level->parent_level && elt->visible)
- filter->root_level_visible--;
-
- if (emit_signal)
- {
- if (level->ref_count == 0 && level != filter->root)
- {
- egg_tree_model_filter_increment_stamp (filter);
- gtk_tree_model_row_deleted (GTK_TREE_MODEL (data), path);
-
- gtk_tree_path_free (path);
- return;
- }
-
- egg_tree_model_filter_increment_stamp (filter);
- gtk_tree_model_row_deleted (GTK_TREE_MODEL (data), path);
- iter.stamp = filter->stamp;
-
- while (elt->ref_count > 0)
- egg_tree_model_filter_real_unref_node (GTK_TREE_MODEL (data), &iter,
- FALSE);
- }
-
- if (level->array->len == 1)
- {
- /* kill level */
- egg_tree_model_filter_free_level (filter, level);
- }
- else
- {
- FilterElt *tmp;
-
- /* remove the row */
- tmp = bsearch_elt_with_offset (level->array, elt->offset, &i);
-
- offset = tmp->offset;
- g_array_remove_index (level->array, i);
-
- for (i = MAX (--i, 0); i < level->array->len; i++)
- {
- elt = &g_array_index (level->array, FilterElt, i);
- if (elt->offset > offset)
- elt->offset--;
- if (elt->children)
- elt->children->parent_elt = elt;
- }
- }
-
- gtk_tree_path_free (path);
-}
-
-static void
-egg_tree_model_filter_rows_reordered (GtkTreeModel *c_model,
- GtkTreePath *c_path,
- GtkTreeIter *c_iter,
- gint *new_order,
- gpointer data)
-{
- FilterElt *elt;
- FilterLevel *level;
- EggTreeModelFilter *filter = EGG_TREE_MODEL_FILTER (data);
-
- GtkTreePath *path;
- GtkTreeIter iter;
-
- gint *tmp_array;
- gint i, j, elt_count;
- gint length;
-
- GArray *new_array;
-
- g_return_if_fail (new_order != NULL);
-
- if (c_path == NULL || gtk_tree_path_get_indices (c_path) == NULL)
- {
- if (!filter->root)
- return;
-
- length = gtk_tree_model_iter_n_children (c_model, NULL);
-
- if (filter->virtual_root)
- {
- gint new_pos = -1;
-
- /* reorder root level of path */
- for (i = 0; i < length; i++)
- if (new_order[i] == gtk_tree_path_get_indices (filter->virtual_root)[0])
- new_pos = i;
-
- if (new_pos < 0)
- return;
-
- gtk_tree_path_get_indices (filter->virtual_root)[0] = new_pos;
- return;
- }
-
- path = gtk_tree_path_new ();
- level = FILTER_LEVEL (filter->root);
- }
- else
- {
- GtkTreeIter child_iter;
-
- /* virtual root anchor reordering */
- if (filter->virtual_root &&
- gtk_tree_path_get_depth (c_path) <
- gtk_tree_path_get_depth (filter->virtual_root))
- {
- gint new_pos = -1;
- gint length;
- gint level;
- GtkTreeIter real_c_iter;
-
- level = gtk_tree_path_get_depth (c_path);
-
- if (c_iter)
- real_c_iter = *c_iter;
- else
- gtk_tree_model_get_iter (c_model, &real_c_iter, c_path);
-
- length = gtk_tree_model_iter_n_children (c_model, &real_c_iter);
-
- for (i = 0; i < length; i++)
- if (new_order[i] == gtk_tree_path_get_indices (filter->virtual_root)[level])
- new_pos = i;
-
- if (new_pos < 0)
- return;
-
- gtk_tree_path_get_indices (filter->virtual_root)[level] = new_pos;
- return;
- }
-
- path = egg_real_tree_model_filter_convert_child_path_to_path (filter,
- c_path,
- FALSE,
- FALSE);
- if (!path && filter->virtual_root &&
- gtk_tree_path_compare (c_path, filter->virtual_root))
- return;
-
- if (!path && !filter->virtual_root)
- return;
-
- if (!path)
- {
- /* root level mode */
- if (!c_iter)
- gtk_tree_model_get_iter (c_model, c_iter, c_path);
- length = gtk_tree_model_iter_n_children (c_model, c_iter);
- path = gtk_tree_path_new ();
- level = FILTER_LEVEL (filter->root);
- }
- else
- {
- gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
-
- level = FILTER_LEVEL (iter.user_data);
- elt = FILTER_ELT (iter.user_data2);
-
- if (!elt->children)
- {
- gtk_tree_path_free (path);
- return;
- }
-
- level = elt->children;
-
- egg_tree_model_filter_convert_iter_to_child_iter (EGG_TREE_MODEL_FILTER (filter), &child_iter, &iter);
- length = gtk_tree_model_iter_n_children (c_model, &child_iter);
- }
- }
-
- if (level->array->len < 1)
- return;
-
- /* NOTE: we do not bail out here if level->array->len < 2 like
- * GtkTreeModelSort does. This because we do some special tricky
- * reordering.
- */
-
- /* construct a new array */
- new_array = g_array_sized_new (FALSE, FALSE, sizeof (FilterElt),
- level->array->len);
- tmp_array = g_new (gint, level->array->len);
-
- for (i = 0, elt_count = 0; i < length; i++)
- {
- FilterElt *e = NULL;
- gint old_offset = -1;
-
- for (j = 0; j < level->array->len; j++)
- if (g_array_index (level->array, FilterElt, j).offset == new_order[i])
- {
- e = &g_array_index (level->array, FilterElt, j);
- old_offset = j;
- break;
- }
-
- if (!e)
- continue;
-
- tmp_array[elt_count] = old_offset;
- g_array_append_val (new_array, *e);
- g_array_index (new_array, FilterElt, elt_count).offset = i;
- elt_count++;
- }
-
- g_array_free (level->array, TRUE);
- level->array = new_array;
-
- /* fix up stuff */
- for (i = 0; i < level->array->len; i++)
- {
- FilterElt *e = &g_array_index (level->array, FilterElt, i);
- if (e->children)
- e->children->parent_elt = e;
- }
-
- /* emit rows_reordered */
- if (!gtk_tree_path_get_indices (path))
- gtk_tree_model_rows_reordered (GTK_TREE_MODEL (data), path, NULL,
- tmp_array);
- else
- gtk_tree_model_rows_reordered (GTK_TREE_MODEL (data), path, &iter,
- tmp_array);
-
- /* done */
- g_free (tmp_array);
- gtk_tree_path_free (path);
-}
-
-/* TreeModelIface implementation */
-static guint
-egg_tree_model_filter_get_flags (GtkTreeModel *model)
-{
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (model), 0);
-
- return 0;
-}
-
-static gint
-egg_tree_model_filter_get_n_columns (GtkTreeModel *model)
-{
- EggTreeModelFilter *filter = (EggTreeModelFilter *)model;
-
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (model), 0);
- g_return_val_if_fail (filter->child_model != NULL, 0);
-
- if (filter->child_model == NULL)
- return 0;
-
- /* so we can't modify the modify func after this ... */
- filter->modify_func_set = TRUE;
-
- if (filter->modify_n_columns > 0)
- return filter->modify_n_columns;
-
- return gtk_tree_model_get_n_columns (filter->child_model);
-}
-
-static GType
-egg_tree_model_filter_get_column_type (GtkTreeModel *model,
- gint index)
-{
- EggTreeModelFilter *filter = (EggTreeModelFilter *)model;
-
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (model), G_TYPE_INVALID);
- g_return_val_if_fail (filter->child_model != NULL, G_TYPE_INVALID);
-
- /* so we can't modify the modify func after this ... */
- filter->modify_func_set = TRUE;
-
- if (filter->modify_types)
- {
- g_return_val_if_fail (index < filter->modify_n_columns, G_TYPE_INVALID);
-
- return filter->modify_types[index];
- }
-
- return gtk_tree_model_get_column_type (filter->child_model, index);
-}
-
-static gboolean
-egg_tree_model_filter_get_iter (GtkTreeModel *model,
- GtkTreeIter *iter,
- GtkTreePath *path)
-{
- EggTreeModelFilter *filter = (EggTreeModelFilter *)model;
- gint *indices;
- FilterLevel *level;
- gint depth, i;
-
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (model), FALSE);
- g_return_val_if_fail (filter->child_model != NULL, FALSE);
-
- indices = gtk_tree_path_get_indices (path);
-
- if (filter->root == NULL)
- egg_tree_model_filter_build_level (filter, NULL, NULL);
- level = FILTER_LEVEL (filter->root);
-
- depth = gtk_tree_path_get_depth (path);
- if (!depth)
- {
- iter->stamp = 0;
- return FALSE;
- }
-
- for (i = 0; i < depth - 1; i++)
- {
- if (!level || indices[i] >= level->array->len)
- {
- return FALSE;
- }
-
- if (!g_array_index (level->array, FilterElt, indices[i]).children)
- egg_tree_model_filter_build_level (filter, level,
- &g_array_index (level->array,
- FilterElt,
- indices[i]));
- level = g_array_index (level->array, FilterElt, indices[i]).children;
- }
-
- if (!level || indices[i] >= level->array->len)
- {
- iter->stamp = 0;
- return FALSE;
- }
-
- iter->stamp = filter->stamp;
- iter->user_data = level;
- iter->user_data2 = &g_array_index (level->array, FilterElt,
- indices[depth - 1]);
-
- return TRUE;
-}
-
-static GtkTreePath *
-egg_tree_model_filter_get_path (GtkTreeModel *model,
- GtkTreeIter *iter)
-{
- GtkTreePath *retval;
- FilterLevel *level;
- FilterElt *elt;
-
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (model), NULL);
- g_return_val_if_fail (EGG_TREE_MODEL_FILTER (model)->child_model != NULL, NULL);
- g_return_val_if_fail (EGG_TREE_MODEL_FILTER (model)->stamp == iter->stamp, NULL);
-
- retval = gtk_tree_path_new ();
- level = iter->user_data;
- elt = iter->user_data2;
-
- while (level)
- {
- gtk_tree_path_prepend_index (retval,
- elt - FILTER_ELT (level->array->data));
- elt = level->parent_elt;
- level = level->parent_level;
- }
-
- return retval;
-}
-
-static void
-egg_tree_model_filter_get_value (GtkTreeModel *model,
- GtkTreeIter *iter,
- gint column,
- GValue *value)
-{
- GtkTreeIter child_iter;
- EggTreeModelFilter *filter = EGG_TREE_MODEL_FILTER (model);
-
- g_return_if_fail (EGG_IS_TREE_MODEL_FILTER (model));
- g_return_if_fail (EGG_TREE_MODEL_FILTER (model)->child_model != NULL);
- g_return_if_fail (EGG_TREE_MODEL_FILTER (model)->stamp == iter->stamp);
-
- if (filter->modify_func)
- {
- g_return_if_fail (column < filter->modify_n_columns);
-
- g_value_init (value, filter->modify_types[column]);
- filter->modify_func (model,
- iter,
- value,
- column,
- filter->modify_data);
-
- return;
- }
-
- egg_tree_model_filter_convert_iter_to_child_iter (EGG_TREE_MODEL_FILTER (model), &child_iter, iter);
- gtk_tree_model_get_value (EGG_TREE_MODEL_FILTER (model)->child_model,
- &child_iter, column, value);
-}
-
-static gboolean
-egg_tree_model_filter_iter_next (GtkTreeModel *model,
- GtkTreeIter *iter)
-{
- FilterLevel *level;
- FilterElt *elt;
-
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (model), FALSE);
- g_return_val_if_fail (EGG_TREE_MODEL_FILTER (model)->child_model != NULL, FALSE);
- g_return_val_if_fail (EGG_TREE_MODEL_FILTER (model)->stamp == iter->stamp, FALSE);
-
- level = iter->user_data;
- elt = iter->user_data2;
-
- if (elt - FILTER_ELT (level->array->data) >= level->array->len - 1)
- {
- iter->stamp = 0;
- return FALSE;
- }
-
- iter->user_data2 = elt + 1;
-
- return TRUE;
-}
-
-static gboolean
-egg_tree_model_filter_iter_children (GtkTreeModel *model,
- GtkTreeIter *iter,
- GtkTreeIter *parent)
-{
- EggTreeModelFilter *filter = (EggTreeModelFilter *)model;
- FilterLevel *level;
-
- iter->stamp = 0;
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (model), FALSE);
- g_return_val_if_fail (filter->child_model != NULL, FALSE);
- if (parent)
- g_return_val_if_fail (filter->stamp == parent->stamp, FALSE);
-
- if (!parent)
- {
- if (!filter->root)
- egg_tree_model_filter_build_level (filter, NULL, NULL);
- if (!filter->root)
- return FALSE;
-
- level = filter->root;
- iter->stamp = filter->stamp;
- iter->user_data = level;
- iter->user_data2 = level->array->data;
- }
- else
- {
- if (FILTER_ELT (parent->user_data2)->children == NULL)
- egg_tree_model_filter_build_level (filter,
- FILTER_LEVEL (parent->user_data),
- FILTER_ELT (parent->user_data2));
- if (FILTER_ELT (parent->user_data2)->children == NULL)
- return FALSE;
-
- /* empty array? */
- if (FILTER_ELT (parent->user_data2)->children->array->len <= 0)
- return FALSE;
-
- iter->stamp = filter->stamp;
- iter->user_data = FILTER_ELT (parent->user_data2)->children;
- iter->user_data2 = FILTER_LEVEL (iter->user_data)->array->data;
- }
-
- return TRUE;
-}
-
-static gboolean
-egg_tree_model_filter_iter_has_child (GtkTreeModel *model,
- GtkTreeIter *iter)
-{
- GtkTreeIter child_iter;
- EggTreeModelFilter *filter = (EggTreeModelFilter *)model;
- FilterElt *elt;
-
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (model), FALSE);
- g_return_val_if_fail (filter->child_model != NULL, FALSE);
- g_return_val_if_fail (filter->stamp == iter->stamp, FALSE);
-
- filter = EGG_TREE_MODEL_FILTER (model);
-
- egg_tree_model_filter_convert_iter_to_child_iter (EGG_TREE_MODEL_FILTER (model), &child_iter, iter);
- elt = FILTER_ELT (iter->user_data2);
-
- /* we need to build the level to check if not all children are filtered
- * out
- */
- if (!elt->children
- && gtk_tree_model_iter_has_child (filter->child_model, &child_iter))
- egg_tree_model_filter_build_level (filter, FILTER_LEVEL (iter->user_data),
- elt);
-
- /* FIXME: we should prolly count the visible nodes here, just like in
- * _iter_n_children.
- */
- if (elt->children && elt->children->array->len > 0)
- return TRUE;
-
- return FALSE;
-}
-
-static gint
-egg_tree_model_filter_iter_n_children (GtkTreeModel *model,
- GtkTreeIter *iter)
-{
- GtkTreeIter child_iter;
- EggTreeModelFilter *filter = (EggTreeModelFilter *)model;
- FilterElt *elt;
-
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (model), 0);
- g_return_val_if_fail (filter->child_model != NULL, 0);
- if (iter)
- g_return_val_if_fail (filter->stamp == iter->stamp, 0);
-
- if (!iter)
- {
- if (!filter->root)
- egg_tree_model_filter_build_level (filter, NULL, NULL);
-
- /* count visible nodes */
- return filter->root_level_visible;
- }
-
- elt = FILTER_ELT (iter->user_data2);
- egg_tree_model_filter_convert_iter_to_child_iter (EGG_TREE_MODEL_FILTER (model), &child_iter, iter);
-
- if (!elt->children &&
- gtk_tree_model_iter_has_child (filter->child_model, &child_iter))
- egg_tree_model_filter_build_level (filter,
- FILTER_LEVEL (iter->user_data),
- elt);
-
- if (elt->children && elt->children->array->len)
- {
- int i = 0;
- int count = 0;
- GArray *a = elt->children->array;
-
- /* count visible nodes */
- for (i = 0; i < a->len; i++)
- if (g_array_index (a, FilterElt, i).visible)
- count++;
-
- return count;
- }
-
- return 0;
-}
-
-static gboolean
-egg_tree_model_filter_iter_nth_child (GtkTreeModel *model,
- GtkTreeIter *iter,
- GtkTreeIter *parent,
- gint n)
-{
- FilterLevel *level;
- GtkTreeIter children;
-
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (model), FALSE);
- if (parent)
- g_return_val_if_fail (EGG_TREE_MODEL_FILTER (model)->stamp == parent->stamp, FALSE);
-
- /* use this instead of has_Child to force us to build the level, if needed */
- if (egg_tree_model_filter_iter_children (model, &children, parent) == FALSE)
- {
- iter->stamp = 0;
- return FALSE;
- }
-
- level = children.user_data;
- if (n >= level->array->len)
- {
- iter->stamp = 0;
- return FALSE;
- }
-
- iter->stamp = EGG_TREE_MODEL_FILTER (model)->stamp;
- iter->user_data = level;
- iter->user_data2 = &g_array_index (level->array, FilterElt, n);
-
- return TRUE;
-}
-
-static gboolean
-egg_tree_model_filter_iter_parent (GtkTreeModel *model,
- GtkTreeIter *iter,
- GtkTreeIter *child)
-{
- FilterLevel *level;
-
- iter->stamp = 0;
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (model), FALSE);
- g_return_val_if_fail (EGG_TREE_MODEL_FILTER (model)->child_model != NULL, FALSE);
- g_return_val_if_fail (EGG_TREE_MODEL_FILTER (model)->stamp == child->stamp, FALSE);
-
- level = child->user_data;
-
- if (level->parent_level)
- {
- iter->stamp = EGG_TREE_MODEL_FILTER (model)->stamp;
- iter->user_data = level->parent_level;
- iter->user_data2 = level->parent_elt;
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-egg_tree_model_filter_ref_node (GtkTreeModel *model,
- GtkTreeIter *iter)
-{
- EggTreeModelFilter *filter = (EggTreeModelFilter *)model;
- GtkTreeIter child_iter;
- FilterLevel *level;
- FilterElt *elt;
-
- g_return_if_fail (EGG_IS_TREE_MODEL_FILTER (model));
- g_return_if_fail (EGG_TREE_MODEL_FILTER (model)->child_model != NULL);
- g_return_if_fail (EGG_TREE_MODEL_FILTER (model)->stamp == iter->stamp);
-
- egg_tree_model_filter_convert_iter_to_child_iter (EGG_TREE_MODEL_FILTER (model), &child_iter, iter);
-
- gtk_tree_model_ref_node (filter->child_model, &child_iter);
-
- level = iter->user_data;
- elt = iter->user_data2;
-
- elt->ref_count++;
- level->ref_count++;
- if (level->ref_count == 1)
- {
- FilterLevel *parent_level = level->parent_level;
- FilterElt *parent_elt = level->parent_elt;
-
- /* we were at zero -- time to decrease the zero_ref_count val */
- do
- {
- if (parent_elt)
- parent_elt->zero_ref_count--;
-
- if (parent_level)
- {
- parent_elt = parent_level->parent_elt;
- parent_level = parent_level->parent_level;
- }
- }
- while (parent_level);
- filter->zero_ref_count--;
- }
-}
-
-static void
-egg_tree_model_filter_unref_node (GtkTreeModel *model,
- GtkTreeIter *iter)
-{
- egg_tree_model_filter_real_unref_node (model, iter, TRUE);
-}
-
-static void
-egg_tree_model_filter_real_unref_node (GtkTreeModel *model,
- GtkTreeIter *iter,
- gboolean propagate_unref)
-{
- EggTreeModelFilter *filter = (EggTreeModelFilter *)model;
- FilterLevel *level;
- FilterElt *elt;
-
- g_return_if_fail (EGG_IS_TREE_MODEL_FILTER (model));
- g_return_if_fail (filter->child_model != NULL);
- g_return_if_fail (filter->stamp == iter->stamp);
-
- if (propagate_unref)
- {
- GtkTreeIter child_iter;
- egg_tree_model_filter_convert_iter_to_child_iter (EGG_TREE_MODEL_FILTER (model), &child_iter, iter);
- gtk_tree_model_unref_node (filter->child_model, &child_iter);
- }
-
- level = iter->user_data;
- elt = iter->user_data2;
-
- g_return_if_fail (elt->ref_count > 0);
-
- elt->ref_count--;
- level->ref_count--;
- if (level->ref_count == 0)
- {
- FilterLevel *parent_level = level->parent_level;
- FilterElt *parent_elt = level->parent_elt;
-
- /* we are at zero -- time to increase the zero_ref_count val */
- while (parent_level)
- {
- parent_elt->zero_ref_count++;
-
- parent_elt = parent_level->parent_elt;
- parent_level = parent_level->parent_level;
- }
- filter->zero_ref_count++;
- }
-}
-
-/* bits and pieces */
-static void
-egg_tree_model_filter_set_model (EggTreeModelFilter *filter,
- GtkTreeModel *child_model)
-{
- g_return_if_fail (EGG_IS_TREE_MODEL_FILTER (filter));
-
- if (filter->child_model)
- {
- g_signal_handler_disconnect (G_OBJECT (filter->child_model),
- filter->changed_id);
- g_signal_handler_disconnect (G_OBJECT (filter->child_model),
- filter->inserted_id);
- g_signal_handler_disconnect (G_OBJECT (filter->child_model),
- filter->has_child_toggled_id);
- g_signal_handler_disconnect (G_OBJECT (filter->child_model),
- filter->deleted_id);
- g_signal_handler_disconnect (G_OBJECT (filter->child_model),
- filter->reordered_id);
-
- /* reset our state */
- if (filter->root)
- egg_tree_model_filter_free_level (filter, filter->root);
-
- filter->root = NULL;
- g_object_unref (G_OBJECT (filter->child_model));
- filter->visible_column = -1;
- /* FIXME: destroy more crack here? the funcs? */
- }
-
- filter->child_model = child_model;
-
- if (child_model)
- {
- g_object_ref (G_OBJECT (filter->child_model));
- filter->changed_id =
- g_signal_connect (child_model, "row_changed",
- G_CALLBACK (egg_tree_model_filter_row_changed),
- filter);
- filter->inserted_id =
- g_signal_connect (child_model, "row_inserted",
- G_CALLBACK (egg_tree_model_filter_row_inserted),
- filter);
- filter->has_child_toggled_id =
- g_signal_connect (child_model, "row_has_child_toggled",
- G_CALLBACK (egg_tree_model_filter_row_has_child_toggled),
- filter);
- filter->deleted_id =
- g_signal_connect (child_model, "row_deleted",
- G_CALLBACK (egg_tree_model_filter_row_deleted),
- filter);
- filter->reordered_id =
- g_signal_connect (child_model, "rows_reordered",
- G_CALLBACK (egg_tree_model_filter_rows_reordered),
- filter);
-
- filter->child_flags = gtk_tree_model_get_flags (child_model);
- filter->stamp = g_random_int ();
- }
-}
-
-static void
-egg_tree_model_filter_set_root (EggTreeModelFilter *filter,
- GtkTreePath *root)
-{
- g_return_if_fail (EGG_IS_TREE_MODEL_FILTER (filter));
-
- if (!root)
- filter->virtual_root = NULL;
- else
- filter->virtual_root = gtk_tree_path_copy (root);
-}
-
-/* public API */
-
-/**
- * egg_tree_model_filter_new:
- * @child_model: A #GtkTreeModel.
- * @root: A #GtkTreePath or %NULL.
- *
- * Creates a new #GtkTreeModel, with @child_model as the child_model
- * and @root as the virtual root.
- *
- * Return value: A new #GtkTreeModel.
- */
-GtkTreeModel *
-egg_tree_model_filter_new (GtkTreeModel *child_model,
- GtkTreePath *root)
-{
- GtkTreeModel *retval;
-
- g_return_val_if_fail (GTK_IS_TREE_MODEL (child_model), NULL);
-
- retval = GTK_TREE_MODEL (g_object_new (egg_tree_model_filter_get_type (), NULL));
-
- egg_tree_model_filter_set_model (EGG_TREE_MODEL_FILTER (retval),
- child_model);
- egg_tree_model_filter_set_root (EGG_TREE_MODEL_FILTER (retval), root);
-
- return retval;
-}
-
-/**
- * egg_tree_model_filter_get_model:
- * @filter: A #EggTreeModelFilter.
- *
- * Returns a pointer to the child model of @filter.
- *
- * Return value: A pointer to a #GtkTreeModel.
- */
-GtkTreeModel *
-egg_tree_model_filter_get_model (EggTreeModelFilter *filter)
-{
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (filter), NULL);
-
- return filter->child_model;
-}
-
-/**
- * egg_tree_model_filter_set_visible_func:
- * @filter: A #EggTreeModelFilter.
- * @func: A #EggTreeModelFilterVisibleFunc, the visible function.
- * @data: User data to pass to the visible function, or %NULL.
- * @destroy: Destroy notifier of @data, or %NULL.
- *
- * Sets the visible function used when filtering the @filter to be @func. The
- * function should return %TRUE if the given row should be visible and
- * %FALSE otherwise.
- */
-void
-egg_tree_model_filter_set_visible_func (EggTreeModelFilter *filter,
- EggTreeModelFilterVisibleFunc func,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- g_return_if_fail (EGG_IS_TREE_MODEL_FILTER (filter));
- g_return_if_fail (func != NULL);
- g_return_if_fail (filter->visible_method_set == FALSE);
-
- if (filter->visible_func)
- {
- GtkDestroyNotify d = filter->visible_destroy;
-
- filter->visible_destroy = NULL;
- d (filter->visible_data);
- }
-
- filter->visible_func = func;
- filter->visible_data = data;
- filter->visible_destroy = destroy;
-
- filter->visible_method_set = TRUE;
-}
-
-/**
- * egg_tree_model_filter_set_modify_func:
- * @filter: A #EggTreeModelFilter.
- * @n_columns: The number of columns in the filter model.
- * @types: The #GType<!-- -->s of the columns.
- * @func: A #EggTreeModelFilterModifyFunc, or %NULL.
- * @data: User data to pass to the modify function, or %NULL.
- * @destroy: Destroy notifier of @data, or %NULL.
- *
- * Sets the @filter to have @n_columns columns with @types. If @func
- * is not %NULL, it will set @func to be the modify function of @filter.
- */
-void
-egg_tree_model_filter_set_modify_func (EggTreeModelFilter *filter,
- gint n_columns,
- GType *types,
- EggTreeModelFilterModifyFunc func,
- gpointer data,
- GtkDestroyNotify destroy)
-{
- g_return_if_fail (EGG_IS_TREE_MODEL_FILTER (filter));
- g_return_if_fail (func != NULL);
- g_return_if_fail (filter->modify_func_set == FALSE);
-
- if (filter->modify_destroy)
- {
- GtkDestroyNotify d = filter->modify_destroy;
-
- filter->modify_destroy = NULL;
- d (filter->modify_data);
- }
-
- filter->modify_n_columns = n_columns;
- filter->modify_types = g_new0 (GType, n_columns);
- memcpy (filter->modify_types, types, sizeof (GType) * n_columns);
- filter->modify_func = func;
- filter->modify_data = data;
- filter->modify_destroy = destroy;
-
- filter->modify_func_set = TRUE;
-}
-
-/**
- * egg_tree_model_filter_set_visible_column:
- * @filter: A #EggTreeModelFilter.
- * @column: A #gint which is the column containing the visible information.
- *
- * Sets @column of the child_model to be the column where @filter should
- * look for visibility information. @columns should be a column of type
- * %G_TYPE_BOOLEAN, where %TRUE means that a row is visible, and %FALSE
- * if not.
- */
-void
-egg_tree_model_filter_set_visible_column (EggTreeModelFilter *filter,
- gint column)
-{
- g_return_if_fail (EGG_IS_TREE_MODEL_FILTER (filter));
- g_return_if_fail (column >= 0);
- g_return_if_fail (filter->visible_method_set == FALSE);
-
- filter->visible_column = column;
-
- filter->visible_method_set = TRUE;
-}
-
-/* conversion */
-
-/**
- * egg_tree_model_filter_convert_child_iter_to_iter:
- * @filter: A #EggTreeModelFilter.
- * @filter_iter: An uninitialized #GtkTreeIter.
- * @child_iter: A valid #GtkTreeIter pointing to a row on the child model.
- *
- * Sets @filter_iter to point to the row in @filter that corresponds to the
- * row pointed at by @child_iter.
- */
-void
-egg_tree_model_filter_convert_child_iter_to_iter (EggTreeModelFilter *filter,
- GtkTreeIter *filter_iter,
- GtkTreeIter *child_iter)
-{
- GtkTreePath *child_path, *path;
-
- g_return_if_fail (EGG_IS_TREE_MODEL_FILTER (filter));
- g_return_if_fail (filter->child_model != NULL);
- g_return_if_fail (filter_iter != NULL);
- g_return_if_fail (child_iter != NULL);
-
- filter_iter->stamp = 0;
-
- child_path = gtk_tree_model_get_path (filter->child_model, child_iter);
- g_return_if_fail (child_path != NULL);
-
- path = egg_tree_model_filter_convert_child_path_to_path (filter,
- child_path);
- gtk_tree_path_free (child_path);
- g_return_if_fail (path != NULL);
-
- gtk_tree_model_get_iter (GTK_TREE_MODEL (filter), filter_iter, path);
- gtk_tree_path_free (path);
-}
-
-/**
- * egg_tree_model_filter_convert_iter_to_child_iter:
- * @filter: A #EggTreeModelFilter.
- * @child_iter: An uninitialized #GtkTreeIter.
- * @filter_iter: A valid #GtkTreeIter pointing to a row on @filter.
- *
- * Sets @child_iter to point to the row pointed to by @filter_iter.
- */
-void
-egg_tree_model_filter_convert_iter_to_child_iter (EggTreeModelFilter *filter,
- GtkTreeIter *child_iter,
- GtkTreeIter *filter_iter)
-{
- g_return_if_fail (EGG_IS_TREE_MODEL_FILTER (filter));
- g_return_if_fail (filter->child_model != NULL);
- g_return_if_fail (child_iter != NULL);
- g_return_if_fail (filter_iter != NULL);
- g_return_if_fail (filter_iter->stamp == filter->stamp);
-
- if (EGG_TREE_MODEL_FILTER_CACHE_CHILD_ITERS (filter))
- {
- *child_iter = FILTER_ELT (filter_iter->user_data2)->iter;
- }
- else
- {
- GtkTreePath *path;
-
- path = egg_tree_model_filter_elt_get_path (filter_iter->user_data,
- filter_iter->user_data2,
- NULL);
- gtk_tree_model_get_iter (filter->child_model, child_iter, path);
- gtk_tree_path_free (path);
- }
-}
-
-static GtkTreePath *
-egg_real_tree_model_filter_convert_child_path_to_path (EggTreeModelFilter *filter,
- GtkTreePath *child_path,
- gboolean build_levels,
- gboolean fetch_childs)
-{
- gint *child_indices;
- GtkTreePath *retval;
- GtkTreePath *real_path;
- FilterLevel *level;
- FilterElt *tmp;
- gint i;
-
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (filter), NULL);
- g_return_val_if_fail (filter->child_model != NULL, NULL);
- g_return_val_if_fail (child_path != NULL, NULL);
-
- if (!filter->virtual_root)
- real_path = gtk_tree_path_copy (child_path);
- else
- real_path = egg_tree_model_filter_remove_root (child_path,
- filter->virtual_root);
-
- if (!real_path)
- return NULL;
-
- retval = gtk_tree_path_new ();
- child_indices = gtk_tree_path_get_indices (real_path);
-
- if (filter->root == NULL && build_levels)
- egg_tree_model_filter_build_level (filter, NULL, NULL);
- level = FILTER_LEVEL (filter->root);
-
- for (i = 0; i < gtk_tree_path_get_depth (real_path); i++)
- {
- gint j;
- gboolean found_child = FALSE;
-
- if (!level)
- {
- gtk_tree_path_free (real_path);
- gtk_tree_path_free (retval);
- return NULL;
- }
-
- tmp = bsearch_elt_with_offset (level->array, child_indices[i], &j);
- if (tmp)
- {
- gtk_tree_path_append_index (retval, j);
- if (!tmp->children && build_levels)
- egg_tree_model_filter_build_level (filter, level, tmp);
- level = tmp->children;
- found_child = TRUE;
- }
-
- if (!found_child && fetch_childs)
- {
- tmp = egg_tree_model_filter_fetch_child (filter, level,
- child_indices[i],
- &j);
-
- /* didn't find the child, let's try to bring it back */
- if (!tmp || tmp->offset != child_indices[i])
- {
- /* not there */
- gtk_tree_path_free (real_path);
- gtk_tree_path_free (retval);
- return NULL;
- }
-
- gtk_tree_path_append_index (retval, j);
- if (!tmp->children && build_levels)
- egg_tree_model_filter_build_level (filter, level, tmp);
- level = tmp->children;
- found_child = TRUE;
- }
- else if (!found_child && !fetch_childs)
- {
- /* no path */
- gtk_tree_path_free (real_path);
- gtk_tree_path_free (retval);
- return NULL;
- }
- }
-
- gtk_tree_path_free (real_path);
- return retval;
-}
-
-/**
- * egg_tree_model_filter_convert_child_path_to_path:
- * @filter: A #EggTreeModelFilter.
- * @child_path: A #GtkTreePath to convert.
- *
- * Converts @child_path to a path relative to @filter. That is, @child_path
- * points to a path in the child model. The rerturned path will point to the
- * same row in the filtered model. If @child_path isn't a valid path on the
- * child model, then %NULL is returned.
- *
- * Return value: A newly allocated #GtkTreePath, or %NULL.
- */
-GtkTreePath *
-egg_tree_model_filter_convert_child_path_to_path (EggTreeModelFilter *filter,
- GtkTreePath *child_path)
-{
- /* this function does the sanity checks */
- return egg_real_tree_model_filter_convert_child_path_to_path (filter,
- child_path,
- TRUE,
- TRUE);
-}
-
-/**
- * egg_tree_model_filter_convert_path_to_child_path:
- * @filter: A #EggTreeModelFilter.
- * @filter_path: A #GtkTreePath to convert.
- *
- * Converts @filter_path to a path on the child model of @filter. That is,
- * @filter_path points to a location in @filter. The returned path will
- * point to the same location in the model not being filtered. If @filter_path
- * does not point to a location in the child model, %NULL is returned.
- *
- * Return value: A newly allocated #GtkTreePath, or %NULL.
- */
-GtkTreePath *
-egg_tree_model_filter_convert_path_to_child_path (EggTreeModelFilter *filter,
- GtkTreePath *filter_path)
-{
- gint *filter_indices;
- GtkTreePath *retval;
- FilterLevel *level;
- gint i;
-
- g_return_val_if_fail (EGG_IS_TREE_MODEL_FILTER (filter), NULL);
- g_return_val_if_fail (filter->child_model != NULL, NULL);
- g_return_val_if_fail (filter_path != NULL, NULL);
-
- /* convert path */
- retval = gtk_tree_path_new ();
- filter_indices = gtk_tree_path_get_indices (filter_path);
- if (!filter->root)
- egg_tree_model_filter_build_level (filter, NULL, NULL);
- level = FILTER_LEVEL (filter->root);
-
- for (i = 0; i < gtk_tree_path_get_depth (filter_path); i++)
- {
- gint count = filter_indices[i];
-
- if (!level || level->array->len <= filter_indices[i])
- {
- gtk_tree_path_free (retval);
- return NULL;
- }
-
- if (g_array_index (level->array, FilterElt, count).children == NULL)
- egg_tree_model_filter_build_level (filter, level, &g_array_index (level->array, FilterElt, count));
-
- if (!level || level->array->len <= filter_indices[i])
- {
- gtk_tree_path_free (retval);
- return NULL;
- }
-
- gtk_tree_path_append_index (retval, g_array_index (level->array, FilterElt, count).offset);
- level = g_array_index (level->array, FilterElt, count).children;
- }
-
- /* apply vroot */
-
- if (filter->virtual_root)
- {
- GtkTreePath *real_retval;
-
- real_retval = egg_tree_model_filter_add_root (retval,
- filter->virtual_root);
- gtk_tree_path_free (retval);
-
- return real_retval;
- }
-
- return retval;
-}
-
-static gboolean
-egg_tree_model_filter_refilter_helper (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gpointer data)
-{
- /* evil, don't try this at home, but certainly speeds things up */
- egg_tree_model_filter_row_changed (model, path, iter, data);
-
- return FALSE;
-}
-
-/**
- * egg_tree_model_filter_refilter:
- * @filter: A #EggTreeModelFilter.
- *
- * Emits ::row_changed for each row in the child model, which causes
- * the filter to re-evaluate whether a row is visible or not.
- */
-void
-egg_tree_model_filter_refilter (EggTreeModelFilter *filter)
-{
- g_return_if_fail (EGG_IS_TREE_MODEL_FILTER (filter));
-
- /* S L O W */
- gtk_tree_model_foreach (filter->child_model,
- egg_tree_model_filter_refilter_helper,
- filter);
-}
-
-/**
- * egg_tree_model_filter_clear_cache:
- * @filter: A #EggTreeModelFilter.
- *
- * This function should almost never be called. It clears the @filter
- * of any cached iterators that haven't been reffed with
- * gtk_tree_model_ref_node(). This might be useful if the child model
- * being filtered is static (and doesn't change often) and there has been
- * a lot of unreffed access to nodes. As a side effect of this function,
- * all unreffed itters will be invalid.
- */
-void
-egg_tree_model_filter_clear_cache (EggTreeModelFilter *filter)
-{
- g_return_if_fail (EGG_IS_TREE_MODEL_FILTER (filter));
-
- if (filter->zero_ref_count)
- egg_tree_model_filter_clear_cache_helper (filter,
- FILTER_LEVEL (filter->root));
-}
diff --git a/lib/egg/eggtreemodelfilter.h b/lib/egg/eggtreemodelfilter.h
deleted file mode 100644
index b30fc2e1a..000000000
--- a/lib/egg/eggtreemodelfilter.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* eggtreemodelfilter.h
- * Copyright (C) 2000,2001 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
- * Copyright (C) 2001,2002 Kristian Rietveld <kris@gtk.org>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __EGG_TREE_MODEL_FILTER_H__
-#define __EGG_TREE_MODEL_FILTER_H__
-
-#include <gtk/gtktreemodel.h>
-
-G_BEGIN_DECLS
-
-#define EGG_TYPE_TREE_MODEL_FILTER (egg_tree_model_filter_get_type ())
-#define EGG_TREE_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_TREE_MODEL_FILTER, EggTreeModelFilter))
-#define EGG_TREE_MODEL_FILTER_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), EGG_TYPE_TREE_MODEL_FILTER, EggTreeModelFilterClass))
-#define EGG_IS_TREE_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_TREE_MODEL_FILTER))
-#define EGG_IS_TREE_MODEL_FILTER_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), EGG_TYPE_TREE_MODEL_FILTER))
-#define EGG_TREE_MODEL_FILTER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((obj), EGG_TYPE_TREE_MODEL_FILTER, EggTreeModelFilterClass))
-
-typedef gboolean (* EggTreeModelFilterVisibleFunc) (GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data);
-typedef void (* EggTreeModelFilterModifyFunc) (GtkTreeModel *model,
- GtkTreeIter *iter,
- GValue *value,
- gint column,
- gpointer data);
-
-typedef struct _EggTreeModelFilter EggTreeModelFilter;
-typedef struct _EggTreeModelFilterClass EggTreeModelFilterClass;
-
-struct _EggTreeModelFilter
-{
- GObject parent;
-
- /*< private >*/
- gpointer root;
- gint stamp;
- guint child_flags;
- GtkTreeModel *child_model;
- gint zero_ref_count;
-
- guint root_level_visible;
-
- GtkTreePath *virtual_root;
-
- EggTreeModelFilterVisibleFunc visible_func;
- gpointer visible_data;
- GtkDestroyNotify visible_destroy;
-
- gint modify_n_columns;
- GType *modify_types;
- EggTreeModelFilterModifyFunc modify_func;
- gpointer modify_data;
- gpointer modify_destroy;
-
- gint visible_column;
-
- gboolean visible_method_set;
- gboolean modify_func_set;
-
- /* signal ids */
- guint changed_id;
- guint inserted_id;
- guint has_child_toggled_id;
- guint deleted_id;
- guint reordered_id;
-};
-
-struct _EggTreeModelFilterClass
-{
- GObjectClass parent_class;
-};
-
-GType egg_tree_model_filter_get_type (void);
-GtkTreeModel *egg_tree_model_filter_new (GtkTreeModel *child_model,
- GtkTreePath *root);
-void egg_tree_model_filter_set_visible_func (EggTreeModelFilter *filter,
- EggTreeModelFilterVisibleFunc func,
- gpointer data,
- GtkDestroyNotify destroy);
-void egg_tree_model_filter_set_modify_func (EggTreeModelFilter *filter,
- gint n_columns,
- GType *types,
- EggTreeModelFilterModifyFunc func,
- gpointer data,
- GtkDestroyNotify destroy);
-void egg_tree_model_filter_set_visible_column (EggTreeModelFilter *filter,
- gint column);
-
-GtkTreeModel *egg_tree_model_filter_get_model (EggTreeModelFilter *filter);
-
-/* conversion */
-void egg_tree_model_filter_convert_child_iter_to_iter (EggTreeModelFilter *filter,
- GtkTreeIter *filter_iter,
- GtkTreeIter *child_iter);
-void egg_tree_model_filter_convert_iter_to_child_iter (EggTreeModelFilter *filter,
- GtkTreeIter *child_iter,
- GtkTreeIter *filter_iter);
-GtkTreePath *egg_tree_model_filter_convert_child_path_to_path (EggTreeModelFilter *filter,
- GtkTreePath *child_path);
-GtkTreePath *egg_tree_model_filter_convert_path_to_child_path (EggTreeModelFilter *path,
- GtkTreePath *filter_path);
-
-void egg_tree_model_filter_refilter (EggTreeModelFilter *filter);
-void egg_tree_model_filter_clear_cache (EggTreeModelFilter *filter);
-
-G_END_DECLS
-
-#endif /* __EGG_TREE_MODEL_FILTER_H__ */
diff --git a/lib/egg/prop-editor.h b/lib/egg/prop-editor.h
deleted file mode 100644
index 1f86d9be1..000000000
--- a/lib/egg/prop-editor.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* prop-editor.h
- * Copyright (C) 2000 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#include <gtk/gtkwidget.h>
-
-#ifndef __PROP_EDITOR_H__
-#define __PROP_EDITOR_H__
-
-G_BEGIN_DECLS
-
-GtkWidget *create_prop_editor (GObject *object,
- GType type);
-
-G_END_DECLS
-
-#endif /* __PROP_EDITOR_H__ */
diff --git a/lib/widgets/ephy-arrow-toolbutton.c b/lib/widgets/ephy-arrow-toolbutton.c
index 36fd99847..e40237f5f 100644
--- a/lib/widgets/ephy-arrow-toolbutton.c
+++ b/lib/widgets/ephy-arrow-toolbutton.c
@@ -71,7 +71,7 @@ ephy_arrow_toolbutton_get_type (void)
(GInstanceInitFunc) ephy_arrow_toolbutton_init
};
- ephy_arrow_toolbutton_type = g_type_register_static (EGG_TYPE_TOOL_BUTTON,
+ ephy_arrow_toolbutton_type = g_type_register_static (GTK_TYPE_TOOL_BUTTON,
"EphyArrowToolButton",
&our_info, 0);
}
@@ -81,7 +81,7 @@ ephy_arrow_toolbutton_get_type (void)
static gboolean
-ephy_arrow_toolbutton_set_tooltip (EggToolItem *tool_item,
+ephy_arrow_toolbutton_set_tooltip (GtkToolItem *tool_item,
GtkTooltips *tooltips,
const char *tip_text,
const char *tip_private)
@@ -99,7 +99,7 @@ static void
ephy_arrow_toolbutton_class_init (EphyArrowToolButtonClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- EggToolItemClass *tool_item_class = EGG_TOOL_ITEM_CLASS (klass);
+ GtkToolItemClass *tool_item_class = GTK_TOOL_ITEM_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@@ -204,11 +204,11 @@ ephy_arrow_toolbutton_init (EphyArrowToolButton *arrowtb)
arrowtb->priv = g_new (EphyArrowToolButtonPrivate, 1);
- egg_tool_item_set_homogeneous (EGG_TOOL_ITEM (arrowtb), FALSE);
+ gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (arrowtb), FALSE);
hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox);
- real_button = EGG_TOOL_BUTTON (arrowtb)->button;
+ real_button = GTK_BIN (arrowtb)->child;
g_object_ref (real_button);
gtk_container_remove (GTK_CONTAINER (arrowtb), real_button);
gtk_container_add (GTK_CONTAINER (hbox), real_button);
diff --git a/lib/widgets/ephy-arrow-toolbutton.h b/lib/widgets/ephy-arrow-toolbutton.h
index 7352d6c1a..f1452f585 100644
--- a/lib/widgets/ephy-arrow-toolbutton.h
+++ b/lib/widgets/ephy-arrow-toolbutton.h
@@ -21,8 +21,7 @@
#include <glib.h>
#include <gtk/gtkmenushell.h>
-
-#include "eggtoolbutton.h"
+#include <gtk/gtktoolbutton.h>
G_BEGIN_DECLS
@@ -39,13 +38,13 @@ typedef struct EphyArrowToolButtonPrivate EphyArrowToolButtonPrivate;
struct EphyArrowToolButton
{
- EggToolButton parent;
+ GtkToolButton parent;
EphyArrowToolButtonPrivate *priv;
};
struct EphyArrowToolButtonClass
{
- EggToolButtonClass parent_class;
+ GtkToolButtonClass parent_class;
void (*menu_activated) (EphyArrowToolButton *b);
};
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index f13c87e88..1d9d2172f 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -135,7 +135,7 @@ ephy_location_entry_get_type (void)
(GInstanceInitFunc) ephy_location_entry_init
};
- ephy_location_entry_type = g_type_register_static (EGG_TYPE_TOOL_ITEM,
+ ephy_location_entry_type = g_type_register_static (GTK_TYPE_TOOL_ITEM,
"EphyLocationEntry",
&our_info, 0);
}
@@ -144,7 +144,7 @@ ephy_location_entry_get_type (void)
}
static gboolean
-ephy_location_entry_set_tooltip (EggToolItem *tool_item,
+ephy_location_entry_set_tooltip (GtkToolItem *tool_item,
GtkTooltips *tooltips,
const char *tip_text,
const char *tip_private)
@@ -162,7 +162,7 @@ static void
ephy_location_entry_class_init (EphyLocationEntryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- EggToolItemClass *tool_item_class = EGG_TOOL_ITEM_CLASS (klass);
+ GtkToolItemClass *tool_item_class = GTK_TOOL_ITEM_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
@@ -224,7 +224,7 @@ ephy_location_entry_init (EphyLocationEntry *w)
ephy_location_entry_construct_contents (w);
- egg_tool_item_set_expand (EGG_TOOL_ITEM (w), TRUE);
+ gtk_tool_item_set_expand (GTK_TOOL_ITEM (w), TRUE);
g_signal_connect (w->priv->entry,
"focus_out_event",
diff --git a/lib/widgets/ephy-location-entry.h b/lib/widgets/ephy-location-entry.h
index 44dea2608..8af364cd7 100644
--- a/lib/widgets/ephy-location-entry.h
+++ b/lib/widgets/ephy-location-entry.h
@@ -20,7 +20,8 @@
#ifndef EPHY_LOCATION_ENTRY_H
#define EPHY_LOCATION_ENTRY_H
-#include "eggtoolitem.h"
+#include <gtk/gtktoolitem.h>
+
#include "ephy-autocompletion.h"
/* object forward declarations */
@@ -45,7 +46,7 @@ typedef struct _EphyLocationEntryPrivate EphyLocationEntryPrivate;
struct _EphyLocationEntryClass
{
- EggToolItemClass parent_class;
+ GtkToolItemClass parent_class;
/* signals */
void (*activated) (EphyLocationEntry *w,
@@ -60,7 +61,7 @@ struct _EphyLocationEntryClass
/* Remember: fields are public read-only */
struct _EphyLocationEntry
{
- EggToolItem parent_object;
+ GtkToolItem parent_object;
EphyLocationEntryPrivate *priv;
};
diff --git a/lib/widgets/ephy-node-view.c b/lib/widgets/ephy-node-view.c
index 8b1f09e0c..19af1961a 100644
--- a/lib/widgets/ephy-node-view.c
+++ b/lib/widgets/ephy-node-view.c
@@ -22,11 +22,11 @@
#include <gtk/gtktreeviewcolumn.h>
#include <gtk/gtkcellrenderertext.h>
#include <gtk/gtkcellrendererpixbuf.h>
+#include <gtk/gtktreemodelfilter.h>
#include <gtk/gtkwindow.h>
#include <gdk/gdkkeysyms.h>
#include <libgnomevfs/gnome-vfs-uri.h>
-#include "eggtreemodelfilter.h"
#include "ephy-node-view.h"
#include "ephy-tree-model-sort.h"
#include "eggtreemultidnd.h"
@@ -236,8 +236,8 @@ get_node_from_path (EphyNodeView *view, GtkTreePath *path)
gtk_tree_model_get_iter (view->priv->sortmodel, &iter, path);
gtk_tree_model_sort_convert_iter_to_child_iter
(GTK_TREE_MODEL_SORT (view->priv->sortmodel), &iter2, &iter);
- egg_tree_model_filter_convert_iter_to_child_iter
- (EGG_TREE_MODEL_FILTER (view->priv->filtermodel), &iter, &iter2);
+ gtk_tree_model_filter_convert_iter_to_child_iter
+ (GTK_TREE_MODEL_FILTER (view->priv->filtermodel), &iter, &iter2);
node = ephy_tree_model_node_node_from_iter (view->priv->nodemodel, &iter);
return node;
@@ -591,8 +591,8 @@ ephy_node_view_row_activated_cb (GtkTreeView *treeview,
gtk_tree_model_get_iter (view->priv->sortmodel, &iter, path);
gtk_tree_model_sort_convert_iter_to_child_iter
(GTK_TREE_MODEL_SORT (view->priv->sortmodel), &iter2, &iter);
- egg_tree_model_filter_convert_iter_to_child_iter
- (EGG_TREE_MODEL_FILTER (view->priv->filtermodel), &iter, &iter2);
+ gtk_tree_model_filter_convert_iter_to_child_iter
+ (GTK_TREE_MODEL_FILTER (view->priv->filtermodel), &iter, &iter2);
node = ephy_tree_model_node_node_from_iter (view->priv->nodemodel, &iter);
@@ -957,9 +957,9 @@ ephy_node_view_construct (EphyNodeView *view)
view->priv->nodemodel = ephy_tree_model_node_new (view->priv->root,
view->priv->filter);
- view->priv->filtermodel = egg_tree_model_filter_new (GTK_TREE_MODEL (view->priv->nodemodel),
+ view->priv->filtermodel = gtk_tree_model_filter_new (GTK_TREE_MODEL (view->priv->nodemodel),
NULL);
- egg_tree_model_filter_set_visible_column (EGG_TREE_MODEL_FILTER (view->priv->filtermodel),
+ gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER (view->priv->filtermodel),
EPHY_TREE_MODEL_NODE_COL_VISIBLE);
view->priv->sortmodel = ephy_tree_model_sort_new (view->priv->filtermodel);
gtk_tree_view_set_model (GTK_TREE_VIEW (view), GTK_TREE_MODEL (view->priv->sortmodel));
@@ -1026,8 +1026,8 @@ cell_renderer_edited (GtkCellRendererText *cell,
gtk_tree_model_get_iter (view->priv->sortmodel, &iter, path);
gtk_tree_model_sort_convert_iter_to_child_iter
(GTK_TREE_MODEL_SORT (view->priv->sortmodel), &iter2, &iter);
- egg_tree_model_filter_convert_iter_to_child_iter
- (EGG_TREE_MODEL_FILTER (view->priv->filtermodel), &iter, &iter2);
+ gtk_tree_model_filter_convert_iter_to_child_iter
+ (GTK_TREE_MODEL_FILTER (view->priv->filtermodel), &iter, &iter2);
node = ephy_tree_model_node_node_from_iter (view->priv->nodemodel, &iter);
g_value_init (&value, G_TYPE_STRING);
@@ -1317,24 +1317,13 @@ static void
get_selection (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
- void **data)
+ gpointer *data)
{
- GtkTreeModelSort *sortmodel = GTK_TREE_MODEL_SORT (model);
- EggTreeModelFilter *filtermodel = EGG_TREE_MODEL_FILTER (sortmodel->child_model);
- EphyTreeModelNode *nodemodel = EPHY_TREE_MODEL_NODE (filtermodel->child_model);
- GList **list = (GList **) data;
- GtkTreeIter *iter2 = gtk_tree_iter_copy (iter);
- GtkTreeIter iter3;
- GtkTreeIter iter4;
+ GList **list = data[0];
+ EphyNodeView *view = EPHY_NODE_VIEW (data);
EphyNode *node;
- gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (model),
- &iter3, iter2);
- egg_tree_model_filter_convert_iter_to_child_iter (filtermodel, &iter4, &iter3);
-
- node = ephy_tree_model_node_node_from_iter (nodemodel, &iter4);
-
- gtk_tree_iter_free (iter2);
+ node = get_node_from_path (view, path);
*list = g_list_prepend (*list, node);
}
@@ -1344,13 +1333,16 @@ ephy_node_view_get_selection (EphyNodeView *view)
{
GList *list = NULL;
GtkTreeSelection *selection;
+ gpointer data[2];
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+ data[0] = &list;
+ data[1] = view;
gtk_tree_selection_selected_foreach
(selection,
(GtkTreeSelectionForeachFunc) get_selection,
- (gpointer) &list);
+ (gpointer) data);
return list;
}
@@ -1375,7 +1367,7 @@ ephy_node_view_remove (EphyNodeView *view)
node = g_list_first (list)->data;
ephy_tree_model_node_iter_from_node (EPHY_TREE_MODEL_NODE (view->priv->nodemodel),
node, &iter);
- egg_tree_model_filter_convert_child_iter_to_iter (EGG_TREE_MODEL_FILTER (view->priv->filtermodel),
+ gtk_tree_model_filter_convert_child_iter_to_iter (GTK_TREE_MODEL_FILTER (view->priv->filtermodel),
&iter2, &iter);
gtk_tree_model_sort_convert_child_iter_to_iter (GTK_TREE_MODEL_SORT (view->priv->sortmodel),
&iter, &iter2);
@@ -1437,7 +1429,7 @@ ephy_node_view_select_node (EphyNodeView *view,
g_value_unset (&val);
if (visible == FALSE) return;
- egg_tree_model_filter_convert_child_iter_to_iter (EGG_TREE_MODEL_FILTER (view->priv->filtermodel),
+ gtk_tree_model_filter_convert_child_iter_to_iter (GTK_TREE_MODEL_FILTER (view->priv->filtermodel),
&iter2, &iter);
gtk_tree_model_sort_convert_child_iter_to_iter (GTK_TREE_MODEL_SORT (view->priv->sortmodel),
&iter, &iter2);
diff --git a/lib/widgets/ephy-zoom-action.c b/lib/widgets/ephy-zoom-action.c
index 248d6c74e..c952a1a08 100644
--- a/lib/widgets/ephy-zoom-action.c
+++ b/lib/widgets/ephy-zoom-action.c
@@ -73,7 +73,7 @@ ephy_zoom_action_get_type (void)
(GInstanceInitFunc) ephy_zoom_action_init,
};
- ephy_zoom_action_type = g_type_register_static (EGG_TYPE_ACTION,
+ ephy_zoom_action_type = g_type_register_static (GTK_TYPE_ACTION,
"EphyZoomAction",
&our_info, 0);
}
@@ -92,7 +92,7 @@ zoom_to_level_cb (EphyZoomControl *control,
}
static void
-sync_zoom_cb (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
+sync_zoom_cb (GtkAction *action, GParamSpec *pspec, GtkWidget *proxy)
{
EphyZoomAction *zoom_action = EPHY_ZOOM_ACTION (action);
@@ -100,14 +100,14 @@ sync_zoom_cb (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
}
static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
+connect_proxy (GtkAction *action, GtkWidget *proxy)
{
g_signal_connect_object (action, "notify::zoom",
G_CALLBACK (sync_zoom_cb), proxy, 0);
g_signal_connect (proxy, "zoom_to_level", GTK_SIGNAL_FUNC(zoom_to_level_cb), action);
- EGG_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
+ GTK_ACTION_CLASS (parent_class)->connect_proxy (action, proxy);
}
static void
@@ -150,7 +150,7 @@ ephy_zoom_action_get_property (GObject *object,
static void
ephy_zoom_action_class_init (EphyZoomActionClass *class)
{
- EggActionClass *action_class;
+ GtkActionClass *action_class;
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->set_property = ephy_zoom_action_set_property;
@@ -158,7 +158,7 @@ ephy_zoom_action_class_init (EphyZoomActionClass *class)
object_class->finalize = ephy_zoom_action_finalize;
parent_class = g_type_class_peek_parent (class);
- action_class = EGG_ACTION_CLASS (class);
+ action_class = GTK_ACTION_CLASS (class);
action_class->toolbar_item_type = EPHY_TYPE_ZOOM_CONTROL;
action_class->connect_proxy = connect_proxy;
diff --git a/lib/widgets/ephy-zoom-action.h b/lib/widgets/ephy-zoom-action.h
index 04e2d4e9b..3bced02f2 100644
--- a/lib/widgets/ephy-zoom-action.h
+++ b/lib/widgets/ephy-zoom-action.h
@@ -20,7 +20,7 @@
#ifndef EPHY_ZOOM_ACTION_H
#define EPHY_ZOOM_ACTION_H
-#include <egg-action.h>
+#include <gtk/gtkaction.h>
G_BEGIN_DECLS
@@ -37,14 +37,14 @@ typedef struct _EphyZoomActionPrivate EphyZoomActionPrivate;
struct _EphyZoomAction
{
- EggAction parent;
+ GtkAction parent;
EphyZoomActionPrivate *priv;
};
struct _EphyZoomActionClass
{
- EggActionClass parent_class;
+ GtkActionClass parent_class;
void (* zoom_to_level) (EphyZoomAction *action, float level);
};
diff --git a/lib/widgets/ephy-zoom-control.c b/lib/widgets/ephy-zoom-control.c
index ccd193a7d..91c611012 100644
--- a/lib/widgets/ephy-zoom-control.c
+++ b/lib/widgets/ephy-zoom-control.c
@@ -85,7 +85,7 @@ ephy_zoom_control_get_type (void)
(GInstanceInitFunc) ephy_zoom_control_init,
};
- ephy_zoom_control_type = g_type_register_static (EGG_TYPE_TOOL_ITEM,
+ ephy_zoom_control_type = g_type_register_static (GTK_TYPE_TOOL_ITEM,
"EphyZoomControl",
&our_info, 0);
}
@@ -116,7 +116,7 @@ proxy_menu_activate_cb (GtkMenuItem *menu_item, gpointer data)
}
static gboolean
-ephy_zoom_control_create_menu_proxy (EggToolItem *item)
+ephy_zoom_control_create_menu_proxy (GtkToolItem *item)
{
EphyZoomControl *control = EPHY_ZOOM_CONTROL (item);
EphyZoomControlPrivate *p = control->priv;
@@ -150,7 +150,7 @@ ephy_zoom_control_create_menu_proxy (EggToolItem *item)
g_object_ref (menu_item);
gtk_object_sink (GTK_OBJECT (menu_item));
- egg_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item);
+ gtk_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item);
g_object_unref (menu_item);
return TRUE;
@@ -272,7 +272,7 @@ ephy_zoom_control_get_property (GObject *object,
}
static gboolean
-ephy_zoom_control_set_tooltip (EggToolItem *tool_item,
+ephy_zoom_control_set_tooltip (GtkToolItem *tool_item,
GtkTooltips *tooltips,
const char *tip_text,
const char *tip_private)
@@ -290,12 +290,12 @@ static void
ephy_zoom_control_class_init (EphyZoomControlClass *klass)
{
GObjectClass *object_class;
- EggToolItemClass *tool_item_class;
+ GtkToolItemClass *tool_item_class;
parent_class = g_type_class_peek_parent (klass);
object_class = (GObjectClass *)klass;
- tool_item_class = (EggToolItemClass *)klass;
+ tool_item_class = (GtkToolItemClass *)klass;
object_class->set_property = ephy_zoom_control_set_property;
object_class->get_property = ephy_zoom_control_get_property;
diff --git a/lib/widgets/ephy-zoom-control.h b/lib/widgets/ephy-zoom-control.h
index 8b0fa0e46..a451bbd0d 100644
--- a/lib/widgets/ephy-zoom-control.h
+++ b/lib/widgets/ephy-zoom-control.h
@@ -19,7 +19,7 @@
#ifndef EPHY_ZOOM_CONTROL_H
#define EPHY_ZOOM_CONTROL_H
-#include "eggtoolitem.h"
+#include <gtk/gtktoolitem.h>
G_BEGIN_DECLS
@@ -42,7 +42,7 @@ typedef struct _EphyZoomControlPrivate EphyZoomControlPrivate;
struct _EphyZoomControlClass
{
- EggToolItemClass parent_class;
+ GtkToolItemClass parent_class;
/* signals */
void (*zoom_to_level) (EphyZoomControl *control, float level);
@@ -50,7 +50,7 @@ struct _EphyZoomControlClass
struct _EphyZoomControl
{
- EggToolItem parent_object;
+ GtkToolItem parent_object;
EphyZoomControlPrivate *priv;
};
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c
index 42aa5cac4..9ddda53c0 100644
--- a/src/bookmarks/ephy-bookmark-action.c
+++ b/src/bookmarks/ephy-bookmark-action.c
@@ -22,13 +22,13 @@
#include <bonobo/bonobo-i18n.h>
#include <libgnomevfs/gnome-vfs-uri.h>
+#include <gtk/gtktoolitem.h>
#include "ephy-bookmark-action.h"
#include "ephy-bookmarks.h"
#include "ephy-favicon-cache.h"
#include "ephy-shell.h"
#include "ephy-string.h"
-#include "eggtoolitem.h"
#include "ephy-debug.h"
#define MAX_LABEL_LENGTH 30
@@ -83,7 +83,7 @@ ephy_bookmark_action_get_type (void)
(GInstanceInitFunc) ephy_bookmark_action_init,
};
- type = g_type_register_static (EGG_TYPE_ACTION,
+ type = g_type_register_static (GTK_TYPE_ACTION,
"EphyBookmarkAction",
&type_info, 0);
}
@@ -91,13 +91,13 @@ ephy_bookmark_action_get_type (void)
}
static GtkWidget *
-create_tool_item (EggAction *action)
+create_tool_item (GtkAction *action)
{
GtkWidget *item, *button, *hbox, *label, *icon, *entry;
LOG ("Creating tool item for action %p", action)
- item = (* EGG_ACTION_CLASS (parent_class)->create_tool_item) (action);
+ item = (* GTK_ACTION_CLASS (parent_class)->create_tool_item) (action);
hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox);
@@ -132,9 +132,9 @@ create_tool_item (EggAction *action)
}
static void
-ephy_bookmark_action_sync_smart_url (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
+ephy_bookmark_action_sync_smart_url (GtkAction *action, GParamSpec *pspec, GtkWidget *proxy)
{
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
GtkWidget *entry;
gboolean smart_url;
@@ -154,7 +154,7 @@ ephy_bookmark_action_sync_smart_url (EggAction *action, GParamSpec *pspec, GtkWi
}
static void
-ephy_bookmark_action_sync_icon (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
+ephy_bookmark_action_sync_icon (GtkAction *action, GParamSpec *pspec, GtkWidget *proxy)
{
char *icon_location;
EphyFaviconCache *cache;
@@ -172,7 +172,7 @@ ephy_bookmark_action_sync_icon (EggAction *action, GParamSpec *pspec, GtkWidget
if (pixbuf == NULL) return;
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
GtkImage *icon;
@@ -196,18 +196,24 @@ ephy_bookmark_action_sync_icon (EggAction *action, GParamSpec *pspec, GtkWidget
}
static void
-ephy_bookmark_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
+ephy_bookmark_action_sync_label (GtkAction *action, GParamSpec *pspec, GtkWidget *proxy)
{
GtkWidget *label;
char *label_text;
char *title;
+ GValue value = { 0, };
LOG ("Set bookmark action proxy label to %s", action->label)
-
- title = ephy_string_shorten (action->label, MAX_LABEL_LENGTH);
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (G_OBJECT (action), "label", &value);
+
+ title = ephy_string_shorten (g_value_get_string (&value),
+ MAX_LABEL_LENGTH);
+ g_value_unset (&value);
if (EPHY_BOOKMARK_ACTION (action)->priv->smart_url
- && EGG_IS_TOOL_ITEM (proxy))
+ && GTK_IS_TOOL_ITEM (proxy))
{
label_text = g_strdup_printf (_("%s:"), title);
}
@@ -216,7 +222,7 @@ ephy_bookmark_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget
label_text = g_strdup (title);
}
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
label = g_object_get_data (G_OBJECT (proxy), "label");
g_return_if_fail (label != NULL);
@@ -238,7 +244,7 @@ ephy_bookmark_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget
}
static void
-activate_cb (GtkWidget *widget, EggAction *action)
+activate_cb (GtkWidget *widget, GtkAction *action)
{
char *location = NULL;
char *text = NULL;
@@ -292,7 +298,7 @@ activate_cb (GtkWidget *widget, EggAction *action)
}
static gboolean
-create_menu_proxy (EggToolItem *item, EggAction *action)
+create_menu_proxy (GtkToolItem *item, GtkAction *action)
{
EphyBookmarkAction *bm_action = EPHY_BOOKMARK_ACTION (action);
GtkWidget *menu_item;
@@ -300,14 +306,14 @@ create_menu_proxy (EggToolItem *item, EggAction *action)
LOG ("create_menu_proxy item %p, action %p", item, action);
- menu_item = EGG_ACTION_GET_CLASS (action)->create_menu_item (action);
+ menu_item = GTK_ACTION_GET_CLASS (action)->create_menu_item (action);
- EGG_ACTION_GET_CLASS (action)->connect_proxy (action, menu_item);
+ GTK_ACTION_GET_CLASS (action)->connect_proxy (action, menu_item);
menu_id = g_strdup_printf ("ephy-bookmark-action-%d-menu-id",
bm_action->priv->bookmark_id);
- egg_tool_item_set_proxy_menu_item (item, menu_id, menu_item);
+ gtk_tool_item_set_proxy_menu_item (item, menu_id, menu_item);
g_free (menu_id);
@@ -315,13 +321,13 @@ create_menu_proxy (EggToolItem *item, EggAction *action)
}
static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
+connect_proxy (GtkAction *action, GtkWidget *proxy)
{
GtkWidget *button, *entry;
LOG ("Connecting action %p to proxy %p", action, proxy)
- (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+ (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
ephy_bookmark_action_sync_label (action, NULL, proxy);
g_signal_connect_object (action, "notify::label",
@@ -335,7 +341,7 @@ connect_proxy (EggAction *action, GtkWidget *proxy)
g_signal_connect_object (action, "notify::smarturl",
G_CALLBACK (ephy_bookmark_action_sync_smart_url), proxy, 0);
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
button = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "button"));
g_signal_connect (button, "clicked", G_CALLBACK (activate_cb), action);
@@ -424,13 +430,13 @@ ephy_bookmark_action_finalize (GObject *object)
static void
ephy_bookmark_action_class_init (EphyBookmarkActionClass *class)
{
- EggActionClass *action_class;
+ GtkActionClass *action_class;
GObjectClass *object_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
- action_class = EGG_ACTION_CLASS (class);
+ action_class = GTK_ACTION_CLASS (class);
- action_class->toolbar_item_type = EGG_TYPE_TOOL_ITEM;
+ action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM;
action_class->create_tool_item = create_tool_item;
action_class->menu_item_type = GTK_TYPE_IMAGE_MENU_ITEM;
action_class->connect_proxy = connect_proxy;
@@ -483,7 +489,7 @@ ephy_bookmark_action_class_init (EphyBookmarkActionClass *class)
}
static void
-sync_bookmark_properties (EggAction *action, EphyNode *bmk)
+sync_bookmark_properties (GtkAction *action, EphyNode *bmk)
{
const char *title, *location, *icon;
gboolean smart_url;
@@ -506,7 +512,7 @@ sync_bookmark_properties (EggAction *action, EphyNode *bmk)
}
static void
-bookmarks_child_changed_cb (EphyNode *node, EphyNode *child, EggAction *action)
+bookmarks_child_changed_cb (EphyNode *node, EphyNode *child, GtkAction *action)
{
gulong id;
@@ -537,19 +543,19 @@ ephy_bookmark_action_init (EphyBookmarkAction *action)
G_OBJECT (action));
}
-EggAction *
+GtkAction *
ephy_bookmark_action_new (const char *name, guint id)
{
EphyNode *bmk;
EphyBookmarks *bookmarks;
- EggAction *action;
+ GtkAction *action;
bookmarks = ephy_shell_get_bookmarks (ephy_shell);
bmk = ephy_bookmarks_get_from_id (bookmarks, id);
g_return_val_if_fail (bmk != NULL, NULL);
- action = EGG_ACTION (g_object_new (EPHY_TYPE_BOOKMARK_ACTION,
+ action = GTK_ACTION (g_object_new (EPHY_TYPE_BOOKMARK_ACTION,
"name", name,
"bookmark_id", id,
NULL));
diff --git a/src/bookmarks/ephy-bookmark-action.h b/src/bookmarks/ephy-bookmark-action.h
index 2aa7a7ed0..d17dfe104 100644
--- a/src/bookmarks/ephy-bookmark-action.h
+++ b/src/bookmarks/ephy-bookmark-action.h
@@ -20,7 +20,7 @@
#define EPHY_BOOKMARK_ACTION_H
#include <gtk/gtk.h>
-#include <egg-action.h>
+#include <gtk/gtkaction.h>
#define EPHY_TYPE_BOOKMARK_ACTION (ephy_bookmark_action_get_type ())
#define EPHY_BOOKMARK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EPHY_TYPE_BOOKMARK_ACTION, EphyBookmarkAction))
@@ -35,20 +35,20 @@ typedef struct EphyBookmarkActionPrivate EphyBookmarkActionPrivate;
struct _EphyBookmarkAction
{
- EggAction parent;
+ GtkAction parent;
EphyBookmarkActionPrivate *priv;
};
struct _EphyBookmarkActionClass
{
- EggActionClass parent_class;
+ GtkActionClass parent_class;
void (*go_location) (EphyBookmarkAction *action, char *location);
};
GType ephy_bookmark_action_get_type (void);
-EggAction *ephy_bookmark_action_new (const char *name,
+GtkAction *ephy_bookmark_action_new (const char *name,
guint id);
#endif
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 952c848e6..aaf111f39 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -29,6 +29,10 @@
#include <gtk/gtkhpaned.h>
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
+#include <gtk/gtkactiongroup.h>
+#include <gtk/gtktoggleaction.h>
+#include <gtk/gtkuimanager.h>
+#include <gtk/gtktoggleaction.h>
#include <gdk/gdkkeysyms.h>
#include <bonobo/bonobo-i18n.h>
#include <libgnomeui/gnome-stock-icons.h>
@@ -45,10 +49,6 @@
#include "ephy-prefs.h"
#include "ephy-shell.h"
#include "ephy-file-helpers.h"
-#include "egg-action-group.h"
-#include "egg-toggle-action.h"
-#include "egg-menu-merge.h"
-#include "egg-toggle-action.h"
#include "popup-commands.h"
#include "ephy-state.h"
#include "window-commands.h"
@@ -94,33 +94,33 @@ static void ephy_bookmarks_editor_get_property (GObject *object,
GParamSpec *pspec);
static void ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor);
-static void cmd_open_bookmarks_in_tabs (EggAction *action,
+static void cmd_open_bookmarks_in_tabs (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_open_bookmarks_in_browser (EggAction *action,
+static void cmd_open_bookmarks_in_browser (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_show_in_bookmarks_bar (EggAction *action,
+static void cmd_show_in_bookmarks_bar (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_delete (EggAction *action,
+static void cmd_delete (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_bookmark_properties (EggAction *action,
+static void cmd_bookmark_properties (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_bookmarks_import (EggAction *action,
+static void cmd_bookmarks_import (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_add_topic (EggAction *action,
+static void cmd_add_topic (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_rename (EggAction *action,
+static void cmd_rename (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_close (EggAction *action,
+static void cmd_close (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_cut (EggAction *action,
+static void cmd_cut (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_copy (EggAction *action,
+static void cmd_copy (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_paste (EggAction *action,
+static void cmd_paste (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_select_all (EggAction *action,
+static void cmd_select_all (GtkAction *action,
EphyBookmarksEditor *editor);
-static void cmd_help_contents (EggAction *action,
+static void cmd_help_contents (GtkAction *action,
EphyBookmarksEditor *editor);
struct EphyBookmarksEditorPrivate
@@ -132,8 +132,8 @@ struct EphyBookmarksEditorPrivate
GtkWidget *search_entry;
GtkWidget *menu_dock;
GtkWidget *window;
- EggMenuMerge *ui_merge;
- EggActionGroup *action_group;
+ GtkUIManager *ui_merge;
+ GtkActionGroup *action_group;
int priority_col;
EphyToolbarsModel *tb_model;
GHashTable *props_dialogs;
@@ -147,58 +147,57 @@ enum
static GObjectClass *parent_class = NULL;
-static EggActionGroupEntry ephy_bookmark_popup_entries [] = {
+static GtkActionEntry ephy_bookmark_popup_entries [] = {
/* Toplevel */
- { "File", N_("_File"), NULL, NULL, NULL, NULL, NULL },
- { "Edit", N_("_Edit"), NULL, NULL, NULL, NULL, NULL },
- { "View", N_("_View"), NULL, NULL, NULL, NULL, NULL },
- { "Help", N_("_Help"), NULL, NULL, NULL, NULL, NULL },
- { "FakeToplevel", (""), NULL, NULL, NULL, NULL, NULL },
+ { "File", NULL, N_("_File") },
+ { "Edit", NULL, N_("_Edit") },
+ { "View", NULL, N_("_View") },
+ { "Help", NULL, N_("_Help") },
/* File Menu*/
- { "NewTopic", N_("_New Topic"), GTK_STOCK_NEW, "<control>N",
+ { "NewTopic", GTK_STOCK_NEW, N_("_New Topic"), "<control>N",
N_("Create a new topic"),
- G_CALLBACK (cmd_add_topic), NULL },
- { "OpenInWindow", N_("_Open in New Window"), GTK_STOCK_OPEN, "<control>O",
+ G_CALLBACK (cmd_add_topic) },
+ { "OpenInWindow", GTK_STOCK_OPEN, N_("_Open in New Window"), "<control>O",
N_("Open the selected bookmark in a new window"),
- G_CALLBACK (cmd_open_bookmarks_in_browser), NULL },
- { "OpenInTab", N_("Open in New _Tab"), NULL, "<shift><control>O",
+ G_CALLBACK (cmd_open_bookmarks_in_browser) },
+ { "OpenInTab", NULL, N_("Open in New _Tab"), "<shift><control>O",
N_("Open the selected bookmark in a new tab"),
- G_CALLBACK (cmd_open_bookmarks_in_tabs), NULL },
- { "Rename", N_("_Rename..."), NULL, "F2",
- N_("Rename the selected bookmark or topic"), G_CALLBACK (cmd_rename), NULL },
- { "Delete", N_("_Delete"), GTK_STOCK_DELETE, NULL,
+ G_CALLBACK (cmd_open_bookmarks_in_tabs) },
+ { "Rename", NULL, N_("_Rename..."), "F2",
+ N_("Rename the selected bookmark or topic"), G_CALLBACK (cmd_rename) },
+ { "Delete", GTK_STOCK_DELETE, N_("_Delete"), NULL,
N_("Delete the selected bookmark or topic"),
- G_CALLBACK (cmd_delete), NULL },
- { "ShowInBookmarksBar", N_("_Show in Bookmarks Bar"), NULL, NULL,
+ G_CALLBACK (cmd_delete) },
+ { "ShowInBookmarksBar", NULL, N_("_Show in Bookmarks Bar"), NULL,
N_("Show the selected bookmark or topic in the bookmarks bar"),
- G_CALLBACK (cmd_show_in_bookmarks_bar), NULL, TOGGLE_ACTION },
- { "Properties", N_("_Properties"), GTK_STOCK_PROPERTIES, "<alt>Return",
+ G_CALLBACK (cmd_show_in_bookmarks_bar), TRUE },
+ { "Properties", GTK_STOCK_PROPERTIES, N_("_Properties"), "<alt>Return",
N_("View or modify the properties of the selected bookmark"),
- G_CALLBACK (cmd_bookmark_properties), NULL },
- { "Import", N_("_Import Bookmarks..."), NULL, NULL,
+ G_CALLBACK (cmd_bookmark_properties) },
+ { "Import", NULL, N_("_Import Bookmarks..."), NULL,
N_("Import bookmarks from another browser or a bookmarks file"),
- G_CALLBACK (cmd_bookmarks_import), NULL },
- { "Close", N_("_Close"), GTK_STOCK_CLOSE, "<control>W",
+ G_CALLBACK (cmd_bookmarks_import) },
+ { "Close", GTK_STOCK_CLOSE, N_("_Close"), "<control>W",
N_("Close the bookmarks window"),
- G_CALLBACK (cmd_close), NULL },
+ G_CALLBACK (cmd_close) },
/* Edit Menu */
- { "Cut", N_("Cu_t"), GTK_STOCK_CUT, "<control>X",
+ { "Cut", GTK_STOCK_CUT, N_("Cu_t"), "<control>X",
N_("Cut the selection"),
- G_CALLBACK (cmd_cut), NULL },
- { "Copy", N_("_Copy"), GTK_STOCK_COPY, "<control>C",
+ G_CALLBACK (cmd_cut) },
+ { "Copy", GTK_STOCK_COPY, N_("_Copy"), "<control>C",
N_("Copy the selection"),
- G_CALLBACK (cmd_copy), NULL },
- { "Paste", N_("_Paste"), GTK_STOCK_PASTE, "<control>V",
+ G_CALLBACK (cmd_copy) },
+ { "Paste", GTK_STOCK_PASTE, N_("_Paste"), "<control>V",
N_("Paste the clipboard"),
- G_CALLBACK (cmd_paste), NULL },
- { "SelectAll", N_("Select _All"), NULL, "<control>A",
+ G_CALLBACK (cmd_paste) },
+ { "SelectAll", NULL, N_("Select _All"), "<control>A",
N_("Select all bookmarks or text"),
- G_CALLBACK (cmd_select_all), NULL },
+ G_CALLBACK (cmd_select_all) },
/* View Menu */
- { "ViewTitle", N_("_Title"), NULL, NULL,
+/* { "ViewTitle", N_("_Title"), NULL, NULL,
N_("Show only the title column"),
NULL, NULL, RADIO_ACTION, NULL },
{ "ViewLocation", N_("_Address"), NULL, NULL,
@@ -206,15 +205,15 @@ static EggActionGroupEntry ephy_bookmark_popup_entries [] = {
NULL, NULL, RADIO_ACTION, "ViewTitle" },
{ "ViewTitleLocation", N_("T_itle and Address"), NULL, NULL,
N_("Show both the title and address columns"),
- NULL, NULL, RADIO_ACTION, "ViewTitle" },
+ NULL, NULL, RADIO_ACTION, "ViewTitle" }, */
/* Help Menu */
- { "HelpContents", N_("_Contents"), GTK_STOCK_HELP, "F1",
+ { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1",
N_("Display bookmarks help"),
- G_CALLBACK (cmd_help_contents), NULL },
- { "HelpAbout", N_("_About"), GNOME_STOCK_ABOUT, NULL,
+ G_CALLBACK (cmd_help_contents) },
+ { "HelpAbout", GNOME_STOCK_ABOUT, N_("_About"), NULL,
N_("Display credits for the web browser creators"),
- G_CALLBACK (window_cmd_help_about), NULL },
+ G_CALLBACK (window_cmd_help_about) },
};
static guint ephy_bookmark_popup_n_entries = G_N_ELEMENTS (ephy_bookmark_popup_entries);
@@ -249,7 +248,7 @@ add_text_renderer_monitor (EphyBookmarksEditor *editor)
}
static void
-cmd_add_topic (EggAction *action,
+cmd_add_topic (GtkAction *action,
EphyBookmarksEditor *editor)
{
EphyNode *node;
@@ -262,14 +261,14 @@ cmd_add_topic (EggAction *action,
}
static void
-cmd_close (EggAction *action,
+cmd_close (GtkAction *action,
EphyBookmarksEditor *editor)
{
gtk_widget_hide (GTK_WIDGET (editor));
}
static void
-cmd_rename (EggAction *action,
+cmd_rename (GtkAction *action,
EphyBookmarksEditor *editor)
{
if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->bm_view)))
@@ -297,7 +296,7 @@ get_target_window (EphyBookmarksEditor *editor)
}
static void
-cmd_show_in_bookmarks_bar (EggAction *action,
+cmd_show_in_bookmarks_bar (GtkAction *action,
EphyBookmarksEditor *editor)
{
EphyNode *node;
@@ -324,7 +323,7 @@ cmd_show_in_bookmarks_bar (EggAction *action,
node = selection->data;
id = ephy_node_get_id (node);
- state = EGG_TOGGLE_ACTION (action)->active;
+ state = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
if (state)
{
@@ -341,7 +340,7 @@ cmd_show_in_bookmarks_bar (EggAction *action,
}
static void
-cmd_open_bookmarks_in_tabs (EggAction *action,
+cmd_open_bookmarks_in_tabs (GtkAction *action,
EphyBookmarksEditor *editor)
{
EphyWindow *window;
@@ -367,7 +366,7 @@ cmd_open_bookmarks_in_tabs (EggAction *action,
}
static void
-cmd_open_bookmarks_in_browser (EggAction *action,
+cmd_open_bookmarks_in_browser (GtkAction *action,
EphyBookmarksEditor *editor)
{
EphyWindow *window;
@@ -393,7 +392,7 @@ cmd_open_bookmarks_in_browser (EggAction *action,
}
static void
-cmd_delete (EggAction *action,
+cmd_delete (GtkAction *action,
EphyBookmarksEditor *editor)
{
if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->bm_view)))
@@ -498,7 +497,7 @@ import_dialog_response_cb (GtkDialog *dialog, gint response,
}
static void
-cmd_bookmarks_import (EggAction *action,
+cmd_bookmarks_import (GtkAction *action,
EphyBookmarksEditor *editor)
{
GtkWidget *dialog;
@@ -556,7 +555,7 @@ cmd_bookmarks_import (EggAction *action,
}
static void
-cmd_bookmark_properties (EggAction *action,
+cmd_bookmark_properties (GtkAction *action,
EphyBookmarksEditor *editor)
{
GList *selection;
@@ -574,7 +573,7 @@ cmd_bookmark_properties (EggAction *action,
}
static void
-cmd_cut (EggAction *action,
+cmd_cut (GtkAction *action,
EphyBookmarksEditor *editor)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -586,7 +585,7 @@ cmd_cut (EggAction *action,
}
static void
-cmd_copy (EggAction *action,
+cmd_copy (GtkAction *action,
EphyBookmarksEditor *editor)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -615,7 +614,7 @@ cmd_copy (EggAction *action,
}
static void
-cmd_paste (EggAction *action,
+cmd_paste (GtkAction *action,
EphyBookmarksEditor *editor)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -627,7 +626,7 @@ cmd_paste (EggAction *action,
}
static void
-cmd_select_all (EggAction *action,
+cmd_select_all (GtkAction *action,
EphyBookmarksEditor *editor)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -647,7 +646,7 @@ cmd_select_all (EggAction *action,
}
static void
-cmd_help_contents (EggAction *action,
+cmd_help_contents (GtkAction *action,
EphyBookmarksEditor *editor)
{
ephy_gui_help (GTK_WINDOW (editor),
@@ -720,7 +719,7 @@ ephy_bookmarks_editor_finalize (GObject *object)
g_object_unref (G_OBJECT (editor->priv->bookmarks_filter));
g_object_unref (editor->priv->action_group);
- egg_menu_merge_remove_action_group (editor->priv->ui_merge,
+ gtk_ui_manager_remove_action_group (editor->priv->ui_merge,
editor->priv->action_group);
g_object_unref (editor->priv->ui_merge);
@@ -768,8 +767,8 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
gboolean bmk_multiple_selection;
gboolean cut, copy, paste, select_all;
gboolean can_show_in_bookmarks_bar, show_in_bookmarks_bar = FALSE;
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
GList *selected;
GtkWidget *focus_widget;
@@ -874,37 +873,37 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
(key_selection && key_focus);
action_group = editor->priv->action_group;
- action = egg_action_group_get_action (action_group, "OpenInWindow");
+ action = gtk_action_group_get_action (action_group, "OpenInWindow");
g_object_set (action, "sensitive", open_in_window, NULL);
g_object_set (action, "label", open_in_window_label, NULL);
- action = egg_action_group_get_action (action_group, "OpenInTab");
+ action = gtk_action_group_get_action (action_group, "OpenInTab");
g_object_set (action, "sensitive", open_in_tab, NULL);
g_object_set (action, "label", open_in_tab_label, NULL);
- action = egg_action_group_get_action (action_group, "Rename");
+ action = gtk_action_group_get_action (action_group, "Rename");
g_object_set (action, "sensitive", rename, NULL);
- action = egg_action_group_get_action (action_group, "Delete");
+ action = gtk_action_group_get_action (action_group, "Delete");
g_object_set (action, "sensitive", delete, NULL);
- action = egg_action_group_get_action (action_group, "Properties");
+ action = gtk_action_group_get_action (action_group, "Properties");
g_object_set (action, "sensitive", properties, NULL);
- action = egg_action_group_get_action (action_group, "Cut");
+ action = gtk_action_group_get_action (action_group, "Cut");
g_object_set (action, "sensitive", cut, NULL);
- action = egg_action_group_get_action (action_group, "Copy");
+ action = gtk_action_group_get_action (action_group, "Copy");
g_object_set (action, "sensitive", copy, NULL);
g_object_set (action, "label", copy_label, NULL);
- action = egg_action_group_get_action (action_group, "Paste");
+ action = gtk_action_group_get_action (action_group, "Paste");
g_object_set (action, "sensitive", paste, NULL);
- action = egg_action_group_get_action (action_group, "SelectAll");
+ action = gtk_action_group_get_action (action_group, "SelectAll");
g_object_set (action, "sensitive", select_all, NULL);
- action = egg_action_group_get_action (action_group, "ShowInBookmarksBar");
+ action = gtk_action_group_get_action (action_group, "ShowInBookmarksBar");
g_object_set (action, "sensitive", can_show_in_bookmarks_bar, NULL);
g_signal_handlers_block_by_func
- (G_OBJECT (EGG_TOGGLE_ACTION (action)),
+ (G_OBJECT (GTK_TOGGLE_ACTION (action)),
G_CALLBACK (cmd_show_in_bookmarks_bar),
editor);
- egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action), show_in_bookmarks_bar);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show_in_bookmarks_bar);
g_signal_handlers_unblock_by_func
- (G_OBJECT (EGG_TOGGLE_ACTION (action)),
+ (G_OBJECT (GTK_TOGGLE_ACTION (action)),
G_CALLBACK (cmd_show_in_bookmarks_bar),
editor);
}
@@ -946,7 +945,7 @@ ephy_bookmarks_editor_show_popup_cb (GtkWidget *view,
{
GtkWidget *widget;
- widget = egg_menu_merge_get_widget (editor->priv->ui_merge,
+ widget = gtk_ui_manager_get_widget (editor->priv->ui_merge,
"/popups/EphyBookmarkEditorPopup");
gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2,
gtk_get_current_event_time ());
@@ -1037,7 +1036,7 @@ keyword_node_show_popup_cb (GtkWidget *view, EphyBookmarksEditor *editor)
{
GtkWidget *widget;
- widget = egg_menu_merge_get_widget (editor->priv->ui_merge,
+ widget = gtk_ui_manager_get_widget (editor->priv->ui_merge,
"/popups/EphyBookmarkKeywordPopup");
gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2,
gtk_get_current_event_time ());
@@ -1118,7 +1117,7 @@ build_search_box (EphyBookmarksEditor *editor)
}
static void
-add_widget (EggMenuMerge *merge, GtkWidget *widget, EphyBookmarksEditor *editor)
+add_widget (GtkUIManager *merge, GtkWidget *widget, EphyBookmarksEditor *editor)
{
gtk_box_pack_start (GTK_BOX (editor->priv->menu_dock),
widget, FALSE, FALSE, 0);
@@ -1206,11 +1205,11 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
GtkWidget *bm_view, *key_view;
GtkWidget *scrolled_window;
EphyNode *node;
- EggMenuMerge *ui_merge;
- EggActionGroup *action_group;
- EggAction *action;
+ GtkUIManager *ui_merge;
+ GtkActionGroup *action_group;
+ GtkAction *action;
GdkPixbuf *icon;
- int i, col_id;
+ int col_id;
gtk_window_set_title (GTK_WINDOW (editor), _("Bookmarks"));
@@ -1223,33 +1222,29 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
g_signal_connect (editor, "delete_event",
G_CALLBACK (delete_event_cb), NULL);
- for (i = 0; i < ephy_bookmark_popup_n_entries; i++)
- {
- ephy_bookmark_popup_entries[i].user_data = editor;
- }
-
editor->priv->menu_dock = gtk_vbox_new (FALSE, 0);
gtk_widget_show (editor->priv->menu_dock);
gtk_container_add (GTK_CONTAINER (editor), editor->priv->menu_dock);
- ui_merge = egg_menu_merge_new ();
+ ui_merge = gtk_ui_manager_new ();
g_signal_connect (ui_merge, "add_widget", G_CALLBACK (add_widget), editor);
- action_group = egg_action_group_new ("PopupActions");
- egg_action_group_add_actions (action_group, ephy_bookmark_popup_entries,
- ephy_bookmark_popup_n_entries);
- egg_menu_merge_insert_action_group (ui_merge,
+ action_group = gtk_action_group_new ("PopupActions");
+ gtk_action_group_add_actions (action_group, ephy_bookmark_popup_entries,
+ ephy_bookmark_popup_n_entries, editor);
+ gtk_ui_manager_insert_action_group (ui_merge,
action_group, 0);
- egg_menu_merge_add_ui_from_file (ui_merge,
+ gtk_ui_manager_add_ui_from_file (ui_merge,
ephy_file ("epiphany-bookmark-editor-ui.xml"),
NULL);
- gtk_window_add_accel_group (GTK_WINDOW (editor), ui_merge->accel_group);
- egg_menu_merge_ensure_update (ui_merge);
+ gtk_window_add_accel_group (GTK_WINDOW (editor),
+ gtk_ui_manager_get_accel_group (ui_merge));
+ /* FIXME gtk_ui_manager_ensure_update (ui_merge); */
editor->priv->ui_merge = ui_merge;
editor->priv->action_group = action_group;
/* Fixme: We should implement gconf prefs for monitoring this setting */
- action = egg_action_group_get_action (action_group, "ViewTitle");
- egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action), TRUE);
+ action = gtk_action_group_get_action (action_group, "ViewTitle");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
hpaned = gtk_hpaned_new ();
gtk_container_set_border_width (GTK_CONTAINER (hpaned), 0);
diff --git a/src/bookmarks/ephy-bookmarks-menu.c b/src/bookmarks/ephy-bookmarks-menu.c
index 9231d7a4c..b34056ac6 100644
--- a/src/bookmarks/ephy-bookmarks-menu.c
+++ b/src/bookmarks/ephy-bookmarks-menu.c
@@ -22,7 +22,6 @@
#include "ephy-bookmarks-menu.h"
#include "ephy-bookmark-action.h"
-#include "egg-menu-merge.h"
#include "ephy-shell.h"
#include "ephy-node-common.h"
#include "ephy-debug.h"
@@ -31,6 +30,7 @@
#include <stdlib.h>
#include <libxml/entities.h>
#include <bonobo/bonobo-i18n.h>
+#include <gtk/gtkuimanager.h>
#define EMPTY_ACTION_NAME "GoBookmarkEmpty"
@@ -41,7 +41,7 @@ struct _EphyBookmarksMenuPrivate
{
EphyWindow *window;
EphyBookmarks *bookmarks;
- EggActionGroup *action_group;
+ GtkActionGroup *action_group;
guint ui_id;
guint update_tag;
};
@@ -92,24 +92,24 @@ static void
ephy_bookmarks_menu_clean (EphyBookmarksMenu *menu)
{
EphyBookmarksMenuPrivate *p = menu->priv;
- EggMenuMerge *merge = EGG_MENU_MERGE (p->window->ui_merge);
+ GtkUIManager *merge = GTK_UI_MANAGER (p->window->ui_merge);
if (p->ui_id > 0)
{
- egg_menu_merge_remove_ui (merge, p->ui_id);
- egg_menu_merge_ensure_update (merge);
+ gtk_ui_manager_remove_ui (merge, p->ui_id);
+ /* FIXME gtk_ui_manager_ensure_update (merge); */
p->ui_id = 0;
}
if (p->action_group != NULL)
{
- egg_menu_merge_remove_action_group (merge, p->action_group);
+ gtk_ui_manager_remove_action_group (merge, p->action_group);
g_object_unref (p->action_group);
}
}
static void
-go_location_cb (EggAction *action, char *location, EphyWindow *window)
+go_location_cb (GtkAction *action, char *location, EphyWindow *window)
{
ephy_window_load_url (window, location);
}
@@ -212,7 +212,7 @@ add_bookmarks_menu (EphyBookmarksMenu *menu, EphyNode *node, GString *xml)
for (l = node_list; l != NULL; l = l->next)
{
- EggAction *action;
+ GtkAction *action;
EphyNode *child;
long id;
char *verb;
@@ -222,7 +222,7 @@ add_bookmarks_menu (EphyBookmarksMenu *menu, EphyNode *node, GString *xml)
verb = g_strdup_printf ("OpenBookmark%ld", id);
action = ephy_bookmark_action_new (verb, id);
- egg_action_group_add_action (p->action_group, action);
+ gtk_action_group_add_action (p->action_group, action);
g_object_unref (action);
g_signal_connect (action, "go_location",
G_CALLBACK (go_location_cb), p->window);
@@ -252,9 +252,9 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu)
EphyNode *topics;
EphyNode *not_categorized;
GPtrArray *children;
- EggMenuMerge *merge = EGG_MENU_MERGE (p->window->ui_merge);
+ GtkUIManager *merge = GTK_UI_MANAGER (p->window->ui_merge);
GList *node_list = NULL, *l;
- EggAction *empty;
+ GtkAction *empty;
LOG ("Rebuilding bookmarks menu")
@@ -271,16 +271,16 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu)
"<placeholder name=\"BookmarksTree\">"
"<separator name=\"BookmarksSep1\"/>");
- p->action_group = egg_action_group_new ("BookmarksActions");
- egg_menu_merge_insert_action_group (merge, p->action_group, 0);
+ p->action_group = gtk_action_group_new ("BookmarksActions");
+ gtk_ui_manager_insert_action_group (merge, p->action_group, 0);
- empty = g_object_new (EGG_TYPE_ACTION,
+ empty = g_object_new (GTK_TYPE_ACTION,
"name", EMPTY_ACTION_NAME,
/* This is the adjective, not the verb */
"label", _("Empty"),
"sensitive", FALSE,
NULL);
- egg_action_group_add_action (p->action_group, empty);
+ gtk_action_group_add_action (p->action_group, empty);
g_object_unref (empty);
for (i = 0; i < children->len; ++i)
@@ -307,17 +307,17 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu)
char *verb;
const char *title;
EphyNode *child;
- EggAction *action;
+ GtkAction *action;
child = l->data;
title = ephy_node_get_property_string (child, EPHY_NODE_KEYWORD_PROP_NAME);
verb = g_strdup_printf ("OpenTopic%ld", ephy_node_get_id (child));
- action = g_object_new (EGG_TYPE_ACTION,
+ action = g_object_new (GTK_TYPE_ACTION,
"name", verb,
"label", title,
NULL);
- egg_action_group_add_action (p->action_group, action);
+ gtk_action_group_add_action (p->action_group, action);
g_object_unref (action);
g_string_append (xml, "<submenu name=\"");
@@ -345,7 +345,7 @@ ephy_bookmarks_menu_rebuild (EphyBookmarksMenu *menu)
{
GError *error = NULL;
LOG ("Merging ui\n%s",xml->str);
- p->ui_id = egg_menu_merge_add_ui_from_string
+ p->ui_id = gtk_ui_manager_add_ui_from_string
(merge, xml->str, -1, &error);
}
@@ -459,8 +459,8 @@ ephy_bookmarks_menu_finalize (GObject *o)
if (p->action_group != NULL)
{
- egg_menu_merge_remove_action_group
- (EGG_MENU_MERGE (p->window->ui_merge),
+ gtk_ui_manager_remove_action_group
+ (GTK_UI_MANAGER (p->window->ui_merge),
p->action_group);
g_object_unref (p->action_group);
}
diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c
index 7fa6ab705..ed69d4e1c 100644
--- a/src/bookmarks/ephy-topic-action.c
+++ b/src/bookmarks/ephy-topic-action.c
@@ -22,12 +22,13 @@
#include <config.h>
#endif
-#include "ephy-node-common.h"
+#include <gtk/gtktoolitem.h>
+
#include "ephy-topic-action.h"
+#include "ephy-node-common.h"
#include "ephy-bookmarks.h"
#include "ephy-favicon-cache.h"
#include "ephy-shell.h"
-#include "eggtoolitem.h"
#include "ephy-debug.h"
#include "ephy-gui.h"
#include "ephy-string.h"
@@ -76,7 +77,7 @@ ephy_topic_action_get_type (void)
(GInstanceInitFunc) ephy_topic_action_init,
};
- type = g_type_register_static (EGG_TYPE_ACTION,
+ type = g_type_register_static (GTK_TYPE_ACTION,
"EphyTopicAction",
&type_info, 0);
}
@@ -84,7 +85,7 @@ ephy_topic_action_get_type (void)
}
static GtkWidget *
-create_tool_item (EggAction *action)
+create_tool_item (GtkAction *action)
{
GtkWidget *item;
GtkWidget *button;
@@ -92,7 +93,7 @@ create_tool_item (EggAction *action)
GtkWidget *hbox;
GtkWidget *label;
- item = (* EGG_ACTION_CLASS (parent_class)->create_tool_item) (action);
+ item = (* GTK_ACTION_CLASS (parent_class)->create_tool_item) (action);
hbox = gtk_hbox_new (FALSE, 0);
gtk_widget_show (hbox);
@@ -128,7 +129,7 @@ menu_deactivate_cb (GtkMenuShell *ms, GtkWidget *button)
}
static void
-menu_activate_cb (GtkWidget *item, EggAction *action)
+menu_activate_cb (GtkWidget *item, GtkAction *action)
{
EphyNode *node;
const char *location;
@@ -141,13 +142,20 @@ menu_activate_cb (GtkWidget *item, EggAction *action)
}
static void
-ephy_topic_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget *proxy)
+ephy_topic_action_sync_label (GtkAction *action, GParamSpec *pspec, GtkWidget *proxy)
{
GtkWidget *label = NULL;
+ GValue value = { 0, };
+ const char *label_text;
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (G_OBJECT (action), "label", &value);
+
+ label_text = g_value_get_string (&value);
LOG ("Set bookmark action proxy label to %s", action->label)
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
label = GTK_WIDGET (g_object_get_data (G_OBJECT (proxy), "label"));
}
@@ -163,10 +171,12 @@ ephy_topic_action_sync_label (EggAction *action, GParamSpec *pspec, GtkWidget *p
g_return_if_fail (label != NULL);
- if (action->label)
+ if (label_text)
{
- gtk_label_set_label (GTK_LABEL (label), action->label);
+ gtk_label_set_label (GTK_LABEL (label), label_text);
}
+
+ g_value_unset (&value);
}
static int
@@ -445,13 +455,22 @@ button_pressed_cb (GtkWidget *button,
}
static GtkWidget *
-create_menu_item (EggAction *action)
+create_menu_item (GtkAction *action)
{
GtkWidget *menu, *menu_item;
+ GValue value = { 0, };
+ const char *label_text;
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_object_get_property (G_OBJECT (action), "label", &value);
+
+ label_text = g_value_get_string (&value);
LOG ("create_menu_item action %p", action)
- menu_item = gtk_menu_item_new_with_label (action->label);
+ menu_item = gtk_menu_item_new_with_label (label_text);
+
+ g_value_unset (&value);
menu = build_menu (EPHY_TOPIC_ACTION (action));
gtk_widget_show (menu);
@@ -462,7 +481,7 @@ create_menu_item (EggAction *action)
}
static gboolean
-create_menu_proxy (EggToolItem *item, EggAction *action)
+create_menu_proxy (GtkToolItem *item, GtkAction *action)
{
GtkWidget *menu_item;
char *menu_id;
@@ -474,7 +493,7 @@ create_menu_proxy (EggToolItem *item, EggAction *action)
menu_id = g_strdup_printf ("ephy-topic-action-%d-menu-id",
EPHY_TOPIC_ACTION (action)->priv->topic_id);
- egg_tool_item_set_proxy_menu_item (item, menu_id, menu_item);
+ gtk_tool_item_set_proxy_menu_item (item, menu_id, menu_item);
g_free (menu_id);
@@ -482,19 +501,19 @@ create_menu_proxy (EggToolItem *item, EggAction *action)
}
static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
+connect_proxy (GtkAction *action, GtkWidget *proxy)
{
GtkWidget *button;
LOG ("connect_proxy action %p, proxy %p", action, proxy)
- (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+ (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
ephy_topic_action_sync_label (action, NULL, proxy);
g_signal_connect_object (action, "notify::label",
G_CALLBACK (ephy_topic_action_sync_label), proxy, 0);
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
g_signal_connect_object (proxy, "create_menu_proxy",
G_CALLBACK (create_menu_proxy),
@@ -567,13 +586,13 @@ ephy_topic_action_finalize (GObject *object)
static void
ephy_topic_action_class_init (EphyTopicActionClass *class)
{
- EggActionClass *action_class;
+ GtkActionClass *action_class;
GObjectClass *object_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
- action_class = EGG_ACTION_CLASS (class);
+ action_class = GTK_ACTION_CLASS (class);
- action_class->toolbar_item_type = EGG_TYPE_TOOL_ITEM;
+ action_class->toolbar_item_type = GTK_TYPE_TOOL_ITEM;
action_class->create_tool_item = create_tool_item;
action_class->create_menu_item = create_menu_item;
action_class->connect_proxy = connect_proxy;
@@ -605,7 +624,7 @@ ephy_topic_action_class_init (EphyTopicActionClass *class)
}
static void
-sync_topic_properties (EggAction *action, EphyNode *bmk)
+sync_topic_properties (GtkAction *action, EphyNode *bmk)
{
const char *title;
@@ -616,7 +635,7 @@ sync_topic_properties (EggAction *action, EphyNode *bmk)
}
static void
-topic_child_changed_cb (EphyNode *node, EphyNode *child, EggAction *action)
+topic_child_changed_cb (EphyNode *node, EphyNode *child, GtkAction *action)
{
gulong id;
@@ -643,19 +662,19 @@ ephy_topic_action_init (EphyTopicAction *action)
G_OBJECT (action));
}
-EggAction *
+GtkAction *
ephy_topic_action_new (const char *name, guint id)
{
EphyNode *bmk;
EphyBookmarks *bookmarks;
- EggAction *action;
+ GtkAction *action;
bookmarks = ephy_shell_get_bookmarks (ephy_shell);
bmk = ephy_bookmarks_get_from_id (bookmarks, id);
g_return_val_if_fail (bmk != NULL, NULL);
- action = EGG_ACTION (g_object_new (EPHY_TYPE_TOPIC_ACTION,
+ action = GTK_ACTION (g_object_new (EPHY_TYPE_TOPIC_ACTION,
"topic_id", id,
"name", name,
NULL));
diff --git a/src/ephy-encoding-menu.c b/src/ephy-encoding-menu.c
index 9aa03e84a..8a45be281 100644
--- a/src/ephy-encoding-menu.c
+++ b/src/ephy-encoding-menu.c
@@ -36,7 +36,7 @@
struct _EphyEncodingMenuPrivate
{
EphyWindow *window;
- EggActionGroup *action_group;
+ GtkActionGroup *action_group;
};
/**
@@ -127,8 +127,8 @@ ephy_encoding_menu_finalize_impl (GObject *o)
if (p->action_group != NULL)
{
- egg_menu_merge_remove_action_group
- (EGG_MENU_MERGE (p->window->ui_merge),
+ gtk_ui_manager_remove_action_group
+ (GTK_UI_MANAGER (p->window->ui_merge),
p->action_group);
g_object_unref (p->action_group);
}
@@ -181,7 +181,7 @@ ephy_encoding_menu_new (EphyWindow *window)
}
static void
-ephy_encoding_menu_verb_cb (EggAction *action,
+ephy_encoding_menu_verb_cb (GtkAction *action,
EphyEncodingMenu *menu)
{
EphyWindow *window;
@@ -204,21 +204,21 @@ ephy_encoding_menu_verb_cb (EggAction *action,
}
static void
-build_group (EggActionGroup *action_group,
+build_group (GtkActionGroup *action_group,
GString *xml_string,
const LanguageGroupInfo *info)
{
gchar *tmp;
gchar *verb;
- EggAction *action;
+ GtkAction *action;
verb = g_strdup_printf ("EncodingGroup%d", info->group);
- action = g_object_new (EGG_TYPE_ACTION,
+ action = g_object_new (GTK_TYPE_ACTION,
"name", verb,
"label", info->title,
NULL);
- egg_action_group_add_action (action_group, action);
+ gtk_action_group_add_action (action_group, action);
g_object_unref (action);
tmp = g_strdup_printf ("<submenu name=\"%sItem\" verb=\"%s\">\n",
@@ -230,16 +230,16 @@ build_group (EggActionGroup *action_group,
static void
build_encoding (EphyEncodingMenu *menu,
- EggActionGroup *action_group,
+ GtkActionGroup *action_group,
GString *xml_string,
const EncodingInfo *info)
{
char *tmp;
char *verb;
- EggAction *action;
+ GtkAction *action;
verb = g_strdup_printf ("Encoding%s", info->encoding);
- action = g_object_new (EGG_TYPE_ACTION,
+ action = g_object_new (GTK_TYPE_ACTION,
"name", verb,
"label", info->title,
NULL);
@@ -247,7 +247,7 @@ build_encoding (EphyEncodingMenu *menu,
G_CALLBACK (ephy_encoding_menu_verb_cb),
menu);
- egg_action_group_add_action (action_group, action);
+ gtk_action_group_add_action (action_group, action);
g_object_unref (action);
tmp = g_strdup_printf ("<menuitem name=\"%sItem\" verb=\"%s\"/>\n",
@@ -263,7 +263,7 @@ ephy_encoding_menu_rebuild (EphyEncodingMenu *wrhm)
{
EphyEmbedSingle *single;
EphyEncodingMenuPrivate *p = wrhm->priv;
- EggMenuMerge *merge = EGG_MENU_MERGE (p->window->ui_merge);
+ GtkUIManager *merge = GTK_UI_MANAGER (p->window->ui_merge);
GString *xml;
GList *groups, *lg, *encodings, *enc;
@@ -281,8 +281,8 @@ ephy_encoding_menu_rebuild (EphyEncodingMenu *wrhm)
"<placeholder name=\"ViewEncodingsPlaceholder\">"
"<submenu name=\"ViewEncodingMenu\" verb=\"ViewEncoding\">");
- p->action_group = egg_action_group_new ("EncodingActions");
- egg_menu_merge_insert_action_group (merge, p->action_group, 0);
+ p->action_group = gtk_action_group_new ("EncodingActions");
+ gtk_ui_manager_insert_action_group (merge, p->action_group, 0);
for (lg = groups; lg != NULL; lg = lg->next)
{
@@ -311,7 +311,7 @@ ephy_encoding_menu_rebuild (EphyEncodingMenu *wrhm)
g_string_append (xml, "</submenu></placeholder></submenu></menu></Root>");
- egg_menu_merge_add_ui_from_string (merge, xml->str, -1, NULL);
+ gtk_ui_manager_add_ui_from_string (merge, xml->str, -1, NULL);
g_string_free (xml, TRUE);
}
diff --git a/src/ephy-favicon-action.c b/src/ephy-favicon-action.c
index bf1d96d36..bb9707b5d 100644
--- a/src/ephy-favicon-action.c
+++ b/src/ephy-favicon-action.c
@@ -74,7 +74,7 @@ ephy_favicon_action_get_type (void)
(GInstanceInitFunc) ephy_favicon_action_init,
};
- type = g_type_register_static (EGG_TYPE_ACTION,
+ type = g_type_register_static (GTK_TYPE_ACTION,
"EphyFaviconAction",
&type_info, 0);
}
@@ -121,7 +121,7 @@ favicon_drag_data_get_cb (GtkWidget *widget,
}
static GtkWidget *
-create_tool_item (EggAction *action)
+create_tool_item (GtkAction *action)
{
GtkWidget *image;
GtkWidget *ebox;
@@ -153,7 +153,7 @@ create_tool_item (EggAction *action)
}
static void
-ephy_favicon_action_sync_icon (EggAction *action, GParamSpec *pspec,
+ephy_favicon_action_sync_icon (GtkAction *action, GParamSpec *pspec,
GtkWidget *proxy)
{
EphyFaviconAction *fav_action = EPHY_FAVICON_ACTION (action);
@@ -183,14 +183,14 @@ ephy_favicon_action_sync_icon (EggAction *action, GParamSpec *pspec,
}
static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
+connect_proxy (GtkAction *action, GtkWidget *proxy)
{
ephy_favicon_action_sync_icon (action, NULL, proxy);
g_signal_connect_object (action, "notify::icon",
G_CALLBACK (ephy_favicon_action_sync_icon),
proxy, 0);
- (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+ (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
}
static void
@@ -240,7 +240,7 @@ ephy_favicon_action_get_property (GObject *object,
static void
ephy_favicon_action_class_init (EphyFaviconActionClass *class)
{
- EggActionClass *action_class;
+ GtkActionClass *action_class;
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->set_property = ephy_favicon_action_set_property;
@@ -248,7 +248,7 @@ ephy_favicon_action_class_init (EphyFaviconActionClass *class)
object_class->finalize = ephy_favicon_action_finalize;
parent_class = g_type_class_peek_parent (class);
- action_class = EGG_ACTION_CLASS (class);
+ action_class = GTK_ACTION_CLASS (class);
action_class->toolbar_item_type = GTK_TYPE_IMAGE;
action_class->create_tool_item = create_tool_item;
diff --git a/src/ephy-favicon-action.h b/src/ephy-favicon-action.h
index 31f6c3d82..88a59cd6e 100644
--- a/src/ephy-favicon-action.h
+++ b/src/ephy-favicon-action.h
@@ -35,13 +35,13 @@ typedef struct EphyFaviconActionPrivate EphyFaviconActionPrivate;
struct _EphyFaviconAction
{
- EggAction parent;
+ GtkAction parent;
EphyFaviconActionPrivate *priv;
};
struct _EphyFaviconActionClass
{
- EggActionClass parent_class;
+ GtkActionClass parent_class;
};
GType ephy_favicon_action_get_type (void);
diff --git a/src/ephy-favorites-menu.c b/src/ephy-favorites-menu.c
index 11d341062..4138098f3 100644
--- a/src/ephy-favorites-menu.c
+++ b/src/ephy-favorites-menu.c
@@ -33,7 +33,7 @@ struct _EphyFavoritesMenuPrivate
{
EphyWindow *window;
EphyBookmarks *bookmarks;
- EggActionGroup *action_group;
+ GtkActionGroup *action_group;
guint ui_id;
};
@@ -83,24 +83,24 @@ static void
ephy_favorites_menu_clean (EphyFavoritesMenu *wrhm)
{
EphyFavoritesMenuPrivate *p = wrhm->priv;
- EggMenuMerge *merge = EGG_MENU_MERGE (p->window->ui_merge);
+ GtkUIManager *merge = GTK_UI_MANAGER (p->window->ui_merge);
if (p->ui_id > 0)
{
- egg_menu_merge_remove_ui (merge, p->ui_id);
- egg_menu_merge_ensure_update (merge);
+ gtk_ui_manager_remove_ui (merge, p->ui_id);
+ gtk_ui_manager_ensure_update (merge);
p->ui_id = 0;
}
if (p->action_group != NULL)
{
- egg_menu_merge_remove_action_group (merge, p->action_group);
+ gtk_ui_manager_remove_action_group (merge, p->action_group);
g_object_unref (p->action_group);
}
}
static void
-go_location_cb (EggAction *action, char *location, EphyWindow *window)
+go_location_cb (GtkAction *action, char *location, EphyWindow *window)
{
ephy_window_load_url (window, location);
}
@@ -113,7 +113,7 @@ ephy_favorites_menu_rebuild (EphyFavoritesMenu *wrhm)
gint i;
EphyNode *fav;
GPtrArray *children;
- EggMenuMerge *merge = EGG_MENU_MERGE (p->window->ui_merge);
+ GtkUIManager *merge = GTK_UI_MANAGER (p->window->ui_merge);
LOG ("Rebuilding favorites menu")
@@ -129,14 +129,14 @@ ephy_favorites_menu_rebuild (EphyFavoritesMenu *wrhm)
"<placeholder name=\"GoFavorites\">"
"<separator name=\"GoSep3\"/>");
- p->action_group = egg_action_group_new ("FavoritesActions");
- egg_menu_merge_insert_action_group (merge, p->action_group, 0);
+ p->action_group = gtk_action_group_new ("FavoritesActions");
+ gtk_ui_manager_insert_action_group (merge, p->action_group, 0);
for (i = 0; i < children->len; i++)
{
char *verb;
EphyNode *node;
- EggAction *action;
+ GtkAction *action;
verb = g_strdup_printf ("GoFav%d", i);
@@ -144,7 +144,7 @@ ephy_favorites_menu_rebuild (EphyFavoritesMenu *wrhm)
action = ephy_bookmark_action_new (verb,
ephy_node_get_id (node));
- egg_action_group_add_action (p->action_group, action);
+ gtk_action_group_add_action (p->action_group, action);
g_object_unref (action);
g_signal_connect (action, "go_location",
G_CALLBACK (go_location_cb), p->window);
@@ -166,7 +166,7 @@ ephy_favorites_menu_rebuild (EphyFavoritesMenu *wrhm)
{
GError *error = NULL;
LOG ("Merging ui\n%s",xml->str);
- p->ui_id = egg_menu_merge_add_ui_from_string
+ p->ui_id = gtk_ui_manager_add_ui_from_string
(merge, xml->str, -1, &error);
}
@@ -248,8 +248,8 @@ ephy_favorites_menu_finalize (GObject *o)
if (p->action_group != NULL)
{
- egg_menu_merge_remove_action_group
- (EGG_MENU_MERGE (p->window->ui_merge),
+ gtk_ui_manager_remove_action_group
+ (GTK_UI_MANAGER (p->window->ui_merge),
p->action_group);
g_object_unref (p->action_group);
}
diff --git a/src/ephy-go-action.c b/src/ephy-go-action.c
index 2c7949ae5..5c2579a98 100644
--- a/src/ephy-go-action.c
+++ b/src/ephy-go-action.c
@@ -56,7 +56,7 @@ ephy_go_action_get_type (void)
(GInstanceInitFunc) ephy_go_action_init,
};
- type = g_type_register_static (EGG_TYPE_ACTION,
+ type = g_type_register_static (GTK_TYPE_ACTION,
"EphyGoAction",
&type_info, 0);
}
@@ -64,13 +64,13 @@ ephy_go_action_get_type (void)
}
static void
-activate_cb (GtkWidget *widget, EggAction *action)
+activate_cb (GtkWidget *widget, GtkAction *action)
{
g_signal_emit_by_name (action, "activate");
}
static GtkWidget *
-create_tool_item (EggAction *action)
+create_tool_item (GtkAction *action)
{
GtkWidget *button;
GtkWidget *item;
@@ -90,7 +90,7 @@ create_tool_item (EggAction *action)
}
static GtkWidget *
-create_menu_item (EggAction *action)
+create_menu_item (GtkAction *action)
{
GtkWidget *menu_item;
@@ -102,13 +102,13 @@ create_menu_item (EggAction *action)
}
static gboolean
-create_menu_proxy_cb (EggToolItem *item, EggAction *action)
+create_menu_proxy_cb (GtkToolItem *item, GtkAction *action)
{
GtkWidget *menu_item;
- menu_item = EGG_ACTION_GET_CLASS (action)->create_menu_item (action);
+ menu_item = GTK_ACTION_GET_CLASS (action)->create_menu_item (action);
- EGG_ACTION_GET_CLASS (action)->connect_proxy (action, menu_item);
+ GTK_ACTION_GET_CLASS (action)->connect_proxy (action, menu_item);
egg_tool_item_set_proxy_menu_item (item, MENU_ID, menu_item);
@@ -116,13 +116,13 @@ create_menu_proxy_cb (EggToolItem *item, EggAction *action)
}
static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
+connect_proxy (GtkAction *action, GtkWidget *proxy)
{
- (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+ (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
g_return_if_fail (EPHY_IS_GO_ACTION (action));
- if (EGG_IS_TOOL_ITEM (proxy))
+ if (GTK_IS_TOOL_ITEM (proxy))
{
g_signal_connect (proxy, "create_menu_proxy",
G_CALLBACK (create_menu_proxy_cb), action);
@@ -132,13 +132,13 @@ connect_proxy (EggAction *action, GtkWidget *proxy)
static void
ephy_go_action_class_init (EphyGoActionClass *class)
{
- EggActionClass *action_class;
+ GtkActionClass *action_class;
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = ephy_go_action_finalize;
parent_class = g_type_class_peek_parent (class);
- action_class = EGG_ACTION_CLASS (class);
+ action_class = GTK_ACTION_CLASS (class);
action_class->create_tool_item = create_tool_item;
action_class->menu_item_type = GTK_TYPE_MENU_ITEM;
diff --git a/src/ephy-go-action.h b/src/ephy-go-action.h
index aa575986d..505280a02 100644
--- a/src/ephy-go-action.h
+++ b/src/ephy-go-action.h
@@ -33,12 +33,12 @@ typedef struct _EphyGoActionClass EphyGoActionClass;
struct _EphyGoAction
{
- EggAction parent;
+ GtkAction parent;
};
struct _EphyGoActionClass
{
- EggActionClass parent_class;
+ GtkActionClass parent_class;
};
GType ephy_go_action_get_type (void);
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 03cc94467..495d0e2f1 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -74,27 +74,27 @@ static void ephy_history_window_get_property (GObject *object,
GParamSpec *pspec);
static void ephy_history_window_dispose (GObject *object);
-static void cmd_open_bookmarks_in_tabs (EggAction *action,
+static void cmd_open_bookmarks_in_tabs (GtkAction *action,
EphyHistoryWindow *editor);
-static void cmd_open_bookmarks_in_browser (EggAction *action,
+static void cmd_open_bookmarks_in_browser (GtkAction *action,
EphyHistoryWindow *editor);
-static void cmd_delete (EggAction *action,
+static void cmd_delete (GtkAction *action,
EphyHistoryWindow *editor);
-static void cmd_bookmark_link (EggAction *action,
+static void cmd_bookmark_link (GtkAction *action,
EphyHistoryWindow *editor);
-static void cmd_clear (EggAction *action,
+static void cmd_clear (GtkAction *action,
EphyHistoryWindow *editor);
-static void cmd_close (EggAction *action,
+static void cmd_close (GtkAction *action,
EphyHistoryWindow *editor);
-static void cmd_cut (EggAction *action,
+static void cmd_cut (GtkAction *action,
EphyHistoryWindow *editor);
-static void cmd_copy (EggAction *action,
+static void cmd_copy (GtkAction *action,
EphyHistoryWindow *editor);
-static void cmd_paste (EggAction *action,
+static void cmd_paste (GtkAction *action,
EphyHistoryWindow *editor);
-static void cmd_select_all (EggAction *action,
+static void cmd_select_all (GtkAction *action,
EphyHistoryWindow *editor);
-static void cmd_help_contents (EggAction *action,
+static void cmd_help_contents (GtkAction *action,
EphyHistoryWindow *editor);
struct EphyHistoryWindowPrivate
@@ -106,8 +106,8 @@ struct EphyHistoryWindowPrivate
GtkWidget *search_entry;
GtkWidget *menu_dock;
GtkWidget *window;
- EggMenuMerge *ui_merge;
- EggActionGroup *action_group;
+ GtkUIManager *ui_merge;
+ GtkActionGroup *action_group;
GtkWidget *confirmation_dialog;
};
@@ -119,64 +119,63 @@ enum
static GObjectClass *parent_class = NULL;
-static EggActionGroupEntry ephy_history_ui_entries [] = {
+static GtkActionGroupEntry ephy_history_ui_entries [] = {
/* Toplevel */
- { "File", N_("_File"), NULL, NULL, NULL, NULL, NULL },
- { "Edit", N_("_Edit"), NULL, NULL, NULL, NULL, NULL },
- { "View", N_("_View"), NULL, NULL, NULL, NULL, NULL },
- { "Help", N_("_Help"), NULL, NULL, NULL, NULL, NULL },
- { "FakeToplevel", (""), NULL, NULL, NULL, NULL, NULL },
+ { "File", NULL, N_("_File") },
+ { "Edit", NULL, N_("_Edit") },
+ { "View", NULL, N_("_View") },
+ { "Help", NULL, N_("_Help") },
/* File Menu */
- { "OpenInWindow", N_("_Open in New Window"), GTK_STOCK_OPEN, "<control>O",
+ { "OpenInWindow", GTK_STOCK_OPEN, N_("_Open in New Window"), "<control>O",
N_("Open the selected history link in a new window"),
- G_CALLBACK (cmd_open_bookmarks_in_browser), NULL },
- { "OpenInTab", N_("Open in New _Tab"), NULL, "<shift><control>O",
+ G_CALLBACK (cmd_open_bookmarks_in_browser) },
+ { "OpenInTab", NULL, N_("Open in New _Tab"), "<shift><control>O",
N_("Open the selected history link in a new tab"),
- G_CALLBACK (cmd_open_bookmarks_in_tabs), NULL },
- { "Delete", N_("_Delete"), GTK_STOCK_DELETE, NULL,
+ G_CALLBACK (cmd_open_bookmarks_in_tabs) },
+ { "Delete", GTK_STOCK_DELETE, N_("_Delete"), NULL,
N_("Delete the selected history link"),
- G_CALLBACK (cmd_delete), NULL },
- { "BookmarkLink", N_("Boo_kmark Link..."), EPHY_STOCK_BOOKMARK_PAGE, "<control>D",
+ G_CALLBACK (cmd_delete) },
+ { "BookmarkLink", EPHY_STOCK_BOOKMARK_PAGE, N_("Boo_kmark Link..."), "<control>D",
N_("Bookmark the selected history link"),
- G_CALLBACK (cmd_bookmark_link), NULL },
- { "Close", N_("_Close"), GTK_STOCK_CLOSE, "<control>W",
+ G_CALLBACK (cmd_bookmark_link) },
+ { "Close", GTK_STOCK_CLOSE, N_("_Close"), "<control>W",
N_("Close the history window"),
G_CALLBACK (cmd_close), NULL },
/* Edit Menu */
- { "Cut", N_("Cu_t"), GTK_STOCK_CUT, "<control>X",
+ { "Cut", GTK_STOCK_CUT, N_("Cu_t"), "<control>X",
N_("Cut the selection"),
G_CALLBACK (cmd_cut), NULL },
- { "Copy", N_("_Copy"), GTK_STOCK_COPY, "<control>C",
+ { "Copy", GTK_STOCK_COPY, N_("_Copy"), "<control>C",
N_("Copy the selection"),
G_CALLBACK (cmd_copy), NULL },
- { "Paste", N_("_Paste"), GTK_STOCK_PASTE, "<control>V",
+ { "Paste", GTK_STOCK_PASTE, N_("_Paste"), "<control>V",
N_("Paste the clipboard"),
G_CALLBACK (cmd_paste), NULL },
- { "SelectAll", N_("Select _All"), NULL, "<control>A",
+ { "SelectAll", NULL, N_("Select _All"), "<control>A",
N_("Select all history links or text"),
G_CALLBACK (cmd_select_all), NULL },
- { "Clear", N_("C_lear History"), GTK_STOCK_CLEAR, NULL,
+ { "Clear", GTK_STOCK_CLEAR, N_("C_lear History"), NULL,
N_("Clear your browsing history"),
G_CALLBACK (cmd_clear), NULL },
/* View Menu */
- { "ViewTitle", N_("_Title"), NULL, NULL,
+/* { "ViewTitle", NULL, N_("_Title"), NULL,
N_("Show only the title column"),
NULL, NULL, RADIO_ACTION, NULL },
- { "ViewLocation", N_("_Address"), NULL, NULL,
+ { "ViewLocation", NULL, N_("_Address"), NULL,
N_("Show only the address column"),
NULL, NULL, RADIO_ACTION, "ViewTitle" },
{ "ViewTitleLocation", N_("T_itle and Address"), NULL, NULL,
N_("Show both the title and address columns"),
- NULL, NULL, RADIO_ACTION, "ViewTitle" },
+ NULL, NULL, RADIO_ACTION, "ViewTitle" },*/
/* Help Menu */
- { "HelpContents", N_("_Contents"), GTK_STOCK_HELP, "F1",
+ { "HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1",
N_("Display history help"),
- G_CALLBACK (cmd_help_contents), NULL },
- { "HelpAbout", N_("_About"), GNOME_STOCK_ABOUT, NULL,
+ G_CALLBACK (cmd_help_contents) },
+ { "HelpAbout", GNOME_STOCK_ABOUT, N_("_About"), NULL,
N_("Display credits for the web browser creators"),
G_CALLBACK (window_cmd_help_about), NULL },
};
@@ -296,7 +295,7 @@ confirmation_dialog_construct (EphyHistoryWindow *editor)
}
static void
-cmd_clear (EggAction *action,
+cmd_clear (GtkAction *action,
EphyHistoryWindow *editor)
{
if (editor->priv->confirmation_dialog == NULL)
@@ -310,7 +309,7 @@ cmd_clear (EggAction *action,
}
static void
-cmd_close (EggAction *action,
+cmd_close (GtkAction *action,
EphyHistoryWindow *editor)
{
if (editor->priv->confirmation_dialog != NULL)
@@ -334,7 +333,7 @@ get_target_window (EphyHistoryWindow *editor)
}
static void
-cmd_open_bookmarks_in_tabs (EggAction *action,
+cmd_open_bookmarks_in_tabs (GtkAction *action,
EphyHistoryWindow *editor)
{
EphyWindow *window;
@@ -360,7 +359,7 @@ cmd_open_bookmarks_in_tabs (EggAction *action,
}
static void
-cmd_open_bookmarks_in_browser (EggAction *action,
+cmd_open_bookmarks_in_browser (GtkAction *action,
EphyHistoryWindow *editor)
{
EphyWindow *window;
@@ -387,7 +386,7 @@ cmd_open_bookmarks_in_browser (EggAction *action,
}
static void
-cmd_cut (EggAction *action,
+cmd_cut (GtkAction *action,
EphyHistoryWindow *editor)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -399,7 +398,7 @@ cmd_cut (EggAction *action,
}
static void
-cmd_copy (EggAction *action,
+cmd_copy (GtkAction *action,
EphyHistoryWindow *editor)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -428,7 +427,7 @@ cmd_copy (EggAction *action,
}
static void
-cmd_paste (EggAction *action,
+cmd_paste (GtkAction *action,
EphyHistoryWindow *editor)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -440,7 +439,7 @@ cmd_paste (EggAction *action,
}
static void
-cmd_select_all (EggAction *action,
+cmd_select_all (GtkAction *action,
EphyHistoryWindow *editor)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
@@ -460,7 +459,7 @@ cmd_select_all (EggAction *action,
}
static void
-cmd_delete (EggAction *action,
+cmd_delete (GtkAction *action,
EphyHistoryWindow *editor)
{
if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->pages_view)))
@@ -470,7 +469,7 @@ cmd_delete (EggAction *action,
}
static void
-cmd_bookmark_link (EggAction *action,
+cmd_bookmark_link (GtkAction *action,
EphyHistoryWindow *editor)
{
GtkWindow *window;
@@ -506,7 +505,7 @@ cmd_bookmark_link (EggAction *action,
}
static void
-cmd_help_contents (EggAction *action,
+cmd_help_contents (GtkAction *action,
EphyHistoryWindow *editor)
{
ephy_gui_help (GTK_WINDOW (editor),
@@ -579,7 +578,7 @@ ephy_history_window_finalize (GObject *object)
g_object_unref (G_OBJECT (editor->priv->pages_filter));
g_object_unref (editor->priv->action_group);
- egg_menu_merge_remove_action_group (editor->priv->ui_merge,
+ gtk_ui_manager_remove_action_group (editor->priv->ui_merge,
editor->priv->action_group);
g_object_unref (editor->priv->ui_merge);
@@ -621,8 +620,8 @@ ephy_history_window_update_menu (EphyHistoryWindow *editor)
gboolean pages_focus, pages_selection;
gboolean pages_multiple_selection;
gboolean delete, bookmark_page;
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
char *open_in_window_label, *open_in_tab_label, *copy_label;
GtkWidget *focus_widget;
@@ -683,24 +682,24 @@ ephy_history_window_update_menu (EphyHistoryWindow *editor)
bookmark_page = (pages_focus && pages_selection && !pages_multiple_selection);
action_group = editor->priv->action_group;
- action = egg_action_group_get_action (action_group, "OpenInWindow");
+ action = gtk_action_group_get_action (action_group, "OpenInWindow");
g_object_set (action, "sensitive", open_in_window, NULL);
g_object_set (action, "label", open_in_window_label, NULL);
- action = egg_action_group_get_action (action_group, "OpenInTab");
+ action = gtk_action_group_get_action (action_group, "OpenInTab");
g_object_set (action, "sensitive", open_in_tab, NULL);
g_object_set (action, "label", open_in_tab_label, NULL);
- action = egg_action_group_get_action (action_group, "Cut");
+ action = gtk_action_group_get_action (action_group, "Cut");
g_object_set (action, "sensitive", cut, NULL);
- action = egg_action_group_get_action (action_group, "Copy");
+ action = gtk_action_group_get_action (action_group, "Copy");
g_object_set (action, "sensitive", copy, NULL);
g_object_set (action, "label", copy_label, NULL);
- action = egg_action_group_get_action (action_group, "Paste");
+ action = gtk_action_group_get_action (action_group, "Paste");
g_object_set (action, "sensitive", paste, NULL);
- action = egg_action_group_get_action (action_group, "SelectAll");
+ action = gtk_action_group_get_action (action_group, "SelectAll");
g_object_set (action, "sensitive", select_all, NULL);
- action = egg_action_group_get_action (action_group, "Delete");
+ action = gtk_action_group_get_action (action_group, "Delete");
g_object_set (action, "sensitive", delete, NULL);
- action = egg_action_group_get_action (action_group, "BookmarkLink");
+ action = gtk_action_group_get_action (action_group, "BookmarkLink");
g_object_set (action, "sensitive", bookmark_page, NULL);
}
@@ -760,7 +759,7 @@ ephy_history_window_show_popup_cb (GtkWidget *view,
{
GtkWidget *widget;
- widget = egg_menu_merge_get_widget (editor->priv->ui_merge,
+ widget = gtk_ui_manager_get_widget (editor->priv->ui_merge,
"/popups/EphyHistoryWindowPopup");
gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2,
gtk_get_current_event_time ());
@@ -889,7 +888,7 @@ build_search_box (EphyHistoryWindow *editor)
}
static void
-add_widget (EggMenuMerge *merge, GtkWidget *widget, EphyHistoryWindow *editor)
+add_widget (GtkUIManager *merge, GtkWidget *widget, EphyHistoryWindow *editor)
{
gtk_box_pack_start (GTK_BOX (editor->priv->menu_dock),
widget, FALSE, FALSE, 0);
@@ -942,9 +941,9 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
GtkWidget *pages_view, *sites_view;
GtkWidget *scrolled_window;
EphyNode *node;
- EggMenuMerge *ui_merge;
- EggActionGroup *action_group;
- EggAction *action;
+ GtkUIManager *ui_merge;
+ GtkActionGroup *action_group;
+ GtkAction *action;
GdkPixbuf *icon;
int i, col_id;
@@ -968,24 +967,24 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
gtk_widget_show (editor->priv->menu_dock);
gtk_container_add (GTK_CONTAINER (editor), editor->priv->menu_dock);
- ui_merge = egg_menu_merge_new ();
+ ui_merge = gtk_ui_manager_new ();
g_signal_connect (ui_merge, "add_widget", G_CALLBACK (add_widget), editor);
- action_group = egg_action_group_new ("PopupActions");
- egg_action_group_add_actions (action_group, ephy_history_ui_entries,
+ action_group = gtk_action_group_new ("PopupActions");
+ gtk_action_group_add_actions (action_group, ephy_history_ui_entries,
ephy_history_ui_n_entries);
- egg_menu_merge_insert_action_group (ui_merge,
+ gtk_ui_manager_insert_action_group (ui_merge,
action_group, 0);
- egg_menu_merge_add_ui_from_file (ui_merge,
+ gtk_ui_manager_add_ui_from_file (ui_merge,
ephy_file ("epiphany-history-window-ui.xml"),
NULL);
gtk_window_add_accel_group (GTK_WINDOW (editor), ui_merge->accel_group);
- egg_menu_merge_ensure_update (ui_merge);
+ gtk_ui_manager_ensure_update (ui_merge);
editor->priv->ui_merge = ui_merge;
editor->priv->action_group = action_group;
/* Fixme: We should implement gconf prefs for monitoring this setting */
- action = egg_action_group_get_action (action_group, "ViewTitle");
- egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action), TRUE);
+ action = gtk_action_group_get_action (action_group, "ViewTitle");
+ egg_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
hpaned = gtk_hpaned_new ();
gtk_container_set_border_width (GTK_CONTAINER (hpaned), 0);
diff --git a/src/ephy-location-action.c b/src/ephy-location-action.c
index c9e1c5903..5706f3eb3 100644
--- a/src/ephy-location-action.c
+++ b/src/ephy-location-action.c
@@ -54,7 +54,7 @@ ephy_location_action_get_type (void)
(GInstanceInitFunc) ephy_location_action_init,
};
- type = g_type_register_static (EGG_TYPE_ACTION,
+ type = g_type_register_static (GTK_TYPE_ACTION,
"EphyLocationAction",
&type_info, 0);
}
@@ -96,7 +96,7 @@ location_url_activate_cb (EphyLocationEntry *entry,
}
static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
+connect_proxy (GtkAction *action, GtkWidget *proxy)
{
EphyAutocompletion *ac;
EphyLocationEntry *e = EPHY_LOCATION_ENTRY (proxy);
@@ -113,17 +113,17 @@ connect_proxy (EggAction *action, GtkWidget *proxy)
GTK_SIGNAL_FUNC(location_url_activate_cb),
action);
- (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+ (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
}
static void
ephy_location_action_class_init (EphyLocationActionClass *class)
{
- EggActionClass *action_class;
+ GtkActionClass *action_class;
GObjectClass *object_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
- action_class = EGG_ACTION_CLASS (class);
+ action_class = GTK_ACTION_CLASS (class);
action_class->toolbar_item_type = EPHY_TYPE_LOCATION_ENTRY;
action_class->connect_proxy = connect_proxy;
@@ -150,7 +150,7 @@ ephy_location_action_get_widget (EphyLocationAction *action)
{
GSList *slist;
- slist = EGG_ACTION (action)->proxies;
+ slist = GTK_ACTION (action)->proxies;
if (slist)
{
diff --git a/src/ephy-location-action.h b/src/ephy-location-action.h
index daa609aee..48e0e0f4f 100644
--- a/src/ephy-location-action.h
+++ b/src/ephy-location-action.h
@@ -34,12 +34,12 @@ typedef struct _EphyLocationActionClass EphyLocationActionClass;
struct _EphyLocationAction
{
- EggAction parent;
+ GtkAction parent;
};
struct _EphyLocationActionClass
{
- EggActionClass parent_class;
+ GtkActionClass parent_class;
void (*go_location) (EphyLocationAction *action, char *location);
};
diff --git a/src/ephy-navigation-action.c b/src/ephy-navigation-action.c
index 6538d1bba..3ac904aa9 100644
--- a/src/ephy-navigation-action.c
+++ b/src/ephy-navigation-action.c
@@ -60,7 +60,7 @@ ephy_navigation_action_get_type (void)
(GInstanceInitFunc) ephy_navigation_action_init,
};
- type = g_type_register_static (EGG_TYPE_ACTION,
+ type = g_type_register_static (GTK_TYPE_ACTION,
"EphyNavigationAction",
&type_info, 0);
}
@@ -243,14 +243,14 @@ menu_activated_cb (EphyArrowToolButton *w, EphyNavigationAction *b)
}
static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
+connect_proxy (GtkAction *action, GtkWidget *proxy)
{
LOG ("Connect navigation action proxy")
g_signal_connect (proxy, "menu-activated",
G_CALLBACK (menu_activated_cb), action);
- (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+ (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
}
static void
@@ -310,7 +310,7 @@ ephy_navigation_action_finalize (GObject *object)
static void
ephy_navigation_action_class_init (EphyNavigationActionClass *class)
{
- EggActionClass *action_class;
+ GtkActionClass *action_class;
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = ephy_navigation_action_finalize;
@@ -318,7 +318,7 @@ ephy_navigation_action_class_init (EphyNavigationActionClass *class)
object_class->get_property = ephy_navigation_action_get_property;
parent_class = g_type_class_peek_parent (class);
- action_class = EGG_ACTION_CLASS (class);
+ action_class = GTK_ACTION_CLASS (class);
action_class->toolbar_item_type = EPHY_ARROW_TOOLBUTTON_TYPE;
action_class->connect_proxy = connect_proxy;
diff --git a/src/ephy-navigation-action.h b/src/ephy-navigation-action.h
index 0e6c23dbe..4990e030d 100644
--- a/src/ephy-navigation-action.h
+++ b/src/ephy-navigation-action.h
@@ -42,13 +42,13 @@ typedef enum
struct _EphyNavigationAction
{
- EggAction parent;
+ GtkAction parent;
EphyNavigationActionPrivate *priv;
};
struct _EphyNavigationActionClass
{
- EggActionClass parent_class;
+ GtkActionClass parent_class;
};
GType ephy_navigation_action_get_type (void);
diff --git a/src/ephy-spinner-action.c b/src/ephy-spinner-action.c
index dffda619a..df5db6f9a 100644
--- a/src/ephy-spinner-action.c
+++ b/src/ephy-spinner-action.c
@@ -57,7 +57,7 @@ ephy_spinner_action_get_type (void)
(GInstanceInitFunc) ephy_spinner_action_init,
};
- type = g_type_register_static (EGG_TYPE_ACTION,
+ type = g_type_register_static (GTK_TYPE_ACTION,
"EphySpinnerAction",
&type_info, 0);
}
@@ -65,7 +65,7 @@ ephy_spinner_action_get_type (void)
}
static void
-ephy_spinner_action_sync_throbbing (EggAction *action, GParamSpec *pspec,
+ephy_spinner_action_sync_throbbing (GtkAction *action, GParamSpec *pspec,
GtkWidget *proxy)
{
EphySpinner *spinner;
@@ -83,7 +83,7 @@ ephy_spinner_action_sync_throbbing (EggAction *action, GParamSpec *pspec,
}
static GtkWidget *
-create_tool_item (EggAction *action)
+create_tool_item (GtkAction *action)
{
GtkWidget *item;
GtkWidget *spinner;
@@ -93,15 +93,15 @@ create_tool_item (EggAction *action)
spinner = ephy_spinner_new ();
gtk_widget_show (spinner);
gtk_container_add (GTK_CONTAINER (item), spinner);
- egg_tool_item_set_pack_end (EGG_TOOL_ITEM (item), TRUE);
- egg_tool_item_set_homogeneous (EGG_TOOL_ITEM (item), FALSE);
+ egg_tool_item_set_pack_end (GTK_TOOL_ITEM (item), TRUE);
+ egg_tool_item_set_homogeneous (GTK_TOOL_ITEM (item), FALSE);
g_object_set_data (G_OBJECT (item), "spinner", spinner);
return item;
}
static void
-toolbar_style_sync (EggToolbar *toolbar,
+toolbar_style_sync (GtkToolbar *toolbar,
GtkToolbarStyle style,
GtkWidget *proxy)
{
@@ -117,12 +117,12 @@ toolbar_style_sync (EggToolbar *toolbar,
static void
item_parent_set_cb (GtkWidget *item, GtkWidget *previous_parent)
{
- EggToolbar *toolbar;
+ GtkToolbar *toolbar;
GtkToolbarStyle style;
if (item->parent == NULL) return;
- toolbar = EGG_TOOLBAR (item->parent);
+ toolbar = GTK_TOOLBAR (item->parent);
g_signal_connect_object (toolbar, "style_changed",
G_CALLBACK (toolbar_style_sync),
@@ -133,7 +133,7 @@ item_parent_set_cb (GtkWidget *item, GtkWidget *previous_parent)
}
static void
-connect_proxy (EggAction *action, GtkWidget *proxy)
+connect_proxy (GtkAction *action, GtkWidget *proxy)
{
g_signal_connect_object (action, "notify::throbbing",
G_CALLBACK (ephy_spinner_action_sync_throbbing),
@@ -142,7 +142,7 @@ connect_proxy (EggAction *action, GtkWidget *proxy)
G_CALLBACK (item_parent_set_cb),
proxy, 0);
- (* EGG_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
+ (* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
}
static void
@@ -197,11 +197,11 @@ ephy_spinner_action_finalize (GObject *object)
static void
ephy_spinner_action_class_init (EphySpinnerActionClass *class)
{
- EggActionClass *action_class;
+ GtkActionClass *action_class;
GObjectClass *object_class = G_OBJECT_CLASS (class);
parent_class = g_type_class_peek_parent (class);
- action_class = EGG_ACTION_CLASS (class);
+ action_class = GTK_ACTION_CLASS (class);
action_class->toolbar_item_type = EPHY_SPINNER_TYPE;
action_class->create_tool_item = create_tool_item;
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index e9643c56f..27df3274b 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -68,7 +68,7 @@ struct EphyTabPrivate
int total_requests;
int width;
int height;
- EggAction *action;
+ GtkAction *action;
float zoom;
EmbedSecurityLevel security_level;
TabNavigationFlags nav_flags;
@@ -224,7 +224,7 @@ ephy_tab_get_property (GObject *object,
}
static void
-ephy_tab_action_activate_cb (EggAction *action, EphyTab *tab)
+ephy_tab_action_activate_cb (GtkAction *action, EphyTab *tab)
{
g_return_if_fail (IS_EPHY_TAB (tab));
@@ -1007,7 +1007,7 @@ ephy_tab_init (EphyTab *tab)
id = g_strdup_printf ("Tab%lu", tab_id++);
- tab->priv->action = g_object_new (EGG_TYPE_ACTION,
+ tab->priv->action = g_object_new (GTK_TYPE_ACTION,
"name", id,
"label", _("Blank page"),
NULL);
diff --git a/src/ephy-tabs-menu.c b/src/ephy-tabs-menu.c
index c0339c897..24bed0848 100644
--- a/src/ephy-tabs-menu.c
+++ b/src/ephy-tabs-menu.c
@@ -40,7 +40,7 @@
struct _EphyTabsMenuPrivate
{
EphyWindow *window;
- EggActionGroup *action_group;
+ GtkActionGroup *action_group;
guint ui_id;
};
@@ -161,18 +161,18 @@ static void
ephy_tabs_menu_clean (EphyTabsMenu *menu)
{
EphyTabsMenuPrivate *p = menu->priv;
- EggMenuMerge *merge = EGG_MENU_MERGE (p->window->ui_merge);
+ GtkUIManager *merge = GTK_UI_MANAGER (p->window->ui_merge);
if (p->ui_id > 0)
{
- egg_menu_merge_remove_ui (merge, p->ui_id);
- egg_menu_merge_ensure_update (merge);
+ gtk_ui_manager_remove_ui (merge, p->ui_id);
+ gtk_ui_manager_ensure_update (merge);
p->ui_id = 0;
}
if (p->action_group != NULL)
{
- egg_menu_merge_remove_action_group (merge, p->action_group);
+ gtk_ui_manager_remove_action_group (merge, p->action_group);
g_object_unref (p->action_group);
}
}
@@ -185,8 +185,8 @@ ephy_tabs_menu_finalize_impl (GObject *o)
if (p->action_group != NULL)
{
- egg_menu_merge_remove_action_group
- (EGG_MENU_MERGE (p->window->ui_merge),
+ gtk_ui_manager_remove_action_group
+ (GTK_UI_MANAGER (p->window->ui_merge),
p->action_group);
g_object_unref (p->action_group);
}
@@ -205,14 +205,14 @@ ephy_tabs_menu_new (EphyWindow *window)
NULL));
}
-/* This code is from EggActionGroup:
- * Ideally either EggAction should support setting an accelerator from
- * a string or EggActionGroup would support adding single EggActionEntry's
+/* This code is from GtkActionGroup:
+ * Ideally either GtkAction should support setting an accelerator from
+ * a string or GtkActionGroup would support adding single EggActionEntry's
* to an action group.
*/
static void
-tab_set_action_accelerator (EggActionGroup *action_group,
- EggAction *action,
+tab_set_action_accelerator (GtkActionGroup *action_group,
+ GtkAction *action,
guint tab_number)
{
char *accel_path = NULL;
@@ -254,9 +254,9 @@ void
ephy_tabs_menu_update (EphyTabsMenu *menu)
{
EphyTabsMenuPrivate *p;
- EggMenuMerge *merge;
+ GtkUIManager *merge;
EphyTab *tab;
- EggAction *action;
+ GtkAction *action;
GString *xml;
guint i = 0;
guint num = 0;
@@ -265,7 +265,7 @@ ephy_tabs_menu_update (EphyTabsMenu *menu)
g_return_if_fail (EPHY_IS_TABS_MENU (menu));
p = menu->priv;
- merge = EGG_MENU_MERGE (p->window->ui_merge);
+ merge = GTK_UI_MANAGER (p->window->ui_merge);
LOG ("Rebuilding open tabs menu")
@@ -278,7 +278,7 @@ ephy_tabs_menu_update (EphyTabsMenu *menu)
num = g_list_length (tabs);
if (num == 0) return;
- p->action_group = egg_action_group_new ("TabsActions");
+ p->action_group = gtk_action_group_new ("TabsActions");
/* it's faster to preallocate, MIN is sanity check */
xml = g_string_sized_new (44 * MIN (num, 64) + 105);
@@ -289,11 +289,11 @@ ephy_tabs_menu_update (EphyTabsMenu *menu)
for (l = tabs; l != NULL; l = l->next)
{
tab = (EphyTab *) l->data;
- action = EGG_ACTION (ephy_tab_get_action (tab));
+ action = GTK_ACTION (ephy_tab_get_action (tab));
tab_set_action_accelerator (p->action_group, action, i);
- egg_action_group_add_action (p->action_group, action);
+ gtk_action_group_add_action (p->action_group, action);
g_string_append (xml, "<menuitem name=\"");
g_string_append (xml, action->name);
@@ -308,8 +308,8 @@ ephy_tabs_menu_update (EphyTabsMenu *menu)
g_string_append (xml, "</placeholder></submenu></menu></Root>");
- egg_menu_merge_insert_action_group (merge, p->action_group, 0);
- p->ui_id = egg_menu_merge_add_ui_from_string
+ gtk_ui_manager_insert_action_group (merge, p->action_group, 0);
+ p->ui_id = gtk_ui_manager_add_ui_from_string
(merge, xml->str, -1, &error);
g_string_free (xml, TRUE);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 59ff4e30e..a91808532 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -59,206 +59,203 @@
#include "egg-menu-merge.h"
#include "egg-toggle-action.h"
-static EggActionGroupEntry ephy_menu_entries [] = {
+static GtkActionGroupEntry ephy_menu_entries [] = {
/* Toplevel */
- { "File", N_("_File"), NULL, NULL, NULL, NULL, NULL },
- { "Edit", N_("_Edit"), NULL, NULL, NULL, NULL, NULL },
- { "View", N_("_View"), NULL, NULL, NULL, NULL, NULL },
- { "Bookmarks", N_("_Bookmarks"), NULL, NULL, NULL, NULL, NULL },
- { "Go", N_("_Go"), NULL, NULL, NULL, NULL, NULL },
- { "Tabs", N_("_Tabs"), NULL, NULL, NULL, NULL, NULL },
- { "Help", N_("_Help"), NULL, NULL, NULL, NULL, NULL },
+ { "File", NULL, N_("_File") },
+ { "Edit", NULL, N_("_Edit") },
+ { "View", NULL, N_("_View") },
+ { "Bookmarks", NULL, N_("_Bookmarks") },
+ { "Go", NULL, N_("_Go") },
+ { "Tabs", NULL, N_("_Tabs") },
+ { "Help", NULL, N_("_Help") },
/* File menu */
- { "FileNewWindow", N_("_New Window"), GTK_STOCK_NEW, "<control>N",
+ { "FileNewWindow", GTK_STOCK_NEW, N_("_New Window"), "<control>N",
N_("Open a new window"),
- G_CALLBACK (window_cmd_file_new_window), NULL },
- { "FileNewTab", N_("New _Tab"), EPHY_STOCK_NEW_TAB, "<control>T",
+ G_CALLBACK (window_cmd_file_new_window) },
+ { "FileNewTab", EPHY_STOCK_NEW_TAB, N_("New _Tab"), "<control>T",
N_("Open a new tab"),
- G_CALLBACK (window_cmd_file_new_tab), NULL },
- { "FileOpen", N_("_Open..."), GTK_STOCK_OPEN, "<control>O",
+ G_CALLBACK (window_cmd_file_new_tab) },
+ { "FileOpen", GTK_STOCK_OPEN, N_("_Open..."), "<control>O",
N_("Open a file"),
- G_CALLBACK (window_cmd_file_open), NULL },
- { "FileSaveAs", N_("Save _As..."), GTK_STOCK_SAVE_AS, "<shift><control>S",
+ G_CALLBACK (window_cmd_file_open) },
+ { "FileSaveAs", GTK_STOCK_SAVE_AS, N_("Save _As..."), "<shift><control>S",
N_("Save the current page"),
- G_CALLBACK (window_cmd_file_save_as), NULL },
- { "FilePrint", N_("_Print..."), GTK_STOCK_PRINT, "<control>P",
+ G_CALLBACK (window_cmd_file_save_as) },
+ { "FilePrint", GTK_STOCK_PRINT, N_("_Print..."), "<control>P",
N_("Print the current page"),
- G_CALLBACK (window_cmd_file_print), NULL },
- { "FileSendTo", N_("S_end To..."), EPHY_STOCK_SEND_LINK, NULL,
+ G_CALLBACK (window_cmd_file_print) },
+ { "FileSendTo", EPHY_STOCK_SEND_LINK, N_("S_end To..."), NULL,
N_("Send a link of the current page"),
- G_CALLBACK (window_cmd_file_send_to), NULL },
- { "FileCloseWindow", N_("_Close"), GTK_STOCK_CLOSE, "<control>W",
+ G_CALLBACK (window_cmd_file_send_to) },
+ { "FileCloseWindow", GTK_STOCK_CLOSE, N_("_Close"), "<control>W",
N_("Close this window"),
- G_CALLBACK (window_cmd_file_close_window), NULL },
+ G_CALLBACK (window_cmd_file_close_window) },
/* Edit menu */
- { "EditCut", N_("Cu_t"), GTK_STOCK_CUT, "<control>X",
+ { "EditCut", GTK_STOCK_CUT, N_("Cu_t"), "<control>X",
N_("Cut the selection"),
- G_CALLBACK (window_cmd_edit_cut), NULL },
- { "EditCopy", N_("_Copy"), GTK_STOCK_COPY, "<control>C",
+ G_CALLBACK (window_cmd_edit_cut) },
+ { "EditCopy", GTK_STOCK_COPY, N_("_Copy"), "<control>C",
N_("Copy the selection"),
- G_CALLBACK (window_cmd_edit_copy), NULL },
- { "EditPaste", N_("_Paste"), GTK_STOCK_PASTE, "<control>V",
+ G_CALLBACK (window_cmd_edit_copy) },
+ { "EditPaste", GTK_STOCK_PASTE, N_("_Paste"), "<control>V",
N_("Paste clipboard"),
- G_CALLBACK (window_cmd_edit_paste), NULL },
- { "EditSelectAll", N_("Select _All"), NULL, "<control>A",
+ G_CALLBACK (window_cmd_edit_paste) },
+ { "EditSelectAll", NULL, N_("Select _All"), "<control>A",
N_("Select the entire page"),
- G_CALLBACK (window_cmd_edit_select_all), NULL },
- { "EditFind", N_("_Find..."), GTK_STOCK_FIND, "<control>F",
+ G_CALLBACK (window_cmd_edit_select_all) },
+ { "EditFind", GTK_STOCK_FIND, N_("_Find..."), "<control>F",
N_("Find a word or phrase in the page"),
- G_CALLBACK (window_cmd_edit_find), NULL },
- { "EditFindNext", N_("Find Ne_xt"), NULL, "<control>G",
+ G_CALLBACK (window_cmd_edit_find) },
+ { "EditFindNext", NULL, N_("Find Ne_xt"), "<control>G",
N_("Find next occurrence of the word or phrase"),
- G_CALLBACK (window_cmd_edit_find_next), NULL },
- { "EditFindPrev", N_("Find Pre_vious"), NULL, "<shift><control>G",
+ G_CALLBACK (window_cmd_edit_find_next) },
+ { "EditFindPrev", NULL, N_("Find Pre_vious"), "<shift><control>G",
N_("Find previous occurrence of the word or phrase"),
- G_CALLBACK (window_cmd_edit_find_prev), NULL },
- { "EditPersonalData", N_("P_ersonal Data"), NULL, NULL,
+ G_CALLBACK (window_cmd_edit_find_prev) },
+ { "EditPersonalData", NULL, N_("P_ersonal Data"), NULL,
N_("View and remove cookies and passwords"),
- G_CALLBACK (window_cmd_edit_personal_data), NULL },
- { "EditToolbar", N_("T_oolbars"), NULL, NULL,
+ G_CALLBACK (window_cmd_edit_personal_data) },
+ { "EditToolbar", NULL, N_("T_oolbars"), NULL,
N_("Customize toolbars"),
- G_CALLBACK (window_cmd_edit_toolbar), NULL },
- { "EditPrefs", N_("P_references"), GTK_STOCK_PREFERENCES, NULL,
+ G_CALLBACK (window_cmd_edit_toolbar) },
+ { "EditPrefs", GTK_STOCK_PREFERENCES, N_("P_references"), NULL,
N_("Configure the web browser"),
- G_CALLBACK (window_cmd_edit_prefs), NULL },
+ G_CALLBACK (window_cmd_edit_prefs) },
/* View menu */
- { "ViewStop", N_("_Stop"), GTK_STOCK_STOP, "Escape",
+ { "ViewStop", GTK_STOCK_STOP, N_("_Stop"), "Escape",
N_("Stop current data transfer"),
- G_CALLBACK (window_cmd_view_stop), NULL },
- { "ViewReload", N_("_Reload"), GTK_STOCK_REFRESH, "<control>R",
+ G_CALLBACK (window_cmd_view_stop) },
+ { "ViewReload", GTK_STOCK_REFRESH, N_("_Reload"), "<control>R",
N_("Display the latest content of the current page"),
- G_CALLBACK (window_cmd_view_reload), NULL },
- { "ViewToolbar", N_("_Toolbar"), NULL, "<shift><control>T",
+ G_CALLBACK (window_cmd_view_reload) },
+ { "ViewToolbar", NULL, N_("_Toolbar"), "<shift><control>T",
N_("Show or hide toolbar"),
- G_CALLBACK (window_cmd_view_toolbar), NULL, TOGGLE_ACTION },
- { "ViewBookmarksBar", N_("_Bookmarks Bar"), NULL, NULL,
+ G_CALLBACK (window_cmd_view_toolbar), TOGGLE_ACTION },
+ { "ViewBookmarksBar", NULL, N_("_Bookmarks Bar"), NULL,
N_("Show or hide bookmarks bar"),
G_CALLBACK (window_cmd_view_bookmarks_bar), NULL, TOGGLE_ACTION },
- { "ViewStatusbar", N_("St_atusbar"), NULL, NULL,
+ { "ViewStatusbar", NULL, N_("St_atusbar"), NULL,
N_("Show or hide statusbar"),
- G_CALLBACK (window_cmd_view_statusbar), NULL, TOGGLE_ACTION },
- { "ViewFullscreen", N_("_Fullscreen"), EPHY_STOCK_FULLSCREEN, "F11",
+ G_CALLBACK (window_cmd_view_statusbar), TOGGLE_ACTION },
+ { "ViewFullscreen", EPHY_STOCK_FULLSCREEN, N_("_Fullscreen"), "F11",
N_("Browse at full screen"),
- G_CALLBACK (window_cmd_view_fullscreen), NULL, TOGGLE_ACTION},
- { "ViewZoomIn", N_("Zoom _In"), GTK_STOCK_ZOOM_IN, "<control>plus",
+ G_CALLBACK (window_cmd_view_fullscreen), TOGGLE_ACTION},
+ { "ViewZoomIn", GTK_STOCK_ZOOM_IN, N_("Zoom _In"), "<control>plus",
N_("Increase the text size"),
- G_CALLBACK (window_cmd_view_zoom_in), NULL },
- { "ViewZoomOut", N_("Zoom _Out"), GTK_STOCK_ZOOM_OUT, "<control>minus",
+ G_CALLBACK (window_cmd_view_zoom_in) },
+ { "ViewZoomOut", GTK_STOCK_ZOOM_OUT, N_("Zoom _Out"), "<control>minus",
N_("Decrease the text size"),
- G_CALLBACK (window_cmd_view_zoom_out), NULL },
- { "ViewZoomNormal", N_("_Normal Size"), GTK_STOCK_ZOOM_100, NULL,
+ G_CALLBACK (window_cmd_view_zoom_out) },
+ { "ViewZoomNormal", GTK_STOCK_ZOOM_100, N_("_Normal Size"), NULL,
N_("Use the normal text size"),
- G_CALLBACK (window_cmd_view_zoom_normal), NULL },
+ G_CALLBACK (window_cmd_view_zoom_normal) },
{ "ViewEncoding", N_("_Encoding"), NULL, NULL, NULL, NULL, NULL },
- { "ViewPageSource", N_("_Page Source"), EPHY_STOCK_VIEWSOURCE, "<control>U",
+ { "ViewPageSource", EPHY_STOCK_VIEWSOURCE, N_("_Page Source"), "<control>U",
N_("View the source code of the page"),
- G_CALLBACK (window_cmd_view_page_source), NULL },
+ G_CALLBACK (window_cmd_view_page_source) },
/* Bookmarks menu */
- { "FileBookmarkPage", N_("_Add Bookmark..."), EPHY_STOCK_BOOKMARK_PAGE, "<control>D",
+ { "FileBookmarkPage", EPHY_STOCK_BOOKMARK_PAGE, N_("_Add Bookmark..."), "<control>D",
N_("Add a bookmark for the current page"),
- G_CALLBACK (window_cmd_file_bookmark_page), NULL },
- { "GoBookmarks", N_("_Edit Bookmarks"), EPHY_STOCK_BOOKMARKS, "<control>B",
+ G_CALLBACK (window_cmd_file_bookmark_page) },
+ { "GoBookmarks", EPHY_STOCK_BOOKMARKS, N_("_Edit Bookmarks"), "<control>B",
N_("Open the bookmarks window"),
- G_CALLBACK (window_cmd_go_bookmarks), NULL },
+ G_CALLBACK (window_cmd_go_bookmarks) },
/* Go menu */
- { "GoBack", N_("_Back"), GTK_STOCK_GO_BACK, "<alt>Left",
+ { "GoBack", GTK_STOCK_GO_BACK, N_("_Back"), "<alt>Left",
N_("Go to the previous visited page"),
- G_CALLBACK (window_cmd_go_back), NULL },
- { "GoForward", N_("_Forward"), GTK_STOCK_GO_FORWARD, "<alt>Right",
+ G_CALLBACK (window_cmd_go_back) },
+ { "GoForward", GTK_STOCK_GO_FORWARD, N_("_Forward"), "<alt>Right",
N_("Go to the next visited page"),
- G_CALLBACK (window_cmd_go_forward), NULL },
- { "GoUp", N_("_Up"), GTK_STOCK_GO_UP, "<alt>Up",
+ G_CALLBACK (window_cmd_go_forward) },
+ { "GoUp", GTK_STOCK_GO_UP, N_("_Up"), "<alt>Up",
N_("Go up one level"),
- G_CALLBACK (window_cmd_go_up), NULL },
- { "GoHome", N_("_Home"), GTK_STOCK_HOME, "<alt>Home",
+ G_CALLBACK (window_cmd_go_up) },
+ { "GoHome", GTK_STOCK_HOME, N_("_Home"), "<alt>Home",
N_("Go to the home page"),
- G_CALLBACK (window_cmd_go_home), NULL },
- { "GoLocation", N_("_Location..."), NULL, "<control>L",
+ G_CALLBACK (window_cmd_go_home) },
+ { "GoLocation", NULL, N_("_Location..."), "<control>L",
N_("Go to a specified location"),
- G_CALLBACK (window_cmd_go_location), NULL },
- { "GoHistory", N_("H_istory"), EPHY_STOCK_HISTORY, "<control>H",
+ G_CALLBACK (window_cmd_go_location) },
+ { "GoHistory", EPHY_STOCK_HISTORY, N_("H_istory"), "<control>H",
N_("Open the history window"),
- G_CALLBACK (window_cmd_go_history), NULL },
+ G_CALLBACK (window_cmd_go_history) },
/* Tabs menu */
- { "TabsPrevious", N_("_Previous Tab"), NULL, "<control>Page_Up",
+ { "TabsPrevious", NULL, N_("_Previous Tab"), "<control>Page_Up",
N_("Activate previous tab"),
- G_CALLBACK (window_cmd_tabs_previous), NULL },
- { "TabsNext", N_("_Next Tab"), NULL, "<control>Page_Down",
+ G_CALLBACK (window_cmd_tabs_previous) },
+ { "TabsNext", NULL, N_("_Next Tab"), "<control>Page_Down",
N_("Activate next tab"),
- G_CALLBACK (window_cmd_tabs_next), NULL },
- { "TabsMoveLeft", N_("Move Tab _Left"), NULL, "<shift><control>Page_Up",
+ G_CALLBACK (window_cmd_tabs_next) },
+ { "TabsMoveLeft", NULL, N_("Move Tab _Left"), "<shift><control>Page_Up",
N_("Move current tab to left"),
- G_CALLBACK (window_cmd_tabs_move_left), NULL },
- { "TabsMoveRight", N_("Move Tab _Right"), NULL, "<shift><control>Page_Down",
+ G_CALLBACK (window_cmd_tabs_move_left) },
+ { "TabsMoveRight", NULL, N_("Move Tab _Right"), "<shift><control>Page_Down",
N_("Move current tab to right"),
- G_CALLBACK (window_cmd_tabs_move_right), NULL },
- { "TabsDetach", N_("_Detach Tab"), NULL, "<shift><control>M",
+ G_CALLBACK (window_cmd_tabs_move_right) },
+ { "TabsDetach", NULL, N_("_Detach Tab"), "<shift><control>M",
N_("Detach current tab"),
- G_CALLBACK (window_cmd_tabs_detach), NULL },
+ G_CALLBACK (window_cmd_tabs_detach) },
/* Help menu */
- {"HelpContents", N_("_Contents"), GTK_STOCK_HELP, "F1",
+ {"HelpContents", GTK_STOCK_HELP, N_("_Contents"), "F1",
N_("Display web browser help"),
- G_CALLBACK (window_cmd_help_contents), NULL },
- { "HelpAbout", N_("_About"), GNOME_STOCK_ABOUT, NULL,
+ G_CALLBACK (window_cmd_help_contents) },
+ { "HelpAbout", GNOME_STOCK_ABOUT, N_("_About"), NULL,
N_("Display credits for the web browser creators"),
- G_CALLBACK (window_cmd_help_about), NULL },
+ G_CALLBACK (window_cmd_help_about) },
};
static guint ephy_menu_n_entries = G_N_ELEMENTS (ephy_menu_entries);
-static EggActionGroupEntry ephy_popups_entries [] = {
- /* Toplevel */
- { "FakeToplevel", (""), NULL, NULL, NULL, NULL, NULL },
-
+static GtkActionGroupEntry ephy_popups_entries [] = {
/* Document */
- { "SaveBackgroundAs", N_("_Save Background As..."), NULL, NULL,
- NULL, G_CALLBACK (popup_cmd_save_background_as), NULL },
- { "ContextBookmarkPage", N_("Add Boo_kmark..."), EPHY_STOCK_BOOKMARK_PAGE, "<control>D",
+ { "SaveBackgroundAs", NULL, N_("_Save Background As..."), NULL,
+ NULL, G_CALLBACK (popup_cmd_save_background_as) },
+ { "ContextBookmarkPage", EPHY_STOCK_BOOKMARK_PAGE, N_("Add Boo_kmark..."), "<control>D",
N_("Add a bookmark for the current page"),
- G_CALLBACK (window_cmd_file_bookmark_page), NULL },
+ G_CALLBACK (window_cmd_file_bookmark_page) },
/* Framed document */
- { "OpenFrame", N_("_Open Frame"), NULL, NULL,
- NULL, G_CALLBACK (popup_cmd_open_frame), NULL },
- { "OpenFrameInNewWindow", N_("Open Frame in _New Window"), NULL, NULL,
- NULL, G_CALLBACK (popup_cmd_frame_in_new_window), NULL },
- { "OpenFrameInNewTab", N_("Open Frame in New _Tab"), NULL, NULL,
- NULL, G_CALLBACK (popup_cmd_frame_in_new_tab), NULL },
+ { "OpenFrame", NULL, N_("_Open Frame"), NULL,
+ NULL, G_CALLBACK (popup_cmd_open_frame) },
+ { "OpenFrameInNewWindow", NULL, N_("Open Frame in _New Window"), NULL,
+ NULL, G_CALLBACK (popup_cmd_frame_in_new_window) },
+ { "OpenFrameInNewTab", NULL, N_("Open Frame in New _Tab"), NULL,
+ NULL, G_CALLBACK (popup_cmd_frame_in_new_tab) },
/* Links */
- { "OpenLink", N_("_Open Link"), GTK_STOCK_OPEN, NULL,
- NULL, G_CALLBACK (popup_cmd_open_link), NULL },
- { "OpenLinkInNewWindow", N_("Open Link in _New Window"), NULL, NULL,
- NULL, G_CALLBACK (popup_cmd_link_in_new_window), NULL },
- { "OpenLinkInNewTab", N_("Open Link in New _Tab"), NULL, NULL,
- NULL, G_CALLBACK (popup_cmd_link_in_new_tab), NULL },
- { "DownloadLink", N_("_Download Link..."), GTK_STOCK_SAVE, NULL,
- NULL, G_CALLBACK (popup_cmd_download_link), NULL },
- { "BookmarkLink", N_("_Bookmark Link..."), EPHY_STOCK_BOOKMARK_PAGE, NULL,
+ { "OpenLink", GTK_STOCK_OPEN, N_("_Open Link"),
+ NULL, G_CALLBACK (popup_cmd_open_link) },
+ { "OpenLinkInNewWindow", NULL, N_("Open Link in _New Window"), NULL,
+ NULL, G_CALLBACK (popup_cmd_link_in_new_window) },
+ { "OpenLinkInNewTab", NULL, N_("Open Link in New _Tab"),
+ NULL, G_CALLBACK (popup_cmd_link_in_new_tab) },
+ { "DownloadLink", GTK_STOCK_SAVE, N_("_Download Link..."), NULL,
+ NULL, G_CALLBACK (popup_cmd_download_link) },
+ { "BookmarkLink", EPHY_STOCK_BOOKMARK_PAGE, N_("_Bookmark Link..."), NULL,
NULL, G_CALLBACK (popup_cmd_bookmark_link), NULL },
- { "CopyLinkAddress", N_("_Copy Link Address"), NULL, NULL,
+ { "CopyLinkAddress", NULL, N_("_Copy Link Address"), NULL,
NULL, G_CALLBACK (popup_cmd_copy_link_address), NULL },
/* Images */
- { "OpenImage", N_("Open _Image"), GTK_STOCK_OPEN, NULL,
+ { "OpenImage", GTK_STOCK_OPEN, N_("Open _Image"), GTK_STOCK_OPEN,
NULL, G_CALLBACK (popup_cmd_open_image), NULL },
- { "OpenImageInNewWindow", N_("Open Image in New _Window"), NULL, NULL,
- NULL, G_CALLBACK (popup_cmd_image_in_new_window), NULL },
- { "OpenImageInNewTab", N_("Open Image in New T_ab"), NULL, NULL,
- NULL, G_CALLBACK (popup_cmd_image_in_new_tab), NULL },
- { "SaveImageAs", N_("_Save Image As..."), GTK_STOCK_SAVE_AS, NULL,
- NULL, G_CALLBACK (popup_cmd_save_image_as), NULL },
- { "SetImageAsBackground", N_("_Use Image As Background"), NULL, NULL,
- NULL, G_CALLBACK (popup_cmd_set_image_as_background), NULL },
- { "CopyImageLocation", N_("Copy I_mage Address"), NULL, NULL,
- NULL, G_CALLBACK (popup_cmd_copy_image_location), NULL },
+ { "OpenImageInNewWindow", NULL, N_("Open Image in New _Window"), NULL,
+ NULL, G_CALLBACK (popup_cmd_image_in_new_window) },
+ { "OpenImageInNewTab", NULL, N_("Open Image in New T_ab"), NULL,
+ NULL, G_CALLBACK (popup_cmd_image_in_new_tab) },
+ { "SaveImageAs", GTK_STOCK_SAVE_AS, N_("_Save Image As..."), NULL,
+ NULL, G_CALLBACK (popup_cmd_save_image_as) },
+ { "SetImageAsBackground", N_("_Use Image As Background"), NULL,
+ NULL, G_CALLBACK (popup_cmd_set_image_as_background) },
+ { "CopyImageLocation", N_("Copy I_mage Address"), NULL,
+ NULL, G_CALLBACK (popup_cmd_copy_image_location) },
};
static guint ephy_popups_n_entries = G_N_ELEMENTS (ephy_popups_entries);
@@ -270,8 +267,8 @@ struct EphyWindowPrivate
GtkWidget *exit_fullscreen_popup;
Toolbar *toolbar;
GtkWidget *statusbar;
- EggActionGroup *action_group;
- EggActionGroup *popups_action_group;
+ GtkActionGroup *action_group;
+ GtkActionGroup *popups_action_group;
EphyFavoritesMenu *fav_menu;
EphyEncodingMenu *enc_menu;
EphyTabsMenu *tabs_menu;
@@ -397,7 +394,7 @@ ephy_window_selection_received_cb (GtkWidget *widget,
}
static void
-add_widget (EggMenuMerge *merge, GtkWidget *widget, EphyWindow *window)
+add_widget (GtkUIManager *merge, GtkWidget *widget, EphyWindow *window)
{
if (GTK_IS_MENU_SHELL (widget))
{
@@ -416,8 +413,8 @@ menu_activate_cb (GtkWidget *widget,
changes to do this properly */
#if 0
gboolean cut, copy, paste, select_all;
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
GtkWidget *focus_widget;
EphyEmbed *embed;
@@ -456,13 +453,13 @@ menu_activate_cb (GtkWidget *widget,
}
action_group = window->priv->action_group;
- action = egg_action_group_get_action (action_group, "EditCut");
+ action = gtk_action_group_get_action (action_group, "EditCut");
g_object_set (action, "sensitive", cut, NULL);
- action = egg_action_group_get_action (action_group, "EditCopy");
+ action = gtk_action_group_get_action (action_group, "EditCopy");
g_object_set (action, "sensitive", copy, NULL);
- action = egg_action_group_get_action (action_group, "EditPaste");
+ action = gtk_action_group_get_action (action_group, "EditPaste");
g_object_set (action, "sensitive", paste, NULL);
- action = egg_action_group_get_action (action_group, "EditSelectAll");
+ action = gtk_action_group_get_action (action_group, "EditSelectAll");
g_object_set (action, "sensitive", select_all, NULL);
#endif
}
@@ -615,7 +612,7 @@ ephy_window_state_event_cb (GtkWidget *widget, GdkEventWindowState *event, EphyW
{
if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
{
- EggAction *action;
+ GtkAction *action;
gboolean fullscreen;
fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN;
@@ -629,9 +626,9 @@ ephy_window_state_event_cb (GtkWidget *widget, GdkEventWindowState *event, EphyW
ephy_window_unfullscreen (window);
}
- action = egg_action_group_get_action (window->priv->action_group,
+ action = gtk_action_group_get_action (window->priv->action_group,
"ViewFullscreen");
- egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action), fullscreen);
+ egg_toggle_action_set_active (GTK_TOGGLE_ACTION (action), fullscreen);
}
return FALSE;
@@ -640,9 +637,9 @@ ephy_window_state_event_cb (GtkWidget *widget, GdkEventWindowState *event, EphyW
static void
setup_window (EphyWindow *window)
{
- EggActionGroup *action_group;
- EggAction *action;
- EggMenuMerge *merge;
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ GtkUIManager *merge;
GtkWidget *menu;
int i;
@@ -667,47 +664,47 @@ setup_window (EphyWindow *window)
ephy_popups_entries[i].user_data = window;
}
- merge = egg_menu_merge_new ();
+ merge = gtk_ui_manager_new ();
- action_group = egg_action_group_new ("WindowActions");
- egg_action_group_add_actions (action_group, ephy_menu_entries,
+ action_group = gtk_action_group_new ("WindowActions");
+ gtk_action_group_add_actions (action_group, ephy_menu_entries,
ephy_menu_n_entries);
- egg_menu_merge_insert_action_group (merge, action_group, 0);
+ gtk_ui_manager_insert_action_group (merge, action_group, 0);
window->priv->action_group = action_group;
- action = egg_action_group_get_action (action_group, "FileOpen");
+ action = gtk_action_group_get_action (action_group, "FileOpen");
g_object_set (action, "short_label", _("Open"), NULL);
- action = egg_action_group_get_action (action_group, "FileSaveAs");
+ action = gtk_action_group_get_action (action_group, "FileSaveAs");
g_object_set (action, "short_label", _("Save As"), NULL);
- action = egg_action_group_get_action (action_group, "FilePrint");
+ action = gtk_action_group_get_action (action_group, "FilePrint");
g_object_set (action, "short_label", _("Print"), NULL);
- action = egg_action_group_get_action (action_group, "FileBookmarkPage");
+ action = gtk_action_group_get_action (action_group, "FileBookmarkPage");
g_object_set (action, "short_label", _("Bookmark"), NULL);
- action = egg_action_group_get_action (action_group, "EditFind");
+ action = gtk_action_group_get_action (action_group, "EditFind");
g_object_set (action, "short_label", _("Find"), NULL);
- action = egg_action_group_get_action (action_group, "GoBookmarks");
+ action = gtk_action_group_get_action (action_group, "GoBookmarks");
g_object_set (action, "short_label", _("Bookmarks"), NULL);
- action = egg_action_group_get_action (action_group, "EditFind");
+ action = gtk_action_group_get_action (action_group, "EditFind");
g_object_set (action, "important", TRUE, NULL);
- action = egg_action_group_get_action (action_group, "GoHome");
+ action = gtk_action_group_get_action (action_group, "GoHome");
g_object_set (action, "important", TRUE, NULL);
- action = egg_action_group_get_action (action_group, "GoBookmarks");
+ action = gtk_action_group_get_action (action_group, "GoBookmarks");
g_object_set (action, "important", TRUE, NULL);
- action_group = egg_action_group_new ("PopupsActions");
- egg_action_group_add_actions (action_group, ephy_popups_entries,
+ action_group = gtk_action_group_new ("PopupsActions");
+ gtk_action_group_add_actions (action_group, ephy_popups_entries,
ephy_popups_n_entries);
- egg_menu_merge_insert_action_group (merge, action_group, 0);
+ gtk_ui_manager_insert_action_group (merge, 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);
- egg_menu_merge_add_ui_from_file
+ gtk_ui_manager_add_ui_from_file
(merge, ephy_file ("epiphany-ui.xml"), NULL);
gtk_window_add_accel_group (GTK_WINDOW (window), merge->accel_group);
- egg_menu_merge_ensure_update (merge);
+ gtk_ui_manager_ensure_update (merge);
- menu = egg_menu_merge_get_widget (merge, "/menu/EditMenu");
+ menu = gtk_ui_manager_get_widget (merge, "/menu/EditMenu");
g_signal_connect (menu, "activate", G_CALLBACK (menu_activate_cb), window);
window->priv->toolbar = toolbar_new (window);
@@ -826,8 +823,8 @@ static void
sync_tab_navigation (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
{
TabNavigationFlags flags;
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
gboolean up = FALSE, back = FALSE, forward = FALSE;
if (window->priv->closing) return;
@@ -848,11 +845,11 @@ sync_tab_navigation (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
}
action_group = window->priv->action_group;
- action = egg_action_group_get_action (action_group, "GoUp");
+ action = gtk_action_group_get_action (action_group, "GoUp");
g_object_set (action, "sensitive", up, NULL);
- action = egg_action_group_get_action (action_group, "GoBack");
+ action = gtk_action_group_get_action (action_group, "GoBack");
g_object_set (action, "sensitive", back, NULL);
- action = egg_action_group_get_action (action_group, "GoForward");
+ action = gtk_action_group_get_action (action_group, "GoForward");
g_object_set (action, "sensitive", forward, NULL);
toolbar_update_navigation_actions (window->priv->toolbar,
@@ -936,11 +933,11 @@ sync_tab_security (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
static void
sync_tab_stop (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
{
- EggAction *action;
+ GtkAction *action;
if (window->priv->closing) return;
- action = egg_action_group_get_action (window->priv->action_group, "ViewStop");
+ action = gtk_action_group_get_action (window->priv->action_group, "ViewStop");
g_object_set (action, "sensitive", ephy_tab_get_load_status (tab), NULL);
}
@@ -996,8 +993,8 @@ sync_tab_visibility (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
static void
sync_tab_zoom (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
{
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
gboolean can_zoom_in = TRUE, can_zoom_out = TRUE, can_zoom_normal = FALSE;
float zoom;
@@ -1021,11 +1018,11 @@ sync_tab_zoom (EphyTab *tab, GParamSpec *pspec, EphyWindow *window)
toolbar_update_zoom (window->priv->toolbar, zoom);
action_group = window->priv->action_group;
- action = egg_action_group_get_action (action_group, "ViewZoomIn");
+ action = gtk_action_group_get_action (action_group, "ViewZoomIn");
g_object_set (action, "sensitive", can_zoom_in, NULL);
- action = egg_action_group_get_action (action_group, "ViewZoomOut");
+ action = gtk_action_group_get_action (action_group, "ViewZoomOut");
g_object_set (action, "sensitive", can_zoom_out, NULL);
- action = egg_action_group_get_action (action_group, "ViewZoomNormal");
+ action = gtk_action_group_get_action (action_group, "ViewZoomNormal");
g_object_set (action, "sensitive", can_zoom_normal, NULL);
}
@@ -1054,8 +1051,8 @@ popup_destroy_cb (GtkWidget *widget, EphyWindow *window)
static void
show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event)
{
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
EmbedEventContext context;
const char *popup;
char *path;
@@ -1101,12 +1098,12 @@ show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event)
}
action_group = window->priv->popups_action_group;
- action = egg_action_group_get_action (action_group, "SaveBackgroundAs");
+ action = gtk_action_group_get_action (action_group, "SaveBackgroundAs");
g_object_set (action, "sensitive", has_background,
"visible", has_background, NULL);
path = g_strconcat ("/popups/", popup, NULL);
- widget = egg_menu_merge_get_widget (EGG_MENU_MERGE (window->ui_merge),
+ widget = gtk_ui_manager_get_widget (GTK_UI_MANAGER (window->ui_merge),
path);
g_free (path);
@@ -1266,8 +1263,8 @@ static void
update_tabs_menu_sensitivity (EphyWindow *window)
{
gboolean prev_tab, next_tab, move_left, move_right, detach;
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
int current;
int last;
@@ -1281,15 +1278,15 @@ update_tabs_menu_sensitivity (EphyWindow *window)
(GTK_NOTEBOOK (window->priv->notebook)) > 1;
action_group = window->priv->action_group;
- action = egg_action_group_get_action (action_group, "TabsPrevious");
+ action = gtk_action_group_get_action (action_group, "TabsPrevious");
g_object_set (action, "sensitive", prev_tab, NULL);
- action = egg_action_group_get_action (action_group, "TabsNext");
+ action = gtk_action_group_get_action (action_group, "TabsNext");
g_object_set (action, "sensitive", next_tab, NULL);
- action = egg_action_group_get_action (action_group, "TabsMoveLeft");
+ action = gtk_action_group_get_action (action_group, "TabsMoveLeft");
g_object_set (action, "sensitive", move_left, NULL);
- action = egg_action_group_get_action (action_group, "TabsMoveRight");
+ action = gtk_action_group_get_action (action_group, "TabsMoveRight");
g_object_set (action, "sensitive", move_right, NULL);
- action = egg_action_group_get_action (action_group, "TabsDetach");
+ action = gtk_action_group_get_action (action_group, "TabsDetach");
g_object_set (action, "sensitive", detach, NULL);
}
@@ -1495,7 +1492,7 @@ ephy_window_finalize (GObject *object)
}
g_object_unref (window->priv->action_group);
- egg_menu_merge_remove_action_group (EGG_MENU_MERGE (window->ui_merge),
+ gtk_ui_manager_remove_action_group (GTK_UI_MANAGER (window->ui_merge),
window->priv->action_group);
g_object_unref (window->ui_merge);
@@ -1556,20 +1553,20 @@ translate_default_chrome (EmbedChromeMask *chrome_mask)
static void
update_layout_toggles (EphyWindow *window)
{
- EggActionGroup *action_group = EGG_ACTION_GROUP (window->priv->action_group);
+ GtkActionGroup *action_group = GTK_ACTION_GROUP (window->priv->action_group);
EmbedChromeMask mask = window->priv->chrome_mask;
- EggAction *action;
+ GtkAction *action;
- action = egg_action_group_get_action (action_group, "ViewToolbar");
- egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action),
+ action = gtk_action_group_get_action (action_group, "ViewToolbar");
+ egg_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
mask & EMBED_CHROME_TOOLBARON);
- action = egg_action_group_get_action (action_group, "ViewBookmarksBar");
- egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action),
+ action = gtk_action_group_get_action (action_group, "ViewBookmarksBar");
+ egg_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
mask & EMBED_CHROME_BOOKMARKSBARON);
- action = egg_action_group_get_action (action_group, "ViewStatusbar");
- egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action),
+ action = gtk_action_group_get_action (action_group, "ViewStatusbar");
+ egg_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
mask & EMBED_CHROME_STATUSBARON);
}
diff --git a/src/popup-commands.c b/src/popup-commands.c
index 0b5d112bd..54b512722 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -41,7 +41,7 @@ get_event_info (EphyWindow *window)
}
void
-popup_cmd_link_in_new_window (EggAction *action,
+popup_cmd_link_in_new_window (GtkAction *action,
EphyWindow *window)
{
EphyEmbedEvent *info;
@@ -61,7 +61,7 @@ popup_cmd_link_in_new_window (EggAction *action,
}
void
-popup_cmd_link_in_new_tab (EggAction *action,
+popup_cmd_link_in_new_tab (GtkAction *action,
EphyWindow *window)
{
EphyEmbedEvent *info;
@@ -81,7 +81,7 @@ popup_cmd_link_in_new_tab (EggAction *action,
}
void
-popup_cmd_image_in_new_tab (EggAction *action,
+popup_cmd_image_in_new_tab (GtkAction *action,
EphyWindow *window)
{
EphyEmbedEvent *info;
@@ -101,7 +101,7 @@ popup_cmd_image_in_new_tab (EggAction *action,
}
void
-popup_cmd_image_in_new_window (EggAction *action,
+popup_cmd_image_in_new_window (GtkAction *action,
EphyWindow *window)
{
EphyEmbedEvent *info;
@@ -121,7 +121,7 @@ popup_cmd_image_in_new_window (EggAction *action,
}
void
-popup_cmd_bookmark_link (EggAction *action,
+popup_cmd_bookmark_link (GtkAction *action,
EphyWindow *window)
{
GtkWidget *new_bookmark;
@@ -179,7 +179,7 @@ popup_cmd_bookmark_link (EggAction *action,
}
void
-popup_cmd_frame_in_new_tab (EggAction *action,
+popup_cmd_frame_in_new_tab (GtkAction *action,
EphyWindow *window)
{
EphyTab *tab;
@@ -201,7 +201,7 @@ popup_cmd_frame_in_new_tab (EggAction *action,
}
void
-popup_cmd_frame_in_new_window (EggAction *action,
+popup_cmd_frame_in_new_window (GtkAction *action,
EphyWindow *window)
{
EphyTab *tab;
@@ -232,7 +232,7 @@ popup_cmd_copy_to_clipboard (EphyWindow *window, const char *text)
}
void
-popup_cmd_copy_link_address (EggAction *action,
+popup_cmd_copy_link_address (GtkAction *action,
EphyWindow *window)
{
EphyEmbedEvent *event;
@@ -257,7 +257,7 @@ popup_cmd_copy_link_address (EggAction *action,
}
static void
-save_property_url (EggAction *action,
+save_property_url (GtkAction *action,
const char *title,
EphyWindow *window,
gboolean ask_dest,
@@ -298,7 +298,7 @@ save_property_url (EggAction *action,
}
void
-popup_cmd_open_link (EggAction *action,
+popup_cmd_open_link (GtkAction *action,
EphyWindow *window)
{
EphyEmbedEvent *info;
@@ -317,7 +317,7 @@ popup_cmd_open_link (EggAction *action,
}
void
-popup_cmd_download_link (EggAction *action,
+popup_cmd_download_link (GtkAction *action,
EphyWindow *window)
{
save_property_url (action, _("Download link"), window,
@@ -327,7 +327,7 @@ popup_cmd_download_link (EggAction *action,
}
void
-popup_cmd_save_image_as (EggAction *action,
+popup_cmd_save_image_as (GtkAction *action,
EphyWindow *window)
{
save_property_url (action, _("Save Image As"),
@@ -360,7 +360,7 @@ background_download_completed (EphyEmbedPersist *persist,
}
void
-popup_cmd_set_image_as_background (EggAction *action,
+popup_cmd_set_image_as_background (GtkAction *action,
EphyWindow *window)
{
EphyEmbedEvent *info;
@@ -397,7 +397,7 @@ popup_cmd_set_image_as_background (EggAction *action,
}
void
-popup_cmd_copy_image_location (EggAction *action,
+popup_cmd_copy_image_location (GtkAction *action,
EphyWindow *window)
{
EphyEmbedEvent *info;
@@ -415,7 +415,7 @@ popup_cmd_copy_image_location (EggAction *action,
}
void
-popup_cmd_save_background_as (EggAction *action,
+popup_cmd_save_background_as (GtkAction *action,
EphyWindow *window)
{
save_property_url (action, _("Save Background As"),
@@ -423,7 +423,7 @@ popup_cmd_save_background_as (EggAction *action,
}
void
-popup_cmd_open_frame (EggAction *action,
+popup_cmd_open_frame (GtkAction *action,
EphyWindow *window)
{
char *location;
@@ -440,7 +440,7 @@ popup_cmd_open_frame (EggAction *action,
}
void
-popup_cmd_open_image (EggAction *action,
+popup_cmd_open_image (GtkAction *action,
EphyWindow *window)
{
EphyEmbedEvent *info;
diff --git a/src/popup-commands.h b/src/popup-commands.h
index da14090aa..2d2da5f11 100644
--- a/src/popup-commands.h
+++ b/src/popup-commands.h
@@ -16,65 +16,66 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "egg-action.h"
+#include <gtk/gtkaction.h>
+
#include "ephy-window.h"
-void popup_cmd_link_in_new_window (EggAction *action,
+void popup_cmd_link_in_new_window (GtkAction *action,
EphyWindow *window);
-void popup_cmd_link_in_new_tab (EggAction *action,
+void popup_cmd_link_in_new_tab (GtkAction *action,
EphyWindow *window);
-void popup_cmd_image_in_new_tab (EggAction *action,
+void popup_cmd_image_in_new_tab (GtkAction *action,
EphyWindow *window);
-void popup_cmd_image_in_new_window (EggAction *action,
+void popup_cmd_image_in_new_window (GtkAction *action,
EphyWindow *window);
-void popup_cmd_bookmark_link (EggAction *action,
+void popup_cmd_bookmark_link (GtkAction *action,
EphyWindow *window);
-void popup_cmd_frame_in_new_tab (EggAction *action,
+void popup_cmd_frame_in_new_tab (GtkAction *action,
EphyWindow *window);
-void popup_cmd_frame_in_new_window (EggAction *action,
+void popup_cmd_frame_in_new_window (GtkAction *action,
EphyWindow *window);
-void popup_cmd_add_frame_bookmark (EggAction *action,
+void popup_cmd_add_frame_bookmark (GtkAction *action,
EphyWindow *window);
-void popup_cmd_view_source (EggAction *action,
+void popup_cmd_view_source (GtkAction *action,
EphyWindow *window);
-void popup_cmd_copy_link_address (EggAction *action,
+void popup_cmd_copy_link_address (GtkAction *action,
EphyWindow *window);
-void popup_cmd_copy_link_location (EggAction *action,
+void popup_cmd_copy_link_location (GtkAction *action,
EphyWindow *window);
-void popup_cmd_open_link (EggAction *action,
+void popup_cmd_open_link (GtkAction *action,
EphyWindow *window);
-void popup_cmd_download_link (EggAction *action,
+void popup_cmd_download_link (GtkAction *action,
EphyWindow *window);
-void popup_cmd_set_image_as_background (EggAction *action,
+void popup_cmd_set_image_as_background (GtkAction *action,
EphyWindow *window);
-void popup_cmd_copy_image_location (EggAction *action,
+void popup_cmd_copy_image_location (GtkAction *action,
EphyWindow *window);
-void popup_cmd_save_background_as (EggAction *action,
+void popup_cmd_save_background_as (GtkAction *action,
EphyWindow *window);
-void popup_cmd_open_frame (EggAction *action,
+void popup_cmd_open_frame (GtkAction *action,
EphyWindow *window);
-void popup_cmd_open_image (EggAction *action,
+void popup_cmd_open_image (GtkAction *action,
EphyWindow *window);
-void popup_cmd_download_link (EggAction *action,
+void popup_cmd_download_link (GtkAction *action,
EphyWindow *window);
-void popup_cmd_save_image_as (EggAction *action,
+void popup_cmd_save_image_as (GtkAction *action,
EphyWindow *window);
diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c
index 26b52926e..76978414b 100755
--- a/src/ppview-toolbar.c
+++ b/src/ppview-toolbar.c
@@ -59,33 +59,33 @@ struct PPViewToolbarPrivate
{
EphyWindow *window;
EmbedChromeMask original_mask;
- EggMenuMerge *ui_merge;
- EggActionGroup *action_group;
+ GtkUIManager *ui_merge;
+ GtkActionGroup *action_group;
guint ui_id;
int current_page;
};
static void
-toolbar_cmd_ppv_goto_first (EggMenuMerge *merge,
+toolbar_cmd_ppv_goto_first (GtkUIManager *merge,
PPViewToolbar *t);
static void
-toolbar_cmd_ppv_goto_last (EggMenuMerge *merge,
+toolbar_cmd_ppv_goto_last (GtkUIManager *merge,
PPViewToolbar *t);
static void
-toolbar_cmd_ppv_go_back (EggMenuMerge *merge,
+toolbar_cmd_ppv_go_back (GtkUIManager *merge,
PPViewToolbar *t);
static void
-toolbar_cmd_ppv_go_forward (EggMenuMerge *merge,
+toolbar_cmd_ppv_go_forward (GtkUIManager *merge,
PPViewToolbar *t);
static void
-toolbar_cmd_ppv_close (EggMenuMerge *merge,
+toolbar_cmd_ppv_close (GtkUIManager *merge,
PPViewToolbar *t);
-static EggActionGroupEntry entries [] = {
+static GtkActionGroupEntry entries [] = {
{ "PPVGotoFirst", N_("First"),
GTK_STOCK_GOTO_FIRST, NULL,
N_("Go to the first page"),
@@ -208,8 +208,8 @@ toolbar_update_sensitivity (PPViewToolbar *t)
int pages, c_page;
EphyWindow *window = t->priv->window;
EphyEmbed *embed;
- EggAction *action;
- EggActionGroup *action_group = t->priv->action_group;
+ GtkAction *action;
+ GtkActionGroup *action_group = t->priv->action_group;
embed = ephy_window_get_active_embed (window);
g_return_if_fail (embed != NULL);
@@ -217,13 +217,13 @@ toolbar_update_sensitivity (PPViewToolbar *t)
ephy_embed_print_preview_num_pages (embed, &pages);
c_page = t->priv->current_page;
- action = egg_action_group_get_action (action_group, "PPVGoBack");
+ action = gtk_action_group_get_action (action_group, "PPVGoBack");
g_object_set (action, "sensitive", c_page > 1, NULL);
- action = egg_action_group_get_action (action_group, "PPVGotoFirst");
+ action = gtk_action_group_get_action (action_group, "PPVGotoFirst");
g_object_set (action, "sensitive", c_page > 1, NULL);
- action = egg_action_group_get_action (action_group, "PPVGoForward");
+ action = gtk_action_group_get_action (action_group, "PPVGoForward");
g_object_set (action, "sensitive", c_page < pages, NULL);
- action = egg_action_group_get_action (action_group, "PPVGotoLast");
+ action = gtk_action_group_get_action (action_group, "PPVGotoLast");
g_object_set (action, "sensitive", c_page < pages, NULL);
}
@@ -233,15 +233,15 @@ ppview_toolbar_set_window (PPViewToolbar *t, EphyWindow *window)
g_return_if_fail (t->priv->window == NULL);
t->priv->window = window;
- t->priv->ui_merge = EGG_MENU_MERGE (t->priv->window->ui_merge);
+ t->priv->ui_merge = GTK_UI_MANAGER (t->priv->window->ui_merge);
t->priv->original_mask = ephy_window_get_chrome (window);
- t->priv->action_group = egg_action_group_new ("PPViewActions");
- egg_action_group_add_actions (t->priv->action_group, entries, n_entries);
- egg_menu_merge_insert_action_group (t->priv->ui_merge,
+ t->priv->action_group = gtk_action_group_new ("PPViewActions");
+ gtk_action_group_add_actions (t->priv->action_group, entries, n_entries);
+ gtk_ui_manager_insert_action_group (t->priv->ui_merge,
t->priv->action_group, 0);
- t->priv->ui_id = egg_menu_merge_add_ui_from_string
+ t->priv->ui_id = gtk_ui_manager_add_ui_from_string
(t->priv->ui_merge, ui_info, -1, NULL);
toolbar_update_sensitivity (t);
@@ -276,8 +276,8 @@ ppview_toolbar_finalize (GObject *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,
+ gtk_ui_manager_remove_ui (t->priv->ui_merge, t->priv->ui_id);
+ gtk_ui_manager_remove_action_group (t->priv->ui_merge,
t->priv->action_group);
g_object_unref (t->priv->action_group);
@@ -301,7 +301,7 @@ ppview_toolbar_new (EphyWindow *window)
}
static void
-toolbar_cmd_ppv_goto_first (EggMenuMerge *merge,
+toolbar_cmd_ppv_goto_first (GtkUIManager *merge,
PPViewToolbar *t)
{
EphyWindow *window = t->priv->window;
@@ -318,7 +318,7 @@ toolbar_cmd_ppv_goto_first (EggMenuMerge *merge,
}
static void
-toolbar_cmd_ppv_goto_last (EggMenuMerge *merge,
+toolbar_cmd_ppv_goto_last (GtkUIManager *merge,
PPViewToolbar *t)
{
EphyWindow *window = t->priv->window;
@@ -353,7 +353,7 @@ clamp_page_limits (PPViewToolbar *t, int page)
}
static void
-toolbar_cmd_ppv_go_back (EggMenuMerge *merge,
+toolbar_cmd_ppv_go_back (GtkUIManager *merge,
PPViewToolbar *t)
{
EphyWindow *window = t->priv->window;
@@ -372,7 +372,7 @@ toolbar_cmd_ppv_go_back (EggMenuMerge *merge,
}
static void
-toolbar_cmd_ppv_go_forward (EggMenuMerge *merge,
+toolbar_cmd_ppv_go_forward (GtkUIManager *merge,
PPViewToolbar *t)
{
EphyWindow *window = t->priv->window;
@@ -391,7 +391,7 @@ toolbar_cmd_ppv_go_forward (EggMenuMerge *merge,
}
static void
-toolbar_cmd_ppv_close (EggMenuMerge *merge,
+toolbar_cmd_ppv_close (GtkUIManager *merge,
PPViewToolbar *t)
{
EphyWindow *window;
diff --git a/src/toolbar.c b/src/toolbar.c
index 9cfab5693..dd88179dd 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -82,8 +82,8 @@ static GObjectClass *parent_class = NULL;
struct ToolbarPrivate
{
EphyWindow *window;
- EggMenuMerge *ui_merge;
- EggActionGroup *action_group;
+ GtkUIManager *ui_merge;
+ GtkActionGroup *action_group;
gboolean visibility;
gboolean can_set_location;
GtkWidget *spinner;
@@ -121,13 +121,13 @@ toolbar_get_type (void)
}
static void
-go_location_cb (EggAction *action, char *location, EphyWindow *window)
+go_location_cb (GtkAction *action, char *location, EphyWindow *window)
{
ephy_window_load_url (window, location);
}
static void
-zoom_to_level_cb (EggAction *action, float zoom, EphyWindow *window)
+zoom_to_level_cb (GtkAction *action, float zoom, EphyWindow *window)
{
ephy_window_set_zoom (window, zoom);
}
@@ -136,7 +136,7 @@ static void
bookmark_destroy_cb (EphyNode *node,
Toolbar *t)
{
- EggAction *action;
+ GtkAction *action;
char *name;
EphyToolbarsModel *model;
long id;
@@ -146,10 +146,10 @@ bookmark_destroy_cb (EphyNode *node,
id = ephy_node_get_id (node);
name = ephy_toolbars_model_get_action_name (model, id);
- action = egg_action_group_get_action (t->priv->action_group, name);
+ action = gtk_action_group_get_action (t->priv->action_group, name);
if (action)
{
- egg_action_group_remove_action (t->priv->action_group, action);
+ gtk_action_group_remove_action (t->priv->action_group, action);
}
g_free (name);
@@ -159,7 +159,7 @@ static void
toolbar_ensure_action (Toolbar *t,
const char *name)
{
- EggAction *action = NULL;
+ GtkAction *action = NULL;
EphyToolbarsModel *model;
EphyBookmarks *bookmarks;
EphyNode *bmks, *topics;
@@ -192,7 +192,7 @@ toolbar_ensure_action (Toolbar *t,
g_signal_connect (action, "go_location",
G_CALLBACK (go_location_cb), t->priv->window);
- egg_action_group_add_action (t->priv->action_group, action);
+ gtk_action_group_add_action (t->priv->action_group, action);
g_object_unref (action);
ephy_node_signal_connect_object (node,
@@ -259,9 +259,9 @@ toolbar_get_property (GObject *object,
static void
toolbar_setup_actions (Toolbar *t)
{
- EggAction *action;
+ GtkAction *action;
- t->priv->action_group = egg_action_group_new ("SpecialToolbarActions");
+ t->priv->action_group = gtk_action_group_new ("SpecialToolbarActions");
action = g_object_new (EPHY_TYPE_NAVIGATION_ACTION,
"name", "NavigationBack",
@@ -274,7 +274,7 @@ toolbar_setup_actions (Toolbar *t)
NULL);
g_signal_connect (action, "activate",
G_CALLBACK (window_cmd_go_back), t->priv->window);
- egg_action_group_add_action (t->priv->action_group, action);
+ gtk_action_group_add_action (t->priv->action_group, action);
g_object_unref (action);
action = g_object_new (EPHY_TYPE_NAVIGATION_ACTION,
@@ -287,7 +287,7 @@ toolbar_setup_actions (Toolbar *t)
NULL);
g_signal_connect (action, "activate",
G_CALLBACK (window_cmd_go_forward), t->priv->window);
- egg_action_group_add_action (t->priv->action_group, action);
+ gtk_action_group_add_action (t->priv->action_group, action);
g_object_unref (action);
action = g_object_new (EPHY_TYPE_NAVIGATION_ACTION,
@@ -300,14 +300,14 @@ toolbar_setup_actions (Toolbar *t)
NULL);
g_signal_connect (action, "activate",
G_CALLBACK (window_cmd_go_up), t->priv->window);
- egg_action_group_add_action (t->priv->action_group, action);
+ gtk_action_group_add_action (t->priv->action_group, action);
g_object_unref (action);
action = g_object_new (EPHY_TYPE_SPINNER_ACTION,
"name", "Spinner",
"label", _("Spinner"),
NULL);
- egg_action_group_add_action (t->priv->action_group, action);
+ gtk_action_group_add_action (t->priv->action_group, action);
g_object_unref (action);
/* FIXME: I'm still waiting for the exact term to
@@ -321,7 +321,7 @@ toolbar_setup_actions (Toolbar *t)
NULL);
g_signal_connect (action, "go_location",
G_CALLBACK (go_location_cb), t->priv->window);
- egg_action_group_add_action (t->priv->action_group, action);
+ gtk_action_group_add_action (t->priv->action_group, action);
g_object_unref (action);
action = g_object_new (EPHY_TYPE_ZOOM_ACTION,
@@ -332,7 +332,7 @@ toolbar_setup_actions (Toolbar *t)
NULL);
g_signal_connect (action, "zoom_to_level",
G_CALLBACK (zoom_to_level_cb), t->priv->window);
- egg_action_group_add_action (t->priv->action_group, action);
+ gtk_action_group_add_action (t->priv->action_group, action);
g_object_unref (action);
action = g_object_new (EPHY_TYPE_FAVICON_ACTION,
@@ -340,7 +340,7 @@ toolbar_setup_actions (Toolbar *t)
"label", _("Favicon"),
"window", t->priv->window,
NULL);
- egg_action_group_add_action (t->priv->action_group, action);
+ gtk_action_group_add_action (t->priv->action_group, action);
g_object_unref (action);
action = g_object_new (EPHY_TYPE_GO_ACTION,
@@ -351,7 +351,7 @@ toolbar_setup_actions (Toolbar *t)
NULL);
g_signal_connect (action, "activate",
G_CALLBACK (window_cmd_load_location), t->priv->window);
- egg_action_group_add_action (t->priv->action_group, action);
+ gtk_action_group_add_action (t->priv->action_group, action);
g_object_unref (action);
}
@@ -430,10 +430,10 @@ update_toolbar_remove_flag (EphyToolbarsModel *model, gpointer data)
static GtkWidget *
get_location_entry (Toolbar *t)
{
- EggAction *action;
+ GtkAction *action;
GtkWidget *location;
- action = egg_action_group_get_action
+ action = gtk_action_group_get_action
(t->priv->action_group, "Location");
location = ephy_location_action_get_widget
(EPHY_LOCATION_ACTION (action));
@@ -465,10 +465,10 @@ toolbar_set_window (Toolbar *t, EphyWindow *window)
g_return_if_fail (t->priv->window == NULL);
t->priv->window = window;
- t->priv->ui_merge = EGG_MENU_MERGE (window->ui_merge);
+ t->priv->ui_merge = GTK_UI_MANAGER (window->ui_merge);
toolbar_setup_actions (t);
- egg_menu_merge_insert_action_group (t->priv->ui_merge,
+ gtk_ui_manager_insert_action_group (t->priv->ui_merge,
t->priv->action_group, 1);
g_signal_connect (t, "action_request",
@@ -510,21 +510,21 @@ toolbar_finalize (GObject *object)
{
Toolbar *t;
ToolbarPrivate *p;
- EggMenuMerge *merge;
+ GtkUIManager *merge;
g_return_if_fail (object != NULL);
g_return_if_fail (IS_TOOLBAR (object));
t = TOOLBAR (object);
p = t->priv;
- merge = EGG_MENU_MERGE (t->priv->window->ui_merge);
+ merge = GTK_UI_MANAGER (t->priv->window->ui_merge);
g_return_if_fail (p != NULL);
G_OBJECT_CLASS (parent_class)->finalize (object);
g_object_unref (t->priv->action_group);
- egg_menu_merge_remove_action_group (merge, t->priv->action_group);
+ gtk_ui_manager_remove_action_group (merge, t->priv->action_group);
g_free (t->priv);
@@ -581,22 +581,22 @@ toolbar_activate_location (Toolbar *t)
void
toolbar_spinner_start (Toolbar *t)
{
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
action_group = t->priv->action_group;
- action = egg_action_group_get_action (action_group, "Spinner");
+ action = gtk_action_group_get_action (action_group, "Spinner");
g_object_set (action, "throbbing", TRUE, NULL);
}
void
toolbar_spinner_stop (Toolbar *t)
{
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
action_group = t->priv->action_group;
- action = egg_action_group_get_action (action_group, "Spinner");
+ action = gtk_action_group_get_action (action_group, "Spinner");
g_object_set (action, "throbbing", FALSE, NULL);
}
@@ -622,13 +622,13 @@ toolbar_update_favicon (Toolbar *t)
{
EphyTab *tab;
const char *url;
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
tab = ephy_window_get_active_tab (t->priv->window);
url = ephy_tab_get_icon_address (tab);
action_group = t->priv->action_group;
- action = egg_action_group_get_action (action_group, "Favicon");
+ action = gtk_action_group_get_action (action_group, "Favicon");
g_object_set (action, "icon", url, NULL);
}
@@ -658,15 +658,15 @@ toolbar_clear_location_history (Toolbar *t)
void
toolbar_update_navigation_actions (Toolbar *t, gboolean back, gboolean forward, gboolean up)
{
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
action_group = t->priv->action_group;
- action = egg_action_group_get_action (action_group, "NavigationBack");
+ action = gtk_action_group_get_action (action_group, "NavigationBack");
g_object_set (action, "sensitive", back, NULL);
- action = egg_action_group_get_action (action_group, "NavigationForward");
+ action = gtk_action_group_get_action (action_group, "NavigationForward");
g_object_set (action, "sensitive", forward, NULL);
- action = egg_action_group_get_action (action_group, "NavigationUp");
+ action = gtk_action_group_get_action (action_group, "NavigationUp");
g_object_set (action, "sensitive", up, NULL);
}
@@ -722,10 +722,10 @@ toolbar_set_visibility (Toolbar *t,
void
toolbar_update_zoom (Toolbar *t, float zoom)
{
- EggActionGroup *action_group;
- EggAction *action;
+ GtkActionGroup *action_group;
+ GtkAction *action;
action_group = t->priv->action_group;
- action = egg_action_group_get_action (action_group, "Zoom");
+ action = gtk_action_group_get_action (action_group, "Zoom");
g_object_set (action, "zoom", zoom, NULL);
}
diff --git a/src/window-commands.c b/src/window-commands.c
index 66145daf4..a07eb7602 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -57,21 +57,21 @@ enum
};
void
-window_cmd_edit_find (EggAction *action,
+window_cmd_edit_find (GtkAction *action,
EphyWindow *window)
{
ephy_window_find (window);
}
void
-window_cmd_file_print (EggAction *action,
+window_cmd_file_print (GtkAction *action,
EphyWindow *window)
{
ephy_window_print (window);
}
void
-window_cmd_go_back (EggAction *action,
+window_cmd_go_back (GtkAction *action,
EphyWindow *window)
{
EphyEmbed *embed;
@@ -85,7 +85,7 @@ window_cmd_go_back (EggAction *action,
}
void
-window_cmd_go_up (EggAction *action,
+window_cmd_go_up (GtkAction *action,
EphyWindow *window)
{
EphyEmbed *embed;
@@ -99,7 +99,7 @@ window_cmd_go_up (EggAction *action,
}
void
-window_cmd_file_send_to (EggAction *action,
+window_cmd_file_send_to (GtkAction *action,
EphyWindow *window)
{
EphyTab *tab;
@@ -142,7 +142,7 @@ window_cmd_file_send_to (EggAction *action,
}
void
-window_cmd_go_forward (EggAction *action,
+window_cmd_go_forward (GtkAction *action,
EphyWindow *window)
{
EphyEmbed *embed;
@@ -156,7 +156,7 @@ window_cmd_go_forward (EggAction *action,
}
void
-window_cmd_go_home (EggAction *action,
+window_cmd_go_home (GtkAction *action,
EphyWindow *window)
{
char *location;
@@ -176,14 +176,14 @@ window_cmd_go_home (EggAction *action,
}
void
-window_cmd_go_location (EggAction *action,
+window_cmd_go_location (GtkAction *action,
EphyWindow *window)
{
ephy_window_activate_location (window);
}
void
-window_cmd_view_stop (EggAction *action,
+window_cmd_view_stop (GtkAction *action,
EphyWindow *window)
{
EphyEmbed *embed;
@@ -197,7 +197,7 @@ window_cmd_view_stop (EggAction *action,
}
void
-window_cmd_view_reload (EggAction *action,
+window_cmd_view_reload (GtkAction *action,
EphyWindow *window)
{
EphyEmbed *embed;
@@ -235,7 +235,7 @@ window_cmd_view_reload (EggAction *action,
}
void
-window_cmd_file_new_window (EggAction *action,
+window_cmd_file_new_window (GtkAction *action,
EphyWindow *window)
{
EphyTab *tab;
@@ -249,7 +249,7 @@ window_cmd_file_new_window (EggAction *action,
}
void
-window_cmd_file_new_tab (EggAction *action,
+window_cmd_file_new_tab (GtkAction *action,
EphyWindow *window)
{
EphyTab *tab;
@@ -264,14 +264,14 @@ window_cmd_file_new_tab (EggAction *action,
}
void
-window_cmd_go_bookmarks (EggAction *action,
+window_cmd_go_bookmarks (GtkAction *action,
EphyWindow *window)
{
ephy_shell_show_bookmarks_editor (ephy_shell, GTK_WIDGET (window));
}
void
-window_cmd_file_bookmark_page (EggAction *action,
+window_cmd_file_bookmark_page (GtkAction *action,
EphyWindow *window)
{
EphyTab *tab;
@@ -315,7 +315,7 @@ window_cmd_file_bookmark_page (EggAction *action,
}
void
-window_cmd_file_open (EggAction *action,
+window_cmd_file_open (GtkAction *action,
EphyWindow *window)
{
gchar *dir, *retDir;
@@ -365,7 +365,7 @@ window_cmd_file_open (EggAction *action,
}
void
-window_cmd_file_save_as (EggAction *action,
+window_cmd_file_save_as (GtkAction *action,
EphyWindow *window)
{
EphyEmbed *embed;
@@ -389,7 +389,7 @@ window_cmd_file_save_as (EggAction *action,
}
void
-window_cmd_file_close_window (EggAction *action,
+window_cmd_file_close_window (GtkAction *action,
EphyWindow *window)
{
EphyTab *tab;
@@ -401,7 +401,7 @@ window_cmd_file_close_window (EggAction *action,
}
void
-window_cmd_edit_cut (EggAction *action,
+window_cmd_edit_cut (GtkAction *action,
EphyWindow *window)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
@@ -421,7 +421,7 @@ window_cmd_edit_cut (EggAction *action,
}
void
-window_cmd_edit_copy (EggAction *action,
+window_cmd_edit_copy (GtkAction *action,
EphyWindow *window)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
@@ -442,7 +442,7 @@ window_cmd_edit_copy (EggAction *action,
}
void
-window_cmd_edit_paste (EggAction *action,
+window_cmd_edit_paste (GtkAction *action,
EphyWindow *window)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
@@ -463,7 +463,7 @@ window_cmd_edit_paste (EggAction *action,
}
void
-window_cmd_edit_select_all (EggAction *action,
+window_cmd_edit_select_all (GtkAction *action,
EphyWindow *window)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
@@ -484,7 +484,7 @@ window_cmd_edit_select_all (EggAction *action,
}
void
-window_cmd_edit_find_next (EggAction *action,
+window_cmd_edit_find_next (GtkAction *action,
EphyWindow *window)
{
EphyEmbed *embed;
@@ -496,7 +496,7 @@ window_cmd_edit_find_next (EggAction *action,
}
void
-window_cmd_edit_find_prev (EggAction *action,
+window_cmd_edit_find_prev (GtkAction *action,
EphyWindow *window)
{
EphyEmbed *embed;
@@ -508,7 +508,7 @@ window_cmd_edit_find_prev (EggAction *action,
}
void
-window_cmd_view_bookmarks_bar (EggAction *action,
+window_cmd_view_bookmarks_bar (GtkAction *action,
EphyWindow *window)
{
EmbedChromeMask mask;
@@ -516,7 +516,7 @@ window_cmd_view_bookmarks_bar (EggAction *action,
gboolean current_state;
mask = ephy_window_get_chrome (window);
- active = EGG_TOGGLE_ACTION (action)->active;
+ active = GTK_TOGGLE_ACTION (action)->active;
current_state = (mask & EMBED_CHROME_BOOKMARKSBARON) > 0;
if (active != current_state)
@@ -527,7 +527,7 @@ window_cmd_view_bookmarks_bar (EggAction *action,
}
void
-window_cmd_view_toolbar (EggAction *action,
+window_cmd_view_toolbar (GtkAction *action,
EphyWindow *window)
{
EmbedChromeMask mask;
@@ -535,7 +535,7 @@ window_cmd_view_toolbar (EggAction *action,
gboolean current_state;
mask = ephy_window_get_chrome (window);
- active = EGG_TOGGLE_ACTION (action)->active;
+ active = GTK_TOGGLE_ACTION (action)->active;
current_state = (mask & EMBED_CHROME_TOOLBARON) > 0;
if (active != current_state)
@@ -546,7 +546,7 @@ window_cmd_view_toolbar (EggAction *action,
}
void
-window_cmd_view_statusbar (EggAction *action,
+window_cmd_view_statusbar (GtkAction *action,
EphyWindow *window)
{
EmbedChromeMask mask;
@@ -554,7 +554,7 @@ window_cmd_view_statusbar (EggAction *action,
gboolean current_state;
mask = ephy_window_get_chrome (window);
- active = EGG_TOGGLE_ACTION (action)->active;
+ active = GTK_TOGGLE_ACTION (action)->active;
current_state = (mask & EMBED_CHROME_STATUSBARON) > 0;
if (active != current_state)
@@ -565,10 +565,10 @@ window_cmd_view_statusbar (EggAction *action,
}
void
-window_cmd_view_fullscreen (EggAction *action,
+window_cmd_view_fullscreen (GtkAction *action,
EphyWindow *window)
{
- if (EGG_TOGGLE_ACTION (action)->active)
+ if (GTK_TOGGLE_ACTION (action)->active)
{
gtk_window_fullscreen (GTK_WINDOW (window));
}
@@ -579,28 +579,28 @@ window_cmd_view_fullscreen (EggAction *action,
}
void
-window_cmd_view_zoom_in (EggAction *action,
+window_cmd_view_zoom_in (GtkAction *action,
EphyWindow *window)
{
ephy_window_set_zoom (window, ZOOM_IN);
}
void
-window_cmd_view_zoom_out (EggAction *action,
+window_cmd_view_zoom_out (GtkAction *action,
EphyWindow *window)
{
ephy_window_set_zoom (window, ZOOM_OUT);
}
void
-window_cmd_view_zoom_normal (EggAction *action,
+window_cmd_view_zoom_normal (GtkAction *action,
EphyWindow *window)
{
ephy_window_set_zoom (window, 1.0);
}
void
-window_cmd_view_page_source (EggAction *action,
+window_cmd_view_page_source (GtkAction *action,
EphyWindow *window)
{
EphyTab *tab;
@@ -614,14 +614,14 @@ window_cmd_view_page_source (EggAction *action,
}
void
-window_cmd_go_history (EggAction *action,
+window_cmd_go_history (GtkAction *action,
EphyWindow *window)
{
ephy_shell_show_history_window (ephy_shell, GTK_WIDGET (window));
}
void
-window_cmd_edit_personal_data (EggAction *action,
+window_cmd_edit_personal_data (GtkAction *action,
EphyWindow *window)
{
EphyDialog *dialog;
@@ -632,7 +632,7 @@ window_cmd_edit_personal_data (EggAction *action,
}
void
-window_cmd_edit_prefs (EggAction *action,
+window_cmd_edit_prefs (GtkAction *action,
EphyWindow *window)
{
EphyDialog *dialog;
@@ -675,7 +675,7 @@ toolbar_editor_response_cb (GtkDialog *dialog,
}
void
-window_cmd_edit_toolbar (EggAction *action,
+window_cmd_edit_toolbar (GtkAction *action,
EphyWindow *window)
{
GtkWidget *editor;
@@ -694,7 +694,7 @@ window_cmd_edit_toolbar (EggAction *action,
GTK_WINDOW (window));
editor = egg_toolbar_editor_new
- (EGG_MENU_MERGE (window->ui_merge),
+ (GTK_UI_MANAGER (window->ui_merge),
EGG_TOOLBARS_MODEL (model));
egg_toolbar_editor_load_actions (EGG_TOOLBAR_EDITOR (editor),
ephy_file ("epiphany-toolbar.xml"));
@@ -729,14 +729,14 @@ window_cmd_edit_toolbar (EggAction *action,
}
void
-window_cmd_help_contents (EggAction *action,
+window_cmd_help_contents (GtkAction *action,
EphyWindow *window)
{
ephy_gui_help (GTK_WINDOW (window), "epiphany", NULL);
}
void
-window_cmd_help_about (EggAction *action,
+window_cmd_help_about (GtkAction *action,
GtkWidget *window)
{
static GtkWidget *about = NULL;
@@ -813,7 +813,7 @@ window_cmd_help_about (EggAction *action,
}
void
-window_cmd_tabs_next (EggAction *action,
+window_cmd_tabs_next (GtkAction *action,
EphyWindow *window)
{
GtkNotebook *nb;
@@ -832,7 +832,7 @@ window_cmd_tabs_next (EggAction *action,
}
void
-window_cmd_tabs_previous (EggAction *action,
+window_cmd_tabs_previous (GtkAction *action,
EphyWindow *window)
{
GtkNotebook *nb;
@@ -851,7 +851,7 @@ window_cmd_tabs_previous (EggAction *action,
}
void
-window_cmd_tabs_move_left (EggAction *action,
+window_cmd_tabs_move_left (GtkAction *action,
EphyWindow *window)
{
GtkWidget *notebook;
@@ -869,7 +869,7 @@ window_cmd_tabs_move_left (EggAction *action,
}
}
-void window_cmd_tabs_move_right (EggAction *action,
+void window_cmd_tabs_move_right (GtkAction *action,
EphyWindow *window)
{
GtkWidget *notebook;
@@ -890,7 +890,7 @@ void window_cmd_tabs_move_right (EggAction *action,
}
void
-window_cmd_tabs_detach (EggAction *action,
+window_cmd_tabs_detach (GtkAction *action,
EphyWindow *window)
{
EphyTab *tab;
@@ -911,7 +911,7 @@ window_cmd_tabs_detach (EggAction *action,
}
void
-window_cmd_load_location (EggAction *action,
+window_cmd_load_location (GtkAction *action,
EphyWindow *window)
{
Toolbar *toolbar;
diff --git a/src/window-commands.h b/src/window-commands.h
index 8b5ee56b4..2fbbd540b 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -16,145 +16,146 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include "egg-action.h"
+#include <gtk/gtkaction.h>
+
#include "ephy-window.h"
#include "ephy-embed-utils.h"
-void window_cmd_edit_find (EggAction *action,
+void window_cmd_edit_find (GtkAction *action,
EphyWindow *window);
-void window_cmd_file_print (EggAction *action,
+void window_cmd_file_print (GtkAction *action,
EphyWindow *window);
-void window_cmd_view_stop (EggAction *action,
+void window_cmd_view_stop (GtkAction *action,
EphyWindow *window);
-void window_cmd_go_back (EggAction *action,
+void window_cmd_go_back (GtkAction *action,
EphyWindow *window);
-void window_cmd_go_forward (EggAction *action,
+void window_cmd_go_forward (GtkAction *action,
EphyWindow *window);
-void window_cmd_go_location (EggAction *action,
+void window_cmd_go_location (GtkAction *action,
EphyWindow *window);
-void window_cmd_go_up (EggAction *action,
+void window_cmd_go_up (GtkAction *action,
EphyWindow *window);
-void window_cmd_go_home (EggAction *action,
+void window_cmd_go_home (GtkAction *action,
EphyWindow *window);
-void window_cmd_go_myportal (EggAction *action,
+void window_cmd_go_myportal (GtkAction *action,
EphyWindow *window);
-void window_cmd_go_location (EggAction *action,
+void window_cmd_go_location (GtkAction *action,
EphyWindow *window);
-void window_cmd_view_reload (EggAction *action,
+void window_cmd_view_reload (GtkAction *action,
EphyWindow *window);
-void window_cmd_new (EggAction *action,
+void window_cmd_new (GtkAction *action,
EphyWindow *window);
-void window_cmd_file_new_window (EggAction *action,
+void window_cmd_file_new_window (GtkAction *action,
EphyWindow *window);
-void window_cmd_file_new_tab (EggAction *action,
+void window_cmd_file_new_tab (GtkAction *action,
EphyWindow *window);
-void window_cmd_file_bookmark_page(EggAction *action,
+void window_cmd_file_bookmark_page(GtkAction *action,
EphyWindow *window);
-void window_cmd_go_bookmarks (EggAction *action,
+void window_cmd_go_bookmarks (GtkAction *action,
EphyWindow *window);
-void window_cmd_file_open (EggAction *action,
+void window_cmd_file_open (GtkAction *action,
EphyWindow *window);
-void window_cmd_file_save_as (EggAction *action,
+void window_cmd_file_save_as (GtkAction *action,
EphyWindow *window);
-void window_cmd_file_send_to (EggAction *action,
+void window_cmd_file_send_to (GtkAction *action,
EphyWindow *window);
-void window_cmd_file_close_window (EggAction *action,
+void window_cmd_file_close_window (GtkAction *action,
EphyWindow *window);
-void window_cmd_edit_cut (EggAction *action,
+void window_cmd_edit_cut (GtkAction *action,
EphyWindow *window);
-void window_cmd_edit_copy (EggAction *action,
+void window_cmd_edit_copy (GtkAction *action,
EphyWindow *window);
-void window_cmd_edit_paste (EggAction *action,
+void window_cmd_edit_paste (GtkAction *action,
EphyWindow *window);
-void window_cmd_edit_select_all (EggAction *action,
+void window_cmd_edit_select_all (GtkAction *action,
EphyWindow *window);
-void window_cmd_edit_find_next (EggAction *action,
+void window_cmd_edit_find_next (GtkAction *action,
EphyWindow *window);
-void window_cmd_edit_find_prev (EggAction *action,
+void window_cmd_edit_find_prev (GtkAction *action,
EphyWindow *window);
-void window_cmd_view_statusbar (EggAction *action,
+void window_cmd_view_statusbar (GtkAction *action,
EphyWindow *window);
-void window_cmd_view_toolbar (EggAction *action,
+void window_cmd_view_toolbar (GtkAction *action,
EphyWindow *window);
-void window_cmd_view_bookmarks_bar (EggAction *action,
+void window_cmd_view_bookmarks_bar (GtkAction *action,
EphyWindow *window);
-void window_cmd_view_fullscreen (EggAction *action,
+void window_cmd_view_fullscreen (GtkAction *action,
EphyWindow *window);
-void window_cmd_view_zoom_in (EggAction *action,
+void window_cmd_view_zoom_in (GtkAction *action,
EphyWindow *window);
-void window_cmd_view_zoom_out (EggAction *action,
+void window_cmd_view_zoom_out (GtkAction *action,
EphyWindow *window);
-void window_cmd_view_zoom_normal(EggAction *action,
+void window_cmd_view_zoom_normal(GtkAction *action,
EphyWindow *window);
-void window_cmd_view_page_source(EggAction *action,
+void window_cmd_view_page_source(GtkAction *action,
EphyWindow *window);
-void window_cmd_go_history (EggAction *action,
+void window_cmd_go_history (GtkAction *action,
EphyWindow *window);
-void window_cmd_edit_personal_data (EggAction *action,
+void window_cmd_edit_personal_data (GtkAction *action,
EphyWindow *window);
-void window_cmd_edit_prefs (EggAction *action,
+void window_cmd_edit_prefs (GtkAction *action,
EphyWindow *window);
-void window_cmd_edit_toolbar (EggAction *action,
+void window_cmd_edit_toolbar (GtkAction *action,
EphyWindow *window);
-void window_cmd_help_contents (EggAction *action,
+void window_cmd_help_contents (GtkAction *action,
EphyWindow *window);
-void window_cmd_help_about (EggAction *action,
+void window_cmd_help_about (GtkAction *action,
GtkWidget *window);
-void window_cmd_tabs_next (EggAction *action,
+void window_cmd_tabs_next (GtkAction *action,
EphyWindow *window);
-void window_cmd_tabs_previous (EggAction *action,
+void window_cmd_tabs_previous (GtkAction *action,
EphyWindow *window);
-void window_cmd_tabs_move_left (EggAction *action,
+void window_cmd_tabs_move_left (GtkAction *action,
EphyWindow *window);
-void window_cmd_tabs_move_right (EggAction *action,
+void window_cmd_tabs_move_right (GtkAction *action,
EphyWindow *window);
-void window_cmd_tabs_detach (EggAction *action,
+void window_cmd_tabs_detach (GtkAction *action,
EphyWindow *window);
-void window_cmd_load_location (EggAction *action,
+void window_cmd_load_location (GtkAction *action,
EphyWindow *window);