totem r5062 - in trunk: . src



Author: hadess
Date: Mon Feb  4 11:16:59 2008
New Revision: 5062
URL: http://svn.gnome.org/viewvc/totem?rev=5062&view=rev

Log:
2008-02-04  Bastien Nocera  <hadess hadess net>

	* src/totem-menu.c: (totem_recent_manager_changed_callback),
	(on_movie_menu_select): Trim the list before sorting it, a tiny
	bit faster (Closes: #514090)



Modified:
   trunk/ChangeLog
   trunk/src/totem-menu.c

Modified: trunk/src/totem-menu.c
==============================================================================
--- trunk/src/totem-menu.c	(original)
+++ trunk/src/totem-menu.c	Mon Feb  4 11:16:59 2008
@@ -580,7 +580,7 @@
 static void
 totem_recent_manager_changed_callback (GtkRecentManager *recent_manager, Totem *totem)
 {
-        GList *items, *l;
+        GList *items, *totem_items, *l;
         guint n_items = 0;
 
         if (totem->recent_ui_id != 0) {
@@ -602,10 +602,26 @@
 
         totem->recent_ui_id = gtk_ui_manager_new_merge_id (totem->ui_manager);
         items = gtk_recent_manager_get_items (recent_manager);
-        items = g_list_sort (items, (GCompareFunc) totem_compare_recent_items);
 
+	/* Remove the non-Totem items */
+	totem_items = NULL;
         for (l = items; l && l->data; l = l->next) {
                 GtkRecentInfo *info;
+
+                info = (GtkRecentInfo *) l->data;
+
+                if (gtk_recent_info_has_group (info, "Totem")) {
+                	gtk_recent_info_ref (info);
+                	totem_items = g_list_prepend (totem_items, info);
+		}
+	}
+	g_list_foreach (items, (GFunc) gtk_recent_info_unref, NULL);
+        g_list_free (items);
+
+        totem_items = g_list_sort (totem_items, (GCompareFunc) totem_compare_recent_items);
+
+        for (l = totem_items; l && l->data; l = l->next) {
+                GtkRecentInfo *info;
                 GtkAction     *action;
                 char           action_name[32];
                 const char    *display_name;
@@ -647,8 +663,8 @@
                         break;
         }
 
-        g_list_foreach (items, (GFunc) gtk_recent_info_unref, NULL);
-        g_list_free (items);
+        g_list_foreach (totem_items, (GFunc) gtk_recent_info_unref, NULL);
+        g_list_free (totem_items);
 }
 
 void



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