[totem] grilo: Move grilo plugin to the core



commit 172eda6fc83820d02fc12ef62672f4da77ebd7cd
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jan 30 13:02:45 2014 +0100

    grilo: Move grilo plugin to the core

 configure.ac                                      |   13 +--
 po/POTFILES.in                                    |   11 +-
 src/Makefile.am                                   |   23 +++-
 src/{plugins/grilo => }/grilo.gresource.xml       |    0
 src/{plugins/grilo => }/grilo.ui                  |    0
 src/{plugins/grilo => }/icon-helpers.c            |    0
 src/{plugins/grilo => }/icon-helpers.h            |    0
 src/plugins/grilo/Makefile.am                     |   46 ------
 src/plugins/grilo/grilo.plugin.in                 |    9 -
 src/{plugins/grilo => }/totem-grilo.c             |  174 ++++++++++----------
 src/{plugins/grilo => }/totem-grilo.conf          |    0
 src/{plugins/grilo => }/totem-main-toolbar.c      |    0
 src/{plugins/grilo => }/totem-main-toolbar.h      |    0
 src/totem-object.c                                |   11 ++
 src/totem-private.h                               |    3 +
 src/{plugins/grilo => }/totem-search-entry.c      |    0
 src/{plugins/grilo => }/totem-search-entry.h      |    0
 src/{plugins/grilo => }/totem-selection-toolbar.c |    0
 src/{plugins/grilo => }/totem-selection-toolbar.h |    0
 src/totem.c                                       |    1 +
 src/{plugins/grilo => }/totemmaintoolbar.ui       |    0
 src/{plugins/grilo => }/totemselectiontoolbar.ui  |    0
 22 files changed, 131 insertions(+), 160 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 72c48cd..81e102a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,7 +80,7 @@ AC_SUBST(TOTEM_API_VERSION)
 AC_DEFINE_UNQUOTED(TOTEM_API_VERSION, ["$TOTEM_API_VERSION"], [Define to the Totem plugin API version])
 
 # The full list of plugins
-allowed_plugins="apple-trailers autoload-subtitles brasero-disc-recorder chapters dbusservice im-status 
gromit lirc media-player-keys ontop opensubtitles properties pythonconsole recent rotation save-file 
samplepython sample-vala screensaver screenshot skipto zeitgeist-dp grilo vimeo"
+allowed_plugins="apple-trailers autoload-subtitles brasero-disc-recorder chapters dbusservice im-status 
gromit lirc media-player-keys ontop opensubtitles properties pythonconsole recent rotation save-file 
samplepython sample-vala screensaver screenshot skipto zeitgeist-dp vimeo"
 
 PLUGINDIR='${libdir}/totem/plugins'
 AC_SUBST(PLUGINDIR)
@@ -235,7 +235,7 @@ AM_CONDITIONAL([ENABLE_PYTHON],[test "x$enable_python" = "xyes"])
 # Player requirements
 #================================================================
 
-PKG_CHECK_MODULES(PLAYER, $BACKEND_MODULES glib-2.0 >= $GLIB_REQS gio-2.0 >= $GIO_REQS gtk+-3.0 >= $GTK_REQS 
gdk-x11-3.0 >= $GTK_REQS gmodule-2.0 totem-plparser >= $TOTEM_PLPARSER_REQS libpeas-1.0 >= $PEAS_REQS 
libpeas-gtk-1.0 >= $PEAS_REQS $PYTHON_MODULES)
+PKG_CHECK_MODULES(PLAYER, $BACKEND_MODULES glib-2.0 >= $GLIB_REQS gio-2.0 >= $GIO_REQS gtk+-3.0 >= $GTK_REQS 
gdk-x11-3.0 >= $GTK_REQS gmodule-2.0 totem-plparser >= $TOTEM_PLPARSER_REQS libpeas-1.0 >= $PEAS_REQS 
libpeas-gtk-1.0 >= $PEAS_REQS $PYTHON_MODULES grilo-0.2 >= $GRILO_REQS)
 PKG_CHECK_MODULES(LIBPLAYER, glib-2.0 >= $GLIB_REQS gio-2.0 >= $GIO_REQS gtk+-3.0 >= $GTK_REQS gdk-x11-3.0 
= $GTK_REQS clutter-gtk-1.0)
 PKG_CHECK_MODULES(HELPER, gstreamer-1.0 gstreamer-tag-1.0)
 PKG_CHECK_MODULES(TIME_HELPER, glib-2.0)
