~kaozilon/totem/test

« back to all changes in this revision

Viewing changes to src/plugins/galago/totem-galago.c

  • Committer: Bazaar Package Importer
  • Author(s): Raphaël Hertzog, Josselin Mouette, Emilio Pozuelo Monfort, Sjoerd Simons, Frederic Peters, Michael Biebl, Raphaël Hertzog
  • Date: 2011-04-10 18:12:25 UTC
  • mfrom: (1.4.6 upstream) (5.1.19 sid)
  • Revision ID: james.westby@ubuntu.com-20110410181225-srhkesant1gx38pw
Tags: 3.0.0-1
* Team upload to experimental.

[ Josselin Mouette ]
* Only suggest totem-mozilla. Closes: #599638.
* totem-coherence depends on totem-plugins. Closes: #607436.

[ Emilio Pozuelo Monfort ]
* New upstream development release.
  - debian/patches/80_webm.patch,
    debian/patches/81_mpegts.patch,
    debian/patches/82_youtube_api.patch:
    + Removed, applied upstream.
  - debian/patches/90_autotools.patch:
    + Removed, no longer needed.
  - debian/patches/70_bbc_plugin.patch:
    + Disabled, needs porting.
  - debian/control.in:
    + Updated build dependencies and dependencies.
    + Removed transitional totem-xine and totem-gstreamer packages.
    + Don't build totem-coherence for now, it hasn't been ported
      to PyGI and so it's that plugin or all the others.
  - debian/totem-common.install:
    + Don't install the gconf schemas, they're gone. Install the
      gsettings files instead.
  - debian/totem.install:
    + Ship libtotem here.
  - debian/control.in,
    debian/rules,
    debian/gir1.2-totem-1.0.install:
    + Add a gir package and update the plugins package dependencies
      for the new gir dependencies.
* debian/rules,
  debian/control.in,
  debian/source/format:
  - Switch to source format 3.0 (quilt).
* debian/control.in:
  - Remove obsolete build dependency on libhal-dev. Closes: #615214.

[ Sjoerd Simons ]
* New upstream release (2.91.7)
* debian/totem-plugins.install:
  * Don't install the grommit plugin
  * Install the chapters plugin

[ Frederic Peters ]
* New upstream release (2.91.91)
* debian/control.in: bump build-dep on libpeas.
* debian/control.in, debian/totem-plugins.install:
  * The galago plugin has been renamed to im-status, and no longer uses
    libgalago.

[ Michael Biebl ]
* debian/control.in:
  - Add Build-Depends on libtracker-sparql-0.10-dev for media search support
    using Tracker.

[ Raphaël Hertzog ]
* New upstream release (3.0.0).
* Added Build-Depends on gstreamer0.10-gconf.
* Bumped minimal version of build-dependency on totem-plparser-dev to
  2.32.4-2 to match the ./configure requirements and to ensure libquvi-dev
  is there as required by the totem-plparser.pc.
* Add some copyright notices to debian/copyright to please lintian.
* Call dh_pysupport on totem to generate the python dependency for
  totem-bugreport.py
* Tell dh_makeshlibs to skip /usr/lib/nautilus. This avoids generating
  an shlib entry for the plugin it contains.
* Tweaked the totem description to fix lintian warning description-
  synopsis-starts-with-article.
* Updated dependencies of totem-coherence to match the new code using
  introspection but keep the package disabled as python-coherence is
  still PyGTK based and thus incompatible.
* Add lintian overrides for menu-icon-missing (icon is in totem-
  common).
* Add gnome-icon-theme-symbolic to totem's dependencies.
* Bump build-dep on libgdata >= 0.8.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
 
/* 
3
 
 * Copyright (C) 2007 Bastien Nocera <hadess@hadess.net>
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License as published by
7
 
 * the Free Software Foundation; either version 2 of the License, or
8
 
 * (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
18
 
 *
19
 
 * The Totem project hereby grant permission for non-gpl compatible GStreamer
20
 
 * plugins to be used and distributed together with GStreamer and Totem. This
21
 
 * permission are above and beyond the permissions granted by the GPL license
22
 
 * Totem is covered by.
23
 
 *
24
 
 * See license_change file for details.
25
 
 *
26
 
 */
