[gnome-settings-daemon] Fix compiler warnings



commit 0511d539d799f2f7c46127a27f5fb5d41e2b3bb3
Author: Jens Granseuer <jensgr gmx net>
Date:   Sun Jul 26 15:07:10 2009 +0200

    Fix compiler warnings
    
    Remove an unused variable and properly cast GtkProgressBar when used.

 plugins/housekeeping/gsd-disk-space.c       |  133 +++++++++++++--------------
 plugins/housekeeping/gsd-ldsm-trash-empty.c |   76 ++++++++--------
 2 files changed, 104 insertions(+), 105 deletions(-)
---
diff --git a/plugins/housekeeping/gsd-disk-space.c b/plugins/housekeeping/gsd-disk-space.c
index a91940c..a91cdd2 100644
--- a/plugins/housekeeping/gsd-disk-space.c
+++ b/plugins/housekeeping/gsd-disk-space.c
@@ -81,7 +81,7 @@ ldsm_get_fs_id_for_path (const gchar *path)
         GFile *file;
         GFileInfo *fileinfo;
         gchar *attr_id_fs;
-        
+
         file = g_file_new_for_path (path);
         fileinfo = g_file_query_info (file, G_FILE_ATTRIBUTE_ID_FILESYSTEM, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, NULL);
         if (fileinfo) {
@@ -90,13 +90,13 @@ ldsm_get_fs_id_for_path (const gchar *path)
         } else {
                 attr_id_fs = NULL;
         }
-        
+
         g_object_unref (file);
-        
+
         return attr_id_fs;
 }
 
-static gboolean 
+static gboolean
 ldsm_mount_has_trash (LdsmMountInfo *mount)
 {
         const gchar *user_data_dir;
@@ -107,13 +107,13 @@ ldsm_mount_has_trash (LdsmMountInfo *mount)
         gboolean has_trash = FALSE;
         GDir *dir;
         const gchar *path;
-        
+
         user_data_dir = g_get_user_data_dir ();
         user_data_attr_id_fs = ldsm_get_fs_id_for_path (user_data_dir);
-        
+
         path = g_unix_mount_get_mount_path (mount->mount);
         path_attr_id_fs = ldsm_get_fs_id_for_path (path);
-        
+
         if (g_strcmp0 (user_data_attr_id_fs, path_attr_id_fs) == 0) {
                 /* The volume that is low on space is on the same volume as our home
                  * directory. This means the trash is at $XDG_DATA_HOME/Trash,
@@ -121,21 +121,21 @@ ldsm_mount_has_trash (LdsmMountInfo *mount)
                  */
                 mount_uses_user_trash = TRUE;
         }
-        
+
         g_free (user_data_attr_id_fs);
         g_free (path_attr_id_fs);
-        
+
         /* I can't think of a better way to find out if a volume has any trash. Any suggestions? */
         if (mount_uses_user_trash) {
                 trash_files_dir = g_build_filename (g_get_user_data_dir (), "Trash", "files", NULL);
         } else {
                 gchar *uid;
-                
+
                 uid = g_strdup_printf ("%d", getuid ());
                 trash_files_dir = g_build_filename (path, ".Trash", uid, "files", NULL);
                 if (!g_file_test (trash_files_dir, G_FILE_TEST_IS_DIR)) {
                         gchar *trash_dir;
-                        
+
                         g_free (trash_files_dir);
                         trash_dir = g_strdup_printf (".Trash-%s", uid);
                         trash_files_dir = g_build_filename (path, trash_dir, "files", NULL);
@@ -148,24 +148,24 @@ ldsm_mount_has_trash (LdsmMountInfo *mount)
                 }
                 g_free (uid);
         }
-        
+
         dir = g_dir_open (trash_files_dir, 0, NULL);
         if (dir) {
                 if (g_dir_read_name (dir))
                         has_trash = TRUE;
                 g_dir_close (dir);
         }
-        
-        g_free (trash_files_dir);      
-                
-        return has_trash;  
+
+        g_free (trash_files_dir);
+
+        return has_trash;
 }
 
 static void
 ldsm_analyze_path (const gchar *path)
 {
         const gchar *argv[] = { DISK_SPACE_ANALYZER, path, NULL };
-        
+
         g_spawn_async (NULL, (gchar **) argv, NULL, G_SPAWN_SEARCH_PATH,
                         NULL, NULL, NULL, NULL);
 }
