GNOME Bugzilla – Bug 394096
Clean up recent files additions
Last modified: 2007-01-09 23:22:58 UTC
There could be some code saved, between totem_action_add_recent() and totem_action_add_recent_stream(). Also make sure that remote files are added to "TotemStreams", when opened on the command-line, so they show up in the "Open URL" dialogue.
Created attachment 79741 [details] [review] Cleanup patch Combine totem_action_add_recent() and totem_action_add_recent_streams(), and make sure all opened streams are tagged with "TotemStreams".
Comment on attachment 79741 [details] [review] Cleanup patch >Index: src/totem-menu.c >=================================================================== >--- src/totem-menu.c (revision 3832) >+++ src/totem-menu.c (working copy) >@@ -493,7 +493,7 @@ > totem->recent_action_group = gtk_action_group_new ("recent-action-group"); > gtk_ui_manager_insert_action_group (totem->ui_manager, > totem->recent_action_group, -1); >- >+ > items = gtk_recent_manager_get_items (recent_manager); > items = g_list_sort (items, (GCompareFunc) totem_compare_recent_items); > >@@ -502,6 +502,7 @@ > GtkAction *action; > gchar *action_name; > gchar *label; >+ const gchar *uri; Use char *, not gchar (not sure why those are gchars already...). >@@ -509,7 +510,11 @@ > continue; > > action_name = g_strdup_printf ("recent-file%u", i++); >- label = g_strdup_printf ("_%d. %s", n_items + 1, >+ uri = gtk_recent_info_get_uri (info); >+ if (strstr (uri, "file:///") == NULL) >+ label = g_strdup_printf ("_%d. %s", n_items + 1, uri); Have you tested this with a *long* URL? Doesn't it make the menu really wide? >+ else If you have multi-lines options for an if, please use braces. >+ label = g_strdup_printf ("_%d. %s", n_items + 1, > gtk_recent_info_get_display_name (info)); > > action = g_object_new (GTK_TYPE_ACTION, >@@ -564,17 +569,22 @@ > totem_action_add_recent (Totem *totem, const char *filename) > { > GtkRecentData data; >- char *groups[] = { "Totem", NULL }; >- char *display; >+ char *groups[] = { "Totem", NULL, NULL }; > >- if (strstr (filename, "file:///") == NULL) >- return; >+ if (strstr (filename, "file:///") == NULL) { >+ /* It's a URI/stream */ >+ groups[1] = "TotemStreams"; >+ data.display_name = NULL; >+ } >+ else { closing brace and else on the same line please.
Created attachment 79879 [details] [review] Modifications made Fixed formatting issues, and added functionality to truncate menu item lengths where necessary. Any recent file in the menu would've stretched it, so I've added truncation to all.
I changed this so the remote files don't show up in the "Movie" menu, but only in the "Open URL" dialogue. 2007-01-09 Bastien Nocera <hadess@hadess.net> * src/totem-menu.c: (totem_str_middle_truncate), (totem_recent_manager_changed_callback), (totem_action_add_recent): * src/totem-menu.h: * src/totem.c: (totem_action_open_location): Patch from Philip Withnall <bugzilla@tecnocode.co.uk> to make sure remote streams launched on the command-line appear in the "Open URL" dialogue (Closes: #394096)