@@ -435,14 +435,6 @@ for plugin in ${used_plugins}; do
                                fi
                        fi
                ;;
-               grilo)
-                       PKG_CHECK_MODULES(LIBGRILO, grilo-0.2 >= $GRILO_REQS,
-                               [HAVE_LIBGRILO=yes], [HAVE_LIBGRILO=no])
-                       if test "${HAVE_LIBGRILO}" != "yes" ; then
-                               plugin_error "you need libgrilo >= $GRILO_REQS installed for the Grilo plugin"
-                               add_plugin="0"
-                       fi
-               ;;
        esac
 
        # Add the specified plugin
@@ -683,7 +675,6 @@ src/plugins/pythonconsole/org.gnome.totem.plugins.pythonconsole.gschema.xml.in
 src/plugins/brasero-disc-recorder/Makefile
 src/plugins/chapters/Makefile
 src/plugins/zeitgeist-dp/Makefile
-src/plugins/grilo/Makefile
 src/plugins/vimeo/Makefile
 src/backend/Makefile
 browser-plugin/Makefile
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4917712..8999055 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -43,12 +43,11 @@ src/plugins/chapters/totem-cmml-parser.c
 src/plugins/chapters/totem-edit-chapter.c
 [type: gettext/ini]src/plugins/dbusservice/dbusservice.plugin.in
 src/plugins/dbusservice/dbusservice.py
-[type: gettext/ini]src/plugins/grilo/grilo.plugin.in
-[type: gettext/glade]src/plugins/grilo/grilo.ui
-src/plugins/grilo/totem-grilo.c
-src/plugins/grilo/totem-main-toolbar.c
-[type: gettext/glade]src/plugins/grilo/totemmaintoolbar.ui
-[type: gettext/glade]src/plugins/grilo/totemselectiontoolbar.ui
+[type: gettext/glade]src/grilo.ui
+src/totem-grilo.c
+src/totem-main-toolbar.c
+[type: gettext/glade]src/totemmaintoolbar.ui
+[type: gettext/glade]src/totemselectiontoolbar.ui
 [type: gettext/ini]src/plugins/gromit/gromit.plugin.in
 src/plugins/gromit/totem-gromit.c
 src/plugins/im-status/totem-im-status.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 990a83b..03391db 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -52,6 +52,16 @@ libtotem_player_la_CFLAGS =  \
        $(AM_CFLAGS)
 
 # Totem main library (used for main player; separate to allow gtk-doc to be used)
+BUILT_SOURCES = griloresources.h griloresources.c
+EXTRA_DIST = grilo.gresource.xml totemmaintoolbar.ui totemselectiontoolbar.ui grilo.ui totem-grilo.conf
+
+griloresources.h: grilo.gresource.xml
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/grilo.gresource.xml \
+               --target=$@ --sourcedir=$(srcdir) --c-name _totem --generate-header
+griloresources.c: $(EXTRA_DIST) griloresources.h
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/grilo.gresource.xml \
+               --target=$@ --sourcedir=$(srcdir) --c-name _totem --generate-source
+
 libtotem_la_SOURCES = \
        $(TOTEM_MARSHAL_FILES)          \
        $(INST_H_FILES)                 \
@@ -78,7 +88,18 @@ libtotem_la_SOURCES = \
        totem-profile.h                 \
        plugins/totem-plugins-engine.c  \
        plugins/totem-plugins-engine.h  \
-       plugins/totem-dirs.c
+       plugins/totem-dirs.c            \
+       totem-grilo.c                   \
+       totem-search-entry.c            \
+       totem-search-entry.h            \
+       totem-main-toolbar.h            \
+       totem-main-toolbar.c            \
+       totem-selection-toolbar.h       \
+       totem-selection-toolbar.c       \
+       icon-helpers.c                  \
+       icon-helpers.h                  \
+       griloresources.h                \
+       griloresources.c
 
 libtotem_la_CPPFLAGS = \
        -I$(top_builddir)/data          \
