[totem] main: Fix (again) doubling files added on the cmd line
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] main: Fix (again) doubling files added on the cmd line
- Date: Wed, 22 Apr 2015 11:39:08 +0000 (UTC)
commit ea29374ebcdb0877832f6eeb61451571bb13bdc4
Author: Bastien Nocera <hadess hadess net>
Date: Wed Apr 22 13:28:38 2015 +0200
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
src/totem-options.c | 14 ++++++++++----
src/totem-options.h | 2 +-
2 files changed, 11 insertions(+), 5 deletions(-)
---
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]