[Xfce4-commits] <ristretto:ristretto-0.0> Removed autogenerated header from git Added the recently used menu to the file-menu

Stephan Arts noreply at xfce.org
Sun Oct 23 19:12:04 CEST 2011


Updating branch refs/heads/ristretto-0.0
         to f4223148a6df935fa94da97a94ec04e89c0f29db (commit)
       from 7d29665d25fe6356853220c6a2e3506fe02d9635 (commit)

commit f4223148a6df935fa94da97a94ec04e89c0f29db
Author: Stephan Arts <stephan at thor.(none)>
Date:   Sat Feb 21 09:18:33 2009 +0100

    Removed autogenerated header from git
    Added the recently used menu to the file-menu

 src/main_window.c      |   19 ++++++++++++++++---
 src/main_window_ui.h   |   37 -------------------------------------
 src/main_window_ui.xml |    4 +---
 3 files changed, 17 insertions(+), 43 deletions(-)

diff --git a/src/main_window.c b/src/main_window.c
index b119b80..c859cdb 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -72,12 +72,13 @@ struct _RsttoMainWindowPriv
     GtkWidget *p_viewer_s_window;
     GtkWidget *statusbar;
 
-    guint      recent_menu_merge_id;
+    guint      recent_merge_id;
     guint      play_merge_id;
     guint      pause_merge_id;
 
     GtkAction *play_action;
     GtkAction *pause_action;
+    GtkAction *recent_action;
 
     gboolean playing;
     gint play_timeout_id;
@@ -185,7 +186,6 @@ static GtkActionEntry action_entries[] =
   { "file-menu", NULL, N_ ("_File"), NULL, },
   { "open", GTK_STOCK_OPEN, N_ ("_Open"), "<control>O", N_ ("Open an image"), G_CALLBACK (cb_rstto_main_window_open_image), },
   { "open-folder", NULL, N_ ("Open _Folder"), NULL, N_ ("Open a folder"), G_CALLBACK (cb_rstto_main_window_open_folder), },
-  { "open-recent-menu", NULL, N_ ("Open _Recent"), NULL, },
   { "file-properties", GTK_STOCK_PROPERTIES, N_ ("_Properties"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_file_properties), },
   { "close", GTK_STOCK_CLOSE, N_ ("_Close"), "<control>W", N_ ("Close this image"), G_CALLBACK (cb_rstto_main_window_close), },
   { "close-all", NULL, N_ ("_Close All"), NULL, N_ ("Close all images"), G_CALLBACK (cb_rstto_main_window_close_all), },
@@ -282,7 +282,7 @@ rstto_main_window_init (RsttoMainWindow *window)
     window->priv->settings_manager = rstto_settings_new();
 
     /* Create mergeid's for adding ui-components */
-    window->priv->recent_menu_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
+    window->priv->recent_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
     window->priv->play_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
     window->priv->pause_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
 
@@ -293,6 +293,8 @@ rstto_main_window_init (RsttoMainWindow *window)
 
     window->priv->play_action = gtk_action_new ("play", "_Play", "Play slideshow", GTK_STOCK_MEDIA_PLAY);
     window->priv->pause_action = gtk_action_new ("pause", "_Pause", "Pause slideshow", GTK_STOCK_MEDIA_PAUSE);
+    window->priv->recent_action = gtk_recent_action_new_for_manager ("recent", "_Recently used", "Recently used", 0, GTK_RECENT_MANAGER(window->priv->recent_manager));
+
     /* Add the same accelerator path to play and pause, so the same kb-shortcut will be used for starting and stopping the slideshow */
     gtk_action_set_accel_path (window->priv->pause_action, "<Actions>/RsttoWindow/play");
     gtk_action_set_accel_path (window->priv->play_action, "<Actions>/RsttoWindow/play");
@@ -301,6 +303,8 @@ rstto_main_window_init (RsttoMainWindow *window)
                                  window->priv->play_action);
     gtk_action_group_add_action (window->priv->action_group,
                                  window->priv->pause_action);
+    gtk_action_group_add_action (window->priv->action_group,
+                                 window->priv->recent_action);
     /* Connect signal-handlers */
     g_signal_connect(G_OBJECT(window->priv->play_action), "activate", G_CALLBACK(cb_rstto_main_window_play), window);
     g_signal_connect(G_OBJECT(window->priv->pause_action), "activate", G_CALLBACK(cb_rstto_main_window_pause), window);