diff --git a/src/plugins/grilo/grilo.gresource.xml b/src/grilo.gresource.xml
similarity index 100%
rename from src/plugins/grilo/grilo.gresource.xml
rename to src/grilo.gresource.xml
diff --git a/src/plugins/grilo/grilo.ui b/src/grilo.ui
similarity index 100%
rename from src/plugins/grilo/grilo.ui
rename to src/grilo.ui
diff --git a/src/plugins/grilo/icon-helpers.c b/src/icon-helpers.c
similarity index 100%
rename from src/plugins/grilo/icon-helpers.c
rename to src/icon-helpers.c
diff --git a/src/plugins/grilo/icon-helpers.h b/src/icon-helpers.h
similarity index 100%
rename from src/plugins/grilo/icon-helpers.h
rename to src/icon-helpers.h
diff --git a/src/plugins/grilo/totem-grilo.c b/src/totem-grilo.c
similarity index 93%
rename from src/plugins/grilo/totem-grilo.c
rename to src/totem-grilo.c
index ad56799..c316342 100644
--- a/src/plugins/grilo/totem-grilo.c
+++ b/src/totem-grilo.c
@@ -35,12 +35,6 @@
 #include <glib/gi18n-lib.h>
 #include <grilo.h>
 
-#include <libpeas/peas-extension-base.h>
-#include <libpeas/peas-object-module.h>
-#include <libpeas/peas-activatable.h>
-#include <libpeas-gtk/peas-gtk-configurable.h>
-
-#include <totem-plugin.h>
 #include <totem-interface.h>
 #include <totem-dirs.h>
 #include <totem.h>
@@ -49,30 +43,18 @@
 #include <totem-time-helpers.h>
 #include <totem-rtl-helpers.h>
 
+#include "totem-grilo.h"
 #include "totem-search-entry.h"
 #include "totem-main-toolbar.h"
 #include "totem-selection-toolbar.h"
 #include <libgd/gd.h>
 
-#define TOTEM_TYPE_GRILO_PLUGIN                                         \
-       (totem_grilo_plugin_get_type ())
-#define TOTEM_GRILO_PLUGIN(o)                                           \
-       (G_TYPE_CHECK_INSTANCE_CAST ((o), TOTEM_TYPE_GRILO_PLUGIN, TotemGriloPlugin))
-#define TOTEM_GRILO_PLUGIN_CLASS(k)                                     \
-       (G_TYPE_CHECK_CLASS_CAST((k), TOTEM_TYPE_GRILO_PLUGIN, TotemGriloPluginClass))
-#define TOTEM_IS_GRILO_PLUGIN(o)                                        \
-       (G_TYPE_CHECK_INSTANCE_TYPE ((o), TOTEM_TYPE_GRILO_PLUGIN))
-#define TOTEM_IS_GRILO_PLUGIN_CLASS(k)                                  \
-       (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_GRILO_PLUGIN))
-#define TOTEM_GRILO_PLUGIN_GET_CLASS(o)                                 \
-       (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_GRILO_PLUGIN, TotemGriloPluginClass))
-
 #define BROWSE_FLAGS          (GRL_RESOLVE_FAST_ONLY | GRL_RESOLVE_IDLE_RELAY)
 #define RESOLVE_FLAGS         (GRL_RESOLVE_FULL | GRL_RESOLVE_IDLE_RELAY)
 #define PAGE_SIZE             50
 #define SCROLL_GET_MORE_LIMIT 0.8
 
