gnome-terminal r2515 - trunk/src



Author: chpe
Date: Thu Mar 20 10:15:58 2008
New Revision: 2515
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=2515&view=rev

Log:
Use g_hash_table_get_values, and add gtkdoc comment for terminal_profile_get_list().


Modified:
   trunk/src/terminal-profile.c

Modified: trunk/src/terminal-profile.c
==============================================================================
--- trunk/src/terminal-profile.c	(original)
+++ trunk/src/terminal-profile.c	Thu Mar 20 10:15:58 2008
@@ -2352,45 +2352,36 @@
   update_default_profile (name, locked);
 }
 
-static void
-listify_foreach (gpointer key,
-                 gpointer value,
-                 gpointer data)
-{
-  GList **listp = data;
-
-  *listp = g_list_prepend (*listp, value);
-}
-
 static int
 alphabetic_cmp (gconstpointer a,
                 gconstpointer b)
 {
-  int result;
-
   TerminalProfile *ap = (TerminalProfile*) a;
   TerminalProfile *bp = (TerminalProfile*) b;
+  int result;
 
   result =  g_utf8_collate (terminal_profile_get_visible_name (ap),
 			    terminal_profile_get_visible_name (bp));
-  if (!result)
+  if (result == 0)
     result = strcmp (terminal_profile_get_name (ap),
 		     terminal_profile_get_name (bp));
 
   return result;
 }
 
+/* FIXMEchpe: make this list contain ref'd objects */
+/**
+ * terminal_profile_get_list:
+ *
+ * Returns: a #GList containing all #TerminalProfile objects.
+ *   The content of the list is owned by the backend and
+ *   should not be modified or freed. Use g_list_free() when done
+ *   using the list.
+ */
 GList*
 terminal_profile_get_list (void)
 {
-  GList *list;
-
-  list = NULL;
-  g_hash_table_foreach (profiles, listify_foreach, &list);
-
-  list = g_list_sort (list, alphabetic_cmp);
-  
-  return list;
+  return g_list_sort (g_hash_table_get_values (profiles), alphabetic_cmp);
 }
 
 int



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