After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 394096 - Clean up recent files additions
Clean up recent files additions
Status: RESOLVED FIXED
Product: totem
Classification: Core
Component: Movie player
2.17.x
Other Linux
: Normal normal
: ---
Assigned To: General Totem maintainer(s)
General Totem maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2007-01-08 00:36 UTC by Bastien Nocera
Modified: 2007-01-09 23:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Cleanup patch (3.77 KB, patch)
2007-01-08 12:29 UTC, Philip Withnall
needs-work Details | Review
Modifications made (6.40 KB, patch)
2007-01-09 19:44 UTC, Philip Withnall
none Details | Review

Description Bastien Nocera 2007-01-08 00:36:15 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.
Comment 1 Philip Withnall 2007-01-08 12:29:32 UTC
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 2 Bastien Nocera 2007-01-09 16:04:11 UTC
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.
Comment 3 Philip Withnall 2007-01-09 19:44:41 UTC
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.
Comment 4 Bastien Nocera 2007-01-09 23:22:58 UTC
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)