@@ -182,16 +182,16 @@ ldsm_notify_for_mount (LdsmMountInfo *mount,
         gboolean has_trash;
         gboolean retval = TRUE;
         const gchar *path;
-        
+
         /* Don't show a dialog if one is already displayed */
         if (dialog)
                 return retval;
-        
+
         name = g_unix_mount_guess_name (mount->mount);
         free_space = (mount->buf.f_frsize * mount->buf.f_bavail);
         has_trash = ldsm_mount_has_trash (mount);
         path = g_unix_mount_get_mount_path (mount->mount);
-        
+
         dialog = gsd_ldsm_dialog_new (other_usable_volumes,
                                       multiple_volumes,
                                       has_disk_analyzer,
@@ -199,15 +199,15 @@ ldsm_notify_for_mount (LdsmMountInfo *mount,
                                       free_space,
                                       name,
                                       path);
-                                        
+
         g_free (name);
-        
-        g_object_ref (G_OBJECT (dialog));        
+
+        g_object_ref (G_OBJECT (dialog));
         response = gtk_dialog_run (GTK_DIALOG (dialog));
-        
+
         gtk_object_destroy (GTK_OBJECT (dialog));
         dialog = NULL;
-        
+
         switch (response) {
         case GTK_RESPONSE_CANCEL:
                 retval = FALSE;
@@ -227,20 +227,20 @@ ldsm_notify_for_mount (LdsmMountInfo *mount,
         default:
                 g_assert_not_reached ();
         }
-        
-        return retval;      
+
+        return retval;
 }
 
 static gboolean
 ldsm_mount_has_space (LdsmMountInfo *mount)
 {
         gdouble free_space;
-        
+
         free_space = (double) mount->buf.f_bavail / (double) mount->buf.f_blocks;
         /* enough free space, nothing to do */
         if (free_space > free_percent_notify)
                 return TRUE;
-        
+
         /* If we got here, then this volume is low on space */
         return FALSE;
 }
@@ -249,7 +249,7 @@ static gboolean
 ldsm_mount_is_virtual (LdsmMountInfo *mount)
 {
         const gchar *dev_path;
-        
+
         if (mount->buf.f_blocks == 0) {
                 /* Filesystems with zero blocks are virtual */
                 return TRUE;
@@ -262,7 +262,7 @@ ldsm_mount_is_virtual (LdsmMountInfo *mount)
                  */
                 return TRUE;
          }
-        
+
         return FALSE;
 }
 
@@ -270,9 +270,9 @@ static void
 ldsm_free_mount_info (gpointer data)
 {
         LdsmMountInfo *mount = data;
-        
+
         g_return_if_fail (mount != NULL);
-        
+
         g_unix_mount_free (mount->mount);
         g_free (mount);
 }
@@ -285,17 +285,16 @@ ldsm_maybe_warn_mounts (GList *mounts,
 {
         GList *l;
         gboolean done = FALSE;
-        
+
         for (l = mounts; l != NULL; l = l->next) {
                 LdsmMountInfo *mount_info = l->data;
                 LdsmMountInfo *previous_mount_info;
                 gdouble free_space;
                 gdouble previous_free_space;
-                time_t previous_notify_time;
                 time_t curr_time;
                 const gchar *path;
                 gboolean show_notify;
-                
+
                 if (done) {
                         /* Don't show any more dialogs if the user took action with the last one. The user action
                          * might free up space on multiple volumes, making the next dialog redundant.
@@ -303,15 +302,15 @@ ldsm_maybe_warn_mounts (GList *mounts,
                         ldsm_free_mount_info (mount_info);
                         continue;
                 }
-                
+
                 path = g_unix_mount_get_mount_path (mount_info->mount);
-                
+
                 previous_mount_info = g_hash_table_lookup (ldsm_notified_hash, path);
                 if (previous_mount_info != NULL)
                         previous_free_space = (gdouble) previous_mount_info->buf.f_bavail / (gdouble) previous_mount_info->buf.f_blocks;
- 
+
                 free_space = (gdouble) mount_info->buf.f_bavail / (gdouble) mount_info->buf.f_blocks;
-                
+
                 if (previous_mount_info == NULL) {
                         /* We haven't notified for this mount yet */
                         show_notify = TRUE;
@@ -337,7 +336,7 @@ ldsm_maybe_warn_mounts (GList *mounts,
                         ldsm_free_mount_info (mount_info);
                         show_notify = FALSE;
                 }
-               
+
                 if (show_notify) {
                         if (ldsm_notify_for_mount (mount_info, has_disk_analyzer, multiple_volumes, other_usable_volumes))
                                 done = TRUE;
@@ -359,7 +358,7 @@ ldsm_mount_should_ignore (const gchar *path)
                 return TRUE;
         else
                 return FALSE;
-}                
+}
 
 static gboolean
 ldsm_check_all_mounts (gpointer data)
@@ -378,13 +377,13 @@ ldsm_check_all_mounts (gpointer data)
         program = g_find_program_in_path (DISK_SPACE_ANALYZER);
         has_disk_analyzer = (program != NULL);
         g_free (program);
-        
+
         /* We iterate through the static mounts in /etc/fstab first, seeing if
          * they're mounted by checking if the GUnixMountPoint has a corresponding GUnixMountEntry.
          * Iterating through the static mounts means we automatically ignore dynamically mounted media.
          */
         mounts = g_unix_mount_points_get (time_read);
-                
+
         for (l = mounts; l != NULL; l = l->next) {
                 GUnixMountPoint *mount_point = l->data;
                 GUnixMountEntry *mount;
@@ -398,35 +397,35 @@ ldsm_check_all_mounts (gpointer data)
                         /* The GUnixMountPoint is not mounted */
                         continue;
                 }
-                
+
                 mount_info = g_new0 (LdsmMountInfo, 1);
                 mount_info->mount = mount;
-                
+
                 path = g_unix_mount_get_mount_path (mount);
-                                
+
                 if (g_unix_mount_is_readonly (mount)) {
                         ldsm_free_mount_info (mount_info);
                         continue;
                 }
-                
+
                 if (ldsm_mount_should_ignore (path)) {
                         ldsm_free_mount_info (mount_info);
-                        continue;                
+                        continue;
                 }
-                
+
                 if (statvfs (path, &mount_info->buf) != 0) {
                         ldsm_free_mount_info (mount_info);
                         continue;
                 }
-                
+
                 if (ldsm_mount_is_virtual (mount_info)) {
                         ldsm_free_mount_info (mount_info);
                         continue;
-                }                        
+                }
 
                 check_mounts = g_list_prepend (check_mounts, mount_info);
         }
-        
+
         number_of_mounts = g_list_length (check_mounts);
         if (number_of_mounts > 1)
                 multiple_volumes = TRUE;
@@ -441,14 +440,14 @@ ldsm_check_all_mounts (gpointer data)
                         ldsm_free_mount_info (mount_info);
                 }
         }
-        
+
         number_of_full_mounts = g_list_length (full_mounts);
         if (number_of_mounts > number_of_full_mounts)
                 other_usable_volumes = TRUE;
-                
+
         ldsm_maybe_warn_mounts (full_mounts, has_disk_analyzer, multiple_volumes,
                                 other_usable_volumes);
-                
+
         g_list_free (check_mounts);
         g_list_free (full_mounts);
 
@@ -502,14 +501,14 @@ ldsm_is_hash_item_in_ignore_paths (gpointer key,
                                    gpointer value,
                                    gpointer user_data)
 {
-        return ldsm_mount_should_ignore (key);   
+        return ldsm_mount_should_ignore (key);
 }
 
 static void
 gsd_ldsm_get_config ()
 {
         GError *error = NULL;
-       
+
         free_percent_notify = gconf_client_get_float (client,
                                                       GCONF_HOUSEKEEPING_DIR "/" GCONF_FREE_PC_NOTIFY_KEY,
                                                       &error);
@@ -522,7 +521,7 @@ gsd_ldsm_get_config ()
                            "Using sensible default", free_percent_notify);
                 free_percent_notify = 0.05;
         }
