[totem] main: Postpone loading library after playback



commit 11af15829345b6baea8db1af99aa0f4ac20e6ca4
Author: Bastien Nocera <hadess hadess net>
Date:   Sun Aug 17 19:45:36 2014 +0200

    main: Postpone loading library after playback
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728716

 src/totem-grilo.c  |   15 ++++++++++++++-
 src/totem-grilo.h  |    1 +
 src/totem-object.c |    6 +++++-
 src/totem.c        |    2 ++
 4 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/totem-grilo.c b/src/totem-grilo.c
index ba12364..26616b5 100644
--- a/src/totem-grilo.c
+++ b/src/totem-grilo.c
@@ -63,6 +63,8 @@ struct _TotemGriloPrivate {
        Totem *totem;
        GtkWindow *main_window;
 
+       gboolean plugins_loaded;
+
        GrlSource *local_metadata_src;
        GrlSource *metadata_store_src;
        GrlSource *bookmarks_src;
@@ -2488,6 +2490,18 @@ totem_grilo_finalize (GObject *object)
        G_OBJECT_CLASS (totem_grilo_parent_class)->finalize (object);
 }
 
+void
+totem_grilo_start (TotemGrilo *self)
+{
+       if (self->priv->plugins_loaded)
+               return;
+
+       g_debug ("TotemGrilo: Loading plugins");
+
+       load_grilo_plugins (self);
+       self->priv->plugins_loaded = TRUE;
+}
+
 static void
 totem_grilo_constructed (GObject *object)
 {
@@ -2498,7 +2512,6 @@ totem_grilo_constructed (GObject *object)
        setup_ui (self);
        grl_init (0, NULL);
        setup_config (self);
-       load_grilo_plugins (self);
 }
 
 gboolean
diff --git a/src/totem-grilo.h b/src/totem-grilo.h
index dcabc2d..693511b 100644
--- a/src/totem-grilo.h
+++ b/src/totem-grilo.h
@@ -65,6 +65,7 @@ typedef enum{
 GType           totem_grilo_get_type              (void) G_GNUC_CONST;
 GtkWidget*      totem_grilo_new                   (TotemObject *totem,
                                                    GtkWidget   *header);
+void            totem_grilo_start                 (TotemGrilo  *self);
 void            totem_grilo_back_button_clicked   (TotemGrilo  *self);
 gboolean        totem_grilo_get_show_back_button  (TotemGrilo  *self);
 void            totem_grilo_set_current_page      (TotemGrilo     *self,
diff --git a/src/totem-object.c b/src/totem-object.c
index 2be564b..59929b3 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -914,8 +914,11 @@ void
 totem_object_set_main_page (TotemObject *totem,
                            const char  *page_id)
 {
-       if (g_strcmp0 (page_id, gtk_stack_get_visible_child_name (GTK_STACK (totem->stack))) == 0)
+       if (g_strcmp0 (page_id, gtk_stack_get_visible_child_name (GTK_STACK (totem->stack))) == 0) {
+               if (g_strcmp0 (page_id, "grilo") == 0)
+                       totem_grilo_start (TOTEM_GRILO (totem->grilo));
                return;
+       }
 
        gtk_stack_set_visible_child_full (GTK_STACK (totem->stack), page_id, GTK_STACK_TRANSITION_TYPE_NONE);
 
@@ -961,6 +964,7 @@ totem_object_set_main_page (TotemObject *totem,
                gtk_widget_hide (totem->gear_button);
                if (totem_grilo_get_current_page (TOTEM_GRILO (totem->grilo)) == TOTEM_GRILO_PAGE_RECENT)
                        gtk_widget_show (totem->add_button);
+               totem_grilo_start (TOTEM_GRILO (totem->grilo));
        }
 }
 
diff --git a/src/totem.c b/src/totem.c
index 8c4df1e..7d1f687 100644
--- a/src/totem.c
+++ b/src/totem.c
@@ -152,9 +152,11 @@ app_init (Totem *totem, char **argv)
        totem_object_plugins_init (totem);
 
        if (optionstate.filenames == NULL) {
+               totem_object_set_main_page (totem, "grilo");
                if (totem_session_try_restore (totem) == FALSE)
                        totem_object_set_mrl (totem, NULL, NULL);
        } else {
+               totem_object_set_main_page (totem, "player");
                if (totem_object_open_files (totem, optionstate.filenames))
                        totem_object_play_pause (totem);
                else


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