[Xfce4-commits] <thunar:master> Fix removing custom launchers again.

Nick Schermer noreply at xfce.org
Sat Jan 21 15:20:02 CET 2012


Updating branch refs/heads/master
         to c352a6f98d14cdee17759dca8e186f203324f62e (commit)
       from 9f249baaf40f96f402da87afdbd1ed56eb7b4c9e (commit)

commit c352a6f98d14cdee17759dca8e186f203324f62e
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Jan 21 15:17:45 2012 +0100

    Fix removing custom launchers again.

 thunar/thunar-chooser-dialog.c |    6 ++----
 thunar/thunar-chooser-model.c  |    9 +++++++++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/thunar/thunar-chooser-dialog.c b/thunar/thunar-chooser-dialog.c
index b44e54d..296d0b9 100644
--- a/thunar/thunar-chooser-dialog.c
+++ b/thunar/thunar-chooser-dialog.c
@@ -562,8 +562,7 @@ thunar_chooser_dialog_context_menu (ThunarChooserDialog *dialog,
 
   /* append the "Remove Launcher" item */
   item = gtk_image_menu_item_new_with_mnemonic (_("_Remove Launcher"));
-  /* FIXME Need a way to find out whether the appinfo was created by the user: */
-  gtk_widget_set_sensitive (item, FALSE);
+  gtk_widget_set_sensitive (item, g_app_info_can_delete (app_info));
   g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_chooser_dialog_action_remove), dialog);
   gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
   gtk_widget_show (item);
@@ -695,8 +694,7 @@ thunar_chooser_dialog_action_remove (ThunarChooserDialog *dialog)
   if (G_UNLIKELY (app_info == NULL))
     return;
 
-  /* FIXME need a way to verify that the application is usercreated */
-  if (FALSE)
+  if (g_app_info_can_delete (app_info))
     {
       /* determine the name of the app info */
       name = g_app_info_get_name (app_info);
diff --git a/thunar/thunar-chooser-model.c b/thunar/thunar-chooser-model.c
index ad9b37a..5861cc4 100644
--- a/thunar/thunar-chooser-model.c
+++ b/thunar/thunar-chooser-model.c
@@ -384,6 +384,15 @@ thunar_chooser_model_remove (ThunarChooserModel *model,
                                              model->content_type,
                                              error);
 
+  /* try to delete the file */
+  if (succeed && g_app_info_delete (app_info))
+    {
+      g_set_error (error, G_IO_ERROR,
+                   G_IO_ERROR_FAILED,
+                   _("Failed to remove \"%s\"."),
+                   g_app_info_get_id (app_info));
+    }
+
   /* clean up */
   g_object_unref (app_info);
 


More information about the Xfce4-commits mailing list