-        
+
         free_percent_notify_again = gconf_client_get_float (client,
                                                             GCONF_HOUSEKEEPING_DIR "/" GCONF_FREE_PC_NOTIFY_AGAIN_KEY,
                                                             &error);
@@ -535,7 +534,7 @@ gsd_ldsm_get_config ()
                            "Using sensible default\n", free_percent_notify_again);
                 free_percent_notify_again = 0.01;
         }
-        
+
         free_size_gb_no_notify = gconf_client_get_int (client,
                                                        GCONF_HOUSEKEEPING_DIR "/" GCONF_FREE_SIZE_NO_NOTIFY,
                                                        &error);
@@ -550,7 +549,7 @@ gsd_ldsm_get_config ()
                  g_warning ("Error reading configuration from GConf: %s", error->message ? error->message : "Unkown error");
                  g_clear_error (&error);
          }
-         
+
          if (ignore_paths != NULL) {
                 g_slist_foreach (ignore_paths, (GFunc) g_free, NULL);
                 g_slist_free (ignore_paths);
@@ -581,7 +580,7 @@ void
 gsd_ldsm_setup (gboolean check_now)
 {
         GError          *error = NULL;
-        
+
         if (ldsm_notified_hash || ldsm_timeout_id || ldsm_monitor) {
                 g_warning ("Low disk space monitor already initialized.");
                 return;
@@ -590,7 +589,7 @@ gsd_ldsm_setup (gboolean check_now)
         ldsm_notified_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                     g_free,
                                                     ldsm_free_mount_info);
-                                                    
+
         client = gconf_client_get_default ();
         if (client != NULL) {
                 gsd_ldsm_get_config ();
@@ -616,7 +615,7 @@ gsd_ldsm_setup (gboolean check_now)
 
         ldsm_timeout_id = g_timeout_add_seconds (CHECK_EVERY_X_SECONDS,
                                                  ldsm_check_all_mounts, NULL);
-                                                 
+
 }
 
 void
@@ -633,17 +632,17 @@ gsd_ldsm_clean (void)
         if (ldsm_monitor)
                 g_object_unref (ldsm_monitor);
         ldsm_monitor = NULL;
-        
+
         if (client) {
                 gconf_client_notify_remove (client, gconf_notify_id);
                 g_object_unref (client);
         }
-        
+
         if (dialog) {
                 gtk_widget_destroy (GTK_WIDGET (dialog));
                 dialog = NULL;
         }
-        
+
         if (ignore_paths) {
                 g_slist_foreach (ignore_paths, (GFunc) g_free, NULL);
                 g_slist_free (ignore_paths);
diff --git a/plugins/housekeeping/gsd-ldsm-trash-empty.c b/plugins/housekeeping/gsd-ldsm-trash-empty.c
index 581929a..d3fd13f 100644
--- a/plugins/housekeeping/gsd-ldsm-trash-empty.c
+++ b/plugins/housekeeping/gsd-ldsm-trash-empty.c
@@ -3,17 +3,17 @@
  * gsd-ldsm-trash-empty.c
  * Copyright (C) Chris Coulson 2009 <chrisccoulson googlemail com>
  *	     (C) Ryan Lortie 2008
- * 
+ *
  * gsd-ldsm-trash-empty.c is free software: you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
  * Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- * 
+ *
  * gsd-ldsm-trash-empty.c is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  * See the GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License along
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -50,7 +50,7 @@ trash_empty_done (gpointer data)
                 g_timer_destroy (timer);
                 timer = NULL;
         }
-	
+
         return FALSE;
 }
 
@@ -87,7 +87,7 @@ trash_empty_update_dialog (gpointer user_data)
                         timer = g_timer_new ();
                         g_timer_start (timer);
                         gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progressbar));
