[eog] Revert "Remove the GtkMenuBar"
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Revert "Remove the GtkMenuBar"
- Date: Wed, 17 Dec 2014 20:42:40 +0000 (UTC)
commit 9000e9f25687e1ee6425269df63ff86b9e3309c7
Author: Felix Riemann <friemann gnome org>
Date: Wed Dec 17 21:39:54 2014 +0100
Revert "Remove the GtkMenuBar"
This reverts commit 3d0405be352fa13e7021d19d1ead1375140b41c3.
data/eog-ui.xml | 83 +++++++++++++++++++++++++++++++++++++
src/eog-window.c | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 201 insertions(+), 3 deletions(-)
---
diff --git a/data/eog-ui.xml b/data/eog-ui.xml
index 374a171..c20cb9e 100644
--- a/data/eog-ui.xml
+++ b/data/eog-ui.xml
@@ -1,4 +1,79 @@
<ui>
+ <menubar name="MainMenu">
+ <menu action="Image">
+ <menuitem action="ImageOpen"/>
+ <menu action='ImageOpenWith'>
+ <placeholder name="Applications Placeholder"/>
+ </menu>
+ <separator/>
+ <menuitem action="ImageSave"/>
+ <menuitem action="ImageSaveAs"/>
+ <separator/>
+ <menuitem action="ImagePrint"/>
+ <separator/>
+ <menuitem action="ImageSetAsWallpaper"/>
+ <menuitem action="ImageOpenContainingFolder"/>
+ <separator/>
+ <menuitem action="ImageProperties"/>
+ <separator/>
+ <placeholder name="RecentDocuments"/>
+ <separator/>
+ <menuitem action="ImageClose"/>
+ </menu>
+ <menu action="Edit">
+ <menuitem action="EditUndo"/>
+ <separator/>
+ <menuitem action="EditCopyImage"/>
+ <separator/>
+ <menuitem action="EditFlipHorizontal"/>
+ <menuitem action="EditFlipVertical"/>
+ <separator/>
+ <menuitem action="EditRotate90"/>
+ <menuitem action="EditRotate270"/>
+ <separator/>
+ <menuitem action="EditMoveToTrash"/>
+ <menuitem action="EditDelete"/>
+ <separator/>
+ <menuitem action="EditPreferences"/>
+ </menu>
+ <menu action="View">
+ <menuitem name="StatusbarToggle" action="ViewStatusbar"/>
+ <menuitem name="ImageGalleryToggle" action="ViewImageGallery"/>
+ <menuitem name="SidebarToggle" action="ViewSidebar"/>
+ <separator/>
+ <menuitem name="Fullscreen" action="ViewFullscreen"/>
+ <menuitem name="Slideshow" action="ViewSlideshow"/>
+ <separator/>
+ <menuitem action="ViewZoomIn"/>
+ <menuitem action="ViewZoomOut"/>
+ <menuitem action="ViewZoomNormal"/>
+ <menuitem action="ViewZoomFit"/>
+ </menu>
+ <menu action="Go">
+ <menuitem name="GoPrevious" action="GoPrevious"/>
+ <menuitem name="GoNext" action="GoNext"/>
+ <separator/>
+ <menuitem name="GoFirst" action="GoFirst"/>
+ <menuitem name="GoLast" action="GoLast"/>
+ <separator/>
+ <menuitem name="GoRandom" action="GoRandom"/>
+ </menu>
+ <menu name="ToolsMenu" action="Tools">
+ <placeholder name="ToolsOps_1" />
+ <separator/>
+ <placeholder name="ToolsOps_2" />
+ <separator/>
+ <placeholder name="ToolsOps_3" />
+ <separator/>
+ <placeholder name="ToolsOps_4" />
+ <separator/>
+ <placeholder name="ToolsOps_5" />
+ </menu>
+ <menu action="Help">
+ <menuitem action="HelpManual"/>
+ <menuitem action="HelpAbout"/>
+ </menu>
+ </menubar>
<toolbar name="FullscreenToolbar">
<toolitem action="GoFirst"/>
<toolitem action="GoPrevious"/>
@@ -55,4 +130,12 @@
<menuitem action="ImageSetAsWallpaper"/>
<menuitem action="ImageOpenContainingFolder"/>
</popup>
+
+ <accelerator name="ControlEqualAccel" action="ControlEqual"/>
+ <accelerator name="ControlKPAddAccel" action="ControlKpAdd"/>
+ <accelerator name="ControlKPSubAccel" action="ControlKpSub"/>
+ <accelerator name="BackSpaceAccel" action="BackSpace"/>
+ <accelerator name="DeleteAccel" action="Delete"/>
+ <accelerator name="EndAccel" action="End"/>
+ <accelerator name="HomeAccel" action="Home"/>
</ui>
diff --git a/src/eog-window.c b/src/eog-window.c
index 6655ca2..1c39e46 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -1030,6 +1030,14 @@ eog_window_update_openwith_menu (EogWindow *window, EogImage *image)
gtk_ui_manager_add_ui (priv->ui_mgr,
priv->open_with_menu_id,
+ "/MainMenu/Image/ImageOpenWith/Applications Placeholder",
+ name,
+ name,
+ GTK_UI_MANAGER_MENUITEM,
+ FALSE);
+
+ gtk_ui_manager_add_ui (priv->ui_mgr,
+ priv->open_with_menu_id,
"/ThumbnailPopup/ImageOpenWith/Applications Placeholder",
name,
name,
@@ -1043,6 +1051,15 @@ eog_window_update_openwith_menu (EogWindow *window, EogImage *image)
GTK_UI_MANAGER_MENUITEM,
FALSE);
+ path = g_strdup_printf ("/MainMenu/Image/ImageOpenWith/Applications Placeholder/%s", name);
+
+ menuitem = gtk_ui_manager_get_widget (priv->ui_mgr, path);
+
+ /* Only force displaying the icon if it is an application icon */
+ gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (menuitem), app_icon != NULL);
+
+ g_free (path);
+
path = g_strdup_printf ("/ThumbnailPopup/ImageOpenWith/Applications Placeholder/%s", name);
menuitem = gtk_ui_manager_get_widget (priv->ui_mgr, path);
@@ -2013,6 +2030,7 @@ eog_window_run_fullscreen (EogWindow *window, gboolean slideshow)
{
static const GdkRGBA black = { 0., 0., 0., 1.};
EogWindowPrivate *priv;
+ GtkWidget *menubar;
gboolean upscale;
eog_debug (DEBUG_WINDOW);
@@ -2039,6 +2057,10 @@ eog_window_run_fullscreen (EogWindow *window, gboolean slideshow)
update_ui_visibility (window);
+ menubar = gtk_ui_manager_get_widget (priv->ui_mgr, "/MainMenu");
+ g_assert (GTK_IS_WIDGET (menubar));
+ gtk_widget_hide (menubar);
+
g_signal_connect (priv->view,
"motion-notify-event",
G_CALLBACK (fullscreen_motion_notify_cb),
@@ -2098,6 +2120,7 @@ static void
eog_window_stop_fullscreen (EogWindow *window, gboolean slideshow)
{
EogWindowPrivate *priv;
+ GtkWidget *menubar;
eog_debug (DEBUG_WINDOW);
@@ -2133,6 +2156,10 @@ eog_window_stop_fullscreen (EogWindow *window, gboolean slideshow)
update_ui_visibility (window);
+ menubar = gtk_ui_manager_get_widget (priv->ui_mgr, "/MainMenu");
+ g_assert (GTK_IS_WIDGET (menubar));
+ gtk_widget_show (menubar);
+
eog_scroll_view_set_zoom_upscale (EOG_SCROLL_VIEW (priv->view), FALSE);
eog_scroll_view_override_bg_color (EOG_SCROLL_VIEW (window->priv->view),
@@ -2620,6 +2647,8 @@ eog_window_set_wallpaper (EogWindow *window, const gchar *filename, const gchar
g_object_unref (settings);
g_free (uri);
+ /* I18N: When setting mnemonics for these strings, watch out to not
+ clash with mnemonics from eog's menubar */
info_bar = gtk_info_bar_new_with_buttons (_("_Open Background Preferences"),
GTK_RESPONSE_YES,
C_("MessageArea","Hi_de"),
@@ -4023,6 +4052,60 @@ static const GActionEntry window_actions[] = {
};
static void
+menu_item_select_cb (GtkMenuItem *proxy, EogWindow *window)
+{
+ GAction *action;
+ char *message;
+
+ action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (proxy));
+
+ g_return_if_fail (action != NULL);
+
+ g_object_get (G_OBJECT (action), "tooltip", &message, NULL);
+
+ if (message) {
+ gtk_statusbar_push (GTK_STATUSBAR (window->priv->statusbar),
+ window->priv->tip_message_cid, message);
+ g_free (message);
+ }
+}
+
+static void
+menu_item_deselect_cb (GtkMenuItem *proxy, EogWindow *window)
+{
+ gtk_statusbar_pop (GTK_STATUSBAR (window->priv->statusbar),
+ window->priv->tip_message_cid);
+}
+
+static void
+connect_proxy_cb (GtkUIManager *manager,
+ GAction *action,
+ GtkWidget *proxy,
+ EogWindow *window)
+{
+ if (GTK_IS_MENU_ITEM (proxy)) {
+ g_signal_connect (proxy, "select",
+ G_CALLBACK (menu_item_select_cb), window);
+ g_signal_connect (proxy, "deselect",
+ G_CALLBACK (menu_item_deselect_cb), window);
+ }
+}
+
+static void
+disconnect_proxy_cb (GtkUIManager *manager,
+ GAction *action,
+ GtkWidget *proxy,
+ EogWindow *window)
+{
+ if (GTK_IS_MENU_ITEM (proxy)) {
+ g_signal_handlers_disconnect_by_func
+ (proxy, G_CALLBACK (menu_item_select_cb), window);
+ g_signal_handlers_disconnect_by_func
+ (proxy, G_CALLBACK (menu_item_deselect_cb), window);
+ }
+}
+
+static void
eog_window_ui_settings_changed_cb (GSettings *settings,
gchar *key,
gpointer user_data)
@@ -4154,11 +4237,10 @@ eog_window_update_recent_files_menu (EogWindow *window)
g_object_unref (action);
- /* TODO: replace this with code for the new UI. */
- /*gtk_ui_manager_add_ui (priv->ui_mgr, priv->recent_menu_id,
+ gtk_ui_manager_add_ui (priv->ui_mgr, priv->recent_menu_id,
"/MainMenu/Image/RecentDocuments",
action_name, action_name,
- GTK_UI_MANAGER_AUTO, FALSE);*/
+ GTK_UI_MANAGER_AUTO, FALSE);
g_free (action_name);
}
@@ -4357,9 +4439,11 @@ eog_window_construct_ui (EogWindow *window)
GError *error = NULL;
+ GtkWidget *menubar;
GtkWidget *thumb_popup;
GtkWidget *view_popup;
GtkWidget *hpaned;
+ GtkWidget *menuitem;
GAction *action = NULL;
@@ -4379,6 +4463,36 @@ eog_window_construct_ui (EogWindow *window)
g_error_free (error);
}
+ g_signal_connect (priv->ui_mgr, "connect_proxy",
+ G_CALLBACK (connect_proxy_cb), window);
+ g_signal_connect (priv->ui_mgr, "disconnect_proxy",
+ G_CALLBACK (disconnect_proxy_cb), window);
+
+ menubar = gtk_ui_manager_get_widget (priv->ui_mgr, "/MainMenu");
+ g_assert (GTK_IS_WIDGET (menubar));
+ gtk_box_pack_start (GTK_BOX (priv->box), menubar, FALSE, FALSE, 0);
+ gtk_widget_show (menubar);
+
+ menuitem = gtk_ui_manager_get_widget (priv->ui_mgr,
+ "/MainMenu/Edit/EditFlipHorizontal");
+ gtk_image_menu_item_set_always_show_image (
+ GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
+
+ menuitem = gtk_ui_manager_get_widget (priv->ui_mgr,
+ "/MainMenu/Edit/EditFlipVertical");
+ gtk_image_menu_item_set_always_show_image (
+ GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
+
+ menuitem = gtk_ui_manager_get_widget (priv->ui_mgr,
+ "/MainMenu/Edit/EditRotate90");
+ gtk_image_menu_item_set_always_show_image (
+ GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
+
+ menuitem = gtk_ui_manager_get_widget (priv->ui_mgr,
+ "/MainMenu/Edit/EditRotate270");
+ gtk_image_menu_item_set_always_show_image (
+ GTK_IMAGE_MENU_ITEM (menuitem), TRUE);
+
/*gtk_window_add_accel_group (GTK_WINDOW (window),
gtk_ui_manager_get_accel_group (priv->ui_mgr));*/
@@ -5166,6 +5280,7 @@ eog_window_new (EogStartupFlags flags)
window = EOG_WINDOW (g_object_new (EOG_TYPE_WINDOW,
"type", GTK_WINDOW_TOPLEVEL,
"application", EOG_APP,
+ "show-menubar", FALSE,
"startup-flags", flags,
NULL));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]