[totem] main: Fix opening files



commit ed8485f70d79e78126816a69bdf1bc186098f609
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Sep 3 00:16:31 2014 +0200

    main: Fix opening files
    
    Caused by the switch to D-Bus activation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=735935

 src/totem-object.c |   20 ++++++++++++++++++++
 src/totem.c        |    2 +-
 2 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/src/totem-object.c b/src/totem-object.c
index 59929b3..c607c1c 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -136,6 +136,25 @@ static int totem_table_signals[LAST_SIGNAL] = { 0 };
 
 G_DEFINE_TYPE(TotemObject, totem_object, GTK_TYPE_APPLICATION)
 
+static void
+totem_object_app_open (GApplication  *application,
+                      GFile        **files,
+                      gint           n_files,
+                      const char    *hint)
+{
+       GSList *slist = NULL;
+       int i;
+
+       totem_object_set_main_page (TOTEM_OBJECT (application), "player");
+
+       for (i = 0 ; i < n_files; i++)
+               slist = g_slist_prepend (slist, g_file_get_uri (files[i]));
+
+       slist = g_slist_reverse (slist);
+       totem_object_open_files_list (TOTEM_OBJECT (application), slist);
+       g_slist_free_full (slist, g_free);
+}
+
 static gboolean
 totem_object_local_command_line (GApplication              *application,
                                 gchar                   ***arguments,
@@ -221,6 +240,7 @@ totem_object_class_init (TotemObjectClass *klass)
        object_class->finalize = totem_object_finalize;
 
        app_class->local_command_line = totem_object_local_command_line;
+       app_class->open = totem_object_app_open;
 
        /**
         * TotemObject:fullscreen:
diff --git a/src/totem.c b/src/totem.c
index 7d1f687..6c3de0e 100644
--- a/src/totem.c
+++ b/src/totem.c
@@ -254,7 +254,7 @@ main (int argc, char **argv)
        /* Build the main Totem object */
        totem = g_object_new (TOTEM_TYPE_OBJECT,
                              "application-id", "org.gnome.Totem",
-                             "flags", G_APPLICATION_HANDLES_COMMAND_LINE,
+                             "flags", G_APPLICATION_HANDLES_COMMAND_LINE | G_APPLICATION_HANDLES_OPEN,
                              NULL);
        totem->settings = g_settings_new (TOTEM_GSETTINGS_SCHEMA);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]