-typedef struct {
+struct _TotemGriloPrivate {
        Totem *totem;
        GtkWindow *main_window;
 
@@ -115,18 +97,19 @@ typedef struct {
        /* Selection toolbar */
        GtkWidget *selection_bar;
        GtkWidget *selection_revealer;
-} TotemGriloPluginPrivate;
+};
 
-TOTEM_PLUGIN_REGISTER (TOTEM_TYPE_GRILO_PLUGIN, TotemGriloPlugin, totem_grilo_plugin)
+G_DEFINE_TYPE_WITH_CODE (TotemGrilo, totem_grilo, GTK_TYPE_WIDGET,
+                         G_ADD_PRIVATE (TotemGrilo));
 
 typedef struct {
-       TotemGriloPlugin *totem_grilo;
+       TotemGrilo *totem_grilo;
        GtkTreeRowReference *ref_parent;
        GtkTreeModel *model;
 } BrowseUserData;
 
 typedef struct {
-       TotemGriloPlugin *totem_grilo;
+       TotemGrilo *totem_grilo;
        GrlMedia *media;
        GrlSource *source;
        GtkTreeModel *model;
@@ -299,7 +282,7 @@ out:
 }
 
 static void
-set_thumbnail_async (TotemGriloPlugin *self,
+set_thumbnail_async (TotemGrilo *self,
                     GrlMedia         *media,
                     GtkTreeModel     *model,
                     GtkTreePath      *path)
@@ -318,7 +301,7 @@ set_thumbnail_async (TotemGriloPlugin *self,
 }
 
 static void
-set_thumbnail_source_async (TotemGriloPlugin *self,
+set_thumbnail_source_async (TotemGrilo *self,
                            GrlSource        *source,
                            GtkTreeModel     *model,
                            GtkTreePath      *path)
@@ -337,7 +320,7 @@ set_thumbnail_source_async (TotemGriloPlugin *self,
 }
 
 static gboolean
-update_search_thumbnails_idle (TotemGriloPlugin *self)
+update_search_thumbnails_idle (TotemGrilo *self)
 {
        GtkTreePath *start_path;
        GtkTreePath *end_path;
@@ -409,7 +392,7 @@ update_search_thumbnails_idle (TotemGriloPlugin *self)
 }
 
 static void
-update_search_thumbnails (TotemGriloPlugin *self)
+update_search_thumbnails (TotemGrilo *self)
 {
        g_idle_add ((GSourceFunc) update_search_thumbnails_idle, self);
 }
@@ -445,7 +428,7 @@ update_media (GtkTreeStore *model,
 }
 
 static void
-add_local_metadata (TotemGriloPlugin *self,
+add_local_metadata (TotemGrilo *self,
                    GrlMedia         *media)
 {
        GrlOperationOptions *options;
@@ -532,7 +515,7 @@ browse_cb (GrlSource *source,
            const GError *error)
 {
        BrowseUserData *bud;
-       TotemGriloPlugin *self;
+       TotemGrilo *self;
        GtkTreeIter parent;
        GtkWindow *window;
        guint remaining_expected;
@@ -590,7 +573,7 @@ browse_cb (GrlSource *source,
 }
 
 static void
-browse (TotemGriloPlugin *self,
+browse (TotemGrilo *self,
        GtkTreeModel     *model,
         GtkTreePath      *path,
         GrlSource        *source,
@@ -633,7 +616,7 @@ browse (TotemGriloPlugin *self,
 }
 
 static void
-play (TotemGriloPlugin *self,
+play (TotemGrilo *self,
       GrlSource *source,
       GrlMedia *media,
       gboolean resolve_url)
@@ -668,9 +651,9 @@ search_cb (GrlSource *source,
            const GError *error)
 {
        GtkWindow *window;
-       TotemGriloPlugin *self;
+       TotemGrilo *self;
 
-       self = TOTEM_GRILO_PLUGIN (user_data);
+       self = TOTEM_GRILO (user_data);
 
        if (error != NULL &&
            g_error_matches (error,
@@ -705,7 +688,7 @@ search_cb (GrlSource *source,
 }
 
 static GrlOperationOptions *
-get_search_options (TotemGriloPlugin *self)
+get_search_options (TotemGrilo *self)
 {
        GrlOperationOptions *default_options;
        GrlOperationOptions *supported_options;
@@ -727,7 +710,7 @@ get_search_options (TotemGriloPlugin *self)
 }
 
 static void
-search_more (TotemGriloPlugin *self)
+search_more (TotemGrilo *self)
 {
        GrlOperationOptions *search_options;
 
@@ -763,7 +746,7 @@ search_more (TotemGriloPlugin *self)
 }
 
 static void
-search (TotemGriloPlugin *self, GrlSource *source, const gchar *text)
+search (TotemGrilo *self, GrlSource *source, const gchar *text)
 {
        gtk_tree_store_clear (GTK_TREE_STORE (self->priv->search_results_model));
 //     g_hash_table_remove_all (self->priv->cache_thumbnails);
@@ -779,7 +762,7 @@ search (TotemGriloPlugin *self, GrlSource *source, const gchar *text)
 }
 
 static void
-search_entry_activate_cb (GtkEntry *entry, TotemGriloPlugin *self)
+search_entry_activate_cb (GtkEntry *entry, TotemGrilo *self)
 {
        GrlRegistry *registry;
        const char *id;
@@ -804,7 +787,7 @@ search_entry_activate_cb (GtkEntry *entry, TotemGriloPlugin *self)
 }
 
 static void
-set_browser_filter_model_for_path (TotemGriloPlugin *self,
+set_browser_filter_model_for_path (TotemGrilo *self,
                                   GtkTreePath      *path)
 {
        g_clear_object (&self->priv->browser_filter_model);
@@ -844,7 +827,7 @@ browser_activated_cb (GdMainView  *view,
        GtkTreeIter iter;
        GrlMedia *content;
        GrlSource *source;
-       TotemGriloPlugin *self = TOTEM_GRILO_PLUGIN (user_data);
+       TotemGrilo *self = TOTEM_GRILO (user_data);
        GtkTreeIter real_model_iter;
        GtkTreePath *treepath;
 
@@ -888,7 +871,7 @@ free_data:
 static void
 search_entry_source_changed_cb (GObject          *object,
                                 GParamSpec       *pspec,
-                                TotemGriloPlugin *self)
+                                TotemGrilo *self)
 {
        /* FIXME: Do we actually want to do that? */
        if (self->priv->search_id > 0) {
@@ -915,7 +898,7 @@ search_activated_cb (GdMainView  *view,
                            MODEL_RESULTS_CONTENT, &content,
                            -1);
 
-       play (TOTEM_GRILO_PLUGIN (user_data), source, content, TRUE);
+       play (TOTEM_GRILO (user_data), source, content, TRUE);
 
        g_clear_object (&source);
        g_clear_object (&content);
@@ -927,7 +910,7 @@ item_activated_cb (GdMainView  *view,
                   GtkTreePath *path,
                   gpointer user_data)
 {
-       TotemGriloPlugin *self = TOTEM_GRILO_PLUGIN (user_data);
+       TotemGrilo *self = TOTEM_GRILO (user_data);
        GtkTreeModel *model;
 
        model = gd_main_view_get_model (view);
@@ -1046,7 +1029,7 @@ find_media (GtkTreeModel *model,
 }
 
 static GtkTreeModel *
-get_tree_model_for_source (TotemGriloPlugin *self,
+get_tree_model_for_source (TotemGrilo *self,
                           GrlSource        *source)
 {
        const char *id;
@@ -1061,7 +1044,7 @@ get_tree_model_for_source (TotemGriloPlugin *self,
 }
 
 static void
-content_changed (TotemGriloPlugin   *self,
+content_changed (TotemGrilo   *self,
                 GrlSource          *source,
                 GPtrArray          *changed_medias)
 {
@@ -1080,7 +1063,7 @@ content_changed (TotemGriloPlugin   *self,
 }
 
 static void
-content_removed (TotemGriloPlugin   *self,
+content_removed (TotemGrilo   *self,
                 GrlSource          *source,
                 GPtrArray          *changed_medias)
 {
@@ -1099,7 +1082,7 @@ content_removed (TotemGriloPlugin   *self,
 }
 
 static void
-content_added (TotemGriloPlugin   *self,
+content_added (TotemGrilo   *self,
               GrlSource          *source,
               GPtrArray          *changed_medias)
 {
@@ -1124,7 +1107,7 @@ content_changed_cb (GrlSource          *source,
                    GPtrArray          *changed_medias,
                    GrlSourceChangeType change_type,
                    gboolean            location_unknown,
-                   TotemGriloPlugin   *self)
+                   TotemGrilo   *self)
 {
        switch (change_type) {
        case GRL_CONTENT_CHANGED:
@@ -1149,7 +1132,7 @@ source_added_cb (GrlRegistry *registry,
                  gpointer user_data)
 {
        const gchar *name;
-       TotemGriloPlugin *self;
+       TotemGrilo *self;
        GrlSupportedOps ops;
        const char *id;
 
@@ -1161,7 +1144,7 @@ source_added_cb (GrlRegistry *registry,
                return;
        }
 
-       self = TOTEM_GRILO_PLUGIN (user_data);
+       self = TOTEM_GRILO (user_data);
        id = grl_source_get_id (source);
        if (g_str_equal (id, "grl-tracker-source"))
                name = _("Local");
@@ -1240,7 +1223,7 @@ source_removed_cb (GrlRegistry *registry,
                    gpointer user_data)
 {
        GrlSupportedOps ops;
-       TotemGriloPlugin *self = TOTEM_GRILO_PLUGIN (user_data);
+       TotemGrilo *self = TOTEM_GRILO (user_data);
 
        ops = grl_source_supported_operations (source);
 
@@ -1267,7 +1250,7 @@ source_removed_cb (GrlRegistry *registry,
 }
 
 static void
-load_grilo_plugins (TotemGriloPlugin *self)
+load_grilo_plugins (TotemGrilo *self)
 {
        GrlRegistry *registry;
        GError *error = NULL;
@@ -1286,7 +1269,7 @@ load_grilo_plugins (TotemGriloPlugin *self)
 }
 
 static void
-unload_grilo_plugins (TotemGriloPlugin *self)
+unload_grilo_plugins (TotemGrilo *self)
 {
        GrlRegistry *registry;
        GList *l, *plugins;
@@ -1314,14 +1297,14 @@ adjustment_over_limit (GtkAdjustment *adjustment)
 
 static void
 adjustment_changed_cb (GtkAdjustment *adjustment,
-                       TotemGriloPlugin *self)
+                       TotemGrilo *self)
 {
        update_search_thumbnails (self);
 }
 
 static void
 get_more_browse_results_cb (GtkAdjustment *adjustment,
-                            TotemGriloPlugin *self)
+                            TotemGrilo *self)
 {
        GtkTreeModel *model;
        GtkIconView *icon_view;
@@ -1410,7 +1393,7 @@ get_more_browse_results_cb (GtkAdjustment *adjustment,
 
 static void
 adjustment_value_changed_cb (GtkAdjustment *adjustment,
-                             TotemGriloPlugin *self)
+                             TotemGrilo *self)
 {
        update_search_thumbnails (self);
 
@@ -1433,7 +1416,7 @@ adjustment_value_changed_cb (GtkAdjustment *adjustment,
 
 static void
 back_button_clicked_cb (TotemMainToolbar *toolbar,
-                       TotemGriloPlugin *self)
+                       TotemGrilo *self)
 {
        GtkTreePath *path;
        GtkTreeIter iter;
@@ -1468,7 +1451,7 @@ back_button_clicked_cb (TotemMainToolbar *toolbar,
 static gboolean
 window_key_press_event_cb (GtkWidget        *win,
                           GdkEvent         *event,
-                          TotemGriloPlugin *self)
+                          TotemGrilo *self)
 {
        /* Check whether we're in the browse panel */
        if (!g_str_equal (totem_object_get_main_page (self->priv->totem), "grilo"))
@@ -1479,7 +1462,7 @@ window_key_press_event_cb (GtkWidget        *win,
 
 static void
 selection_mode_requested (GdMainView       *view,
-                         TotemGriloPlugin *self)
+                         TotemGrilo *self)
 {
        GtkTreePath *root = NULL;
 
@@ -1517,7 +1500,7 @@ can_remove_foreach (gpointer data,
 
 static void
 view_selection_changed_cb (GdMainView       *view,
-                          TotemGriloPlugin *self)
+                          TotemGrilo *self)
 {
        GtkTreeModel *model;
        GList *list;
@@ -1545,7 +1528,7 @@ view_selection_changed_cb (GdMainView       *view,
 static void
 select_all_action_cb (GSimpleAction    *action,
                      GVariant         *parameter,
-                     TotemGriloPlugin *self)
+                     TotemGrilo *self)
 {
        gd_main_view_select_all (GD_MAIN_VIEW (self->priv->browser));
 }
@@ -1553,14 +1536,14 @@ select_all_action_cb (GSimpleAction    *action,
 static void
 select_none_action_cb (GSimpleAction    *action,
                       GVariant         *parameter,
-                      TotemGriloPlugin *self)
+                      TotemGrilo *self)
 {
        gd_main_view_unselect_all (GD_MAIN_VIEW (self->priv->browser));
 }
 
 static void
 source_switched (GtkToggleButton  *button,
-                TotemGriloPlugin *self)
+                TotemGrilo *self)
 {
        const char *id;
 
@@ -1583,7 +1566,7 @@ source_switched (GtkToggleButton  *button,
 }
 
 static GtkWidget *
-create_switcher_button (TotemGriloPlugin *self,
+create_switcher_button (TotemGrilo *self,
                        const char *label,
                        const char *id)
 {
@@ -1603,7 +1586,7 @@ create_switcher_button (TotemGriloPlugin *self,
 }
 
 static void
-setup_source_switcher (TotemGriloPlugin *self)
+setup_source_switcher (TotemGrilo *self)
 {
        GtkStyleContext *context;
 
@@ -1628,7 +1611,7 @@ setup_source_switcher (TotemGriloPlugin *self)
 static void
 search_mode_changed (GObject          *gobject,
                     GParamSpec       *pspec,
-                    TotemGriloPlugin *self)
+                    TotemGrilo *self)
 {
        gboolean search_mode;
 
@@ -1720,7 +1703,7 @@ shuffle_items (GList *list)
 }
 
 static void
-play_selection (TotemGriloPlugin *self,
+play_selection (TotemGrilo *self,
                gboolean          shuffle)
 {
        GtkTreeModel *model;
@@ -1785,14 +1768,14 @@ next_item:
 
 static void
 play_cb (TotemSelectionToolbar *bar,
-        TotemGriloPlugin      *self)
+        TotemGrilo      *self)
 {
        play_selection (self, FALSE);
 }
 
 static void
 shuffle_cb (TotemSelectionToolbar *bar,
-           TotemGriloPlugin      *self)
+           TotemGrilo      *self)
 {
        play_selection (self, TRUE);
 }
@@ -1856,7 +1839,7 @@ delete_foreach (gpointer data,
 
 static void
 delete_cb (TotemSelectionToolbar *bar,
-          TotemGriloPlugin      *self)
+          TotemGrilo      *self)
 {
        GtkTreeModel *model;
        GList *list;
@@ -1870,7 +1853,7 @@ delete_cb (TotemSelectionToolbar *bar,
 }
 
 static void
-setup_browse (TotemGriloPlugin *self,
+setup_browse (TotemGrilo *self,
              GtkBuilder *builder)
 {
        GtkAdjustment *adj;
@@ -1973,10 +1956,6 @@ setup_browse (TotemGriloPlugin *self,
 
        gd_main_view_set_model (GD_MAIN_VIEW (self->priv->browser),
                                self->priv->recent_sort_model);
-
-       totem_object_add_main_page (self->priv->totem,
-                                   "grilo",
-                                   GTK_WIDGET (gtk_builder_get_object (builder, "gw_search")));
 }
 
 static void
@@ -2034,7 +2013,7 @@ remaining_to_text (GtkTreeViewColumn *column,
 }
 
 static void
-create_debug_window (TotemGriloPlugin *self,
+create_debug_window (TotemGrilo *self,
                     GtkTreeModel     *model)
 {
        GtkWidget *window, *scrolled, *tree;
@@ -2093,7 +2072,7 @@ create_debug_window (TotemGriloPlugin *self,
 }
 
 static void
-setup_ui (TotemGriloPlugin *self,
+setup_ui (TotemGrilo *self,
           GtkBuilder *builder)
 {
        totem_grilo_setup_icons (self->priv->totem);
@@ -2104,20 +2083,23 @@ setup_ui (TotemGriloPlugin *self,
 }
 
 static void
-setup_config (TotemGriloPlugin *self)
+setup_config (TotemGrilo *self)
 {
        GrlRegistry *registry = grl_registry_get_default ();
        grl_registry_add_config_from_resource (registry, "/org/totem/grilo/totem-grilo.conf", NULL);
 }
 
-static void
-impl_activate (PeasActivatable *plugin)
+GtkWidget *
+totem_grilo_new (TotemObject *totem)
 {
        GtkBuilder *builder;
+       TotemGrilo *self;
+       TotemGriloPrivate *priv;
+
+       self = g_object_new (TOTEM_TYPE_GRILO, NULL);
+       priv = self->priv;
 
-       TotemGriloPlugin *self = TOTEM_GRILO_PLUGIN (plugin);
-       TotemGriloPluginPrivate *priv = self->priv;
-       priv->totem = g_object_ref (g_object_get_data (G_OBJECT (plugin), "object"));
+       priv->totem = g_object_ref (totem);
        priv->main_window = totem_object_get_main_window (priv->totem);
 
        priv->metadata_keys = grl_metadata_key_list_new (GRL_METADATA_KEY_ARTIST,
@@ -2136,18 +2118,18 @@ impl_activate (PeasActivatable *plugin)
        grl_init (0, NULL);
        setup_config (self);
        load_grilo_plugins (self);
+
+       return GTK_WIDGET (gtk_builder_get_object (builder, "gw_search"));
 }
 
 static void
-impl_deactivate (PeasActivatable *plugin)
+totem_grilo_finalize (GObject *object)
 {
-       TotemGriloPlugin *self = TOTEM_GRILO_PLUGIN (plugin);
+       TotemGrilo *self = TOTEM_GRILO (object);
        GList *sources;
        GList *s;
        GrlRegistry *registry;
 
-       /* FIXME remove main page? */
-
        registry = grl_registry_get_default ();
        g_signal_handlers_disconnect_by_func (registry, source_added_cb, self);
        g_signal_handlers_disconnect_by_func (registry, source_removed_cb, self);
@@ -2169,4 +2151,22 @@ impl_deactivate (PeasActivatable *plugin)
 
        g_object_unref (self->priv->main_window);
        g_object_unref (self->priv->totem);
+
+       G_OBJECT_CLASS (totem_grilo_parent_class)->finalize (object);
+}
+
+static void
+totem_grilo_class_init (TotemGriloClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       object_class->finalize = totem_grilo_finalize;
+}
+
+static void
+totem_grilo_init (TotemGrilo *self)
+{
+       self->priv = totem_grilo_get_instance_private (self);
+
+       /* FIXME this is gross */
 }
diff --git a/src/plugins/grilo/totem-grilo.conf b/src/totem-grilo.conf
similarity index 100%
rename from src/plugins/grilo/totem-grilo.conf
rename to src/totem-grilo.conf
diff --git a/src/plugins/grilo/totem-main-toolbar.c b/src/totem-main-toolbar.c
similarity index 100%
rename from src/plugins/grilo/totem-main-toolbar.c
rename to src/totem-main-toolbar.c
diff --git a/src/plugins/grilo/totem-main-toolbar.h b/src/totem-main-toolbar.h
similarity index 100%
rename from src/plugins/grilo/totem-main-toolbar.h
rename to src/totem-main-toolbar.h
diff --git a/src/totem-object.c b/src/totem-object.c
index 665d071..a2567e2 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -53,6 +53,7 @@
 #include "totem-options.h"
 #include "totem-plugins-engine.h"
 #include "totem-playlist.h"
+#include "totem-grilo.h"
 #include "bacon-video-widget.h"
 #include "bacon-time-label.h"
 #include "totem-time-label.h"
@@ -3700,6 +3701,16 @@ playlist_widget_setup (TotemObject *totem)
 }
 
 void
+grilo_widget_setup (TotemObject *totem)
+{
+       totem->grilo = totem_grilo_new (totem);
+       gtk_stack_add_named (GTK_STACK (totem->stack),
+                            totem->grilo,
+                            "grilo");
+       gtk_stack_set_visible_child_name (GTK_STACK (totem->stack), "grilo");
+}
+
+void
 video_widget_create (TotemObject *totem)
 {
        GError *err = NULL;
diff --git a/src/totem-private.h b/src/totem-private.h
index 24af562..f2c9008 100644
--- a/src/totem-private.h
+++ b/src/totem-private.h
@@ -85,6 +85,8 @@ struct _TotemObject {
        GtkWidget *prefs;
        GtkBuilder *prefs_xml;
 
+       GtkWidget *grilo;
+
        GObject *controls;
        BaconTimeLabel *time_label;
        BaconTimeLabel *time_rem_label;
@@ -180,6 +182,7 @@ void        show_controls                           (Totem *totem, gboolean 
was_fullscreen);
 void   totem_setup_window                      (Totem *totem);
 void   totem_callback_connect                  (Totem *totem);
 void   playlist_widget_setup                   (Totem *totem);
+void   grilo_widget_setup                      (Totem *totem);
 void   video_widget_create                     (Totem *totem);
 void    totem_object_plugins_init              (TotemObject *totem);
 void    totem_object_plugins_shutdown          (TotemObject *totem);
diff --git a/src/plugins/grilo/totem-search-entry.c b/src/totem-search-entry.c
similarity index 100%
rename from src/plugins/grilo/totem-search-entry.c
rename to src/totem-search-entry.c
diff --git a/src/plugins/grilo/totem-search-entry.h b/src/totem-search-entry.h
similarity index 100%
rename from src/plugins/grilo/totem-search-entry.h
rename to src/totem-search-entry.h
diff --git a/src/plugins/grilo/totem-selection-toolbar.c b/src/totem-selection-toolbar.c
similarity index 100%
rename from src/plugins/grilo/totem-selection-toolbar.c
rename to src/totem-selection-toolbar.c
diff --git a/src/plugins/grilo/totem-selection-toolbar.h b/src/totem-selection-toolbar.h
similarity index 100%
rename from src/plugins/grilo/totem-selection-toolbar.h
rename to src/totem-selection-toolbar.h
diff --git a/src/totem.c b/src/totem.c
index 3329a29..d61870c 100644
--- a/src/totem.c
+++ b/src/totem.c
@@ -128,6 +128,7 @@ app_init (Totem *totem, char **argv)
 
        /* Show ! (again) the video widget this time. */
        video_widget_create (totem);
+       grilo_widget_setup (totem);
 
        /* Show ! */
        if (optionstate.fullscreen == FALSE) {
diff --git a/src/plugins/grilo/totemmaintoolbar.ui b/src/totemmaintoolbar.ui
similarity index 100%
rename from src/plugins/grilo/totemmaintoolbar.ui
rename to src/totemmaintoolbar.ui
diff --git a/src/plugins/grilo/totemselectiontoolbar.ui b/src/totemselectiontoolbar.ui
similarity index 100%
rename from src/plugins/grilo/totemselectiontoolbar.ui
rename to src/totemselectiontoolbar.ui


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