~walkerlee/totem/pre-interview

« back to all changes in this revision

Viewing changes to src/plugins/apple-trailers/totem-apple-trailers.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-05-26 00:07:51 UTC
  • mfrom: (1.6.1) (24.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20130526000751-kv8ap3x1di4qq8j2
Tags: 3.8.2-0ubuntu1
* Sync with Debian. Remaining changes: 
* debian/control.in:
  - Drop build-depends on libepc-ui-dev and libgrilo-0.2-dev (in universe)
  - Drop libxtst-dev build-depends so that the (redundant) fake key presses
    for inhibiting the screensaver are disabled (LP: #1007438)
  - Build-depend on libzeitgeist-dev
  - Suggest rather than recommend gstreamer components in universe
  - Add totem-plugins-extra
  - Add XB-Npp-Description and XB-Npp-Filename header to the 
    totem-mozilla package to improve ubufox/ubuntu plugin db integration 
  - Refer to Firefox in totem-mozilla description instead of Iceweasel
  - Don't have totem-mozilla recommend any particular browser
  - Drop obsolete python library dependencies since iplayer is no longer
    included
* debian/totem-common.install, debian/source_totem.py:
  - Install Ubuntu apport debugging hook
* debian/totem-plugins-extra.install:
  - Universe plugins split out of totem-plugins (currently only gromit)
* debian/totem-plugins.install:    
  - Skip the plugins split to -extra and add the zeitgeist plugin
* debian/rules:
  - Build with --fail-missing, to ensure we install everything. 
    + Ignore libtotem.{,l}a since we delibrately don't install these.
  - Re-enable hardening, make sure both PIE and BINDNOW are used
    by setting hardening=+all. (LP: #1039604)
* debian/patches/91_quicklist_entries.patch:
  - Add static quicklist
* debian/patches/92_gst-plugins-good.patch:
  - Build without unnecessary gstreamer1.0-bad dependency
* debian/patches/93_grilo_optional.patch:
  - Allow building without grilo while grilo MIR is still pending
* debian/patches/correct_desktop_mimetypes.patch:
  - Don't list the mimetypes after the unity lists
* debian/patches/revert_shell_menu.patch: 
  - revert the use of a shell menu until indicator-appmenu can handle
    the mixed shell/traditional menus itself
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2012 Bastien Nocera <hadess@hadess.net>
 
3
 *
 
4
 *  This program is free software; you can redistribute it and/or modify
 
5
 *  it under the terms of the GNU General Public License as published by
 
6
 *  the Free Software Foundation; either version 2 of the License, or
 
7
 *  (at your option) any later version.
 
8
 *
 
9
 *  This program is distributed in the hope that it will be useful,
 
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 *  GNU General Public License for more details.
 
13
 *
 
14
 *  You should have received a copy of the GNU General Public License
 
15
 *  along with this program; if not, write to the Free Software
 
16
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
 
17
 *
 
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
 * Monday 7th February 2005: Christian Schaller: Add exception clause.
 
25
 * See license_change file for details.
 
26
 *
 
27
 */
 
28
 
 
29
 
 
30
#include "config.h"
 
31
 
 
32
#include <glib-object.h>
 
33
 
 
34
#include "totem-plugin.h"
 
35
#include "totem.h"
 
36
 
 
37
#define TOTEM_TYPE_APPLE_TRAILERS_PLUGIN        (totem_apple_trailers_plugin_get_type ())
 
38
#define TOTEM_APPLE_TRAILERS_PLUGIN(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), TOTEM_TYPE_APPLE_TRAILERS_PLUGIN, TotemAppleTrailersPlugin))
 
39
 
 
40
typedef struct {
 
41
        guint signal_id;
 
42
        TotemObject *totem;
 
43
} TotemAppleTrailersPluginPrivate;
 
44
 
 
45
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_APPLE_TRAILERS_PLUGIN, TotemAppleTrailersPlugin, totem_apple_trailers_plugin)
 
46
 
 
47
static char *
 
48
get_user_agent_cb (TotemObject *totem,
 
49
                   const char  *mrl)
 
50
{
 
51
        if (g_str_has_prefix (mrl, "http://movies.apple.com") ||
 
52
            g_str_has_prefix (mrl, "http://trailers.apple.com"))
 
53
                return g_strdup ("Quicktime/7.2.0");
 
54
        return NULL;
 
55
}
 
56
 
 
57
static void
 
58
impl_activate (PeasActivatable *plugin)
 
59
{
 
60
        TotemAppleTrailersPlugin *pi = TOTEM_APPLE_TRAILERS_PLUGIN (plugin);
 
61
 
 
62
        pi->priv->totem = g_object_ref (g_object_get_data (G_OBJECT (plugin), "object"));
 
63
        pi->priv->signal_id = g_signal_connect (G_OBJECT (pi->priv->totem), "get-user-agent",
 
64
                                                G_CALLBACK (get_user_agent_cb), NULL);
 
65
}
 
66
 
 
67
static void
 
68
impl_deactivate (PeasActivatable *plugin)
 
69
{
 
70
        TotemAppleTrailersPlugin *pi = TOTEM_APPLE_TRAILERS_PLUGIN (plugin);
 
71
 
 
72
        if (pi->priv->signal_id) {
 
73
                g_signal_handler_disconnect (pi->priv->totem, pi->priv->signal_id);
 
74
                pi->priv->signal_id = 0;
 
75
        }
 
76
 
 
77
        if (pi->priv->totem) {
 
78
                g_object_unref (pi->priv->totem);
 
79
                pi->priv->totem = NULL;
 
80
        }
 
81
}