1
0
mirror of https://github.com/dguglielmi/sunny-overlay.git synced 2025-12-06 22:32:37 +01:00
Files
sunny-overlay/media-video/totem/files/totem-3.14.2-0002-fix-doubling-files-added-on-the-cmd-line.patch
2015-05-03 14:25:06 +02:00

84 lines
2.7 KiB
Diff

From ea29374ebcdb0877832f6eeb61451571bb13bdc4 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 22 Apr 2015 13:28:38 +0200
Subject: main: Fix (again) doubling files added on the cmd line
When handling local command-line options, we would process all the
options and send them as "remote" commands through totem. But the
"remote-command" action would activate the application first. Thus we
would do something like:
- process command-line options in totem_object_app_handle_local_options()
which calls totem_options_process_for_server(), which sends out
"remote-command" actions
- when handling "remote-command", to make sure that the application is
actually ready, we call "activate".
- but we didn't clear the filenames struct member in optionstate, so we
process it again in "activate"
With help from Carlos Maddela <maddela@labyrinth.net.au>
https://bugzilla.gnome.org/show_bug.cgi?id=740995
diff --git a/src/totem-options.c b/src/totem-options.c
index f48bf74..daba578 100644
--- a/src/totem-options.c
+++ b/src/totem-options.c
@@ -78,11 +78,12 @@ totem_send_remote_command (Totem *totem,
}
void
-totem_options_process_for_server (Totem *totem,
- const TotemCmdLineOptions *options)
+totem_options_process_for_server (Totem *totem,
+ TotemCmdLineOptions *options)
{
TotemRemoteCommand action;
GList *commands, *l;
+ char **filenames;
int i;
commands = NULL;
@@ -103,12 +104,15 @@ totem_options_process_for_server (Totem *totem,
action = TOTEM_REMOTE_COMMAND_ENQUEUE;
}
+ filenames = options->filenames;
+ options->filenames = NULL;
+
/* Send the files to enqueue */
- for (i = 0; options->filenames && options->filenames[i] != NULL; i++) {
+ for (i = 0; filenames && filenames[i] != NULL; i++) {
const char *filename;
char *full_path;
- filename = options->filenames[i];
+ filename = filenames[i];
full_path = totem_create_full_path (filename);
totem_send_remote_command (totem, action, full_path ? full_path : filename);
@@ -122,6 +126,8 @@ totem_options_process_for_server (Totem *totem,
}
}
+ g_clear_pointer (&filenames, g_strfreev);
+
if (options->playpause) {
commands = g_list_append (commands, GINT_TO_POINTER
(TOTEM_REMOTE_COMMAND_PLAYPAUSE));
diff --git a/src/totem-options.h b/src/totem-options.h
index cdc3888..662b775 100644
--- a/src/totem-options.h
+++ b/src/totem-options.h
@@ -55,7 +55,7 @@ extern TotemCmdLineOptions optionstate;
void totem_options_register_remote_commands (Totem *totem);
void totem_options_process_for_server (Totem *totem,
- const TotemCmdLineOptions* options);
+ TotemCmdLineOptions* options);
G_END_DECLS
--
cgit v0.10.2