[Xfce4-commits] <terminal:master> Use static pspec array for saving too.

Nick Schermer noreply at xfce.org
Tue Dec 25 13:58:01 CET 2012


Updating branch refs/heads/master
         to 126473abd20151e755034ee2e842ba10c67d9c4a (commit)
       from 8b7f1c2cdb89a6ba003aae5c397e5b43a8e30f5b (commit)

commit 126473abd20151e755034ee2e842ba10c67d9c4a
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Dec 25 13:57:14 2012 +0100

    Use static pspec array for saving too.

 terminal/terminal-preferences.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index 5010f25..5caaf0d 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -1113,11 +1113,10 @@ terminal_preferences_store_idle (gpointer user_data)
 {
   TerminalPreferences  *preferences = TERMINAL_PREFERENCES (user_data);
   const gchar          *blurb;
-  GParamSpec          **pspecs, *pspec;
+  GParamSpec           *pspec;
   XfceRc               *rc = NULL;
   GValue               *value;
   GValue                src = { 0, };
-  guint                 nspecs;
   guint                 n;
   gchar                *filename;
 
@@ -1135,18 +1134,17 @@ terminal_preferences_store_idle (gpointer user_data)
 
   xfce_rc_set_group (rc, "Configuration");
 
-  pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (preferences), &nspecs);
-  for (n = 0; n < nspecs; ++n)
+  for (n = PROP_0 + 1; n < N_PROPERTIES; ++n)
     {
-      pspec = pspecs[n];
-      value = preferences->values + (n + 1);
+      pspec = preferences_props[n];
+      value = preferences->values + n;
       blurb = g_param_spec_get_blurb (pspec);
 
-      if (G_IS_VALUE (value) && !g_param_value_defaults (pspec, value))
+      if (G_IS_VALUE (value)
+          && !g_param_value_defaults (pspec, value))
         {
-          /* store the value non-default value */
+          /* always save non-default values */
           terminal_preferences_store_value (value, blurb, rc);
-
           continue;
         }
 
@@ -1164,7 +1162,6 @@ terminal_preferences_store_idle (gpointer user_data)
           xfce_rc_delete_entry (rc, blurb, FALSE);
         }
     }
-  g_free (pspecs);
 
   /* check if verything has been written */
   xfce_rc_flush (rc);


More information about the Xfce4-commits mailing list