nautilus r14724 - in trunk: . libnautilus-private



Author: alexl
Date: Mon Oct 13 12:29:27 2008
New Revision: 14724
URL: http://svn.gnome.org/viewvc/nautilus?rev=14724&view=rev

Log:
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



Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/libnautilus-private/nautilus-open-with-dialog.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Mon Oct 13 12:29:27 2008
@@ -3,7 +3,7 @@
 dnl ===========================================================================
 
 m4_define(eel_minver,                  2.25.1)
-m4_define(glib_minver,                 2.17.5)
+m4_define(glib_minver,                 2.19.0)
 m4_define(gnome_desktop_minver,        2.9.91)
 m4_define(pango_minver,                1.1.2)
 m4_define(gtk_minver,                  2.13.0)

Modified: trunk/libnautilus-private/nautilus-open-with-dialog.c
==============================================================================
--- trunk/libnautilus-private/nautilus-open-with-dialog.c	(original)
+++ trunk/libnautilus-private/nautilus-open-with-dialog.c	Mon Oct 13 12:29:27 2008
@@ -72,7 +72,8 @@
 };
 
 enum {
-	RESPONSE_OPEN
+	RESPONSE_OPEN,
+	RESPONSE_REMOVE
 };
 
 enum {
@@ -295,6 +296,33 @@
 		}
 
 		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 @@
 		
 	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 @@
 	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 @@
 	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);



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