27
 
 
28
 
#include "config.h"
29
 
 
30
 
#include <glib.h>
31
 
#include <glib-object.h>
32
 
#include <glib/gi18n-lib.h>
33
 
#include <gmodule.h>
34
 
#include <string.h>
35
 
#include <libgalago/galago.h>
36
 
 
37
 
#include "totem-plugin.h"
38
 
#include "totem.h"
39
 
 
40
 
#define TOTEM_TYPE_GALAGO_PLUGIN                (totem_galago_plugin_get_type ())
41
 
#define TOTEM_GALAGO_PLUGIN(o)                  (G_TYPE_CHECK_INSTANCE_CAST ((o), TOTEM_TYPE_GALAGO_PLUGIN, TotemGalagoPlugin))
42
 
#define TOTEM_GALAGO_PLUGIN_CLASS(k)            (G_TYPE_CHECK_CLASS_CAST((k), TOTEM_TYPE_GALAGO_PLUGIN, TotemGalagoPluginClass))
43
 
#define TOTEM_IS_GALAGO_PLUGIN(o)               (G_TYPE_CHECK_INSTANCE_TYPE ((o), TOTEM_TYPE_GALAGO_PLUGIN))
44
 
#define TOTEM_IS_GALAGO_PLUGIN_CLASS(k)         (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_GALAGO_PLUGIN))
45
 
#define TOTEM_GALAGO_PLUGIN_GET_CLASS(o)        (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_GALAGO_PLUGIN, TotemGalagoPluginClass))
46
 
 
47
 
typedef struct
48
 
{
49
 
        TotemPlugin     parent;
50
 
 
51
 
        guint           handler_id_fullscreen;
52
 
        guint           handler_id_playing;
53
 
        gboolean        idle; /* Whether we're idle */
54
 
        GalagoPerson    *me; /* Me! */
55
 
} TotemGalagoPlugin;
56
 
 
57
 
typedef struct
58
 
{
59
 
        TotemPluginClass parent_class;
60
 
} TotemGalagoPluginClass;
61
 
 
62
 
 
63
 
G_MODULE_EXPORT GType register_totem_plugin     (GTypeModule *module);
64
 
GType totem_galago_plugin_get_type              (void) G_GNUC_CONST;
65
 
 
66
 
static void totem_galago_plugin_init            (TotemGalagoPlugin *plugin);
67
 
static void totem_galago_plugin_dispose         (GObject *object);
68
 
static void totem_galago_plugin_finalize        (GObject *object);
69
 
static gboolean impl_activate                   (TotemPlugin *plugin, TotemObject *totem, GError **error);
70
 
static void impl_deactivate                     (TotemPlugin *plugin, TotemObject *totem);
71
 
 
72
 
TOTEM_PLUGIN_REGISTER(TotemGalagoPlugin, totem_galago_plugin)
73
 
 
74
 
static void
75
 
totem_galago_plugin_class_init (TotemGalagoPluginClass *klass)
76
 
{
77
 
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
78
 
        TotemPluginClass *plugin_class = TOTEM_PLUGIN_CLASS (klass);
79
 
 
80
 
        object_class->dispose = totem_galago_plugin_dispose;
81
 
        object_class->finalize = totem_galago_plugin_finalize;
82
 
 
83
 
        plugin_class->activate = impl_activate;
84
 
        plugin_class->deactivate = impl_deactivate;
85
 
}
86
 
 
87
 
static void
88
 
totem_galago_plugin_init (TotemGalagoPlugin *plugin)
89
 
{
90
 
        if (galago_init (PACKAGE_NAME, GALAGO_INIT_FEED) == FALSE
91
 
            || galago_is_connected () == FALSE) {
92
 
                g_warning ("Failed to initialise libgalago.");
93
 
                return;
94
 
        }
95
 
 
96
 
        /* Get "me" and list accounts */
97
 
        plugin->me = galago_get_me (GALAGO_REMOTE, TRUE);
98
 
}
99
 
 
100
 
static void
101
 
totem_galago_plugin_dispose (GObject *object)
102
 
