[evince/outline_search_improvements: 25/28] Improve "Print" menu item of Outline sidebar




commit 8f8c4117dd6f770c82fcd81b6895d2d91acf5dbd
Author: Nelson Benítez León <nbenitezl gmail com>
Date:   Wed Jun 22 18:24:08 2022 +0100

    Improve "Print" menu item of Outline sidebar
    
    Change its wording to the more descriptive "Print this section"
    as the action is not to print the whole document but the
    selected section.
    
    In concordance with the rest of the menu items, sensitivize it
    only when we acting on a selected path.

 libmisc/ev-page-action-widget.c |  5 -----
 shell/ev-sidebar-links.c        | 10 ++++++++--
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/libmisc/ev-page-action-widget.c b/libmisc/ev-page-action-widget.c
index 39152d087..28296497f 100644
--- a/libmisc/ev-page-action-widget.c
+++ b/libmisc/ev-page-action-widget.c
@@ -53,7 +53,6 @@ struct _EvPageActionWidget
        gulong notify_document_signal_id;
        GtkTreeModel *filter_model;
        GtkTreeModel *model;
-       GtkEntryCompletion *completion;
 };
 
 static guint widget_signals[WIDGET_N_SIGNALS] = {0, };
@@ -344,8 +343,6 @@ ev_page_action_widget_finalize (GObject *object)
                action_widget->doc_model = NULL;
        }
 
-       g_clear_object (&action_widget->completion);
-
         ev_page_action_widget_set_document (action_widget, NULL);
 
        G_OBJECT_CLASS (ev_page_action_widget_parent_class)->finalize (object);
@@ -571,8 +568,6 @@ ev_page_action_widget_update_links_model (EvPageActionWidget *proxy, GtkTreeMode
        filter_model = get_filter_model_from_model (model);
 
        completion = gtk_entry_completion_new ();
-       g_clear_object (&proxy->completion);
-       proxy->completion = completion;
        g_object_set (G_OBJECT (completion),
                      "popup-set-width", FALSE,
                      "model", filter_model,
diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c
index 15f54fe32..7224af1a4 100644
--- a/shell/ev-sidebar-links.c
+++ b/shell/ev-sidebar-links.c
@@ -90,6 +90,7 @@ static gboolean ev_sidebar_links_support_document     (EvSidebarPage  *sidebar_page,
 static const gchar* ev_sidebar_links_get_label                 (EvSidebarPage *sidebar_page);
 
 static guint signals[N_SIGNALS];
+static GtkWidget *menu_item_print_section;
 static GtkWidget *menu_item_collapse_all;
 static GtkWidget *menu_item_expand_all;
 static GtkWidget *menu_item_expand_under;
@@ -365,8 +366,9 @@ build_popup_menu (EvSidebarLinks *sidebar)
        g_signal_connect (item, "activate",
                          G_CALLBACK (search_section_cb), sidebar);
 
-       item = gtk_menu_item_new_with_mnemonic(_("Print…"));
+       item = gtk_menu_item_new_with_mnemonic(_("Print this section…"));
        gtk_widget_show (item);
+       menu_item_print_section = item; /* save ref to sensitivize later */
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
        g_signal_connect (item, "activate",
                          G_CALLBACK (print_section_cb), sidebar);
@@ -447,12 +449,16 @@ check_menu_sensitivity (GtkTreeView *treeview,
                }
        }
 
-       if (!selected_path)
+       if (!selected_path) {
                gtk_widget_set_sensitive (menu_item_expand_under, FALSE);
+               gtk_widget_set_sensitive (menu_item_print_section, FALSE);
+       }
 
        if (is_list || !selected_path)
                return;
 
+       gtk_widget_set_sensitive (menu_item_print_section, TRUE);
+
        /* Enable 'Expand under this' only when 'this' element has grandchildren */
        gtk_tree_model_get_iter (model, &parent, selected_path);
        if (gtk_tree_model_iter_children (model, &iter, &parent)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]