[Xfce4-commits] <xfce4-session:master> Show a warning dialog if unlinking at least one of the files fails.

Jérôme Guelfucci noreply at xfce.org
Tue Apr 5 07:48:03 CEST 2011


Updating branch refs/heads/master
         to 33bed308bbd00891cb17f241249b8dfb588e5aba (commit)
       from 93d9eeb32a85ccdf492d4de7fbb798c2bc1165d1 (commit)

commit 33bed308bbd00891cb17f241249b8dfb588e5aba
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Tue Apr 5 07:45:22 2011 +0200

    Show a warning dialog if unlinking at least one of the files fails.
    
    At least we let the user know that it did not work 100%, I don't know
    how useful this is...

 settings/session-editor.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/settings/session-editor.c b/settings/session-editor.c
index 1a26688..240b3b2 100644
--- a/settings/session-editor.c
+++ b/settings/session-editor.c
@@ -177,6 +177,7 @@ session_editor_clear_sessions(GtkWidget *btn,
         gchar       *cache_dir_path, *item_path;
         GDir        *cache_dir;
         GError      *error = NULL;
+        gboolean     failed = FALSE;
 
         cache_dir_path = g_build_path(G_DIR_SEPARATOR_S, g_get_user_cache_dir(), "sessions", NULL);
         cache_dir = g_dir_open(cache_dir_path, 0, &error);
@@ -198,10 +199,23 @@ session_editor_clear_sessions(GtkWidget *btn,
 
             item_path = g_build_filename(cache_dir_path, item_name, NULL);
             if(G_UNLIKELY(g_unlink(item_path) == -1)) {
-                g_warning("Failed to delete \"%s\" from the session cache.", item_path);
+                DBG("Failed to delete \"%s\" from the session cache.", item_path);
+                failed = TRUE;
             }
             g_free(item_path);
         }
+
+        if(failed){
+            gchar *secondary_text;
+
+            secondary_text = g_strconcat(_("You might need to delete some files manually in "),
+                                         cache_dir_path, NULL);
+            xfce_dialog_show_warning(GTK_WINDOW(gtk_widget_get_toplevel(treeview)),
+                                     secondary_text,
+                                     _("All Xfce cache files could not be cleared"));
+            g_free(secondary_text);
+        }
+
         g_dir_close(cache_dir);
         g_free(cache_dir_path);
     }



More information about the Xfce4-commits mailing list