[gtk+] GtkFileChooser: Only allow creating bookmarks for folders, not files



commit e6dca054457256465881dadaa00106e925a7fe12
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed May 22 17:22:28 2013 -0500

    GtkFileChooser: Only allow creating bookmarks for folders, not files
    
    https://bugzilla.gnome.org/show_bug.cgi?id=561221
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 gtk/gtkfilechooserdefault.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 4f557c4..8d9b115 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -1645,19 +1645,19 @@ static void
 check_file_list_menu_sensitivity (GtkFileChooserDefault *impl)
 {
   GtkFileChooserDefaultPrivate *priv = impl->priv;
-  GtkTreeSelection *selection;
+  gint num_selected;
+  gboolean all_files;
+  gboolean all_folders;
   gboolean active;
 
-  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->browse_files_tree_view));
-  if (gtk_tree_selection_count_selected_rows (selection) == 0)
-    active = FALSE;
-  else
-    active = TRUE;
+  selection_check (impl, &num_selected, &all_files, &all_folders);
+
+  active = (num_selected != 0);
 
   if (priv->browse_files_popup_menu_copy_file_location_item)
     gtk_widget_set_sensitive (priv->browse_files_popup_menu_copy_file_location_item, active);
   if (priv->browse_files_popup_menu_add_shortcut_item)
-    gtk_widget_set_sensitive (priv->browse_files_popup_menu_add_shortcut_item, active);
+    gtk_widget_set_sensitive (priv->browse_files_popup_menu_add_shortcut_item, active && all_folders);
   if (priv->browse_files_popup_menu_visit_file_item)
     gtk_widget_set_sensitive (priv->browse_files_popup_menu_visit_file_item, active);
 }


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