[Xfce4-commits] <xfce4-mount-plugin:master> Fix a whole bunchh of warnings with debug enabled

Landry Breuil noreply at xfce.org
Tue Apr 10 20:44:02 CEST 2012


Updating branch refs/heads/master
         to 48c3e827418716f18e1bcef43526ca77a36387b9 (commit)
       from a6d2c39bac72dcb20bc5199cfebae3d631f240e5 (commit)

commit 48c3e827418716f18e1bcef43526ca77a36387b9
Author: Landry Breuil <landry at xfce.org>
Date:   Tue Apr 10 20:28:31 2012 +0200

    Fix a whole bunchh of warnings with debug enabled
    
    - Fix use of xfce_dialog_show_error()
    - Use DBG() macros
    - Declare functions in devices.h

 panel-plugin/devices.c      |   40 +++++++++++++++-------------------------
 panel-plugin/devices.h      |   10 ++++++++++
 panel-plugin/mount-plugin.c |    9 ++++-----
 3 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/panel-plugin/devices.c b/panel-plugin/devices.c
index 101d7ec..e79e467 100644
--- a/panel-plugin/devices.c
+++ b/panel-plugin/devices.c
@@ -236,9 +236,7 @@ disk_mount (t_disk *pdisk, char *on_mount_cmd, char* mount_command, gboolean eje
     GError *error = NULL;
     gboolean val;
 
-    #ifdef DEBUG
-    g_printf ("disk_mount: eject=%d\n", eject);
-    #endif
+    DBG("disk_mount: eject=%d\n", eject);
 
     if (pdisk != NULL)
     {
@@ -262,13 +260,10 @@ disk_mount (t_disk *pdisk, char *on_mount_cmd, char* mount_command, gboolean eje
         else
             cmd = g_strconcat (cmd, " '", NULL);
 
-        #ifdef DEBUG
-        g_printf ("cmd: '%s'\n", cmd);
-        #endif
-
         val = xfce_spawn_command_line_on_screen(gdk_screen_get_default(), cmd, FALSE, TRUE, &error);
+        DBG("cmd: '%s', returned %d \n", tmp, val);
         if (!val)
-            xfce_dialog_show_error (NULL, error, g_strconcat ("%s Cause:%%s", _("Mount Plugin: Error executing command.")));
+            xfce_dialog_show_error (NULL, error, "%s", _("Mount Plugin: Error executing command."));
 
         g_free(cmd);
         g_free(tmp);
@@ -289,9 +284,7 @@ disk_umount (t_disk *pdisk, char* umount_command, gboolean synchronous, gboolean
     char *cmd;
     GError *error = NULL;
 
-    #ifdef DEBUG
-    g_printf ("disk_umount: eject=%d\n", eject);
-    #endif
+    DBG("disk_umount: eject=%d\n", eject);
 
 
     if (pdisk != NULL)
@@ -310,14 +303,11 @@ disk_umount (t_disk *pdisk, char* umount_command, gboolean synchronous, gboolean
         else
             tmp = g_strconcat (cmd, " '", NULL);
 
-        #ifdef DEBUG
-        g_printf ("cmd: '%s'\n", tmp);
-        #endif
-
         val = xfce_spawn_command_line_on_screen(gdk_screen_get_default(), tmp, FALSE, TRUE, &error);
+        DBG("cmd: '%s', returned %d \n", tmp, val);
 
         if  (!val) {
-            xfce_dialog_show_error (NULL, error, g_strconcat ("%s Cause:%%s", _("Mount Plugin: Error executing command.")));
+            xfce_dialog_show_error (NULL, error, "%s", _("Mount Plugin: Error executing command."));
             retval = ERROR;
         }
 
@@ -405,7 +395,7 @@ disks_new (gboolean include_NFSs, gboolean *showed_fstab_dialog)
 void
 disks_free (GPtrArray ** pdisks)
 {
-    int i ;
+    unsigned int i ;
     t_disk * pdisk ;
 
     if (*pdisks != NULL)
@@ -427,7 +417,7 @@ disks_free (GPtrArray ** pdisks)
 void
 disks_print (GPtrArray * pdisks)
 {
-    int i ;
+    unsigned int i ;
     for (i=0; i < pdisks->len ; i++)
     {
         disk_print (g_ptr_array_index(pdisks, i));
@@ -444,7 +434,7 @@ disks_print (GPtrArray * pdisks)
 gboolean
 disks_remove_device (GPtrArray * pdisks, char *device)
 {
-    int i;
+    unsigned int i;
     gpointer p=NULL;
 
     for (i=0; i < pdisks->len ; i++)
@@ -468,7 +458,7 @@ disks_remove_device (GPtrArray * pdisks, char *device)
 gboolean
 disks_remove_mountpoint (GPtrArray * pdisks, char *mountp)
 {
-    int i;
+    unsigned int i;
     gpointer p=NULL;
 
     for (i=0; i < pdisks->len ; i++)
@@ -492,7 +482,7 @@ disks_remove_mountpoint (GPtrArray * pdisks, char *mountp)
 t_disk *
 disks_search (GPtrArray * pdisks, char * mount_point)
 {
-    int i ;
+    unsigned int i ;
 
     for (i=0; i < pdisks->len ; i++)
     {
@@ -513,7 +503,7 @@ disks_search (GPtrArray * pdisks, char * mount_point)
 void
 disks_free_mount_info(GPtrArray * pdisks)
 {
-    int i ;
+    unsigned int i ;
 
     for (i=0; i < pdisks->len ; i++)
     {
@@ -530,7 +520,7 @@ disks_free_mount_info(GPtrArray * pdisks)
 gboolean
 exclude_filesystem (GPtrArray *excluded_FSs, gchar *mountpoint, gchar *device)
 {
-    int i;
+    unsigned int i;
 
     TRACE("Entering exclude_filesystems\n");
 
@@ -572,11 +562,11 @@ disks_refresh(GPtrArray * pdisks, GPtrArray *excluded_FSs)
     struct statfs * pstatfs = NULL;
     gboolean exclude =  FALSE;
 
-    TRACE("Entering disks_refresh\n");
-
     t_mount_info * mount_info;
     t_disk * pdisk ;
 
+    TRACE("Entering disks_refresh\n");
+
     /* remove t_mount_info for all devices */
     disks_free_mount_info (pdisks);
 
diff --git a/panel-plugin/devices.h b/panel-plugin/devices.h
index 22ebb08..f4d6f3a 100644
--- a/panel-plugin/devices.h
+++ b/panel-plugin/devices.h
@@ -199,6 +199,16 @@ t_deviceclass disk_classify (char* device, char *mountpoint);
  */
 gboolean disk_check_mounted (const char *disk);
 
+void mount_info_print(t_mount_info * mount_info);
+t_mount_info * mount_info_new (float size, float used, float avail, unsigned int percent, char * type, char * mounted_on);
+t_mount_info * mount_info_new_from_stat (struct statfs * pstatfs, char * mnt_type, char * mnt_dir);
+void mount_info_free(t_mount_info * * mount_info);
+void disk_print (t_disk * pdisk);
+char * shorten_disk_name (const char *dev);
+t_disk * disk_new (const char * dev, const char * mountpoint);
+void disk_free(t_disk **pdisk);
+void disks_free_mount_info(GPtrArray * pdisks);
+
 #endif /* _DEVICES_H_ */
 
 
diff --git a/panel-plugin/mount-plugin.c b/panel-plugin/mount-plugin.c
index 689b8ec..6f82345 100644
--- a/panel-plugin/mount-plugin.c
+++ b/panel-plugin/mount-plugin.c
@@ -93,7 +93,6 @@ on_activate_disk_display (GtkWidget *widget, t_disk * disk)
 static void
 mounter_set_size (XfcePanelPlugin *plugin, int size, t_mounter *mt)
 {
-   GtkWidget* image;
    /* shrink the gtk button's image to new size -*/
 #ifdef HAS_PANEL_49
    size /= xfce_panel_plugin_get_nrows (plugin);
@@ -136,7 +135,7 @@ format_LVM_name (const char *disk_device, gchar **formatted_diskname)
 static void
 disk_display_set_sizes (GPtrArray *array)
 {
-    int i, max_width_label_disk=0, max_width_label_mount_info=0, tmp;
+    unsigned int i, max_width_label_disk=0, max_width_label_mount_info=0, tmp;
     t_disk_display *disk_display;
 
     for (i=0; i<array->len; i++) {
@@ -298,15 +297,15 @@ mounter_free (XfcePanelPlugin *plugin, t_mounter *mounter)
 static void
 mounter_data_new (t_mounter *mt)
 {
-    TRACE ("enters mounter_data_new");
-
-    int i, res;
+    unsigned int i, res;
     t_disk * disk;
     t_disk_display * disk_display;
     GPtrArray *array =  NULL, *disk_displays = NULL;
     char *dev_mp; /* device or mountpoint */
     gboolean removed_device;
 
+    TRACE ("enters mounter_data_new");
+
     /* get static infos from /etc/fstab */
     mt->pdisks = disks_new (mt->include_NFSs, &(mt->showed_fstab_dialog));
 


More information about the Xfce4-commits mailing list