From c65f029b1669d2aae4417169d6b0c25969521d47 Mon Sep 17 00:00:00 2001 From: Luca Ferretti Date: Wed, 09 Feb 2005 10:47:45 +0000 Subject: Improve toolbar layout/icons 2005-02-09 Luca Ferretti * data/Makefile.am: * data/evince-ui.xml: * shell/ev-stock-icons.c: (ev_stock_icons_init): * shell/ev-stock-icons.h: * shell/ev-window.c: (update_action_sensitivity), (ev_window_cmd_go_previous_page), (ev_window_cmd_go_next_page), (set_action_properties): Improve toolbar layout/icons --- diff --git a/ChangeLog b/ChangeLog index 421e5c8..6fc1f34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-02-09 Luca Ferretti + + * data/Makefile.am: + * data/evince-ui.xml: + * shell/ev-stock-icons.c: (ev_stock_icons_init): + * shell/ev-stock-icons.h: + * shell/ev-window.c: (update_action_sensitivity), + (ev_window_cmd_go_previous_page), (ev_window_cmd_go_next_page), + (set_action_properties): + + Improve toolbar layout/icons + 2005-02-08 Marco Pesenti Gritti * pdf/xpdf/pdf-document.cc: diff --git a/data/Makefile.am b/data/Makefile.am index 60f14f9..0b1bd18 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -13,11 +13,6 @@ glade_DATA = \ evince-password.glade \ $(NULL) -stockdir = $(datadir)/pixmaps/evince -stock_DATA = \ - ev-stock-zoom-fit-width.png \ - $(NULL) - DESKTOP_IN_FILES= evince.desktop.in DESKTOP_FILES= $(DESKTOP_IN_FILES:.desktop.in=.desktop) @@ -38,7 +33,6 @@ if GCONF_SCHEMAS_INSTALL endif EXTRA_DIST = \ - $(stock_DATA) \ $(glade_DATA) \ $(ui_DATA) \ $(DESKTOP_IN_FILES) \ diff --git a/data/evince-ui.xml b/data/evince-ui.xml index 88d18a2..bce68ea 100644 --- a/data/evince-ui.xml +++ b/data/evince-ui.xml @@ -33,8 +33,8 @@ - - + + @@ -47,8 +47,8 @@ - - + + diff --git a/shell/ev-stock-icons.c b/shell/ev-stock-icons.c index a9f533c..f60697d 100644 --- a/shell/ev-stock-icons.c +++ b/shell/ev-stock-icons.c @@ -29,51 +29,44 @@ #include #include -/* Toolbar icons files */ -#define STOCK_ZOOM_FIT_WIDTH_FILE "ev-stock-zoom-fit-width.png" +typedef struct { + char *stock_id; + char *icon; +} EvStockIcon; + +/* Evince stock icons from gnome-icon-theme */ +static EvStockIcon stock_icons [] = { + { EV_STOCK_ZOOM_PAGE, "stock_zoom-page" }, + { EV_STOCK_ZOOM_WIDTH, "stock_zoom-page-width" }, + { EV_STOCK_LEAVE_FULLSCREEN, "stock_leave-fullscreen" } +}; -#define EV_ADD_STOCK_ICON(id, file, def_id) \ -{ \ - GdkPixbuf *pixbuf; \ - GtkIconSet *icon_set = NULL; \ - pixbuf = gdk_pixbuf_new_from_file (GNOMEICONDIR "/evince/" file, NULL); \ - if (pixbuf) { \ - icon_set = gtk_icon_set_new_from_pixbuf (pixbuf); \ - } else if (def_id) { \ - icon_set = gtk_icon_factory_lookup_default (def_id); \ - gtk_icon_set_ref (icon_set); \ - } \ - gtk_icon_factory_add (factory, id, icon_set); \ - gtk_icon_set_unref (icon_set); \ -} void ev_stock_icons_init (void) { - static const char *icon_theme_items[] = { - EV_STOCK_LEAVE_FULLSCREEN - }; - GtkIconFactory *factory; - guint i; + GtkIconFactory *factory; + GtkIconSource *source; + gint i; factory = gtk_icon_factory_new (); gtk_icon_factory_add_default (factory); - /* fitwidth stock icon */ - EV_ADD_STOCK_ICON (EV_STOCK_ZOOM_FIT_WIDTH, STOCK_ZOOM_FIT_WIDTH_FILE, GTK_STOCK_ZOOM_FIT); + source = gtk_icon_source_new (); + + for (i = 0; i < G_N_ELEMENTS (stock_icons); i++) { + GtkIconSet *set; - for (i = 0; i < G_N_ELEMENTS (icon_theme_items); i++) { - GtkIconSet *icon_set; - GtkIconSource *icon_source; + gtk_icon_source_set_icon_name (source, stock_icons [i].icon); - icon_set = gtk_icon_set_new (); - icon_source = gtk_icon_source_new (); - gtk_icon_source_set_icon_name (icon_source, icon_theme_items[i]); - gtk_icon_set_add_source (icon_set, icon_source); - gtk_icon_factory_add (factory, icon_theme_items[i], icon_set); - gtk_icon_set_unref (icon_set); - gtk_icon_source_free (icon_source); + set = gtk_icon_set_new (); + gtk_icon_set_add_source (set, source); + + gtk_icon_factory_add (factory, stock_icons [i].stock_id, set); + gtk_icon_set_unref (set); } + gtk_icon_source_free (source); + g_object_unref (G_OBJECT (factory)); } diff --git a/shell/ev-stock-icons.h b/shell/ev-stock-icons.h index 52c54cf..55616dd 100644 --- a/shell/ev-stock-icons.h +++ b/shell/ev-stock-icons.h @@ -28,9 +28,10 @@ G_BEGIN_DECLS -/* Toolbar icons */ -#define EV_STOCK_ZOOM_FIT_WIDTH "ev-zoom-fit-width" -#define EV_STOCK_LEAVE_FULLSCREEN "stock_leave-fullscreen" +/* Evince stock icons */ +#define EV_STOCK_ZOOM_PAGE "stock_zoom-page" +#define EV_STOCK_ZOOM_WIDTH "stock_zoom-page-width" +#define EV_STOCK_LEAVE_FULLSCREEN "stock_leave-fullscreen" void ev_stock_icons_init (void); diff --git a/shell/ev-window.c b/shell/ev-window.c index 84206b7..4f7bab4 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -178,14 +178,14 @@ update_action_sensitivity (EvWindow *ev_window) page = ev_view_get_page (EV_VIEW (ev_window->priv->view)); n_pages = ev_document_get_n_pages (document); - set_action_sensitive (ev_window, "GoPageUp", page > 1); - set_action_sensitive (ev_window, "GoPageDown", page < n_pages); + set_action_sensitive (ev_window, "GoPreviousPage", page > 1); + set_action_sensitive (ev_window, "GoNextPage", page < n_pages); set_action_sensitive (ev_window, "GoFirstPage", page > 1); set_action_sensitive (ev_window, "GoLastPage", page < n_pages); } else { set_action_sensitive (ev_window, "GoFirstPage", FALSE); - set_action_sensitive (ev_window, "GoPageUp", FALSE); - set_action_sensitive (ev_window, "GoPageDown", FALSE); + set_action_sensitive (ev_window, "GoPreviousPage", FALSE); + set_action_sensitive (ev_window, "GoNextPage", FALSE); set_action_sensitive (ev_window, "GoLastPage", FALSE); } @@ -1144,7 +1144,7 @@ ev_window_cmd_view_page_width (GtkAction *action, EvWindow *ev_window) } static void -ev_window_cmd_go_page_up (GtkAction *action, EvWindow *ev_window) +ev_window_cmd_go_previous_page (GtkAction *action, EvWindow *ev_window) { g_return_if_fail (EV_IS_WINDOW (ev_window)); @@ -1153,7 +1153,7 @@ ev_window_cmd_go_page_up (GtkAction *action, EvWindow *ev_window) } static void -ev_window_cmd_go_page_down (GtkAction *action, EvWindow *ev_window) +ev_window_cmd_go_next_page (GtkAction *action, EvWindow *ev_window) { g_return_if_fail (EV_IS_WINDOW (ev_window)); @@ -1521,54 +1521,54 @@ static GtkActionEntry entries[] = { { "Help", NULL, N_("_Help") }, /* File menu */ - { "FileOpen", GTK_STOCK_OPEN, N_("_Open"), "O", - N_("Open a file"), + { "FileOpen", GTK_STOCK_OPEN, NULL, "O", + N_("Open an existing document"), G_CALLBACK (ev_window_cmd_file_open) }, { "FileSaveAs", GTK_STOCK_SAVE_AS, N_("_Save a Copy..."), NULL, N_("Save the current document with a new filename"), G_CALLBACK (ev_window_cmd_save_as) }, - { "FilePrint", GTK_STOCK_PRINT, N_("_Print"), "P", + { "FilePrint", GTK_STOCK_PRINT, NULL, "P", N_("Print this document"), G_CALLBACK (ev_window_cmd_file_print) }, - { "FileCloseWindow", GTK_STOCK_CLOSE, N_("_Close"), "W", + { "FileCloseWindow", GTK_STOCK_CLOSE, NULL, "W", N_("Close this window"), G_CALLBACK (ev_window_cmd_file_close_window) }, /* Edit menu */ - { "EditCopy", GTK_STOCK_COPY, N_("_Copy"), "C", + { "EditCopy", GTK_STOCK_COPY, NULL, "C", N_("Copy text from the document"), G_CALLBACK (ev_window_cmd_edit_copy) }, { "EditSelectAll", NULL, N_("Select _All"), "A", N_("Select the entire page"), G_CALLBACK (ev_window_cmd_edit_select_all) }, - { "EditFind", GTK_STOCK_FIND, N_("_Find"), "F", + { "EditFind", GTK_STOCK_FIND, NULL, "F", N_("Find a word or phrase in the document"), G_CALLBACK (ev_window_cmd_edit_find) }, /* View menu */ - { "ViewZoomIn", GTK_STOCK_ZOOM_IN, N_("Zoom _In"), "plus", + { "ViewZoomIn", GTK_STOCK_ZOOM_IN, NULL, "plus", N_("Enlarge the document"), G_CALLBACK (ev_window_cmd_view_zoom_in) }, - { "ViewZoomOut", GTK_STOCK_ZOOM_OUT, N_("Zoom _Out"), "minus", + { "ViewZoomOut", GTK_STOCK_ZOOM_OUT, NULL, "minus", N_("Shrink the document"), G_CALLBACK (ev_window_cmd_view_zoom_out) }, - { "ViewNormalSize", GTK_STOCK_ZOOM_100, N_("_Normal Size"), "0", - N_("Zoom to the normal size"), + { "ViewNormalSize", GTK_STOCK_ZOOM_100, NULL, "0", + N_("Reset the zoom level to the defaul value"), G_CALLBACK (ev_window_cmd_view_normal_size) }, - { "ViewBestFit", GTK_STOCK_ZOOM_FIT, N_("_Best Fit"), NULL, - N_("Zoom to fit the document to the current window"), + { "ViewBestFit", EV_STOCK_ZOOM_PAGE, N_("_Best Fit"), NULL, + N_("Make the current document fill the window"), G_CALLBACK (ev_window_cmd_view_best_fit) }, - { "ViewPageWidth", EV_STOCK_ZOOM_FIT_WIDTH, N_("Fit Page _Width"), NULL, - N_("Zoom to fit the width of the current window "), + { "ViewPageWidth", EV_STOCK_ZOOM_WIDTH, N_("Fit Page _Width"), NULL, + N_("Make the current document fill the window width"), G_CALLBACK (ev_window_cmd_view_page_width) }, /* Go menu */ - { "GoPageUp", GTK_STOCK_GO_UP, N_("_Page Up"), "Page_Up", + { "GoPreviousPage", GTK_STOCK_GO_BACK, N_("_Previous Page"), "Page_Up", N_("Go to the previous page"), - G_CALLBACK (ev_window_cmd_go_page_up) }, - { "GoPageDown", GTK_STOCK_GO_DOWN, N_("_Page Down"), "Page_Down", + G_CALLBACK (ev_window_cmd_go_previous_page) }, + { "GoNextPage", GTK_STOCK_GO_FORWARD, N_("_Next Page"), "Page_Down", N_("Go to the next page"), - G_CALLBACK (ev_window_cmd_go_page_down) }, + G_CALLBACK (ev_window_cmd_go_next_page) }, { "GoFirstPage", GTK_STOCK_GOTO_FIRST, N_("_First Page"), "Home", N_("Go to the first page"), G_CALLBACK (ev_window_cmd_go_first_page) }, @@ -1595,13 +1595,13 @@ static GtkActionEntry entries[] = { static GtkToggleActionEntry toggle_entries[] = { /* View Menu */ { "ViewToolbar", NULL, N_("_Toolbar"), "T", - N_("Show or hide toolbar"), + N_("Show or hide the toolbar"), G_CALLBACK (ev_window_view_toolbar_cb), TRUE }, { "ViewStatusbar", NULL, N_("_Statusbar"), NULL, - N_("Show or hide statusbar"), + N_("Show or hide the statusbar"), G_CALLBACK (ev_window_view_statusbar_cb), TRUE }, - { "ViewSidebar", NULL, N_("Side_bar"), "F9", - N_("Show or hide sidebar"), + { "ViewSidebar", NULL, N_("Side _pane"), "F9", + N_("Show or hide the side pane"), G_CALLBACK (ev_window_view_sidebar_cb), TRUE }, { "ViewFullscreen", NULL, N_("_Fullscreen"), "F11", N_("Expand the window to fill the screen"), @@ -1648,12 +1648,16 @@ set_action_properties (GtkActionGroup *action_group) { GtkAction *action; - action = gtk_action_group_get_action (action_group, "GoPageUp"); - g_object_set (action, "short_label", _("Up"), NULL); - action = gtk_action_group_get_action (action_group, "GoPageDown"); - g_object_set (action, "short_label", _("Down"), NULL); + action = gtk_action_group_get_action (action_group, "GoPreviousPage"); + /*translators: this is the label for toolbar button*/ + g_object_set (action, "short_label", _("Previous"), NULL); + action = gtk_action_group_get_action (action_group, "GoNextPage"); + /*translators: this is the label for toolbar button*/ + g_object_set (action, "short_label", _("Next"), NULL); action = gtk_action_group_get_action (action_group, "ViewPageWidth"); + /*translators: this is the label for toolbar button*/ g_object_set (action, "short_label", _("Fit Width"), NULL); + action = gtk_action_group_get_action (action_group, "ViewZoomIn"); action = gtk_action_group_get_action (action_group, "LeaveFullscreen"); g_object_set (action, "is-important", TRUE, NULL); -- cgit v0.9.1