[Xfce4-commits] <ristretto:ristretto-0.0> Add popup-menu to change the navigationbar position
Stephan Arts
noreply at xfce.org
Sun Oct 23 19:20:17 CEST 2011
Updating branch refs/heads/ristretto-0.0
to a31e4fdd0c4e82937eb2c8d9306b1121f701dd9d (commit)
from 1f629afbfbf65b23fd27e97fae36cc47c5002f2e (commit)
commit a31e4fdd0c4e82937eb2c8d9306b1121f701dd9d
Author: Stephan Arts <stephan at xfce.org>
Date: Sun Aug 30 13:35:48 2009 +0200
Add popup-menu to change the navigationbar position
po/ristretto.pot | 260 ------------------------------------------------
src/main_window.c | 90 ++++++++++++++---
src/main_window_ui.xml | 13 ++-
3 files changed, 88 insertions(+), 275 deletions(-)
diff --git a/po/ristretto.pot b/po/ristretto.pot
deleted file mode 100644
index a035a6a..0000000
--- a/po/ristretto.pot
+++ /dev/null
@@ -1,260 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
-#
-#: ../src/main.c:231
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: xfce-i18n at xfce.org\n"
-"POT-Creation-Date: 2008-11-14 13:24+0100\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
-"Language-Team: LANGUAGE <LL at li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#: ../src/main.c:61
-msgid "Version information"
-msgstr ""
-
-#: ../src/main.c:65
-msgid "Start in fullscreen mode"
-msgstr ""
-
-#: ../src/main.c:69
-msgid "Start a slideshow"
-msgstr ""
-
-#: ../src/main.c:235
-#, c-format
-msgid ""
-"%s: %s\n"
-"Try %s --help to see a full list of available command line options.\n"
-msgstr ""
-
-#: ../src/main.c:448 ../src/main_window.c:1598 ../src/main_window.c:1638
-#: ../src/main_window.c:1675
-msgid "Opening file(s)..."
-msgstr ""
-
-#. Create 'File' menu
-#: ../src/main_window.c:340
-msgid "_File"
-msgstr ""
-
-#: ../src/main_window.c:347
-msgid "O_pen Folder"
-msgstr ""
-
-#: ../src/main_window.c:348
-msgid "_Recently used"
-msgstr ""
-
-#: ../src/main_window.c:353
-msgid "Close _all"
-msgstr ""
-
-#. Create 'Edit' menu
-#: ../src/main_window.c:383
-msgid "_Edit"
-msgstr ""
-
-#: ../src/main_window.c:388 ../src/main_window.c:659
-msgid "Open with..."
-msgstr ""
-
-#: ../src/main_window.c:396 ../src/main_window.c:670
-msgid "No applications available"
-msgstr ""
-
-#. Create 'View' menu
-#: ../src/main_window.c:405
-msgid "_View"
-msgstr ""
-
-#: ../src/main_window.c:412
-msgid "Show _Toolbar"
-msgstr ""
-
-#: ../src/main_window.c:413
-msgid "Thumbnail _Viewer"
-msgstr ""
-
-#: ../src/main_window.c:417
-msgid "_Zooming"
-msgstr ""
-
-#: ../src/main_window.c:418
-msgid "_Rotate"
-msgstr ""
-
-#: ../src/main_window.c:425
-msgid "_Set as wallpaper"
-msgstr ""
-
-#: ../src/main_window.c:476
-msgid "Show _Horizontally"
-msgstr ""
-
-#: ../src/main_window.c:480
-msgid "Show _Vertically"
-msgstr ""
-
-#: ../src/main_window.c:484
-msgid "H_ide"
-msgstr ""
-
-#: ../src/main_window.c:521
-msgid "Rotate _Right"
-msgstr ""
-
-#: ../src/main_window.c:522
-msgid "Rotate _Left"
-msgstr ""
-
-#. Create 'Go' menu
-#: ../src/main_window.c:543
-msgid "_Go"
-msgstr ""
-
-#. Create 'Help' menu
-#: ../src/main_window.c:574
-msgid "_Help"
-msgstr ""
-
-#: ../src/main_window.c:906
-msgid "One or more images have been modified, do you want to save the changes?"
-msgstr ""
-
-#: ../src/main_window.c:1394
-msgid "Image viewer Preferences"
-msgstr ""
-
-#: ../src/main_window.c:1412
-msgid "Display"
-msgstr ""
-
-#: ../src/main_window.c:1416
-msgid "Slideshow"
-msgstr ""
-
-#: ../src/main_window.c:1420
-msgid "Behaviour"
-msgstr ""
-
-#: ../src/main_window.c:1425
-msgid "Scaling"
-msgstr ""
-
-#: ../src/main_window.c:1427
-msgid "Don't scale over 100% when maximizing the window."
-msgstr ""
-
-#: ../src/main_window.c:1437
-msgid "Background Color"
-msgstr ""
-
-#: ../src/main_window.c:1439
-msgid "_Override Background Color:"
-msgstr ""
-
-#: ../src/main_window.c:1462
-msgid "Image Cache"
-msgstr ""
-
-#: ../src/main_window.c:1465
-msgid "Cache size:"
-msgstr ""
-
-#: ../src/main_window.c:1466
-msgid "MB"
-msgstr ""
-
-#: ../src/main_window.c:1468
-msgid "_Preload images (GUI more responsive but more CPU-intensive)"
-msgstr ""
-
-#: ../src/main_window.c:1486
-msgid "Timeout"
-msgstr ""
-
-#: ../src/main_window.c:1489
-msgid "Thumbnails"
-msgstr ""
-
-#: ../src/main_window.c:1494
-msgid ""
-"The time period an individual image is displayed during a slideshow\n"
-"(in seconds)"
-msgstr ""
-
-#: ../src/main_window.c:1497
-msgid "Hide the thumbnails bar during slideshow"
-msgstr ""
-
-#: ../src/main_window.c:1498
-msgid "_Hide thumbnails"
-msgstr ""
-
-#: ../src/main_window.c:1556
-msgid "Developer:"
-msgstr ""
-
-#: ../src/main_window.c:1566
-msgid ""
-"Ristretto is a fast and lightweight picture-viewer for the Xfce desktop "
-"environment."
-msgstr ""
-
-#: ../src/main_window.c:1574
-msgid "translator-credits"
-msgstr ""
-
-#: ../src/main_window.c:1600
-msgid "Open image"
-msgstr ""
-
-#: ../src/main_window.c:1618
-msgid "Could not open file"
-msgstr ""
-
-#: ../src/main_window.c:1640
-msgid "Open folder"
-msgstr ""
-
-#: ../src/main_window.c:1715
-msgid ""
-"Are you sure you want to clear ristretto's list of recently opened documents?"
-msgstr ""
-
-#: ../src/thumbnail_bar.c:185
-msgid "Spacing"
-msgstr ""
-
-#: ../src/thumbnail_bar.c:186
-msgid "The amount of space between the thumbnails"
-msgstr ""
-
-#: ../src/thumbnail_bar.c:192
-msgid "Border Width"
-msgstr ""
-
-#: ../src/thumbnail_bar.c:193
-msgid "The border width of the thumbnail-bar"
-msgstr ""
-
-#: ../ristretto.desktop.in.h:1
-msgid "Image Viewer"
-msgstr ""
-
-#: ../ristretto.desktop.in.h:2
-msgid "Ristretto"
-msgstr ""
-
-#: ../ristretto.desktop.in.h:3
-msgid "Xfce Image viewer"
-msgstr ""
diff --git a/src/main_window.c b/src/main_window.c
index 30cb546..f9cd00d 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -75,6 +75,7 @@ struct _RsttoMainWindowPriv
GtkWidget *toolbar;
GtkWidget *image_list_toolbar;
GtkWidget *image_list_toolbar_menu;
+ GtkWidget *position_menu;
GtkWidget *picture_viewer;
GtkWidget *p_viewer_s_window;
GtkWidget *table;
@@ -188,6 +189,13 @@ static void
cb_rstto_main_window_delete (GtkWidget *widget, RsttoMainWindow *window);
static void
+cb_rstto_main_window_set_as_wallpaper (GtkWidget *widget, RsttoMainWindow *window);
+static void
+cb_rstto_main_window_navigationtoolbar_position_changed (GtkRadioAction *, GtkRadioAction *, RsttoMainWindow *window);
+static void
+cb_rstto_main_window_navigationtoolbar_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data);
+
+static void
cb_rstto_main_window_print (GtkWidget *widget, RsttoMainWindow *window);
static void
rstto_main_window_print_draw_page (GtkPrintOperation *operation,
@@ -236,7 +244,7 @@ cb_rstto_main_window_picture_viewer_motion_notify_event (RsttoPictureViewer *vie
static void
rstto_main_window_update_buttons (RsttoMainWindow *window);
static void
-rstto_main_window_set_navigationbar_orientation (RsttoMainWindow *window, guint orientation);
+rstto_main_window_set_navigationbar_position (RsttoMainWindow *window, guint orientation);
static GtkWidgetClass *parent_class = NULL;
@@ -261,7 +269,7 @@ static GtkActionEntry action_entries[] =
{ "view-menu", NULL, N_ ("_View"), NULL, },
{ "fullscreen", GTK_STOCK_FULLSCREEN, N_ ("_Fullscreen"), "F11", NULL, G_CALLBACK (cb_rstto_main_window_fullscreen), },
{ "unfullscreen", GTK_STOCK_LEAVE_FULLSCREEN, N_ ("_Leave Fullscreen"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_fullscreen), },
- { "set-as-wallpaper", NULL, N_ ("_Set as Wallpaper"), NULL, NULL, NULL, },
+ { "set-as-wallpaper", NULL, N_ ("_Set as Wallpaper"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_set_as_wallpaper), },
/* Thumbnailbar submenu */
{ "thumbnailbar-menu", NULL, N_ ("_Thumbnail Bar"), NULL, },
/* Zoom submenu */
@@ -292,6 +300,8 @@ static GtkActionEntry action_entries[] =
NULL,
N_ ("Display information about ristretto"),
G_CALLBACK (cb_rstto_main_window_about), },
+/* Positio Menu */
+ { "position-menu", NULL, N_ ("_Position"), NULL, },
/* Misc */
{ "leave-fullscreen", GTK_STOCK_LEAVE_FULLSCREEN, N_ ("Leave _Fullscreen"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_fullscreen), },
{ "tb-menu", NULL, NULL, NULL, }
@@ -310,6 +320,14 @@ static const GtkRadioActionEntry radio_action_sort_entries[] =
{"sort-date", NULL, N_("sort by date"), NULL, NULL, 1},
};
+static const GtkRadioActionEntry radio_action_pos_entries[] =
+{
+ { "pos-left", NULL, N_("Left"), NULL, NULL, 0},
+ { "pos-right", NULL, N_("Right"), NULL, NULL, 2},
+ { "pos-top", NULL, N_("Top"), NULL, NULL, 1},
+ { "pos-bottom", NULL, N_("Bottom"), NULL, NULL, 3},
+};
+
GType
rstto_main_window_get_type (void)
@@ -350,6 +368,8 @@ rstto_main_window_init (RsttoMainWindow *window)
GClosure *next_image_closure = g_cclosure_new ((GCallback)cb_rstto_main_window_next_image, window, NULL);
GClosure *previous_image_closure = g_cclosure_new ((GCallback)cb_rstto_main_window_previous_image, window, NULL);
+ guint navigationbar_position = 3;
+
gtk_window_set_title (GTK_WINDOW (window), RISTRETTO_APP_TITLE);
window->priv = g_new0(RsttoMainWindowPriv, 1);
@@ -417,12 +437,14 @@ rstto_main_window_init (RsttoMainWindow *window)
gtk_action_group_add_actions (window->priv->action_group, action_entries, G_N_ELEMENTS (action_entries), GTK_WIDGET (window));
gtk_action_group_add_toggle_actions (window->priv->action_group, toggle_action_entries, G_N_ELEMENTS (toggle_action_entries), GTK_WIDGET (window));
gtk_action_group_add_radio_actions (window->priv->action_group, radio_action_sort_entries , G_N_ELEMENTS (radio_action_sort_entries), 0, NULL, GTK_WIDGET (window));
+ gtk_action_group_add_radio_actions (window->priv->action_group, radio_action_pos_entries, G_N_ELEMENTS (radio_action_pos_entries), navigationbar_position, G_CALLBACK (cb_rstto_main_window_navigationtoolbar_position_changed), GTK_WIDGET (window));
gtk_ui_manager_add_ui_from_string (window->priv->ui_manager,main_window_ui, main_window_ui_length, NULL);
window->priv->menubar = gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu");
- window->priv->toolbar = gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar");
+ window->priv->toolbar = gtk_ui_manager_get_widget (window->priv->ui_manager, "/file-toolbar");
window->priv->image_list_toolbar = gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar");
window->priv->image_list_toolbar_menu = gtk_ui_manager_get_widget (window->priv->ui_manager, "/tb-menu");
+ window->priv->position_menu = gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar-menu");
@@ -491,7 +513,7 @@ rstto_main_window_init (RsttoMainWindow *window)
gtk_widget_set_no_show_all (window->priv->message_bar, TRUE);
gtk_widget_set_no_show_all (window->priv->thumbnailbar, TRUE);
- rstto_main_window_set_navigationbar_orientation (window, 3);
+ rstto_main_window_set_navigationbar_position (window, navigationbar_position);
/**
* Add missing pieces to the UI
@@ -601,6 +623,7 @@ rstto_main_window_init (RsttoMainWindow *window)
g_signal_connect(G_OBJECT(window->priv->picture_viewer), "motion-notify-event", G_CALLBACK(cb_rstto_main_window_picture_viewer_motion_notify_event), window);
g_signal_connect(G_OBJECT(window), "configure-event", G_CALLBACK(cb_rstto_main_window_configure_event), NULL);
g_signal_connect(G_OBJECT(window), "window-state-event", G_CALLBACK(cb_rstto_main_window_state_event), NULL);
+ g_signal_connect(G_OBJECT(window->priv->image_list_toolbar), "button-press-event", G_CALLBACK(cb_rstto_main_window_navigationtoolbar_button_press_event), window);
g_signal_connect(G_OBJECT(window->priv->settings_manager), "notify", G_CALLBACK(cb_rstto_main_window_settings_notify), window);
}
@@ -756,9 +779,9 @@ rstto_main_window_update_buttons (RsttoMainWindow *window)
gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/view-menu/rotation-menu"), FALSE);
/* Toolbar */
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/save-copy"), FALSE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/close"), FALSE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/delete"), FALSE);
+ gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/file-toolbar/save-copy"), FALSE);
+ gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/file-toolbar/close"), FALSE);
+ gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/file-toolbar/delete"), FALSE);
gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/forward"), FALSE);
gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/back"), FALSE);
gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/zoom-in"), FALSE);
@@ -791,9 +814,9 @@ rstto_main_window_update_buttons (RsttoMainWindow *window)
gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/view-menu/rotation-menu"), TRUE);
/* Toolbar */
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/save-copy"), TRUE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/close"), TRUE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/delete"), TRUE);
+ gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/file-toolbar/save-copy"), TRUE);
+ gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/file-toolbar/close"), TRUE);
+ gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/file-toolbar/delete"), TRUE);
gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/forward"), FALSE);
gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/back"), FALSE);
gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/zoom-in"), TRUE);
@@ -826,9 +849,9 @@ rstto_main_window_update_buttons (RsttoMainWindow *window)
gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/view-menu/rotation-menu"), TRUE);
/* Toolbar */
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/save-copy"), TRUE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/close"), TRUE);
- gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/delete"), TRUE);
+ gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/file-toolbar/save-copy"), TRUE);
+ gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/file-toolbar/close"), TRUE);
+ gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/file-toolbar/delete"), TRUE);
gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/forward"), TRUE);
gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/back"), TRUE);
gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/zoom-in"), TRUE);
@@ -2098,7 +2121,18 @@ cb_rstto_main_window_message_bar_open (GtkWidget *widget, RsttoMainWindow *windo
}
static void
-rstto_main_window_set_navigationbar_orientation (RsttoMainWindow *window, guint orientation)
+cb_rstto_main_window_set_as_wallpaper (GtkWidget *widget, RsttoMainWindow *window)
+{
+}
+
+static void
+cb_rstto_main_window_navigationtoolbar_position_changed (GtkRadioAction *action, GtkRadioAction *current, RsttoMainWindow *window)
+{
+ rstto_main_window_set_navigationbar_position (window, gtk_radio_action_get_current_value (current));
+}
+
+static void
+rstto_main_window_set_navigationbar_position (RsttoMainWindow *window, guint orientation)
{
switch (orientation)
{
@@ -2155,6 +2189,34 @@ rstto_main_window_set_navigationbar_orientation (RsttoMainWindow *window, guint
}
}
+
+static void
+cb_rstto_main_window_navigationtoolbar_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
+{
+ int button, event_time;
+ RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data);
+ GtkWidget *menu = NULL;
+ if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
+ {
+ if (event)
+ {
+ button = event->button;
+ event_time = event->time;
+ }
+ else
+ {
+ button = 0;
+ event_time = gtk_get_current_event_time ();
+ }
+
+
+ menu = window->priv->position_menu;
+ gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
+ button, event_time);
+ }
+}
+
+
/*
static gboolean
cb_rstto_main_window_image_list_toolbar_popup_context_menu (GtkToolbar *toolbar,
diff --git a/src/main_window_ui.xml b/src/main_window_ui.xml
index 0ab4824..d6e4237 100644
--- a/src/main_window_ui.xml
+++ b/src/main_window_ui.xml
@@ -63,14 +63,25 @@
</menu>
</menubar>
+ <!--
<popup name="tb-menu">
<menuitem action="open"/>
</popup>
+ -->
+
+ <popup name="navigation-toolbar-menu">
+ <menu action="position-menu">
+ <menuitem action="pos-left"/>
+ <menuitem action="pos-right"/>
+ <menuitem action="pos-top"/>
+ <menuitem action="pos-bottom"/>
+ </menu>
+ </popup>
<!--
-->
- <toolbar name="main-toolbar">
+ <toolbar name="file-toolbar">
<toolitem action="open"/>
<toolitem action="open-folder"/>
<separator />
More information about the Xfce4-commits
mailing list