-                }	
+                }
         } else {
                 gchar *text;
                 gchar *tmp;
@@ -108,7 +108,7 @@ trash_empty_update_dialog (gpointer user_data)
                 parent = g_file_get_parent (file);
                 text = g_file_get_uri (parent);
                 g_object_unref (parent);
-	
+
                 gtk_label_set_text (GTK_LABEL (location_label), text);
                 g_free (text);
 
@@ -117,7 +117,7 @@ trash_empty_update_dialog (gpointer user_data)
                 gtk_label_set_markup (GTK_LABEL (file_label), text);
                 g_free (text);
                 g_free (tmp);
-                
+
                 /* unhide the labels */
                 gtk_widget_show_all (GTK_WIDGET (trash_empty_dialog));
         }
@@ -141,7 +141,7 @@ trash_empty_maybe_schedule_update (GIOSchedulerJob *job,
 {
         if (!trash_empty_update_pending) {
                 g_assert (trash_empty_current_file == NULL);
-		
+
                 trash_empty_current_file = g_object_ref (file);
                 trash_empty_deleted_files = deleted;
                 trash_empty_actually_deleting = actually_deleting;
@@ -213,8 +213,8 @@ trash_empty_job (GIOSchedulerJob *job,
         deleted = 0;
         trash_empty_delete_contents (job, cancellable, trash, FALSE, &deleted);
         trash_empty_total_files = deleted;
- 
-        /* now do the real thing */ 
+
+        /* now do the real thing */
         deleted = 0;
         trash_empty_delete_contents (job, cancellable, trash, TRUE, &deleted);
 
@@ -229,24 +229,24 @@ trash_empty_job (GIOSchedulerJob *job,
 
 /* Worker thread end */
 
-static void 
+static void
 trash_empty_start ()
-{	
+{
         GtkWidget *vbox1, *vbox2, *hbox;
         GtkWidget *label1, *label3;
         gchar *markup;
-        GCancellable *cancellable;	
-	
+        GCancellable *cancellable;
+
         trash_empty_dialog = gtk_dialog_new ();
         gtk_window_set_default_size (GTK_WINDOW (trash_empty_dialog), 400, -1);
         gtk_window_set_icon_name (GTK_WINDOW (trash_empty_dialog), "user-trash");
         gtk_window_set_title (GTK_WINDOW (trash_empty_dialog),
                               _("Emptying the trash"));
-	
+
         vbox1 = gtk_vbox_new (FALSE, 12);
         vbox2 = gtk_vbox_new (FALSE, 0);
         hbox = gtk_hbox_new (FALSE, 0);
-	
+
         label1 = gtk_label_new (NULL);
         gtk_label_set_line_wrap (GTK_LABEL (label1), TRUE);
         gtk_misc_set_alignment (GTK_MISC (label1), 0.0, 0.5);
@@ -255,19 +255,19 @@ trash_empty_start ()
         gtk_label_set_line_wrap (GTK_LABEL (label3), TRUE);
         gtk_misc_set_alignment (GTK_MISC (label3), 0.0, 0.5);
         gtk_widget_hide (label3);
-	
+
         location_label = gtk_label_new (NULL);
         gtk_label_set_line_wrap (GTK_LABEL (location_label), TRUE);
         gtk_misc_set_alignment (GTK_MISC (location_label), 0.0, 0.5);
-	
+
         file_label = gtk_label_new (NULL);
         gtk_label_set_line_wrap (GTK_LABEL (file_label), TRUE);
         gtk_misc_set_alignment (GTK_MISC (file_label), 0.0, 0.5);
-	
+
         progressbar = gtk_progress_bar_new ();
-        gtk_progress_bar_set_pulse_step (progressbar, 0.1);
-        gtk_progress_bar_set_text (progressbar, _("Preparing to empty trash..."));
-	
+        gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR (progressbar), 0.1);
+        gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progressbar), _("Preparing to empty trash..."));
+
         gtk_box_pack_start (GTK_BOX (GTK_DIALOG (trash_empty_dialog)->vbox), vbox1, TRUE, TRUE, 0);
         gtk_box_pack_start (GTK_BOX (vbox1), label1, TRUE, TRUE, 0);
         gtk_box_pack_start (GTK_BOX (hbox), label3, FALSE, TRUE, 0);
@@ -276,32 +276,32 @@ trash_empty_start ()
         gtk_box_pack_start (GTK_BOX (vbox2), progressbar, TRUE, TRUE, 0);
         gtk_box_pack_start (GTK_BOX (vbox2), file_label, TRUE, TRUE, 0);
         gtk_box_pack_start (GTK_BOX (vbox1), vbox2, TRUE, TRUE, 0);
-	
+
         gtk_widget_show (label1);
         gtk_widget_show (vbox1);
         gtk_widget_show_all (vbox2);
         gtk_widget_show (hbox);
         gtk_widget_show (location_label);
-	
+
         gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (trash_empty_dialog)->vbox), 6);
         gtk_container_set_border_width (GTK_CONTAINER (vbox1), 6);
-	
+
         gtk_dialog_add_button (GTK_DIALOG (trash_empty_dialog),
                                GTK_STOCK_CANCEL,
                                GTK_RESPONSE_CANCEL);
-	
+
         markup = g_markup_printf_escaped ("<big><b>%s</b></big>", _("Emptying the trash"));
         gtk_label_set_markup (GTK_LABEL (label1), markup);
         gtk_label_set_text (GTK_LABEL (label3), _("From: "));
-	
+
         cancellable = g_cancellable_new ();
         g_signal_connect_object (trash_empty_dialog, "response",
                                  G_CALLBACK (g_cancellable_cancel),
                                  cancellable, G_CONNECT_SWAPPED);
         g_io_scheduler_push_job (trash_empty_job, NULL, NULL, 0, cancellable);
-	
+
         gtk_widget_show (trash_empty_dialog);
-	
+
         g_free (markup);
         g_object_unref (cancellable);
 }
@@ -324,7 +324,7 @@ trash_empty_require_confirmation ()
         GConfClient *client;
         gboolean require_confirmation = TRUE;
         GError *error = NULL;
-	
+
         client = gconf_client_get_default ();
         if (client) {
                 require_confirmation = gconf_client_get_bool (client, NAUTILUS_CONFIRM_TRASH_KEY, &error);
@@ -336,22 +336,22 @@ trash_empty_require_confirmation ()
                 }
                 g_object_unref (client);
         }
