[Xfce4-commits] <mousepad:master> Cleanup colour scheme util functions a bit.

Matthew Brush noreply at xfce.org
Sat May 5 21:31:49 CEST 2012


Updating branch refs/heads/master
         to 66a2d472174195507aa00ae8287ff4c1b62c6604 (commit)
       from 5d74b7018dd0f821f6f37a0293868466a9b836b3 (commit)

commit 66a2d472174195507aa00ae8287ff4c1b62c6604
Author: Matthew Brush <matt at xfce.org>
Date:   Thu Oct 6 01:35:14 2011 -0700

    Cleanup colour scheme util functions a bit.

 mousepad/mousepad-util.c   |   17 +++++++++++++----
 mousepad/mousepad-util.h   |    2 ++
 mousepad/mousepad-window.c |    2 +-
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/mousepad/mousepad-util.c b/mousepad/mousepad-util.c
index 31bac40..05ed8af 100644
--- a/mousepad/mousepad-util.c
+++ b/mousepad/mousepad-util.c
@@ -1078,9 +1078,9 @@ mousepad_util_color_schemes_name_compare (gconstpointer a,
 {
   const gchar *name_a, *name_b;
 
-  if (G_UNLIKELY (!a))
+  if (G_UNLIKELY (!GTK_IS_SOURCE_STYLE_SCHEME (a)))
     return -(a != b);
-  if (G_UNLIKELY (!b))
+  if (G_UNLIKELY (!GTK_IS_SOURCE_STYLE_SCHEME (b)))
     return a != b;
 
   name_a = gtk_source_style_scheme_get_name (GTK_SOURCE_STYLE_SCHEME (a));
@@ -1092,7 +1092,7 @@ mousepad_util_color_schemes_name_compare (gconstpointer a,
 
 
 GSList *
-mousepad_util_color_schemes_get_sorted (void)
+mousepad_util_color_schemes_get (void)
 {
   GSList               *list = NULL;
   const gchar * const  *schemes;
@@ -1109,7 +1109,16 @@ mousepad_util_color_schemes_get_sorted (void)
       schemes++;
     }
 
-  return g_slist_sort (list, mousepad_util_color_schemes_name_compare);
+  return list;
+}
+
+
+
+GSList *
+mousepad_util_color_schemes_get_sorted (void)
+{
+  return g_slist_sort (mousepad_util_color_schemes_get (),
+                       mousepad_util_color_schemes_name_compare);
 }
 
 
diff --git a/mousepad/mousepad-util.h b/mousepad/mousepad-util.h
index 539e11e..dbafd81 100644
--- a/mousepad/mousepad-util.h
+++ b/mousepad/mousepad-util.h
@@ -122,6 +122,8 @@ gint       mousepad_util_search                           (GtkTextBuffer       *
 gint       mousepad_util_color_schemes_name_compare       (gconstpointer        a,
                                                            gconstpointer        b);
 
+GSList    *mousepad_util_color_schemes_get                (void);
+
 GSList    *mousepad_util_color_schemes_get_sorted         (void);
 
 gint       mousepad_util_languages_name_compare           (gconstpointer        a,
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index e2d51db..313ec76 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -4428,7 +4428,7 @@ mousepad_window_action_color_scheme (GtkToggleAction *action,
       if (scheme_id_hash != g_str_hash ("none"))
         {
           /* lookup the scheme from the id hash */
-          schemes = mousepad_util_color_schemes_get_sorted ();
+          schemes = mousepad_util_color_schemes_get ();
           for (iter = schemes; iter != NULL; iter = g_slist_next (iter))
             {
               if (scheme_id_hash == g_str_hash (gtk_source_style_scheme_get_id (iter->data)))


More information about the Xfce4-commits mailing list