[Xfce4-commits] <xfce4-fsguard-plugin:master> Set default values so that it doesnt crash at startup (bug #8821)

Landry Breuil noreply at xfce.org
Fri May 4 17:16:01 CEST 2012


Updating branch refs/heads/master
         to 661471acf727c1ee7ddd923ecc6f5dc20e3393b4 (commit)
       from 5e92d3696647932acbada5169d6319f3b422313f (commit)

commit 661471acf727c1ee7ddd923ecc6f5dc20e3393b4
Author: Landry Breuil <landry at xfce.org>
Date:   Fri May 4 16:37:32 2012 +0200

    Set default values so that it doesnt crash at startup (bug #8821)

 panel-plugin/fsguard.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/panel-plugin/fsguard.c b/panel-plugin/fsguard.c
index 1101657..0887101 100644
--- a/panel-plugin/fsguard.c
+++ b/panel-plugin/fsguard.c
@@ -323,15 +323,28 @@ fsguard_read_config (FsGuard *fsguard)
     char               *file;
     XfceRc             *rc;
 
-    file = xfce_panel_plugin_lookup_rc_file (fsguard->plugin);
+    /* prepare default values */
+    fsguard->seen               = FALSE;
+    fsguard->name               = g_strdup ("");
+    fsguard->show_name          = FALSE;
+    fsguard->path               = g_strdup ("/");
+    fsguard->show_size          = TRUE;
+    fsguard->show_progress_bar  = TRUE;
+    fsguard->hide_button        = FALSE;
+    fsguard->limit_warning      = 8;
+    fsguard->limit_urgent       = 2;
+
+    file = xfce_panel_plugin_lookup_rc_file(fsguard->plugin);
+    g_return_if_fail (file);
     DBG ("Lookup rc file `%s'", file);
     rc = xfce_rc_simple_open (file, TRUE);
     g_free (file);
     g_return_if_fail (rc);
 
-    fsguard->seen               = FALSE;
+    g_free (fsguard->name);
     fsguard->name               = g_strdup (xfce_rc_read_entry (rc, "label", ""));
     fsguard->show_name          = xfce_rc_read_bool_entry (rc, "label_visible", FALSE);
+    g_free (fsguard->path);
     fsguard->path               = g_strdup (xfce_rc_read_entry (rc, "mnt", "/"));
     fsguard->show_size          = xfce_rc_read_bool_entry (rc, "lab_size_visible", TRUE);
     fsguard->show_progress_bar  = xfce_rc_read_bool_entry (rc, "progress_bar_visible", TRUE);


More information about the Xfce4-commits mailing list