forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
6d797d5356
commit
18dba17f0b
@ -486,6 +486,7 @@ build_dialog_ui (GtkAppChooserDialog *self)
|
|||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *vbox2;
|
GtkWidget *vbox2;
|
||||||
GtkWidget *button, *w;
|
GtkWidget *button, *w;
|
||||||
|
GAppInfo *info;
|
||||||
|
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (self), 5);
|
gtk_container_set_border_width (GTK_CONTAINER (self), 5);
|
||||||
|
|
||||||
@ -539,6 +540,11 @@ build_dialog_ui (GtkAppChooserDialog *self)
|
|||||||
_("_Select"),
|
_("_Select"),
|
||||||
GTK_RESPONSE_OK);
|
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_dialog_set_default_response (GTK_DIALOG (self),
|
||||||
GTK_RESPONSE_OK);
|
GTK_RESPONSE_OK);
|
||||||
}
|
}
|
||||||
|
@ -1176,7 +1176,7 @@ gtk_app_chooser_widget_init (GtkAppChooserWidget *self)
|
|||||||
gtk_widget_show (self->priv->program_list);
|
gtk_widget_show (self->priv->program_list);
|
||||||
|
|
||||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (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,
|
gtk_tree_selection_set_select_function (selection, gtk_app_chooser_selection_func,
|
||||||
self, NULL);
|
self, NULL);
|
||||||
g_signal_connect_swapped (selection, "changed",
|
g_signal_connect_swapped (selection, "changed",
|
||||||
|
Loading…
Reference in New Issue
Block a user