[gtk+] GtkAppChooserDialog: handle sensitivity of 'Select' better



commit 18dba17f0bbacebf64b65423b2aee64eb2dcc141
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Aug 28 23:49:41 2011 -0400

    GtkAppChooserDialog: handle sensitivity of 'Select' better
    
    When the dialog comes up without a selected item, make 'Select'
    insensitive. Also, don't allow to unselect an item without
    selecting a different one.

 gtk/gtkappchooserdialog.c |    6 ++++++
 gtk/gtkappchooserwidget.c |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkappchooserdialog.c b/gtk/gtkappchooserdialog.c
index 178d291..5412e7a 100644
--- a/gtk/gtkappchooserdialog.c
+++ b/gtk/gtkappchooserdialog.c
@@ -486,6 +486,7 @@ build_dialog_ui (GtkAppChooserDialog *self)
   GtkWidget *vbox;
   GtkWidget *vbox2;
   GtkWidget *button, *w;
+  GAppInfo *info;
 
   gtk_container_set_border_width (GTK_CONTAINER (self), 5);
 
@@ -539,6 +540,11 @@ build_dialog_ui (GtkAppChooserDialog *self)
                                               _("_Select"),
                                               GTK_RESPONSE_OK);
 
+  info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (self->priv->app_chooser_widget));
+  gtk_widget_set_sensitive (self->priv->button, info != NULL);
+  if (info)
+    g_object_unref (info);
+
   gtk_dialog_set_default_response (GTK_DIALOG (self),
                                    GTK_RESPONSE_OK);
 }
diff --git a/gtk/gtkappchooserwidget.c b/gtk/gtkappchooserwidget.c
index 8b3ab9d..551c1dd 100644
--- a/gtk/gtkappchooserwidget.c
+++ b/gtk/gtkappchooserwidget.c
@@ -1176,7 +1176,7 @@ gtk_app_chooser_widget_init (GtkAppChooserWidget *self)
   gtk_widget_show (self->priv->program_list);
 
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->priv->program_list));
-  gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
+  gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
   gtk_tree_selection_set_select_function (selection, gtk_app_chooser_selection_func,
                                           self, NULL);
   g_signal_connect_swapped (selection, "changed",



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