-	
-        return require_confirmation;	
+
+        return require_confirmation;
 }
 
 static void
 trash_empty_show_confirmation_dialog ()
 {
         GtkWidget *button;
-	
+
         if (!trash_empty_require_confirmation ()) {
                 trash_empty_start ();
                 return;
         }
-	
+
         trash_empty_confirm_dialog = gtk_message_dialog_new (NULL, 0,
-                                                             GTK_MESSAGE_WARNING, 
+                                                             GTK_MESSAGE_WARNING,
                                                              GTK_BUTTONS_NONE,
                                                              _("Empty all of the items from the trash?"));
 
@@ -359,7 +359,7 @@ trash_empty_show_confirmation_dialog ()
                                                   _("If you choose to empty the trash, all items in "
                                                   "it will be permanently lost. Please note that "
                                                   "you can also delete them separately."));
-												
+
         gtk_dialog_add_button (GTK_DIALOG (trash_empty_confirm_dialog), GTK_STOCK_CANCEL,
                                GTK_RESPONSE_CANCEL);
 
@@ -367,12 +367,12 @@ trash_empty_show_confirmation_dialog ()
         gtk_widget_show (button);
         GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
 
-        gtk_dialog_add_action_widget (GTK_DIALOG (trash_empty_confirm_dialog), 
+        gtk_dialog_add_action_widget (GTK_DIALOG (trash_empty_confirm_dialog),
                                       button, GTK_RESPONSE_YES);
 
         gtk_dialog_set_default_response (GTK_DIALOG (trash_empty_confirm_dialog),
                                          GTK_RESPONSE_YES);
-	
+
         gtk_window_set_icon_name (GTK_WINDOW (trash_empty_confirm_dialog),
                                   "user-trash");
 



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