From 92599dd89bbb969c842981fac80ccf2414866c10 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Sun, 28 Oct 2007 18:34:23 +0000 Subject: Add an expander to the open toolbar item which pops up a dropdown menu 2007-10-29 Carlos Garcia Campos * data/evince-toolbar.xml: * shell/Makefile.am: * shell/ev-application.c: (ev_application_init): * shell/ev-open-recent-action.[ch]: * shell/ev-window.c: (ev_window_open_recent_action_item_activated), (register_custom_actions): Add an expander to the open toolbar item which pops up a dropdown menu with the recently used documents. Fixes bug #487215. svn path=/trunk/; revision=2731 --- (limited to 'shell/ev-window.c') diff --git a/shell/ev-window.c b/shell/ev-window.c index 675308d..6c15e79 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -32,6 +32,7 @@ #include "ev-window-title.h" #include "ev-navigation-action.h" #include "ev-page-action.h" +#include "ev-open-recent-action.h" #include "ev-sidebar.h" #include "ev-sidebar-links.h" #include "ev-sidebar-attachments.h" @@ -1701,8 +1702,8 @@ ev_window_cmd_file_open_copy (GtkAction *action, EvWindow *window) } static void -ev_window_cmd_recent_file_activate (GtkAction *action, - EvWindow *window) +ev_window_cmd_recent_file_activate (GtkAction *action, + EvWindow *window) { GtkRecentInfo *info; const gchar *uri; @@ -1719,6 +1720,17 @@ ev_window_cmd_recent_file_activate (GtkAction *action, } static void +ev_window_open_recent_action_item_activated (EvOpenRecentAction *action, + const gchar *uri, + EvWindow *window) +{ + ev_application_open_uri_at_dest (EV_APP, uri, + gtk_window_get_screen (GTK_WINDOW (window)), + NULL, 0, FALSE, NULL, + GDK_CURRENT_TIME); +} + +static void ev_window_add_recent (EvWindow *window, const char *filename) { gtk_recent_manager_add_item (window->priv->recent_manager, filename); @@ -4467,6 +4479,20 @@ register_custom_actions (EvWindow *window, GtkActionGroup *group) G_CALLBACK (navigation_action_activate_link_cb), window); gtk_action_group_add_action (group, action); g_object_unref (action); + + action = g_object_new (EV_TYPE_OPEN_RECENT_ACTION, + "name", "FileOpenRecent", + "label", _("_Open..."), + "tooltip", _("Open an existing document"), + "stock_id", GTK_STOCK_OPEN, + NULL); + g_signal_connect (action, "activate", + G_CALLBACK (ev_window_cmd_file_open), window); + g_signal_connect (action, "item_activated", + G_CALLBACK (ev_window_open_recent_action_item_activated), + window); + gtk_action_group_add_action (group, action); + g_object_unref (action); } static void @@ -5154,7 +5180,7 @@ ev_window_init (EvWindow *ev_window) "changed", G_CALLBACK (ev_window_setup_recent), ev_window); - + ev_window->priv->menubar = gtk_ui_manager_get_widget (ev_window->priv->ui_manager, "/MainMenu"); @@ -5162,7 +5188,6 @@ ev_window_init (EvWindow *ev_window) ev_window->priv->menubar, FALSE, FALSE, 0); - ev_window->priv->toolbar = GTK_WIDGET (g_object_new (EGG_TYPE_EDITABLE_TOOLBAR, "ui-manager", ev_window->priv->ui_manager, -- cgit v0.9.1