{
103
 
        TotemGalagoPlugin *plugin = TOTEM_GALAGO_PLUGIN (object);
104
 
 
105
 
        if (plugin->me != NULL) {
106
 
                g_object_unref (plugin->me);
107
 
                plugin->me = NULL;
108
 
        }
109
 
 
110
 
        G_OBJECT_CLASS (totem_galago_plugin_parent_class)->dispose (object);
111
 
}
112
 
 
113
 
static void
114
 
totem_galago_plugin_finalize (GObject *object)
115
 
{
116
 
        if (galago_is_connected ())
117
 
                galago_uninit ();
118
 
 
119
 
        G_OBJECT_CLASS (totem_galago_plugin_parent_class)->finalize (object);
120
 
}
121
 
 
122
 
static void
123
 
totem_galago_set_idleness (TotemGalagoPlugin *plugin, gboolean idle)
124
 
{
125
 
        GList *account;
126
 
        GalagoPresence *presence;
127
 
 
128
 
        if (galago_is_connected () == FALSE)
129
 
                return;
130
 
 
131
 
        if (plugin->idle == idle)
132
 
                return;
133
 
 
134
 
        plugin->idle = idle;
135
 
        for (account = galago_person_get_accounts (plugin->me, TRUE); account != NULL; account = g_list_next (account)) {
136
 
                presence = galago_account_get_presence ((GalagoAccount *)account->data, TRUE);
137
 
                if (presence != NULL)
138
 
                        galago_presence_set_idle (presence, idle, time (NULL));
139
 
        }
140
 
}
141
 
 
142
 
static void
143
 
totem_galago_update_from_state (TotemObject *totem,
144
 
                                TotemGalagoPlugin *plugin)
145
 
{
146
 
        if (totem_is_playing (totem) != FALSE
147
 
            && totem_is_fullscreen (totem) != FALSE) {
148
 
                totem_galago_set_idleness (plugin, TRUE);
149
 
        } else {
150
 
                totem_galago_set_idleness (plugin, FALSE);
151
 
        }
152
 
}
153
 
 
154
 
static void
155
 
property_notify_cb (TotemObject *totem,
156
 
                    GParamSpec *spec,
157
 
                    TotemGalagoPlugin *plugin)
158
 
{
159
 
        totem_galago_update_from_state (totem, plugin);
160
 
}
161
 
 
162
 
static gboolean
163
 
impl_activate (TotemPlugin *plugin,
164
 
               TotemObject *totem,
165
 
               GError **error)
166
 
{
167
 
        TotemGalagoPlugin *pi = TOTEM_GALAGO_PLUGIN (plugin);
168
 
 
169
 
        if (!galago_is_connected ()) {
170
 
                g_set_error_literal (error, TOTEM_PLUGIN_ERROR, TOTEM_PLUGIN_ERROR_ACTIVATION,
171
 
                                     _("Could not connect to the Galago daemon."));
172
 
                return FALSE;
173
 
        }
174
 
 
175
 
        pi->handler_id_fullscreen = g_signal_connect (G_OBJECT (totem),
176
 
                                "notify::fullscreen",
177
 
                                G_CALLBACK (property_notify_cb),
178
 
                                pi);
179
 
        pi->handler_id_playing = g_signal_connect (G_OBJECT (totem),
180
 
                                "notify::playing",
181
 
                                G_CALLBACK (property_notify_cb),
182
 
                                pi);
183
 
 
184
 
        /* Force setting the current status */
185
 
        totem_galago_update_from_state (totem, pi);
186
 
 
187
 
        return TRUE;
188
 
}
189
 
 
190
 
static void
191
 
impl_deactivate (TotemPlugin *plugin,
192
 
                 TotemObject *totem)
193
 
{
194
 
        TotemGalagoPlugin *pi = TOTEM_GALAGO_PLUGIN (plugin);
195
 
 
196
 
        g_signal_handler_disconnect (G_OBJECT (totem), pi->handler_id_fullscreen);
197
 
        g_signal_handler_disconnect (G_OBJECT (totem), pi->handler_id_playing);
198
 
 
199
 
        totem_galago_set_idleness (pi, FALSE);
200
 
}
201