@@ -349,6 +353,15 @@ rstto_main_window_init (RsttoMainWindow *window)
                            GTK_UI_MANAGER_MENUITEM,
                            FALSE);
 
+    
+    gtk_ui_manager_add_ui (window->priv->ui_manager,
+                           window->priv->recent_merge_id,
+                           "/main-menu/file-menu/placeholder-open-recent",
+                           "recent",
+                           "recent",
+                           GTK_UI_MANAGER_MENUITEM,
+                           FALSE);
+
     g_value_init (&window_width, G_TYPE_UINT);
     g_value_init (&window_height, G_TYPE_UINT);
     g_object_get_property (G_OBJECT(window->priv->settings_manager), "window-width", &window_width);
diff --git a/src/main_window_ui.h b/src/main_window_ui.h
deleted file mode 100644
index e66253c..0000000
--- a/src/main_window_ui.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* automatically generated from main_window_ui.xml */
-#ifdef __SUNPRO_C
-#pragma align 4 (main_window_ui)
-#endif
-#ifdef __GNUC__
-static const char main_window_ui[] __attribute__ ((__aligned__ (4))) =
-#else
-static const char main_window_ui[] =
-#endif
-{
-  "<ui><menubar name=\"main-menu\"><menu action=\"file-menu\"><menuitem ac"
-  "tion=\"open\"/><menuitem action=\"open-folder\"/><menu action=\"open-re"
-  "cent-menu\"><placeholder name=\"placeholder-open-recent\"/></menu><sepa"
-  "rator/><menuitem action=\"file-properties\"/><separator/><menuitem acti"
-  "on=\"close\"/><menuitem action=\"close-all\"/><menuitem action=\"quit\""
-  "/></menu><menu action=\"edit-menu\"><menu action=\"open-with-menu\"><pl"
-  "aceholder name=\"open-with-apps\" /></menu><separator/><menuitem action"
-  "=\"preferences\"/></menu><menu action=\"view-menu\"><menuitem action=\""
-  "show-toolbar\"/><menuitem action=\"show-thumbnailbar\"/><separator/><me"
-  "nu action=\"zoom-menu\"><menuitem action=\"zoom-in\"/><menuitem action="
-  "\"zoom-out\"/><menuitem action=\"zoom-fit\"/><menuitem action=\"zoom-10"
-  "0\"/></menu><menu action=\"rotation-menu\"><menuitem action=\"rotate-cw"
-  "\"/><menuitem action=\"rotate-ccw\"/></menu><separator/><menuitem actio"
-  "n=\"fullscreen\"/><menuitem action=\"set-as-wallpaper\"/></menu><menu a"
-  "ction=\"go-menu\"><menuitem action=\"back\"/><menuitem action=\"forward"
-  "\"/><menuitem action=\"first\"/><menuitem action=\"last\"/><separator/>"
-  "<placeholder name=\"placeholder-slideshow\" /></menu><menu action=\"hel"
-  "p-menu\"><menuitem action=\"contents\"/><menuitem action=\"about\"/></m"
-  "enu></menubar><toolbar name=\"main-toolbar\"><toolitem action=\"open\"/"
-  "><separator /><toolitem action=\"back\"/><toolitem action=\"forward\"/>"
-  "<separator name=\"placeholder-1\"/><toolitem action=\"zoom-in\"/><tooli"
-  "tem action=\"zoom-out\"/><toolitem action=\"zoom-100\"/><toolitem actio"
-  "n=\"zoom-fit\"/></toolbar></ui>"
-};
-
-static const unsigned main_window_ui_length = 1503u;
-
diff --git a/src/main_window_ui.xml b/src/main_window_ui.xml
index 2004b83..2e15784 100644
--- a/src/main_window_ui.xml
+++ b/src/main_window_ui.xml
@@ -7,9 +7,7 @@
         <menu action="file-menu">
             <menuitem action="open"/>
             <menuitem action="open-folder"/>
-            <menu action="open-recent-menu">
-                <placeholder name="placeholder-open-recent"/>
-            </menu>
+            <placeholder name="placeholder-open-recent"/>
             <separator/>
             <menuitem action="file-properties"/>
             <separator/>


More information about the Xfce4-commits mailing list