[totem] main: Pass remote commands through D-Bus
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] main: Pass remote commands through D-Bus
- Date: Mon, 20 Oct 2014 17:12:27 +0000 (UTC)
commit ad724cb1a9956b67adb30ec0482ae2d0b4524dd0
Author: Bastien Nocera <hadess hadess net>
Date: Mon Oct 20 17:27:04 2014 +0200
main: Pass remote commands through D-Bus
Instead of expecting us to be called from the primary instance.
src/totem-options.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/totem-options.c b/src/totem-options.c
index fc98ed5..f8d1fe5 100644
--- a/src/totem-options.c
+++ b/src/totem-options.c
@@ -98,6 +98,17 @@ totem_options_process_early (Totem *totem, const TotemCmdLineOptions* options)
}
}
+static void
+totem_send_remote_command (Totem *totem,
+ TotemRemoteCommand action,
+ const char *url)
+{
+ GVariant *variant;
+
+ variant = g_variant_new ("(is)", action, url ? url : "");
+ g_action_group_activate_action (G_ACTION_GROUP (totem), "remote-command", variant);
+}
+
void
totem_options_process_for_server (Totem *totem,
const TotemCmdLineOptions *options)
@@ -111,7 +122,7 @@ totem_options_process_for_server (Totem *totem,
/* Are we quitting ? */
if (options->quit) {
- totem_object_remote_command (totem, TOTEM_REMOTE_COMMAND_QUIT, NULL);
+ totem_send_remote_command (totem, TOTEM_REMOTE_COMMAND_QUIT, NULL);
return;
}
@@ -132,7 +143,7 @@ totem_options_process_for_server (Totem *totem,
filename = options->filenames[i];
full_path = totem_create_full_path (filename);
- totem_object_remote_command (totem, action, full_path ? full_path : filename);
+ totem_send_remote_command (totem, action, full_path ? full_path : filename);
g_free (full_path);
@@ -199,14 +210,15 @@ totem_options_process_for_server (Totem *totem,
}
/* No commands, no files, show ourselves */
- if (commands == NULL) {
- totem_object_remote_command (totem, TOTEM_REMOTE_COMMAND_SHOW, NULL);
+ if (commands == NULL &&
+ !(g_application_get_flags (G_APPLICATION (totem)) & G_APPLICATION_IS_SERVICE)) {
+ totem_send_remote_command (totem, TOTEM_REMOTE_COMMAND_SHOW, NULL);
return;
}
/* Send commands */
for (l = commands; l != NULL; l = l->next) {
- totem_object_remote_command (totem, GPOINTER_TO_INT (l->data), NULL);
+ totem_send_remote_command (totem, GPOINTER_TO_INT (l->data), NULL);
}
g_list_free (commands);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]