summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-open-with-dialog.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2008-10-13 12:29:27 +0000
committerAlexander Larsson <alexl@src.gnome.org>2008-10-13 12:29:27 +0000
commitd9acd8a11fbd4b5e01bc78662b1bdcec83ae9239 (patch)
tree8c166a8a1f2d063da21684aae50617c757360e29 /libnautilus-private/nautilus-open-with-dialog.c
parenta60444a576297c98172773ced49dcb7dcc6d3872 (diff)
downloadnautilus-d9acd8a11fbd4b5e01bc78662b1bdcec83ae9239.tar.gz
Require glib 2.19.0
2008-10-13 Alexander Larsson <alexl@redhat.com> * configure.in: Require glib 2.19.0 * libnautilus-private/nautilus-open-with-dialog.c: Allow removal of custom applications (#545354) Patch from Matthias Clasen svn path=/trunk/; revision=14724
Diffstat (limited to 'libnautilus-private/nautilus-open-with-dialog.c')
-rw-r--r--libnautilus-private/nautilus-open-with-dialog.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/libnautilus-private/nautilus-open-with-dialog.c b/libnautilus-private/nautilus-open-with-dialog.c
index 4b54dd5db..d7f198402 100644
--- a/libnautilus-private/nautilus-open-with-dialog.c
+++ b/libnautilus-private/nautilus-open-with-dialog.c
@@ -72,7 +72,8 @@ enum {
};
enum {
- RESPONSE_OPEN
+ RESPONSE_OPEN,
+ RESPONSE_REMOVE
};
enum {
@@ -295,6 +296,33 @@ response_cb (NautilusOpenWithDialog *dialog,
}
break;
+ case RESPONSE_REMOVE:
+ if (dialog->details->selected_app_info != NULL) {
+ if (g_app_info_delete (dialog->details->selected_app_info)) {
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GAppInfo *info, *selected;
+
+ selected = dialog->details->selected_app_info;
+ dialog->details->selected_app_info = NULL;
+
+ model = GTK_TREE_MODEL (dialog->details->program_list_store);
+ if (gtk_tree_model_get_iter_first (model, &iter)) {
+ do {
+ gtk_tree_model_get (model, &iter,
+ COLUMN_APP_INFO, &info,
+ -1);
+ if (g_app_info_equal (selected, info)) {
+ gtk_list_store_remove (dialog->details->program_list_store, &iter);
+ break;
+ }
+ } while (gtk_tree_model_iter_next (model, &iter));
+ }
+
+ g_object_unref (selected);
+ }
+ }
+ break;
case GTK_RESPONSE_NONE:
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
@@ -655,6 +683,9 @@ program_list_selection_changed (GtkTreeSelection *selection,
if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
gtk_widget_set_sensitive (dialog->details->button, FALSE);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ RESPONSE_REMOVE,
+ FALSE);
return;
}
@@ -672,6 +703,9 @@ program_list_selection_changed (GtkTreeSelection *selection,
gtk_label_set_text (GTK_LABEL (dialog->details->desc_label),
sure_string (g_app_info_get_description (info)));
gtk_widget_set_sensitive (dialog->details->button, TRUE);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ RESPONSE_REMOVE,
+ g_app_info_can_delete (info));
if (dialog->details->selected_app_info) {
g_object_unref (dialog->details->selected_app_info);
@@ -809,6 +843,13 @@ nautilus_open_with_dialog_instance_init (NautilusOpenWithDialog *dialog)
gtk_box_pack_start (GTK_BOX (hbox), dialog->details->button, FALSE, FALSE, 0);
gtk_widget_show (dialog->details->button);
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ GTK_STOCK_REMOVE,
+ RESPONSE_REMOVE);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ RESPONSE_REMOVE,
+ FALSE);
+
gtk_dialog_add_button (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);