[gtk+/gtk-3-8] Improve sensitivity handling in filechooser context menu



commit 650da1e6b04386bd89ede581011ffd9be00bd229
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 12 23:10:15 2013 -0400

    Improve sensitivity handling in filechooser context menu
    
    Items that act on the selection should not be sensitive if the
    selection is empty. This was already the case for the 'Copy file
    location' item, but not for the 'Add bookmark' and 'Visit file'
    items.
    https://bugzilla.gnome.org/show_bug.cgi?id=699104

 gtk/gtkfilechooserdefault.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 99c4200..1be1fd1 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -4112,11 +4112,11 @@ file_list_drag_motion_cb (GtkWidget             *widget,
   return TRUE;
 }
 
-/* Sensitizes the "Copy file’s location" context menu item if there is actually
+/* Sensitizes the "Copy file’s location" and other context menu items if there is actually
  * a selection active.
  */
 static void
-check_copy_file_location_sensitivity (GtkFileChooserDefault *impl)
+check_file_list_menu_sensitivity (GtkFileChooserDefault *impl)
 {
   GtkTreeSelection *selection;
   gboolean active;
@@ -4129,6 +4129,10 @@ check_copy_file_location_sensitivity (GtkFileChooserDefault *impl)
 
   if (impl->browse_files_popup_menu_copy_file_location_item)
     gtk_widget_set_sensitive (impl->browse_files_popup_menu_copy_file_location_item, active);
+  if (impl->browse_files_popup_menu_add_shortcut_item)
+    gtk_widget_set_sensitive (impl->browse_files_popup_menu_add_shortcut_item, active);
+  if (impl->browse_files_popup_menu_visit_file_item)
+    gtk_widget_set_sensitive (impl->browse_files_popup_menu_visit_file_item, active);
 }
 
 static GtkWidget *
@@ -4198,7 +4202,7 @@ file_list_build_popup_menu (GtkFileChooserDefault *impl)
                                                                                         G_CALLBACK 
(show_size_column_toggled_cb));
 
   bookmarks_check_add_sensitivity (impl);
-  check_copy_file_location_sensitivity (impl);
+  check_file_list_menu_sensitivity (impl);
 }
 
 /* Updates the popup menu for the file list, creating it if necessary */
@@ -10066,7 +10070,7 @@ list_selection_changed (GtkTreeSelection      *selection,
 
   check_preview_change (impl);
   bookmarks_check_add_sensitivity (impl);
-  check_copy_file_location_sensitivity (impl);
+  check_file_list_menu_sensitivity (impl);
 
   g_signal_emit_by_name (impl, "selection-changed", 0);
 }


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