[totem/peas-0.5.4: 4/4] Convert all the plugins to use the new PeasActivatable interface
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/peas-0.5.4: 4/4] Convert all the plugins to use the new PeasActivatable interface
- Date: Fri, 6 Aug 2010 15:11:43 +0000 (UTC)
commit c1bde978f337070c6a3618dc493f71de3de35f19
Author: Philip Withnall <philip tecnocode co uk>
Date: Fri Aug 6 09:47:52 2010 +0100
Convert all the plugins to use the new PeasActivatable interface
src/plugins/bemused/totem-bemused.c | 125 ++++-----
.../brasero-disc-recorder/totem-disc-recorder.c | 142 ++++------
src/plugins/coherence_upnp/coherence_upnp.py | 14 +-
src/plugins/dbus-service/dbus-service.py | 12 +-
src/plugins/galago/totem-galago.c | 103 ++-----
src/plugins/gromit/totem-gromit.c | 115 +++-----
src/plugins/iplayer/iplayer.py | 13 +-
src/plugins/jamendo/jamendo.py | 13 +-
src/plugins/lirc/totem-lirc.c | 74 ++----
.../media-player-keys/totem-media-player-keys.c | 80 ++----
src/plugins/mythtv/totem-mythtv.c | 174 ++++--------
src/plugins/ontop/totem-ontop.c | 62 +---
src/plugins/opensubtitles/opensubtitles.py | 19 +-
src/plugins/properties/totem-movie-properties.c | 80 ++----
src/plugins/publish/totem-publish.c | 260 +++++++---------
src/plugins/pythonconsole/pythonconsole.py | 27 +-
src/plugins/sample-python/sample-python.py | 8 +-
src/plugins/screensaver/totem-screensaver.c | 106 ++-----
src/plugins/screenshot/totem-gallery.c | 2 +-
src/plugins/screenshot/totem-gallery.h | 3 +-
src/plugins/screenshot/totem-screenshot-plugin.c | 56 ++--
src/plugins/screenshot/totem-screenshot-plugin.h | 24 --
src/plugins/screenshot/totem-screenshot.c | 2 +-
src/plugins/screenshot/totem-screenshot.h | 5 +-
src/plugins/sidebar-test/totem-sidebar-test.c | 35 +--
src/plugins/skipto/Makefile.am | 1 -
src/plugins/skipto/totem-skipto-plugin.c | 100 +++----
src/plugins/skipto/totem-skipto-plugin.h | 67 -----
src/plugins/skipto/totem-skipto.c | 7 +-
src/plugins/skipto/totem-skipto.h | 3 +-
src/plugins/thumbnail/totem-thumbnail.c | 54 +---
src/plugins/tracker/totem-tracker.c | 37 +--
src/plugins/youtube/totem-youtube.c | 312 ++++++++++----------
33 files changed, 784 insertions(+), 1351 deletions(-)
---
diff --git a/src/plugins/bemused/totem-bemused.c b/src/plugins/bemused/totem-bemused.c
index 61f8ec7..e90a7da 100644
--- a/src/plugins/bemused/totem-bemused.c
+++ b/src/plugins/bemused/totem-bemused.c
@@ -56,24 +56,14 @@
#define TOTEM_IS_BEMUSED_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_BEMUSED_PLUGIN))
#define TOTEM_BEMUSED_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_BEMUSED_PLUGIN, TotemBemusedPluginClass))
-typedef struct
-{
- PeasExtensionBase parent;
-
+typedef struct {
TotemObject *totem;
BaconVideoWidget *bvw;
guint server_watch_id;
guint client_watch_id;
GIOChannel *server_iochan, *client_iochan;
sdp_session_t *sdp_session;
-} TotemBemusedPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemBemusedPluginClass;
-
-GType totem_bemused_plugin_get_type (void) G_GNUC_CONST;
+} TotemBemusedPluginPrivate;
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_BEMUSED_PLUGIN, TotemBemusedPlugin, totem_bemused_plugin)
@@ -153,11 +143,12 @@ read_filename (TotemBemusedPlugin *tp, GIOChannel *source)
static void
write_playlist (TotemBemusedPlugin *tp, GIOChannel *source)
{
+ TotemBemusedPluginPrivate *priv = tp->priv;
char buf[11];
int playlist_pos, playlist_len, i;
- playlist_pos = totem_get_playlist_pos (tp->totem);
- playlist_len = totem_get_playlist_length (tp->totem);
+ playlist_pos = totem_get_playlist_pos (priv->totem);
+ playlist_len = totem_get_playlist_length (priv->totem);
strncpy(buf, "PLSTACK", strlen ("PLSTACK"));
if (playlist_len == 0) {
@@ -174,7 +165,7 @@ write_playlist (TotemBemusedPlugin *tp, GIOChannel *source)
for (i = 0; i < playlist_len; i++) {
char *title;
- title = totem_get_title_at_playlist_pos (tp->totem, i);
+ title = totem_get_title_at_playlist_pos (priv->totem, i);
if (title == NULL)
title = g_strdup_printf (_("Untitled %d"), i);
g_message ("pushing entry %s", title);
@@ -193,7 +184,7 @@ write_current_volume (TotemBemusedPlugin *tp, GIOChannel *source)
char buf[8];
strncpy(buf, "GVOLACK", strlen ("GVOLACK"));
- volume = bacon_video_widget_get_volume (tp->bvw);
+ volume = bacon_video_widget_get_volume (tp->priv->bvw);
if (volume >= 1.0)
buf[7] = (unsigned char) 255;
else
@@ -209,7 +200,7 @@ set_volume (TotemBemusedPlugin *tp, GIOChannel *source)
read_response (tp, source, &buf, 1);
volume = (double) buf / (double) 256;
- bacon_video_widget_set_volume (tp->bvw, volume);
+ bacon_video_widget_set_volume (tp->priv->bvw, volume);
}
static void
@@ -230,7 +221,7 @@ set_setting (TotemBemusedPlugin *tp, GIOChannel *source, TotemRemoteSetting sett
char buf;
read_response (tp, source, &buf, 1);
- totem_action_remote_set_setting (tp->totem, setting, buf != 0);
+ totem_action_remote_set_setting (tp->priv->totem, setting, buf != 0);
}
static void
@@ -245,7 +236,7 @@ seek_to_pos (TotemBemusedPlugin *tp, GIOChannel *source)
_time += buf[2] << 8;
_time += buf[3];
- totem_action_seek_time (tp->totem, (gint64) _time * 1000, FALSE);
+ totem_action_seek_time (tp->priv->totem, (gint64) _time * 1000, FALSE);
}
static void
@@ -254,7 +245,7 @@ write_playlist_length (TotemBemusedPlugin *tp, GIOChannel *source)
char buf[2];
int len;
- len = totem_get_playlist_length (tp->totem);
+ len = totem_get_playlist_length (tp->priv->totem);
buf[0] = (len >> 8) & 0xFF;
buf[1] = len & 0xFF;
@@ -348,6 +339,7 @@ write_detailed_file_info (TotemBemusedPlugin *tp, GIOChannel *source)
static void
write_song_info (TotemBemusedPlugin *tp, GIOChannel *source, gboolean send_null)
{
+ TotemBemusedPluginPrivate *priv = tp->priv;
char *title;
char status;
@@ -357,22 +349,22 @@ write_song_info (TotemBemusedPlugin *tp, GIOChannel *source, gboolean send_null)
send_response_flush (tp, source, "INFOACK", strlen ("INFOACK"), FALSE);
else
send_response_flush (tp, source, "INF2ACK", strlen ("INF2ACK"), FALSE);
- if (totem_is_playing (tp->totem) != FALSE)
+ if (totem_is_playing (priv->totem) != FALSE)
status = 1;
- else if (totem_is_paused (tp->totem) != FALSE)
+ else if (totem_is_paused (priv->totem) != FALSE)
status = 2;
else
status = 0;
send_response_flush (tp, source, &status, 1, FALSE);
- STUFF4((int) bacon_video_widget_get_stream_length (tp->bvw) / 1000);
- STUFF4((int) bacon_video_widget_get_current_time (tp->bvw) / 1000);
- status = totem_action_remote_get_setting (tp->totem, TOTEM_REMOTE_SETTING_SHUFFLE);
+ STUFF4((int) bacon_video_widget_get_stream_length (priv->bvw) / 1000);
+ STUFF4((int) bacon_video_widget_get_current_time (priv->bvw) / 1000);
+ status = totem_action_remote_get_setting (priv->totem, TOTEM_REMOTE_SETTING_SHUFFLE);
send_response_flush (tp, source, &status, 1, FALSE);
- status = totem_action_remote_get_setting (tp->totem, TOTEM_REMOTE_SETTING_REPEAT);
+ status = totem_action_remote_get_setting (priv->totem, TOTEM_REMOTE_SETTING_REPEAT);
send_response_flush (tp, source, &status, 1, FALSE);
- title = totem_get_short_title (tp->totem);
+ title = totem_get_short_title (priv->totem);
g_message ("written info for %s", title);
if (title == NULL) {
flush_response (tp, source);
@@ -394,7 +386,7 @@ set_playlist_at_pos (TotemBemusedPlugin *tp, GIOChannel *source)
read_response (tp, source, buf, 2);
idx = (buf[0] << 8) + buf[1];
- totem_action_set_playlist_index (tp->totem, idx);
+ totem_action_set_playlist_index (tp->priv->totem, idx);
}
#if 0
@@ -455,7 +447,7 @@ handle_command (TotemBemusedPlugin *tp, GIOChannel *source, const char *cmd)
} else CMD_IS("FADE") {
//stop
} else CMD_IS("FFWD") {
- totem_action_remote (tp->totem, TOTEM_REMOTE_COMMAND_SEEK_FORWARD, NULL);
+ totem_action_remote (tp->priv->totem, TOTEM_REMOTE_COMMAND_SEEK_FORWARD, NULL);
} else CMD_IS("FINF") {
write_detailed_file_info (tp, source);
} else CMD_IS("GVOL") {
@@ -469,9 +461,9 @@ handle_command (TotemBemusedPlugin *tp, GIOChannel *source, const char *cmd)
} else CMD_IS("LIST") {
write_directory_listing (tp, source, TRUE);
} else CMD_IS("NEXT") {
- totem_action_remote (tp->totem, TOTEM_REMOTE_COMMAND_NEXT, NULL);
+ totem_action_remote (tp->priv->totem, TOTEM_REMOTE_COMMAND_NEXT, NULL);
} else CMD_IS("PAUS") {
- totem_action_remote (tp->totem, TOTEM_REMOTE_COMMAND_PAUSE, NULL);
+ totem_action_remote (tp->priv->totem, TOTEM_REMOTE_COMMAND_PAUSE, NULL);
} else CMD_IS("PLAY") {
add_or_enqueue (tp, source, TOTEM_REMOTE_COMMAND_REPLACE);
} else CMD_IS("PLEN") {
@@ -479,19 +471,19 @@ handle_command (TotemBemusedPlugin *tp, GIOChannel *source, const char *cmd)
} else CMD_IS("PLST") {
write_playlist (tp, source);
} else CMD_IS("PREV") {
- totem_action_remote (tp->totem, TOTEM_REMOTE_COMMAND_PREVIOUS, NULL);
+ totem_action_remote (tp->priv->totem, TOTEM_REMOTE_COMMAND_PREVIOUS, NULL);
} else CMD_IS("REPT") {
set_setting (tp, source, TOTEM_REMOTE_SETTING_REPEAT);
} else CMD_IS("RMAL") {
- totem_action_remote (tp->totem, TOTEM_REMOTE_COMMAND_REPLACE, NULL);
+ totem_action_remote (tp->priv->totem, TOTEM_REMOTE_COMMAND_REPLACE, NULL);
} else CMD_IS("RWND") {
- totem_action_remote (tp->totem, TOTEM_REMOTE_COMMAND_SEEK_BACKWARD, NULL);
+ totem_action_remote (tp->priv->totem, TOTEM_REMOTE_COMMAND_SEEK_BACKWARD, NULL);
} else CMD_IS("SHFL") {
set_setting (tp, source, TOTEM_REMOTE_SETTING_SHUFFLE);
} else CMD_IS("SEEK") {
seek_to_pos (tp, source);
} else CMD_IS("SHUT") {
- totem_action_remote (tp->totem, TOTEM_REMOTE_COMMAND_QUIT, NULL);
+ totem_action_remote (tp->priv->totem, TOTEM_REMOTE_COMMAND_QUIT, NULL);
} else CMD_IS("STEN") {
//stop at end of track
} else CMD_IS("SLCT") {
@@ -499,7 +491,7 @@ handle_command (TotemBemusedPlugin *tp, GIOChannel *source, const char *cmd)
} else CMD_IS("STOP") {
//stop
} else CMD_IS("STRT") {
- totem_action_remote (tp->totem, TOTEM_REMOTE_COMMAND_PLAY, NULL);
+ totem_action_remote (tp->priv->totem, TOTEM_REMOTE_COMMAND_PLAY, NULL);
} else CMD_IS("VOLM") {
set_volume (tp, source);
} else CMD_IS("VERS") {
@@ -548,7 +540,7 @@ client_watch_func (GIOChannel *source, GIOCondition condition, gpointer data)
static gboolean
server_watch_func (GIOChannel *source, GIOCondition condition, gpointer data)
{
- TotemBemusedPlugin *tp = (TotemBemusedPlugin *) data;
+ TotemBemusedPluginPrivate *priv = TOTEM_BEMUSED_PLUGIN (data)->priv;
g_message ("server_watch_func");
@@ -573,21 +565,21 @@ server_watch_func (GIOChannel *source, GIOCondition condition, gpointer data)
//FIXME check batostr(&ba) is our expected client
g_message ("connected from %s", batostr(&ba));
- if (tp->bvw != NULL)
- g_object_unref (G_OBJECT (tp->bvw));
- tp->bvw = BACON_VIDEO_WIDGET (totem_get_video_widget (tp->totem));
+ if (priv->bvw != NULL)
+ g_object_unref (G_OBJECT (priv->bvw));
+ priv->bvw = BACON_VIDEO_WIDGET (totem_get_video_widget (priv->totem));
- tp->client_iochan = g_io_channel_unix_new (client_fd);
- g_io_channel_set_encoding (tp->client_iochan, NULL, NULL);
- g_io_channel_set_buffered (tp->client_iochan, FALSE);
- g_io_channel_set_flags (tp->client_iochan,
- g_io_channel_get_flags (tp->client_iochan) | G_IO_FLAG_NONBLOCK,
+ priv->client_iochan = g_io_channel_unix_new (client_fd);
+ g_io_channel_set_encoding (priv->client_iochan, NULL, NULL);
+ g_io_channel_set_buffered (priv->client_iochan, FALSE);
+ g_io_channel_set_flags (priv->client_iochan,
+ g_io_channel_get_flags (priv->client_iochan) | G_IO_FLAG_NONBLOCK,
NULL);
- tp->client_watch_id = g_io_add_watch (tp->client_iochan,
+ priv->client_watch_id = g_io_add_watch (priv->client_iochan,
G_IO_IN | G_IO_PRI | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
client_watch_func,
- tp);
- g_io_channel_unref (tp->client_iochan);
+ data);
+ g_io_channel_unref (priv->client_iochan);
}
}
@@ -680,26 +672,12 @@ sdp_svc_del (sdp_session_t *session)
/* Object functions */
static void
-totem_bemused_plugin_class_init (TotemBemusedPluginClass *klass)
+impl_activate (PeasActivatable *plugin)
{
-}
-
-static void
-totem_bemused_plugin_init (TotemBemusedPlugin *plugin)
-{
-}
-
-static void
-impl_activate (PeasActivatable *plugin,
- GObject *object)
-{
- TotemBemusedPlugin *tp = TOTEM_BEMUSED_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemBemusedPluginPrivate *priv = TOTEM_BEMUSED_PLUGIN (plugin)->priv;
int fd, channel;
struct sockaddr_rc addr;
- tp->totem = totem;
-
fd = socket (PF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
if (fd < 0) {
g_message ("couldn't create socket");
@@ -710,12 +688,12 @@ impl_activate (PeasActivatable *plugin,
g_message ("socket created");
channel = 1;
- tp->sdp_session = sdp_svc_add_spp (channel,
+ priv->sdp_session = sdp_svc_add_spp (channel,
BEMUSED_SVC_NAME,
BEMUSED_SVC_DESC,
BEMUSED_SVC_PROV,
BEMUSED_SVC_UUID);
- if (tp->sdp_session == NULL) {
+ if (priv->sdp_session == NULL) {
close (fd);
g_message ("registering service failed");
return;
@@ -727,7 +705,7 @@ impl_activate (PeasActivatable *plugin,
if (bind(fd, (struct sockaddr*) &addr, sizeof(addr)) < 0) {
//FIXME
- sdp_svc_del (tp->sdp_session);
+ sdp_svc_del (priv->sdp_session);
g_message ("couldn't bind");
return;
}
@@ -737,19 +715,19 @@ impl_activate (PeasActivatable *plugin,
if (listen (fd, 10) < 0) {
//FIXME
g_message ("couldn't listen");
- sdp_svc_del (tp->sdp_session);
+ sdp_svc_del (priv->sdp_session);
return;
}
g_message ("listen launched");
- tp->server_iochan = g_io_channel_unix_new (fd);
- g_io_channel_set_encoding (tp->server_iochan, NULL, NULL);
- tp->server_watch_id = g_io_add_watch (tp->server_iochan,
+ priv->server_iochan = g_io_channel_unix_new (fd);
+ g_io_channel_set_encoding (priv->server_iochan, NULL, NULL);
+ priv->server_watch_id = g_io_add_watch (priv->server_iochan,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
server_watch_func,
plugin);
- g_io_channel_unref (tp->server_iochan);
+ g_io_channel_unref (priv->server_iochan);
g_message ("io chan set");
@@ -757,8 +735,7 @@ impl_activate (PeasActivatable *plugin,
}
static void
-impl_deactivate (PeasActivatable *plugin,
- GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
//FIXME
}
diff --git a/src/plugins/brasero-disc-recorder/totem-disc-recorder.c b/src/plugins/brasero-disc-recorder/totem-disc-recorder.c
index 57b9aa7..12186ec 100644
--- a/src/plugins/brasero-disc-recorder/totem-disc-recorder.c
+++ b/src/plugins/brasero-disc-recorder/totem-disc-recorder.c
@@ -47,26 +47,14 @@
#define TOTEM_IS_DISC_RECORDER_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_DISC_RECORDER_PLUGIN))
#define TOTEM_DISC_RECORDER_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_DISC_RECORDER_PLUGIN, TotemDiscRecorderPluginClass))
-typedef struct TotemDiscRecorderPluginPrivate TotemDiscRecorderPluginPrivate;
-
-typedef struct
-{
- PeasExtensionBase parent;
-
+typedef struct {
TotemObject *totem;
GtkActionGroup *action_group;
guint ui_merge_id;
gboolean enabled;
-} TotemDiscRecorderPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemDiscRecorderPluginClass;
-
-GType totem_disc_recorder_plugin_get_type (void) G_GNUC_CONST;
+} TotemDiscRecorderPluginPrivate;
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_DISC_RECORDER_PLUGIN, TotemDiscRecorderPlugin, totem_disc_recorder_plugin)
@@ -108,7 +96,7 @@ totem_disc_recorder_plugin_start_burning (TotemDiscRecorderPlugin *pi,
g_ptr_array_add (array, (gpointer) "-r");
g_ptr_array_add (array, (gpointer) path);
- main_window = totem_get_main_window (pi->totem);
+ main_window = totem_get_main_window (pi->priv->totem);
screen = gtk_widget_get_screen (GTK_WIDGET (main_window));
xid = gdk_x11_drawable_get_xid (GDK_DRAWABLE (gtk_widget_get_window (GTK_WIDGET (main_window))));
xid_str = g_strdup_printf ("%d", xid);
@@ -125,11 +113,11 @@ totem_disc_recorder_plugin_start_burning (TotemDiscRecorderPlugin *pi,
if (copy != FALSE) {
totem_interface_error (_("The video disc could not be duplicated."),
error->message,
- totem_get_main_window (pi->totem));
+ totem_get_main_window (pi->priv->totem));
} else {
totem_interface_error (_("The movie could not be recorded."),
error->message,
- totem_get_main_window (pi->totem));
+ totem_get_main_window (pi->priv->totem));
}
ret = FALSE;
g_error_free (error);
@@ -194,7 +182,7 @@ totem_disc_recorder_plugin_write_video_project (TotemDiscRecorderPlugin *pi,
if (success < 0)
goto error;
- title = totem_get_short_title (pi->totem);
+ title = totem_get_short_title (pi->priv->totem);
if (title) {
success = xmlTextWriterWriteElement (project,
(xmlChar *) "label",
@@ -213,7 +201,7 @@ totem_disc_recorder_plugin_write_video_project (TotemDiscRecorderPlugin *pi,
if (success < 0)
goto error;
- uri = totem_get_current_mrl (pi->totem);
+ uri = totem_get_current_mrl (pi->priv->totem);
escaped = (unsigned char *) g_uri_escape_string (uri, NULL, FALSE);
g_free (uri);
@@ -280,7 +268,7 @@ totem_disc_recorder_plugin_burn (GtkAction *action,
if (!path) {
totem_interface_error (_("The movie could not be recorded."),
error,
- totem_get_main_window (pi->totem));
+ totem_get_main_window (pi->priv->totem));
g_free (error);
return;
}
@@ -297,7 +285,7 @@ totem_disc_recorder_plugin_copy (GtkAction *action,
{
char *mrl;
- mrl = totem_get_current_mrl (pi->totem);
+ mrl = totem_get_current_mrl (pi->priv->totem);
if (!g_str_has_prefix (mrl, "dvd:") && !g_str_has_prefix (mrl, "vcd:")) {
g_free (mrl);
g_assert_not_reached ();
@@ -313,11 +301,11 @@ totem_disc_recorder_file_closed (TotemObject *totem,
{
GtkAction *action;
- action = gtk_action_group_get_action (pi->action_group, "VideoBurnToDisc");
+ action = gtk_action_group_get_action (pi->priv->action_group, "VideoBurnToDisc");
gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (pi->action_group, "VideoDVDCopy");
+ action = gtk_action_group_get_action (pi->priv->action_group, "VideoDVDCopy");
gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (pi->action_group, "VideoVCDCopy");
+ action = gtk_action_group_get_action (pi->priv->action_group, "VideoVCDCopy");
gtk_action_set_visible (action, FALSE);
}
@@ -326,50 +314,50 @@ totem_disc_recorder_file_opened (TotemObject *totem,
const char *mrl,
TotemDiscRecorderPlugin *pi)
{
+ TotemDiscRecorderPluginPrivate *priv = pi->priv;
GtkAction *action;
/* Check if that stream is supported by brasero */
if (g_str_has_prefix (mrl, "file:")) {
/* If the file is supported we can always burn, even if there
* aren't any burner since we can still create an image. */
- action = gtk_action_group_get_action (pi->action_group, "VideoBurnToDisc");
+ action = gtk_action_group_get_action (priv->action_group, "VideoBurnToDisc");
gtk_action_set_visible (action, TRUE);
- action = gtk_action_group_get_action (pi->action_group, "VideoDVDCopy");
+ action = gtk_action_group_get_action (priv->action_group, "VideoDVDCopy");
gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (pi->action_group, "VideoVCDCopy");
+ action = gtk_action_group_get_action (priv->action_group, "VideoVCDCopy");
gtk_action_set_visible (action, FALSE);
}
else if (g_str_has_prefix (mrl, "dvd:")) {
- action = gtk_action_group_get_action (pi->action_group, "VideoBurnToDisc");
+ action = gtk_action_group_get_action (priv->action_group, "VideoBurnToDisc");
gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (pi->action_group, "VideoDVDCopy");
+ action = gtk_action_group_get_action (priv->action_group, "VideoDVDCopy");
gtk_action_set_visible (action, TRUE);
- action = gtk_action_group_get_action (pi->action_group, "VideoVCDCopy");
+ action = gtk_action_group_get_action (priv->action_group, "VideoVCDCopy");
gtk_action_set_visible (action, FALSE);
}
else if (g_str_has_prefix (mrl, "vcd:")) {
- action = gtk_action_group_get_action (pi->action_group, "VideoBurnToDisc");
+ action = gtk_action_group_get_action (priv->action_group, "VideoBurnToDisc");
gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (pi->action_group, "VideoDVDCopy");
+ action = gtk_action_group_get_action (priv->action_group, "VideoDVDCopy");
gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (pi->action_group, "VideoVCDCopy");
+ action = gtk_action_group_get_action (priv->action_group, "VideoVCDCopy");
gtk_action_set_visible (action, TRUE);
}
else {
- action = gtk_action_group_get_action (pi->action_group, "VideoBurnToDisc");
+ action = gtk_action_group_get_action (priv->action_group, "VideoBurnToDisc");
gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (pi->action_group, "VideoDVDCopy");
+ action = gtk_action_group_get_action (priv->action_group, "VideoDVDCopy");
gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (pi->action_group, "VideoVCDCopy");
+ action = gtk_action_group_get_action (priv->action_group, "VideoVCDCopy");
gtk_action_set_visible (action, FALSE);
}
}
static void
-impl_activate (PeasActivatable *plugin, GObject *object)
+impl_activate (PeasActivatable *plugin)
{
- TotemDiscRecorderPlugin *pi = TOTEM_DISC_RECORDER_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemDiscRecorderPluginPrivate *priv = TOTEM_DISC_RECORDER_PLUGIN (plugin)->priv;
GtkUIManager *uimanager = NULL;
GtkAction *action;
char *path;
@@ -388,40 +376,38 @@ impl_activate (PeasActivatable *plugin, GObject *object)
g_free (path);
#endif
- pi->totem = totem;
-
- g_signal_connect (totem,
+ g_signal_connect (priv->totem,
"file-opened",
G_CALLBACK (totem_disc_recorder_file_opened),
plugin);
- g_signal_connect (totem,
+ g_signal_connect (priv->totem,
"file-closed",
G_CALLBACK (totem_disc_recorder_file_closed),
plugin);
/* add UI */
- pi->action_group = gtk_action_group_new ("DiscRecorderActions");
- gtk_action_group_set_translation_domain (pi->action_group, GETTEXT_PACKAGE);
- gtk_action_group_add_actions (pi->action_group,
+ priv->action_group = gtk_action_group_new ("DiscRecorderActions");
+ gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
+ gtk_action_group_add_actions (priv->action_group,
totem_disc_recorder_plugin_actions,
G_N_ELEMENTS (totem_disc_recorder_plugin_actions),
- pi);
+ plugin);
- uimanager = totem_get_ui_manager (totem);
- gtk_ui_manager_insert_action_group (uimanager, pi->action_group, -1);
- g_object_unref (pi->action_group);
+ uimanager = totem_get_ui_manager (priv->totem);
+ gtk_ui_manager_insert_action_group (uimanager, priv->action_group, -1);
+ g_object_unref (priv->action_group);
- pi->ui_merge_id = gtk_ui_manager_new_merge_id (uimanager);
+ priv->ui_merge_id = gtk_ui_manager_new_merge_id (uimanager);
gtk_ui_manager_add_ui (uimanager,
- pi->ui_merge_id,
+ priv->ui_merge_id,
"/ui/tmw-menubar/movie/burn-placeholder",
"VideoBurnToDisc",
"VideoBurnToDisc",
GTK_UI_MANAGER_MENUITEM,
TRUE);
gtk_ui_manager_add_ui (uimanager,
- pi->ui_merge_id,
+ priv->ui_merge_id,
"/ui/totem-main-popup/burn-placeholder",
"VideoBurnToDisc",
"VideoBurnToDisc",
@@ -429,14 +415,14 @@ impl_activate (PeasActivatable *plugin, GObject *object)
TRUE);
gtk_ui_manager_add_ui (uimanager,
- pi->ui_merge_id,
+ priv->ui_merge_id,
"/ui/tmw-menubar/movie/burn-placeholder",
"VideoDVDCopy",
"VideoDVDCopy",
GTK_UI_MANAGER_MENUITEM,
TRUE);
gtk_ui_manager_add_ui (uimanager,
- pi->ui_merge_id,
+ priv->ui_merge_id,
"/ui/totem-main-popup/burn-placeholder",
"VideoDVDCopy",
"VideoDVDCopy",
@@ -444,62 +430,48 @@ impl_activate (PeasActivatable *plugin, GObject *object)
TRUE);
gtk_ui_manager_add_ui (uimanager,
- pi->ui_merge_id,
+ priv->ui_merge_id,
"/ui/tmw-menubar/movie/burn-placeholder",
"VideoVCDCopy",
"VideoVCDCopy",
GTK_UI_MANAGER_MENUITEM,
TRUE);
gtk_ui_manager_add_ui (uimanager,
- pi->ui_merge_id,
+ priv->ui_merge_id,
"/ui/totem-main-popup/burn-placeholder",
"VideoVCDCopy",
"VideoVCDCopy",
GTK_UI_MANAGER_MENUITEM,
TRUE);
- if (!totem_is_paused (totem) && !totem_is_playing (totem)) {
- action = gtk_action_group_get_action (pi->action_group, "VideoBurnToDisc");
+ if (!totem_is_paused (priv->totem) && !totem_is_playing (priv->totem)) {
+ action = gtk_action_group_get_action (priv->action_group, "VideoBurnToDisc");
gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (pi->action_group, "VideoDVDCopy");
+ action = gtk_action_group_get_action (priv->action_group, "VideoDVDCopy");
gtk_action_set_visible (action, FALSE);
- action = gtk_action_group_get_action (pi->action_group, "VideoVCDCopy");
+ action = gtk_action_group_get_action (priv->action_group, "VideoVCDCopy");
gtk_action_set_visible (action, FALSE); }
else {
char *mrl;
- mrl = totem_get_current_mrl (totem);
- totem_disc_recorder_file_opened (totem, mrl, pi);
+ mrl = totem_get_current_mrl (priv->totem);
+ totem_disc_recorder_file_opened (priv->totem, mrl, TOTEM_DISC_RECORDER_PLUGIN (plugin));
g_free (mrl);
}
}
static void
-impl_deactivate (PeasActivatable *plugin, GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
- TotemDiscRecorderPlugin *pi = TOTEM_DISC_RECORDER_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemDiscRecorderPluginPrivate *priv = TOTEM_DISC_RECORDER_PLUGIN (plugin)->priv;
GtkUIManager *uimanager = NULL;
- pi->enabled = FALSE;
+ priv->enabled = FALSE;
- g_signal_handlers_disconnect_by_func (totem, totem_disc_recorder_file_opened, plugin);
- g_signal_handlers_disconnect_by_func (totem, totem_disc_recorder_file_closed, plugin);
+ g_signal_handlers_disconnect_by_func (priv->totem, totem_disc_recorder_file_opened, plugin);
+ g_signal_handlers_disconnect_by_func (priv->totem, totem_disc_recorder_file_closed, plugin);
- uimanager = totem_get_ui_manager (totem);
- gtk_ui_manager_remove_ui (uimanager, pi->ui_merge_id);
- gtk_ui_manager_remove_action_group (uimanager, pi->action_group);
-
- pi->totem = NULL;
+ uimanager = totem_get_ui_manager (priv->totem);
+ gtk_ui_manager_remove_ui (uimanager, priv->ui_merge_id);
+ gtk_ui_manager_remove_action_group (uimanager, priv->action_group);
}
-
-static void
-totem_disc_recorder_plugin_class_init (TotemDiscRecorderPluginClass *klass)
-{
-}
-
-static void
-totem_disc_recorder_plugin_init (TotemDiscRecorderPlugin *pi)
-{
-}
-
diff --git a/src/plugins/coherence_upnp/coherence_upnp.py b/src/plugins/coherence_upnp/coherence_upnp.py
index e1517df..15f8cb8 100644
--- a/src/plugins/coherence_upnp/coherence_upnp.py
+++ b/src/plugins/coherence_upnp/coherence_upnp.py
@@ -18,7 +18,10 @@ _ = gettext.gettext
class UPnPClient(gobject.GObject, Peas.Activatable):
__gtype_name__ = 'UPnPClient'
+ object = gobject.property(type = gobject.GObject)
+
def __init__ (self):
+ self.totem_object = self.object
self.ui = TreeWidget()
self.ui.window.set_shadow_type(gtk.SHADOW_IN)
self.ui.cb_item_right_click = self.button_pressed
@@ -107,14 +110,13 @@ class UPnPClient(gobject.GObject, Peas.Activatable):
else:
self.context = self.context_no_delete
- def do_activate (self, totem_object):
- totem_object.add_sidebar_page ("upnp-coherence", _("Coherence DLNA/UPnP Client"), self.ui.window)
- self.totem_object = totem_object
+ def do_activate (self):
+ self.totem_object.add_sidebar_page ("upnp-coherence", _("Coherence DLNA/UPnP Client"), self.ui.window)
def load_and_play(url):
- totem_object.add_to_playlist_and_play (url, '', True)
+ self.totem_object.add_to_playlist_and_play (url, '', True)
self.ui.cb_item_dbl_click = load_and_play
- def do_deactivate (self, totem_object):
- totem_object.remove_sidebar_page ("upnp-coherence")
+ def do_deactivate (self):
+ self.totem_object.remove_sidebar_page ("upnp-coherence")
diff --git a/src/plugins/dbus-service/dbus-service.py b/src/plugins/dbus-service/dbus-service.py
index eeb3f9f..7d96ffa 100644
--- a/src/plugins/dbus-service/dbus-service.py
+++ b/src/plugins/dbus-service/dbus-service.py
@@ -30,15 +30,17 @@ from dbus.mainloop.glib import DBusGMainLoop
class dbusservice(gobject.GObject, Peas.Activatable):
__gtype_name__ = 'dbusservice'
- def do_activate(self, totem):
+ object = gobject.property(type = gobject.GObject)
+
+ def do_activate(self):
DBusGMainLoop(set_as_default = True)
name = dbus.service.BusName ('org.mpris.Totem', bus = dbus.SessionBus ())
- self.root = Root (name, totem)
- self.player = Player (name, totem)
- self.track_list = TrackList (name, totem)
+ self.root = Root (name, self.object)
+ self.player = Player (name, self.object)
+ self.track_list = TrackList (name, self.object)
- def do_deactivate(self, totem):
+ def do_deactivate(self):
self.root.disconnect() # ensure we don't leak our paths on the bus
self.player.disconnect()
self.track_list.disconnect()
diff --git a/src/plugins/galago/totem-galago.c b/src/plugins/galago/totem-galago.c
index b6d4ec4..2bd77ec 100644
--- a/src/plugins/galago/totem-galago.c
+++ b/src/plugins/galago/totem-galago.c
@@ -48,83 +48,30 @@
#define TOTEM_GALAGO_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_GALAGO_PLUGIN, TotemGalagoPluginClass))
typedef struct {
- PeasExtensionBase parent;
-
+ TotemObject *totem;
guint handler_id_fullscreen;
guint handler_id_playing;
gboolean idle; /* Whether we're idle */
GalagoPerson *me; /* Me! */
-} TotemGalagoPlugin;
-
-typedef struct {
- PeasExtensionBaseClass parent_class;
-} TotemGalagoPluginClass;
-
-GType totem_galago_plugin_get_type (void) G_GNUC_CONST;
-
-static void totem_galago_plugin_dispose (GObject *object);
-static void totem_galago_plugin_finalize (GObject *object);
+} TotemGalagoPluginPrivate;
TOTEM_PLUGIN_REGISTER (TOTEM_TYPE_GALAGO_PLUGIN, TotemGalagoPlugin, totem_galago_plugin);
static void
-totem_galago_plugin_class_init (TotemGalagoPluginClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = totem_galago_plugin_dispose;
- object_class->finalize = totem_galago_plugin_finalize;
-}
-
-static void
-totem_galago_plugin_init (TotemGalagoPlugin *plugin)
-{
- if (galago_init (PACKAGE_NAME, GALAGO_INIT_FEED) == FALSE
- || galago_is_connected () == FALSE) {
- g_warning ("Failed to initialise libgalago.");
- return;
- }
-
- /* Get "me" and list accounts */
- plugin->me = galago_get_me (GALAGO_REMOTE, TRUE);
-}
-
-static void
-totem_galago_plugin_dispose (GObject *object)
-{
- TotemGalagoPlugin *plugin = TOTEM_GALAGO_PLUGIN (object);
-
- if (plugin->me != NULL) {
- g_object_unref (plugin->me);
- plugin->me = NULL;
- }
-
- G_OBJECT_CLASS (totem_galago_plugin_parent_class)->dispose (object);
-}
-
-static void
-totem_galago_plugin_finalize (GObject *object)
-{
- if (galago_is_connected ())
- galago_uninit ();
-
- G_OBJECT_CLASS (totem_galago_plugin_parent_class)->finalize (object);
-}
-
-static void
totem_galago_set_idleness (TotemGalagoPlugin *plugin, gboolean idle)
{
+ TotemGalagoPluginPrivate *priv = plugin->priv;
GList *account;
GalagoPresence *presence;
if (galago_is_connected () == FALSE)
return;
- if (plugin->idle == idle)
+ if (priv->idle == idle)
return;
- plugin->idle = idle;
- for (account = galago_person_get_accounts (plugin->me, TRUE); account != NULL; account = g_list_next (account)) {
+ priv->idle = idle;
+ for (account = galago_person_get_accounts (priv->me, TRUE); account != NULL; account = g_list_next (account)) {
presence = galago_account_get_presence ((GalagoAccount *)account->data, TRUE);
if (presence != NULL)
galago_presence_set_idle (presence, idle, time (NULL));
@@ -152,44 +99,50 @@ property_notify_cb (TotemObject *totem,
}
static void
-impl_activate (PeasActivatable *plugin, GObject *object)
+impl_activate (PeasActivatable *plugin)
{
- TotemGalagoPlugin *pi = TOTEM_GALAGO_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemGalagoPluginPrivate *priv = TOTEM_GALAGO_PLUGIN (plugin)->priv;
- if (!galago_is_connected ()) {
- GtkWindow *window = totem_get_main_window (totem);
+ if (galago_init (PACKAGE_NAME, GALAGO_INIT_FEED) == FALSE || galago_is_connected () == FALSE) {
+ GtkWindow *window = totem_get_main_window (priv->totem);
totem_interface_error (_("Error loading Galago plugin"), _("Could not connect to the Galago daemon."), window);
g_object_unref (window);
return;
}
- pi->handler_id_fullscreen = g_signal_connect (G_OBJECT (totem),
+ /* Get "me" and list accounts */
+ priv->me = galago_get_me (GALAGO_REMOTE, TRUE);
+
+ priv->handler_id_fullscreen = g_signal_connect (G_OBJECT (priv->totem),
"notify::fullscreen",
G_CALLBACK (property_notify_cb),
- pi);
- pi->handler_id_playing = g_signal_connect (G_OBJECT (totem),
+ plugin);
+ priv->handler_id_playing = g_signal_connect (G_OBJECT (priv->totem),
"notify::playing",
G_CALLBACK (property_notify_cb),
- pi);
+ plugin);
/* Force setting the current status */
- totem_galago_update_from_state (totem, pi);
+ totem_galago_update_from_state (priv->totem, TOTEM_GALAGO_PLUGIN (plugin));
}
static void
-impl_deactivate (PeasActivatable *plugin, GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
- TotemGalagoPlugin *pi = TOTEM_GALAGO_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemGalagoPluginPrivate *priv = TOTEM_GALAGO_PLUGIN (plugin)->priv;
/* Failed to initialise */
if (!galago_is_connected ())
return;
- g_signal_handler_disconnect (G_OBJECT (totem), pi->handler_id_fullscreen);
- g_signal_handler_disconnect (G_OBJECT (totem), pi->handler_id_playing);
+ g_signal_handler_disconnect (G_OBJECT (priv->totem), priv->handler_id_fullscreen);
+ g_signal_handler_disconnect (G_OBJECT (priv->totem), priv->handler_id_playing);
+
+ totem_galago_set_idleness (TOTEM_GALAGO_PLUGIN (plugin), FALSE);
+
+ if (priv->me != NULL)
+ g_object_unref (priv->me);
- totem_galago_set_idleness (pi, FALSE);
+ galago_uninit ();
}
diff --git a/src/plugins/gromit/totem-gromit.c b/src/plugins/gromit/totem-gromit.c
index 52df53f..5d67d36 100644
--- a/src/plugins/gromit/totem-gromit.c
+++ b/src/plugins/gromit/totem-gromit.c
@@ -56,19 +56,14 @@
typedef struct
{
- PeasExtensionBase parent;
+ TotemObject *totem;
char *path;
int id;
GPid pid;
gulong handler_id;
-} TotemGromitPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemGromitPluginClass;
+} TotemGromitPluginPrivate;
#define INTERVAL 10 /* seconds */
@@ -94,39 +89,9 @@ static const char *visibility_cmd[] = { NULL, "-v", NULL };
\"Core Pointer\"[Button3] = \"Eraser\"; \n\
\n"
-GType totem_gromit_plugin_get_type (void) G_GNUC_CONST;
-
-static void totem_gromit_plugin_finalize (GObject *object);
-
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_GROMIT_PLUGIN, TotemGromitPlugin, totem_gromit_plugin)
static void
-totem_gromit_plugin_class_init (TotemGromitPluginClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = totem_gromit_plugin_finalize;
-}
-
-static void
-totem_gromit_plugin_init (TotemGromitPlugin *plugin)
-{
- plugin->id = -1;
- plugin->pid = -1;
-}
-
-static void
-totem_gromit_plugin_finalize (GObject *object)
-{
- TotemGromitPlugin *plugin = TOTEM_GROMIT_PLUGIN (object);
-
- g_free (plugin->path);
- plugin->path = NULL;
-
- G_OBJECT_CLASS (totem_gromit_plugin_parent_class)->finalize (object);
-}
-
-static void
totem_gromit_ensure_config_file (void)
{
char *path;
@@ -150,13 +115,14 @@ totem_gromit_ensure_config_file (void)
static gboolean
totem_gromit_available (TotemGromitPlugin *plugin)
{
- plugin->path = g_find_program_in_path ("gromit");
+ TotemGromitPluginPrivate *priv = plugin->priv;
- if (plugin->path == NULL) {
+ priv->path = g_find_program_in_path ("gromit");
+
+ if (priv->path == NULL)
return FALSE;
- }
- start_cmd[0] = toggle_cmd[0] = clear_cmd[0] = visibility_cmd[0] = plugin->path;
+ start_cmd[0] = toggle_cmd[0] = clear_cmd[0] = visibility_cmd[0] = priv->path;
totem_gromit_ensure_config_file ();
return TRUE;
@@ -172,17 +138,19 @@ launch (const char **cmd)
static void
totem_gromit_exit (TotemGromitPlugin *plugin)
{
+ TotemGromitPluginPrivate *priv = plugin->priv;
+
/* Nothing to do */
- if (plugin->pid == -1) {
- if (plugin->id != -1) {
- g_source_remove (plugin->id);
- plugin->id = -1;
+ if (priv->pid == -1) {
+ if (priv->id != -1) {
+ g_source_remove (priv->id);
+ priv->id = -1;
}
return;
}
- kill ((pid_t) plugin->pid, SIGKILL);
- plugin->pid = -1;
+ kill ((pid_t) priv->pid, SIGKILL);
+ priv->pid = -1;
}
static gboolean
@@ -190,7 +158,7 @@ totem_gromit_timeout_cb (gpointer data)
{
TotemGromitPlugin *plugin = TOTEM_GROMIT_PLUGIN (data);
- plugin->id = -1;
+ plugin->priv->id = -1;
totem_gromit_exit (plugin);
return FALSE;
}
@@ -198,22 +166,24 @@ totem_gromit_timeout_cb (gpointer data)
static void
totem_gromit_toggle (TotemGromitPlugin *plugin)
{
+ TotemGromitPluginPrivate *priv = plugin->priv;
+
/* Not started */
- if (plugin->pid == -1) {
+ if (priv->pid == -1) {
if (g_spawn_async (NULL,
(char **)start_cmd, NULL, 0, NULL, NULL,
- &plugin->pid, NULL) == FALSE) {
+ &priv->pid, NULL) == FALSE) {
g_printerr ("Couldn't start gromit");
return;
}
- } else if (plugin->id == -1) { /* Started but disabled */
- g_source_remove (plugin->id);
- plugin->id = -1;
+ } else if (priv->id == -1) { /* Started but disabled */
+ g_source_remove (priv->id);
+ priv->id = -1;
launch (toggle_cmd);
} else {
/* Started and visible */
- g_source_remove (plugin->id);
- plugin->id = -1;
+ g_source_remove (priv->id);
+ priv->id = -1;
launch (toggle_cmd);
}
}
@@ -228,7 +198,7 @@ totem_gromit_clear (TotemGromitPlugin *plugin, gboolean now)
launch (visibility_cmd);
launch (clear_cmd);
- plugin->id = g_timeout_add_seconds (INTERVAL, totem_gromit_timeout_cb, plugin);
+ plugin->priv->id = g_timeout_add_seconds (INTERVAL, totem_gromit_timeout_cb, plugin);
}
static gboolean
@@ -254,14 +224,15 @@ on_window_key_press_event (GtkWidget *window, GdkEventKey *event, TotemGromitPlu
}
static void
-impl_activate (PeasActivatable *plugin,
- GObject *object)
+impl_activate (PeasActivatable *plugin)
{
- TotemGromitPlugin *pi = TOTEM_GROMIT_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemGromitPluginPrivate *priv = TOTEM_GROMIT_PLUGIN (plugin)->priv;
GtkWindow *window;
- if (!totem_gromit_available (pi)) {
+ priv->id = -1;
+ priv->pid = -1;
+
+ if (!totem_gromit_available (TOTEM_GROMIT_PLUGIN (plugin))) {
//FIXME
#if 0
g_set_error_literal (error, TOTEM_PLUGIN_ERROR, TOTEM_PLUGIN_ERROR_ACTIVATION,
@@ -271,27 +242,27 @@ impl_activate (PeasActivatable *plugin,
#endif
}
- window = totem_get_main_window (totem);
- pi->handler_id = g_signal_connect (G_OBJECT(window), "key-press-event",
+ window = totem_get_main_window (priv->totem);
+ priv->handler_id = g_signal_connect (G_OBJECT(window), "key-press-event",
G_CALLBACK (on_window_key_press_event), plugin);
g_object_unref (window);
}
static void
-impl_deactivate (PeasActivatable *plugin,
- GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
- TotemGromitPlugin *pi = TOTEM_GROMIT_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemGromitPluginPrivate *priv = TOTEM_GROMIT_PLUGIN (plugin)->priv;
GtkWindow *window;
- if (pi->handler_id != 0) {
- window = totem_get_main_window (totem);
- g_signal_handler_disconnect (G_OBJECT(window), pi->handler_id);
- pi->handler_id = 0;
+ if (priv->handler_id != 0) {
+ window = totem_get_main_window (priv->totem);
+ g_signal_handler_disconnect (G_OBJECT(window), priv->handler_id);
+ priv->handler_id = 0;
g_object_unref (window);
}
- totem_gromit_clear (pi, TRUE);
+ totem_gromit_clear (TOTEM_GROMIT_PLUGIN (plugin), TRUE);
+
+ g_free (priv->path);
}
diff --git a/src/plugins/iplayer/iplayer.py b/src/plugins/iplayer/iplayer.py
index a79dcec..525485a 100644
--- a/src/plugins/iplayer/iplayer.py
+++ b/src/plugins/iplayer/iplayer.py
@@ -16,14 +16,16 @@ _ = gettext.gettext
class IplayerPlugin (gobject.GObject, Peas.Activatable):
__gtype_name__ = 'IplayerPlugin'
+ object = gobject.property(type = gobject.GObject)
+
def __init__ (self):
self.debug = False
- self.totem = None
+ self.totem = self.object
self.programme_download_lock = threading.Lock ()
- def do_activate (self, totem_object):
+ def do_activate (self):
# Build the interface
- builder = Totem.plugin_load_interface ("iplayer", "iplayer.ui", True, totem_object.get_main_window (), self)
+ builder = Totem.plugin_load_interface ("iplayer", "iplayer.ui", True, self.totem.get_main_window (), self)
container = builder.get_object ('iplayer_vbox')
self.tv_tree_store = builder.get_object ('iplayer_programme_store')
@@ -31,7 +33,6 @@ class IplayerPlugin (gobject.GObject, Peas.Activatable):
programme_list.connect ('row-expanded', self._row_expanded_cb)
programme_list.connect ('row-activated', self._row_activated_cb)
- self.totem = totem_object
container.show_all ()
self.tv = iplayer2.feed ('tv')
@@ -42,8 +43,8 @@ class IplayerPlugin (gobject.GObject, Peas.Activatable):
# Get the channel category listings
self.populate_channel_list (self.tv, self.tv_tree_store)
- def do_deactivate (self, totem_object):
- totem_object.remove_sidebar_page ("iplayer")
+ def do_deactivate (self):
+ self.totem.remove_sidebar_page ("iplayer")
def populate_channel_list (self, feed, tree_store):
if self.debug:
diff --git a/src/plugins/jamendo/jamendo.py b/src/plugins/jamendo/jamendo.py
index 9c06583..e0db439 100644
--- a/src/plugins/jamendo/jamendo.py
+++ b/src/plugins/jamendo/jamendo.py
@@ -67,6 +67,8 @@ gconf_key = '/apps/totem/plugins/jamendo'
class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasUI.Configurable):
__gtype_name__ = 'JamendoPlugin'
+ object = gobject.property(type = gobject.GObject)
+
"""
Jamendo totem plugin GUI.
"""
@@ -79,16 +81,16 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasUI.Configurable):
def __init__(self):
self.debug = True
self.gstreamer_plugins_present = True
- self.totem = None
+ self.totem = self.object
self.gconf = GConf.Client.get_default()
self.init_settings()
- def do_activate(self, totem_object):
+ def do_activate(self):
"""
Plugin activation.
"""
# Initialise the interface
- builder = Totem.plugin_load_interface ("jamendo", "jamendo.ui", True, totem_object.get_main_window (), self)
+ builder = Totem.plugin_load_interface ("jamendo", "jamendo.ui", True, self.totem.get_main_window (), self)
self.popup = builder.get_object('popup_menu')
container = builder.get_object('container')
self.notebook = builder.get_object('notebook')
@@ -120,16 +122,15 @@ class JamendoPlugin(gobject.GObject, Peas.Activatable, PeasUI.Configurable):
builder.get_object('add_to_playlist').connect('activate', self.on_add_to_playlist_activate)
builder.get_object('jamendo_album_page').connect('activate', self.on_open_jamendo_album_page_activate)
- self.totem = totem_object
self.reset()
container.show_all()
self.totem.add_sidebar_page("jamendo", _("Jamendo"), container)
- def do_deactivate(self, totem_object):
+ def do_deactivate(self):
"""
Plugin deactivation.
"""
- totem_object.remove_sidebar_page("jamendo")
+ self.totem.remove_sidebar_page("jamendo")
def do_create_configure_widget(self):
"""
diff --git a/src/plugins/lirc/totem-lirc.c b/src/plugins/lirc/totem-lirc.c
index c348927..4b177da 100644
--- a/src/plugins/lirc/totem-lirc.c
+++ b/src/plugins/lirc/totem-lirc.c
@@ -53,18 +53,11 @@
typedef struct
{
- PeasExtensionBase parent;
-
GIOChannel *lirc_channel;
struct lirc_config *lirc_config;
TotemObject *totem;
-} TotemLircPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemLircPluginClass;
+} TotemLircPluginPrivate;
/* strings that we recognize as commands from lirc */
#define TOTEM_IR_COMMAND_PLAY "play"
@@ -96,20 +89,8 @@ typedef struct
#define TOTEM_IR_SETTING_TOGGLE_REPEAT "setting_repeat"
#define TOTEM_IR_SETTING_TOGGLE_SHUFFLE "setting_shuffle"
-GType totem_lirc_plugin_get_type (void) G_GNUC_CONST;
-
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_LIRC_PLUGIN, TotemLircPlugin, totem_lirc_plugin)
-static void
-totem_lirc_plugin_class_init (TotemLircPluginClass *klass)
-{
-}
-
-static void
-totem_lirc_plugin_init (TotemLircPlugin *plugin)
-{
-}
-
static char *
totem_lirc_get_url (const char *str)
{
@@ -194,6 +175,7 @@ totem_lirc_to_command (const gchar *str, char **url)
static gboolean
totem_lirc_read_code (GIOChannel *source, GIOCondition condition, TotemLircPlugin *pi)
{
+ TotemLircPluginPrivate *priv = pi->priv;
char *code;
char *str = NULL, *url = NULL;
int ok;
@@ -213,7 +195,7 @@ totem_lirc_read_code (GIOChannel *source, GIOCondition condition, TotemLircPlugi
}
do {
- ok = lirc_code2char (pi->lirc_config, code, &str);
+ ok = lirc_code2char (priv->lirc_config, code, &str);
if (ok != 0) {
/* Couldn't convert lirc code to string. */
@@ -230,12 +212,12 @@ totem_lirc_read_code (GIOChannel *source, GIOCondition condition, TotemLircPlugi
if (setting >= 0) {
gboolean value;
- value = totem_action_remote_get_setting (pi->totem, setting);
- totem_action_remote_set_setting (pi->totem, setting, !value);
+ value = totem_action_remote_get_setting (priv->totem, setting);
+ totem_action_remote_set_setting (priv->totem, setting, !value);
}
} else {
cmd = totem_lirc_to_command (str, &url);
- totem_action_remote (pi->totem, cmd, url);
+ totem_action_remote (priv->totem, cmd, url);
}
g_free (url);
} while (TRUE);
@@ -246,16 +228,12 @@ totem_lirc_read_code (GIOChannel *source, GIOCondition condition, TotemLircPlugi
}
static void
-impl_activate (PeasActivatable *plugin,
- GObject *object)
+impl_activate (PeasActivatable *plugin)
{
- TotemLircPlugin *pi = TOTEM_LIRC_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemLircPluginPrivate *priv = TOTEM_LIRC_PLUGIN (plugin)->priv;
char *path;
int fd;
- pi->totem = g_object_ref (totem);
-
fd = lirc_init ((char*) "Totem", 0);
if (fd < 0) {
//FIXME
@@ -268,7 +246,7 @@ impl_activate (PeasActivatable *plugin,
/* Load the default Totem setup */
path = totem_plugin_find_file ("lirc", "totem_lirc_default");
- if (path == NULL || lirc_readconfig (path, &pi->lirc_config, NULL) == -1) {
+ if (path == NULL || lirc_readconfig (path, &priv->lirc_config, NULL) == -1) {
g_free (path);
//FIXME
#if 0
@@ -281,42 +259,36 @@ impl_activate (PeasActivatable *plugin,
g_free (path);
/* Load the user config, doesn't matter if it's not there */
- lirc_readconfig (NULL, &pi->lirc_config, NULL);
+ lirc_readconfig (NULL, &priv->lirc_config, NULL);
- pi->lirc_channel = g_io_channel_unix_new (fd);
- g_io_channel_set_encoding (pi->lirc_channel, NULL, NULL);
- g_io_channel_set_buffered (pi->lirc_channel, FALSE);
- g_io_add_watch (pi->lirc_channel, G_IO_IN | G_IO_ERR | G_IO_HUP,
- (GIOFunc) totem_lirc_read_code, pi);
+ priv->lirc_channel = g_io_channel_unix_new (fd);
+ g_io_channel_set_encoding (priv->lirc_channel, NULL, NULL);
+ g_io_channel_set_buffered (priv->lirc_channel, FALSE);
+ g_io_add_watch (priv->lirc_channel, G_IO_IN | G_IO_ERR | G_IO_HUP,
+ (GIOFunc) totem_lirc_read_code, plugin);
}
static void
-impl_deactivate (PeasActivatable *plugin,
- GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
- TotemLircPlugin *pi = TOTEM_LIRC_PLUGIN (plugin);
+ TotemLircPluginPrivate *priv = TOTEM_LIRC_PLUGIN (plugin)->priv;
GError *error = NULL;
- if (pi->lirc_channel) {
- g_io_channel_shutdown (pi->lirc_channel, FALSE, &error);
+ if (priv->lirc_channel) {
+ g_io_channel_shutdown (priv->lirc_channel, FALSE, &error);
if (error != NULL) {
g_warning ("Couldn't destroy lirc connection: %s",
error->message);
g_error_free (error);
}
- pi->lirc_channel = NULL;
+ priv->lirc_channel = NULL;
}
- if (pi->lirc_config) {
- lirc_freeconfig (pi->lirc_config);
- pi->lirc_config = NULL;
+ if (priv->lirc_config) {
+ lirc_freeconfig (priv->lirc_config);
+ priv->lirc_config = NULL;
lirc_deinit ();
}
-
- if (pi->totem) {
- g_object_unref (pi->totem);
- pi->totem = NULL;
- }
}
diff --git a/src/plugins/media-player-keys/totem-media-player-keys.c b/src/plugins/media-player-keys/totem-media-player-keys.c
index 273eeab..374c3ed 100644
--- a/src/plugins/media-player-keys/totem-media-player-keys.c
+++ b/src/plugins/media-player-keys/totem-media-player-keys.c
@@ -50,35 +50,16 @@
typedef struct
{
- PeasExtensionBase parent;
-
+ TotemObject *totem;
DBusGProxy *media_player_keys_proxy;
-
guint handler_id;
-} TotemMediaPlayerKeysPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemMediaPlayerKeysPluginClass;
-
-GType totem_media_player_keys_plugin_get_type (void) G_GNUC_CONST;
+} TotemMediaPlayerKeysPluginPrivate;
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_MEDIA_PLAYER_KEYS_PLUGIN,
TotemMediaPlayerKeysPlugin,
totem_media_player_keys_plugin);
static void
-totem_media_player_keys_plugin_class_init (TotemMediaPlayerKeysPluginClass *klass)
-{
-}
-
-static void
-totem_media_player_keys_plugin_init (TotemMediaPlayerKeysPlugin *plugin)
-{
-}
-
-static void
on_media_player_key_pressed (DBusGProxy *proxy, const gchar *application, const gchar *key, TotemObject *totem)
{
if (strcmp ("Totem", application) == 0) {
@@ -96,8 +77,8 @@ on_media_player_key_pressed (DBusGProxy *proxy, const gchar *application, const
static gboolean
on_window_focus_in_event (GtkWidget *window, GdkEventFocus *event, TotemMediaPlayerKeysPlugin *pi)
{
- if (pi->media_player_keys_proxy != NULL) {
- dbus_g_proxy_call (pi->media_player_keys_proxy,
+ if (pi->priv->media_player_keys_proxy != NULL) {
+ dbus_g_proxy_call (pi->priv->media_player_keys_proxy,
"GrabMediaPlayerKeys", NULL,
G_TYPE_STRING, "Totem", G_TYPE_UINT, 0, G_TYPE_INVALID,
G_TYPE_INVALID);
@@ -110,15 +91,13 @@ static void
proxy_destroy (DBusGProxy *proxy,
TotemMediaPlayerKeysPlugin* plugin)
{
- plugin->media_player_keys_proxy = NULL;
+ plugin->priv->media_player_keys_proxy = NULL;
}
static void
-impl_activate (PeasActivatable *plugin,
- GObject *object)
+impl_activate (PeasActivatable *plugin)
{
- TotemMediaPlayerKeysPlugin *pi = TOTEM_MEDIA_PLAYER_KEYS_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemMediaPlayerKeysPluginPrivate *priv = TOTEM_MEDIA_PLAYER_KEYS_PLUGIN (plugin)->priv;
DBusGConnection *connection;
GError *err = NULL;
GtkWindow *window;
@@ -131,13 +110,13 @@ impl_activate (PeasActivatable *plugin,
/* Try the gnome-settings-daemon version,
* then the gnome-control-center version of things */
- pi->media_player_keys_proxy = dbus_g_proxy_new_for_name_owner (connection,
+ priv->media_player_keys_proxy = dbus_g_proxy_new_for_name_owner (connection,
"org.gnome.SettingsDaemon",
"/org/gnome/SettingsDaemon/MediaKeys",
"org.gnome.SettingsDaemon.MediaKeys",
NULL);
- if (pi->media_player_keys_proxy == NULL) {
- pi->media_player_keys_proxy = dbus_g_proxy_new_for_name_owner (connection,
+ if (priv->media_player_keys_proxy == NULL) {
+ priv->media_player_keys_proxy = dbus_g_proxy_new_for_name_owner (connection,
"org.gnome.SettingsDaemon",
"/org/gnome/SettingsDaemon",
"org.gnome.SettingsDaemon",
@@ -158,53 +137,50 @@ impl_activate (PeasActivatable *plugin,
#endif
return;
} else {
- g_signal_connect_object (pi->media_player_keys_proxy,
+ g_signal_connect_object (priv->media_player_keys_proxy,
"destroy",
G_CALLBACK (proxy_destroy),
- pi, 0);
+ plugin, 0);
}
- dbus_g_proxy_call (pi->media_player_keys_proxy,
+ dbus_g_proxy_call (priv->media_player_keys_proxy,
"GrabMediaPlayerKeys", NULL,
G_TYPE_STRING, "Totem", G_TYPE_UINT, 0, G_TYPE_INVALID,
G_TYPE_INVALID);
dbus_g_object_register_marshaller (totem_marshal_VOID__STRING_STRING,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_add_signal (pi->media_player_keys_proxy, "MediaPlayerKeyPressed",
+ dbus_g_proxy_add_signal (priv->media_player_keys_proxy, "MediaPlayerKeyPressed",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID);
- dbus_g_proxy_connect_signal (pi->media_player_keys_proxy, "MediaPlayerKeyPressed",
- G_CALLBACK (on_media_player_key_pressed), totem, NULL);
-
- window = totem_get_main_window (totem);
- pi->handler_id = g_signal_connect (G_OBJECT (window), "focus-in-event",
- G_CALLBACK (on_window_focus_in_event), pi);
+ dbus_g_proxy_connect_signal (priv->media_player_keys_proxy, "MediaPlayerKeyPressed",
+ G_CALLBACK (on_media_player_key_pressed), priv->totem, NULL);
+ window = totem_get_main_window (priv->totem);
+ priv->handler_id = g_signal_connect (G_OBJECT (window), "focus-in-event",
+ G_CALLBACK (on_window_focus_in_event), plugin);
g_object_unref (G_OBJECT (window));
}
static void
-impl_deactivate (PeasActivatable *plugin,
- GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
- TotemMediaPlayerKeysPlugin *pi = TOTEM_MEDIA_PLAYER_KEYS_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemMediaPlayerKeysPluginPrivate *priv = TOTEM_MEDIA_PLAYER_KEYS_PLUGIN (plugin)->priv;
GtkWindow *window;
- if (pi->media_player_keys_proxy != NULL) {
- dbus_g_proxy_call (pi->media_player_keys_proxy,
+ if (priv->media_player_keys_proxy != NULL) {
+ dbus_g_proxy_call (priv->media_player_keys_proxy,
"ReleaseMediaPlayerKeys", NULL,
G_TYPE_STRING, "Totem", G_TYPE_INVALID, G_TYPE_INVALID);
- g_object_unref (pi->media_player_keys_proxy);
- pi->media_player_keys_proxy = NULL;
+ g_object_unref (priv->media_player_keys_proxy);
+ priv->media_player_keys_proxy = NULL;
}
- if (pi->handler_id != 0) {
- window = totem_get_main_window (totem);
+ if (priv->handler_id != 0) {
+ window = totem_get_main_window (priv->totem);
if (window == NULL)
return;
- g_signal_handler_disconnect (G_OBJECT (window), pi->handler_id);
+ g_signal_handler_disconnect (G_OBJECT (window), priv->handler_id);
g_object_unref (window);
}
diff --git a/src/plugins/mythtv/totem-mythtv.c b/src/plugins/mythtv/totem-mythtv.c
index 73de0ec..d51d918 100644
--- a/src/plugins/mythtv/totem-mythtv.c
+++ b/src/plugins/mythtv/totem-mythtv.c
@@ -71,8 +71,6 @@ enum {
typedef struct
{
- PeasExtensionBase parent;
-
GList *lst_b_info;
GMythUPnP *upnp;
@@ -81,16 +79,7 @@ typedef struct
GtkWidget *sidebar_recordings;
GtkWidget *sidebar_livetv;
-} TotemMythtvPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemMythtvPluginClass;
-
-
-GType totem_mythtv_plugin_get_type (void) G_GNUC_CONST;
-static void totem_mythtv_plugin_finalize (GObject *object);
+} TotemMythtvPluginPrivate;
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_MYTHTV_PLUGIN, TotemMythtvPlugin, totem_mythtv_plugin)
@@ -182,7 +171,7 @@ create_treeview (TotemMythtvPlugin *plugin)
G_TYPE_STRING));
treeview = GTK_WIDGET (g_object_new (TOTEM_TYPE_VIDEO_LIST,
- "totem", plugin->totem,
+ "totem", plugin->priv->totem,
"mrl-column", URI_COL,
"tooltip-column", DESCRIPTION_COL,
NULL));
@@ -231,7 +220,7 @@ totem_mythtv_list_recordings (TotemMythtvPlugin *tm,
gmyth_scheduler_disconnect (scheduler);
g_object_unref (scheduler);
- model = g_object_get_data (G_OBJECT (tm->sidebar_recordings), "model");
+ model = g_object_get_data (G_OBJECT (tm->priv->sidebar_recordings), "model");
for (l = list; l != NULL; l = l->next) {
RecordedInfo *recorded_info = (RecordedInfo *) l->data;
@@ -305,7 +294,7 @@ totem_mythtv_list_livetv (TotemMythtvPlugin *tm,
gmyth_epg_disconnect (epg);
g_object_unref (epg);
- model = g_object_get_data (G_OBJECT (tm->sidebar_livetv), "model");
+ model = g_object_get_data (G_OBJECT (tm->priv->sidebar_livetv), "model");
clist = g_list_sort (clist, (GCompareFunc) sort_channels);
for (ch = clist; ch != NULL; ch = ch->next) {
@@ -336,20 +325,12 @@ totem_mythtv_list_livetv (TotemMythtvPlugin *tm,
}
static void
-totem_mythtv_plugin_class_init (TotemMythtvPluginClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = totem_mythtv_plugin_finalize;
-}
-
-static void
device_found_cb (GMythUPnP *upnp,
GMythBackendInfo *b_info,
TotemMythtvPlugin *plugin)
{
- if (!g_list_find (plugin->lst_b_info, b_info)) {
- plugin->lst_b_info = g_list_append (plugin->lst_b_info,
+ if (!g_list_find (plugin->priv->lst_b_info, b_info)) {
+ plugin->priv->lst_b_info = g_list_append (plugin->priv->lst_b_info,
g_object_ref (b_info));
totem_mythtv_list_recordings (plugin, b_info);
totem_mythtv_list_livetv (plugin, b_info);
@@ -364,10 +345,10 @@ device_lost_cb (GMythUPnP *upnp,
GList *elem;
GMythBackendInfo *b_info;
- elem = g_list_find (plugin->lst_b_info, info);
+ elem = g_list_find (plugin->priv->lst_b_info, info);
if (elem && elem->data) {
b_info = elem->data;
- plugin->lst_b_info = g_list_remove (plugin->lst_b_info,
+ plugin->priv->lst_b_info = g_list_remove (plugin->priv->lst_b_info,
b_info);
g_object_unref (b_info);
}
@@ -377,103 +358,68 @@ device_lost_cb (GMythUPnP *upnp,
static void
totem_mythtv_update_binfo (TotemMythtvPlugin *plugin)
{
+ TotemMythtvPluginPrivate *priv = plugin->priv;
GList *lst;
GList *w;
/* Clear old b_info */
- if (plugin->lst_b_info != NULL) {
- g_list_foreach (plugin->lst_b_info, (GFunc) g_object_unref, NULL);
- g_list_free (plugin->lst_b_info);
- plugin->lst_b_info = NULL;
+ if (priv->lst_b_info != NULL) {
+ g_list_foreach (priv->lst_b_info, (GFunc) g_object_unref, NULL);
+ g_list_free (priv->lst_b_info);
+ priv->lst_b_info = NULL;
}
-
/* Using GMythUPnP to search for avaliable servers */
- if (plugin->upnp == NULL) {
- plugin->upnp = gmyth_upnp_get_instance ();
- g_signal_connect (G_OBJECT (plugin->upnp),
+ if (priv->upnp == NULL) {
+ priv->upnp = gmyth_upnp_get_instance ();
+ g_signal_connect (G_OBJECT (priv->upnp),
"device-found",
G_CALLBACK (device_found_cb),
plugin);
- plugin->upnp = gmyth_upnp_get_instance ();
- g_signal_connect (G_OBJECT (plugin->upnp),
+ priv->upnp = gmyth_upnp_get_instance ();
+ g_signal_connect (G_OBJECT (priv->upnp),
"device-lost",
G_CALLBACK (device_lost_cb),
plugin);
}
/* Load current servers */
- lst = gmyth_upnp_get_devices (plugin->upnp);
+ lst = gmyth_upnp_get_devices (priv->upnp);
for (w = lst; w != NULL; w = w->next) {
GMythBackendInfo *b_info;
b_info = (GMythBackendInfo *) w->data;
- plugin->lst_b_info = g_list_append (plugin->lst_b_info,
+ priv->lst_b_info = g_list_append (priv->lst_b_info,
b_info);
totem_mythtv_list_recordings (plugin, b_info);
totem_mythtv_list_livetv (plugin, b_info);
}
g_list_free (lst);
- gmyth_upnp_search (plugin->upnp);
+ gmyth_upnp_search (priv->upnp);
}
static void
refresh_cb (GtkWidget *button, TotemMythtvPlugin *tm)
{
+ TotemMythtvPluginPrivate *priv = tm->priv;
GtkTreeModel *model;
gtk_widget_set_sensitive (button, FALSE);
- totem_gdk_window_set_waiting_cursor (gtk_widget_get_window (tm->sidebar_recordings));
- totem_gdk_window_set_waiting_cursor (gtk_widget_get_window (tm->sidebar_livetv));
+ totem_gdk_window_set_waiting_cursor (gtk_widget_get_window (priv->sidebar_recordings));
+ totem_gdk_window_set_waiting_cursor (gtk_widget_get_window (priv->sidebar_livetv));
- model = g_object_get_data (G_OBJECT (tm->sidebar_recordings), "model");
+ model = g_object_get_data (G_OBJECT (priv->sidebar_recordings), "model");
gtk_list_store_clear (GTK_LIST_STORE (model));
- model = g_object_get_data (G_OBJECT (tm->sidebar_livetv), "model");
+ model = g_object_get_data (G_OBJECT (priv->sidebar_livetv), "model");
gtk_list_store_clear (GTK_LIST_STORE (model));
totem_mythtv_update_binfo (tm);
- gdk_window_set_cursor (gtk_widget_get_window (tm->sidebar_recordings), NULL);
- gdk_window_set_cursor (gtk_widget_get_window (tm->sidebar_livetv), NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (priv->sidebar_recordings), NULL);
+ gdk_window_set_cursor (gtk_widget_get_window (priv->sidebar_livetv), NULL);
gtk_widget_set_sensitive (button, TRUE);
}
-static void
-totem_mythtv_plugin_init (TotemMythtvPlugin *plugin)
-{
- totem_mythtv_update_binfo (plugin);
-}
-
-static void
-totem_mythtv_plugin_finalize (GObject *object)
-{
- TotemMythtvPlugin *tm = TOTEM_MYTHTV_PLUGIN(object);
-
- if (tm->lst_b_info != NULL) {
- g_list_foreach (tm->lst_b_info, (GFunc ) g_object_unref, NULL);
- g_list_free (tm->lst_b_info);
- tm->lst_b_info = NULL;
- }
- if (tm->client != NULL) {
- g_object_unref (tm->client);
- tm->client = NULL;
- }
- if (tm->upnp != NULL) {
- g_object_unref (tm->upnp);
- tm->upnp = NULL;
- }
- if (tm->sidebar_recordings != NULL) {
- gtk_widget_destroy (tm->sidebar_recordings);
- tm->sidebar_recordings = NULL;
- }
- if (tm->sidebar_livetv != NULL) {
- gtk_widget_destroy (tm->sidebar_livetv);
- tm->sidebar_livetv = NULL;
- }
-
- G_OBJECT_CLASS (totem_mythtv_plugin_parent_class)->finalize (object);
-}
-
static GtkWidget *
add_sidebar (TotemMythtvPlugin *tm, const char *name, const char *label)
{
@@ -493,7 +439,7 @@ add_sidebar (TotemMythtvPlugin *tm, const char *name, const char *label)
gtk_container_add (GTK_CONTAINER (box), scrolled);
gtk_box_pack_end (GTK_BOX (box), button, FALSE, FALSE, 0);
gtk_widget_show_all (box);
- totem_add_sidebar_page (tm->totem, name, label, box);
+ totem_add_sidebar_page (tm->priv->totem, name, label, box);
g_object_set_data (G_OBJECT (box), "treeview", treeview);
g_object_set_data (G_OBJECT (box), "model",
@@ -503,18 +449,14 @@ add_sidebar (TotemMythtvPlugin *tm, const char *name, const char *label)
}
static void
-impl_activate (PeasActivatable *plugin,
- GObject *object)
+impl_activate (PeasActivatable *plugin)
{
TotemMythtvPlugin *tm = TOTEM_MYTHTV_PLUGIN(plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
- tm->totem = g_object_ref (totem);
+ tm->priv->sidebar_recordings = add_sidebar (tm, "mythtv-recordings", _("MythTV Recordings"));
+ tm->priv->sidebar_livetv = add_sidebar (tm, "mythtv-livetv", _("MythTV LiveTV"));
- tm->sidebar_recordings = add_sidebar (tm, "mythtv-recordings", _("MythTV Recordings"));
- tm->sidebar_livetv = add_sidebar (tm, "mythtv-livetv", _("MythTV LiveTV"));
-
- totem_mythtv_update_binfo (TOTEM_MYTHTV_PLUGIN(plugin));
+ totem_mythtv_update_binfo (tm);
/* FIXME we should only do that if it will be done in the background */
#if 0
@@ -526,35 +468,33 @@ impl_activate (PeasActivatable *plugin,
}
static void
-impl_deactivate (PeasActivatable *plugin,
- GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
- TotemMythtvPlugin *tm = TOTEM_MYTHTV_PLUGIN(plugin);
+ TotemMythtvPluginPrivate *priv = TOTEM_MYTHTV_PLUGIN (plugin)->priv;
- totem_remove_sidebar_page (tm->totem, MYTHTV_SIDEBAR_RECORDINGS);
- totem_remove_sidebar_page (tm->totem, MYTHTV_SIDEBAR_LIVETV);
+ totem_remove_sidebar_page (priv->totem, MYTHTV_SIDEBAR_RECORDINGS);
+ totem_remove_sidebar_page (priv->totem, MYTHTV_SIDEBAR_LIVETV);
- if (tm->lst_b_info != NULL) {
- g_list_foreach (tm->lst_b_info, (GFunc ) g_object_unref, NULL);
- g_list_free (tm->lst_b_info);
- tm->lst_b_info = NULL;
- }
- if (tm->client != NULL) {
- g_object_unref (tm->client);
- tm->client = NULL;
- }
- if (tm->upnp != NULL) {
- g_object_unref (tm->upnp);
- tm->upnp = NULL;
- }
- if (tm->sidebar_recordings != NULL) {
- gtk_widget_destroy (tm->sidebar_recordings);
- tm->sidebar_recordings = NULL;
- }
- if (tm->sidebar_livetv != NULL) {
- gtk_widget_destroy (tm->sidebar_livetv);
- tm->sidebar_livetv = NULL;
+ if (priv->lst_b_info != NULL) {
+ g_list_foreach (priv->lst_b_info, (GFunc ) g_object_unref, NULL);
+ g_list_free (priv->lst_b_info);
}
- g_object_unref (tm->totem);
+ priv->lst_b_info = NULL;
+
+ if (priv->client != NULL)
+ g_object_unref (priv->client);
+ priv->client = NULL;
+
+ if (priv->upnp != NULL)
+ g_object_unref (priv->upnp);
+ priv->upnp = NULL;
+
+ if (priv->sidebar_recordings != NULL)
+ gtk_widget_destroy (priv->sidebar_recordings);
+ priv->sidebar_recordings = NULL;
+
+ if (priv->sidebar_livetv != NULL)
+ gtk_widget_destroy (priv->sidebar_livetv);
+ priv->sidebar_livetv = NULL;
}
diff --git a/src/plugins/ontop/totem-ontop.c b/src/plugins/ontop/totem-ontop.c
index c62e169..fc363a1 100644
--- a/src/plugins/ontop/totem-ontop.c
+++ b/src/plugins/ontop/totem-ontop.c
@@ -54,34 +54,9 @@ typedef struct
TotemObject *totem;
} TotemOntopPluginPrivate;
-typedef struct
-{
- PeasExtensionBase parent;
- TotemOntopPluginPrivate *priv;
-} TotemOntopPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemOntopPluginClass;
-
-GType totem_ontop_plugin_get_type (void) G_GNUC_CONST;
-
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_ONTOP_PLUGIN, TotemOntopPlugin, totem_ontop_plugin)
static void
-totem_ontop_plugin_class_init (TotemOntopPluginClass *klass)
-{
- g_type_class_add_private (klass, sizeof (TotemOntopPluginPrivate));
-}
-
-static void
-totem_ontop_plugin_init (TotemOntopPlugin *plugin)
-{
- plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin, TOTEM_TYPE_ONTOP_PLUGIN, TotemOntopPluginPrivate);
-}
-
-static void
update_from_state (TotemOntopPluginPrivate *priv)
{
GValue has_video = { 0, };
@@ -109,43 +84,38 @@ property_notify_cb (TotemObject *totem,
}
static void
-impl_activate (PeasActivatable *plugin,
- GObject *object)
+impl_activate (PeasActivatable *plugin)
{
- TotemOntopPlugin *pi = TOTEM_ONTOP_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemOntopPluginPrivate *priv = TOTEM_ONTOP_PLUGIN (plugin)->priv;
- pi->priv->window = totem_get_main_window (totem);
- pi->priv->bvw = BACON_VIDEO_WIDGET (totem_get_video_widget (totem));
- pi->priv->totem = totem;
+ priv->window = totem_get_main_window (priv->totem);
+ priv->bvw = BACON_VIDEO_WIDGET (totem_get_video_widget (priv->totem));
- pi->priv->handler_id = g_signal_connect (G_OBJECT (totem),
+ priv->handler_id = g_signal_connect (G_OBJECT (priv->totem),
"notify::playing",
G_CALLBACK (property_notify_cb),
- pi);
- pi->priv->handler_id_metadata = g_signal_connect (G_OBJECT (pi->priv->bvw),
+ plugin);
+ priv->handler_id_metadata = g_signal_connect (G_OBJECT (priv->bvw),
"got-metadata",
G_CALLBACK (got_metadata_cb),
- pi);
+ plugin);
- update_from_state (pi->priv);
+ update_from_state (priv);
}
static void
-impl_deactivate (PeasActivatable *plugin,
- GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
- TotemOntopPlugin *pi = TOTEM_ONTOP_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemOntopPluginPrivate *priv = TOTEM_ONTOP_PLUGIN (plugin)->priv;
- g_signal_handler_disconnect (G_OBJECT (totem), pi->priv->handler_id);
- g_signal_handler_disconnect (G_OBJECT (pi->priv->bvw), pi->priv->handler_id_metadata);
+ g_signal_handler_disconnect (G_OBJECT (priv->totem), priv->handler_id);
+ g_signal_handler_disconnect (G_OBJECT (priv->bvw), priv->handler_id_metadata);
- g_object_unref (pi->priv->bvw);
+ g_object_unref (priv->bvw);
/* We can't really "restore" the previous state, as there's
* no way to find the old state */
- gtk_window_set_keep_above (pi->priv->window, FALSE);
- g_object_unref (pi->priv->window);
+ gtk_window_set_keep_above (priv->window, FALSE);
+ g_object_unref (priv->window);
}
diff --git a/src/plugins/opensubtitles/opensubtitles.py b/src/plugins/opensubtitles/opensubtitles.py
index 6cae53d..cf767e4 100644
--- a/src/plugins/opensubtitles/opensubtitles.py
+++ b/src/plugins/opensubtitles/opensubtitles.py
@@ -297,24 +297,23 @@ class OpenSubtitlesModel(object):
class OpenSubtitles(gobject.GObject, Peas.Activatable):
__gtype_name__ = 'OpenSubtitles'
+ object = gobject.property(type = gobject.GObject)
+
def __init__(self):
self.dialog = None
+ self.totem = self.object
self.gconf_client = GConf.Client.get_default()
self.GCONF_BASE_DIR = "/apps/totem/plugins/opensubtitles/"
self.GCONF_LANGUAGE = "language"
# totem.Plugin methods
- def do_activate(self, totem_object):
+ def do_activate(self):
"""
Called when the plugin is activated.
Here the sidebar page is initialized(set up the treeview, connect
the callbacks, ...) and added to totem.
-
- @param totem_object:
- @type totem_object: {totem.TotemObject}
"""
- self.totem = totem_object
self.filename = None
self.manager = self.totem.get_ui_manager()
@@ -327,7 +326,7 @@ class OpenSubtitles(gobject.GObject, Peas.Activatable):
server = xmlrpclib.Server('http://api.opensubtitles.org/xml-rpc')
self.model = OpenSubtitlesModel(server)
- def do_deactivate(self, totem):
+ def do_deactivate(self):
if self.dialog:
self.dialog.destroy()
self.dialog = None
@@ -336,8 +335,8 @@ class OpenSubtitles(gobject.GObject, Peas.Activatable):
# UI related code
- def os_build_dialog(self, action, totem_object):
- builder = Totem.plugin_load_interface ("opensubtitles", "opensubtitles.ui", True, totem_object.get_main_window (), self)
+ def os_build_dialog(self, action):
+ builder = Totem.plugin_load_interface ("opensubtitles", "opensubtitles.ui", True, self.totem.get_main_window (), self)
# Obtain all the widgets we need to initialize
combobox = builder.get_object('language_combobox')
@@ -403,9 +402,9 @@ class OpenSubtitles(gobject.GObject, Peas.Activatable):
self.treeview.get_selection().connect('changed', self.on_treeview__row_change)
self.treeview.connect('row-activated', self.on_treeview__row_activate)
- def os_show_dialog(self, action, totem_object):
+ def os_show_dialog(self, action):
if not self.dialog:
- self.os_build_dialog(action, totem_object)
+ self.os_build_dialog(action)
filename = self.totem.get_current_mrl()
if not self.model.results or filename != self.filename:
diff --git a/src/plugins/properties/totem-movie-properties.c b/src/plugins/properties/totem-movie-properties.c
index ed678a4..901a98d 100644
--- a/src/plugins/properties/totem-movie-properties.c
+++ b/src/plugins/properties/totem-movie-properties.c
@@ -49,34 +49,17 @@
typedef struct
{
- PeasExtensionBase parent;
+ TotemObject *totem;
GtkWidget *props;
guint handler_id_stream_length;
-} TotemMoviePropertiesPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemMoviePropertiesPluginClass;
-
-GType totem_movie_properties_plugin_get_type (void) G_GNUC_CONST;
+} TotemMoviePropertiesPluginPrivate;
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_MOVIE_PROPERTIES_PLUGIN,
TotemMoviePropertiesPlugin,
totem_movie_properties_plugin)
static void
-totem_movie_properties_plugin_class_init (TotemMoviePropertiesPluginClass *klass)
-{
-}
-
-static void
-totem_movie_properties_plugin_init (TotemMoviePropertiesPlugin *plugin)
-{
-}
-
-static void
stream_length_notify_cb (TotemObject *totem,
GParamSpec *arg1,
TotemMoviePropertiesPlugin *plugin)
@@ -88,7 +71,7 @@ stream_length_notify_cb (TotemObject *totem,
NULL);
bacon_video_widget_properties_from_time
- (BACON_VIDEO_WIDGET_PROPERTIES (plugin->props),
+ (BACON_VIDEO_WIDGET_PROPERTIES (plugin->priv->props),
stream_length);
}
@@ -101,9 +84,9 @@ totem_movie_properties_plugin_file_opened (TotemObject *totem,
bvw = totem_get_video_widget (totem);
bacon_video_widget_properties_update
- (BACON_VIDEO_WIDGET_PROPERTIES (plugin->props), bvw);
+ (BACON_VIDEO_WIDGET_PROPERTIES (plugin->priv->props), bvw);
g_object_unref (bvw);
- gtk_widget_set_sensitive (plugin->props, TRUE);
+ gtk_widget_set_sensitive (plugin->priv->props, TRUE);
}
static void
@@ -112,8 +95,8 @@ totem_movie_properties_plugin_file_closed (TotemObject *totem,
{
/* Reset the properties and wait for the signal*/
bacon_video_widget_properties_reset
- (BACON_VIDEO_WIDGET_PROPERTIES (plugin->props));
- gtk_widget_set_sensitive (plugin->props, FALSE);
+ (BACON_VIDEO_WIDGET_PROPERTIES (plugin->priv->props));
+ gtk_widget_set_sensitive (plugin->priv->props, FALSE);
}
static void
@@ -128,66 +111,57 @@ totem_movie_properties_plugin_metadata_updated (TotemObject *totem,
bvw = totem_get_video_widget (totem);
bacon_video_widget_properties_update
- (BACON_VIDEO_WIDGET_PROPERTIES (plugin->props), bvw);
+ (BACON_VIDEO_WIDGET_PROPERTIES (plugin->priv->props), bvw);
g_object_unref (bvw);
}
static void
-impl_activate (PeasActivatable *plugin,
- GObject *object)
+impl_activate (PeasActivatable *plugin)
{
- TotemMoviePropertiesPlugin *pi;
- TotemObject *totem;
+ TotemMoviePropertiesPluginPrivate *priv = TOTEM_MOVIE_PROPERTIES_PLUGIN (plugin)->priv;
- pi = TOTEM_MOVIE_PROPERTIES_PLUGIN (plugin);
- totem = TOTEM_OBJECT (object);
-
- pi->props = bacon_video_widget_properties_new ();
- gtk_widget_show (pi->props);
- totem_add_sidebar_page (totem,
+ priv->props = bacon_video_widget_properties_new ();
+ gtk_widget_show (priv->props);
+ totem_add_sidebar_page (priv->totem,
"properties",
_("Properties"),
- pi->props);
- gtk_widget_set_sensitive (pi->props, FALSE);
+ priv->props);
+ gtk_widget_set_sensitive (priv->props, FALSE);
- g_signal_connect (G_OBJECT (totem),
+ g_signal_connect (G_OBJECT (priv->totem),
"file-opened",
G_CALLBACK (totem_movie_properties_plugin_file_opened),
plugin);
- g_signal_connect (G_OBJECT (totem),
+ g_signal_connect (G_OBJECT (priv->totem),
"file-closed",
G_CALLBACK (totem_movie_properties_plugin_file_closed),
plugin);
- g_signal_connect (G_OBJECT (totem),
+ g_signal_connect (G_OBJECT (priv->totem),
"metadata-updated",
G_CALLBACK (totem_movie_properties_plugin_metadata_updated),
plugin);
- pi->handler_id_stream_length = g_signal_connect (G_OBJECT (totem),
+ priv->handler_id_stream_length = g_signal_connect (G_OBJECT (priv->totem),
"notify::stream-length",
G_CALLBACK (stream_length_notify_cb),
plugin);
}
static void
-impl_deactivate (PeasActivatable *plugin,
- GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
- TotemMoviePropertiesPlugin *pi;
- TotemObject *totem = TOTEM_OBJECT (object);
-
- pi = TOTEM_MOVIE_PROPERTIES_PLUGIN (plugin);
+ TotemMoviePropertiesPluginPrivate *priv = TOTEM_MOVIE_PROPERTIES_PLUGIN (plugin)->priv;
- g_signal_handler_disconnect (G_OBJECT (totem), pi->handler_id_stream_length);
- g_signal_handlers_disconnect_by_func (G_OBJECT (totem),
+ g_signal_handler_disconnect (G_OBJECT (priv->totem), priv->handler_id_stream_length);
+ g_signal_handlers_disconnect_by_func (G_OBJECT (priv->totem),
totem_movie_properties_plugin_metadata_updated,
plugin);
- g_signal_handlers_disconnect_by_func (G_OBJECT (totem),
+ g_signal_handlers_disconnect_by_func (G_OBJECT (priv->totem),
totem_movie_properties_plugin_file_opened,
plugin);
- g_signal_handlers_disconnect_by_func (G_OBJECT (totem),
+ g_signal_handlers_disconnect_by_func (G_OBJECT (priv->totem),
totem_movie_properties_plugin_file_closed,
plugin);
- pi->handler_id_stream_length = 0;
- totem_remove_sidebar_page (totem, "properties");
+ priv->handler_id_stream_length = 0;
+ totem_remove_sidebar_page (priv->totem, "properties");
}
diff --git a/src/plugins/publish/totem-publish.c b/src/plugins/publish/totem-publish.c
index d08bc10..15c84d2 100644
--- a/src/plugins/publish/totem-publish.c
+++ b/src/plugins/publish/totem-publish.c
@@ -70,10 +70,7 @@ enum
LAST_COLUMN
};
-typedef struct
-{
- PeasExtensionBase parent;
-
+typedef struct {
TotemObject *totem;
GConfClient *client;
GtkWidget *settings;
@@ -92,14 +89,7 @@ typedef struct
gulong item_added_id;
gulong item_removed_id;
-} TotemPublishPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemPublishPluginClass;
-
-GType totem_publish_plugin_get_type (void) G_GNUC_CONST;
+} TotemPublishPluginPrivate;
void totem_publish_plugin_service_name_entry_changed_cb (GtkEntry *entry,
gpointer data);
@@ -126,7 +116,7 @@ totem_publish_plugin_name_changed_cb (GConfClient *client,
const gchar *pattern = gconf_value_get_string (entry->value);
gchar *name = epc_publisher_expand_name (pattern, NULL);
- epc_publisher_set_service_name (self->publisher, name);
+ epc_publisher_set_service_name (self->priv->publisher, name);
g_free (name);
}
@@ -172,9 +162,9 @@ totem_publish_plugin_protocol_changed_cb (GConfClient *client,
protocol_name = gconf_value_get_string (entry->value);
protocol = epc_protocol_from_name (protocol_name, EPC_PROTOCOL_HTTPS);
- epc_publisher_quit (self->publisher);
- epc_publisher_set_protocol (self->publisher, protocol);
- epc_publisher_run_async (self->publisher, &error);
+ epc_publisher_quit (self->priv->publisher);
+ epc_publisher_set_protocol (self->priv->publisher, protocol);
+ epc_publisher_run_async (self->priv->publisher, &error);
if (error) {
g_warning ("%s: %s", G_STRFUNC, error->message);
@@ -203,9 +193,9 @@ totem_publish_plugin_playlist_cb (EpcPublisher *publisher,
g_string_append_printf (buffer,
"[playlist]\nNumberOfEntries=%d\n",
- g_slist_length (self->playlist));
+ g_slist_length (self->priv->playlist));
- for (iter = self->playlist, i = 1; iter; iter = iter->next, ++i) {
+ for (iter = self->priv->playlist, i = 1; iter; iter = iter->next, ++i) {
gchar *file_key = iter->data;
gchar *uri;
@@ -289,26 +279,26 @@ totem_publish_plugin_rebuild_playlist_cb (TotemPlaylist *playlist,
{
TotemPublishPlugin *self = TOTEM_PUBLISH_PLUGIN (data);
gchar *key = totem_publish_plugin_build_key (filename);
- self->playlist = g_slist_prepend (self->playlist, key);
+ self->priv->playlist = g_slist_prepend (self->priv->playlist, key);
}
static void
totem_publish_plugin_playlist_changed_cb (TotemPlaylist *playlist,
gpointer data)
{
- TotemPublishPlugin *self = TOTEM_PUBLISH_PLUGIN (data);
+ TotemPublishPluginPrivate *priv = TOTEM_PUBLISH_PLUGIN (data)->priv;
G_LOCK (totem_publish_plugin_lock);
- g_slist_foreach (self->playlist, (GFunc) g_free, NULL);
- g_slist_free (self->playlist);
- self->playlist = NULL;
+ g_slist_foreach (priv->playlist, (GFunc) g_free, NULL);
+ g_slist_free (priv->playlist);
+ priv->playlist = NULL;
totem_playlist_foreach (playlist,
totem_publish_plugin_rebuild_playlist_cb,
- self);
+ data);
- self->playlist = g_slist_reverse (self->playlist);
+ priv->playlist = g_slist_reverse (priv->playlist);
G_UNLOCK (totem_publish_plugin_lock);
}
@@ -322,7 +312,7 @@ totem_publish_plugin_playlist_item_added_cb (TotemPlaylist *playlist,
TotemPublishPlugin *self = TOTEM_PUBLISH_PLUGIN (data);
gchar *key = totem_publish_plugin_build_key (filename);
- epc_publisher_add_handler (self->publisher, key,
+ epc_publisher_add_handler (self->priv->publisher, key,
totem_publish_plugin_media_cb,
g_strdup (url), g_free);
@@ -338,7 +328,7 @@ totem_publish_plugin_playlist_item_removed_cb (TotemPlaylist *playlist,
{
TotemPublishPlugin *self = TOTEM_PUBLISH_PLUGIN (data);
gchar *key = totem_publish_plugin_build_key (filename);
- epc_publisher_remove (self->publisher, key);
+ epc_publisher_remove (self->priv->publisher, key);
g_free (key);
}
@@ -349,8 +339,8 @@ totem_publish_plugin_service_found_cb (TotemPublishPlugin *self,
{
GtkTreeIter iter;
- gtk_list_store_append (self->neighbours, &iter);
- gtk_list_store_set (self->neighbours, &iter, NAME_COLUMN, name,
+ gtk_list_store_append (self->priv->neighbours, &iter);
+ gtk_list_store_set (self->priv->neighbours, &iter, NAME_COLUMN, name,
INFO_COLUMN, info,
-1);
}
@@ -360,7 +350,7 @@ totem_publish_plugin_service_removed_cb (TotemPublishPlugin *self,
const gchar *name,
const gchar *type)
{
- GtkTreeModel *model = GTK_TREE_MODEL (self->neighbours);
+ GtkTreeModel *model = GTK_TREE_MODEL (self->priv->neighbours);
GtkTreeIter iter;
if (gtk_tree_model_get_iter_first (model, &iter)) {
@@ -381,7 +371,7 @@ totem_publish_plugin_service_removed_cb (TotemPublishPlugin *self,
path = path_iter->data;
if (gtk_tree_model_get_iter (model, &iter, path))
- gtk_list_store_remove (self->neighbours, &iter);
+ gtk_list_store_remove (self->priv->neighbours, &iter);
gtk_tree_path_free (path);
}
@@ -394,13 +384,15 @@ static void
totem_publish_plugin_scanning_done_cb (TotemPublishPlugin *self,
const gchar *type)
{
- if (self->scanning_id) {
- g_source_remove (self->scanning_id);
- self->scanning_id = 0;
+ TotemPublishPluginPrivate *priv = self->priv;
+
+ if (priv->scanning_id) {
+ g_source_remove (priv->scanning_id);
+ priv->scanning_id = 0;
}
- if (self->scanning)
- gtk_widget_hide (self->scanning);
+ if (priv->scanning)
+ gtk_widget_hide (priv->scanning);
}
static void
@@ -424,8 +416,8 @@ totem_publish_plugin_load_playlist (TotemPublishPlugin *self,
if (error)
goto out;
- ev_sidebar_set_current_page (EV_SIDEBAR (self->totem->sidebar), "playlist");
- totem_playlist_clear (self->totem->playlist);
+ ev_sidebar_set_current_page (EV_SIDEBAR (self->priv->totem->sidebar), "playlist");
+ totem_playlist_clear (self->priv->totem->playlist);
for (i = 0; i < n_entries; ++i) {
gchar *key, *mrl, *title;
@@ -439,7 +431,7 @@ totem_publish_plugin_load_playlist (TotemPublishPlugin *self,
g_free (key);
if (mrl)
- totem_playlist_add_mrl (self->totem->playlist, mrl, title, FALSE, NULL, NULL, NULL);
+ totem_playlist_add_mrl (self->priv->totem->playlist, mrl, title, FALSE, NULL, NULL, NULL);
g_free (title);
g_free (mrl);
@@ -468,8 +460,8 @@ totem_publish_plugin_neighbours_list_row_activated_cb (GtkTreeView *view,
EpcServiceInfo *info = NULL;
GtkTreeIter iter;
- if (gtk_tree_model_get_iter (GTK_TREE_MODEL (self->neighbours), &iter, path)) {
- gtk_tree_model_get (GTK_TREE_MODEL (self->neighbours),
+ if (gtk_tree_model_get_iter (GTK_TREE_MODEL (self->priv->neighbours), &iter, path)) {
+ gtk_tree_model_get (GTK_TREE_MODEL (self->priv->neighbours),
&iter, INFO_COLUMN, &info, -1);
totem_publish_plugin_load_playlist (self, info);
epc_service_info_unref (info);
@@ -486,28 +478,29 @@ totem_publish_plugin_scanning_cb (gpointer data)
static GtkWidget*
totem_publish_plugin_create_neigbours_page (TotemPublishPlugin *self, GtkBuilder *builder)
{
+ TotemPublishPluginPrivate *priv = self->priv;
GtkWidget *page, *list;
page = GTK_WIDGET (gtk_builder_get_object (builder, "neighbours-page"));
list = GTK_WIDGET (gtk_builder_get_object (builder, "neighbours-list"));
- self->scanning = GTK_WIDGET (gtk_builder_get_object (builder, "neighbours-scanning"));
- self->scanning_id = g_timeout_add (100, totem_publish_plugin_scanning_cb, self->scanning);
+ priv->scanning = GTK_WIDGET (gtk_builder_get_object (builder, "neighbours-scanning"));
+ priv->scanning_id = g_timeout_add (100, totem_publish_plugin_scanning_cb, priv->scanning);
- g_signal_connect_swapped (self->monitor, "service-found",
+ g_signal_connect_swapped (priv->monitor, "service-found",
G_CALLBACK (totem_publish_plugin_service_found_cb),
self);
- g_signal_connect_swapped (self->monitor, "service-removed",
+ g_signal_connect_swapped (priv->monitor, "service-removed",
G_CALLBACK (totem_publish_plugin_service_removed_cb),
self);
- g_signal_connect_swapped (self->monitor, "scanning-done",
+ g_signal_connect_swapped (priv->monitor, "scanning-done",
G_CALLBACK (totem_publish_plugin_scanning_done_cb),
self);
- self->neighbours = gtk_list_store_new (LAST_COLUMN, G_TYPE_STRING, EPC_TYPE_SERVICE_INFO);
+ priv->neighbours = gtk_list_store_new (LAST_COLUMN, G_TYPE_STRING, EPC_TYPE_SERVICE_INFO);
gtk_tree_view_set_model (GTK_TREE_VIEW (list),
- GTK_TREE_MODEL (self->neighbours));
+ GTK_TREE_MODEL (priv->neighbours));
gtk_tree_view_append_column (GTK_TREE_VIEW (list),
gtk_tree_view_column_new_with_attributes (
@@ -521,10 +514,9 @@ totem_publish_plugin_create_neigbours_page (TotemPublishPlugin *self, GtkBuilder
}
static void
-impl_activate (PeasActivatable *plugin, GObject *object)
+impl_activate (PeasActivatable *plugin)
{
- TotemPublishPlugin *self = TOTEM_PUBLISH_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemPublishPluginPrivate *priv = TOTEM_PUBLISH_PLUGIN (plugin)->priv;
EpcProtocol protocol = EPC_PROTOCOL_HTTPS;
GtkWindow *window;
GtkBuilder *builder;
@@ -535,48 +527,46 @@ impl_activate (PeasActivatable *plugin, GObject *object)
gchar *service_pattern;
gchar *service_name;
- g_return_if_fail (NULL == self->publisher);
- g_return_if_fail (NULL == self->totem);
+ g_return_if_fail (NULL == priv->publisher);
G_LOCK (totem_publish_plugin_lock);
- self->totem = g_object_ref (totem);
-
- window = totem_get_main_window (self->totem);
- builder = totem_plugin_load_interface ("publish", "publish-plugin.ui", TRUE, window, self);
+ window = totem_get_main_window (priv->totem);
+ builder = totem_plugin_load_interface ("publish", "publish-plugin.ui", TRUE, window, plugin);
epc_progress_window_install (window);
g_object_unref (window);
- gconf_client_add_dir (self->client,
+ priv->client = gconf_client_get_default ();
+ gconf_client_add_dir (priv->client,
TOTEM_PUBLISH_CONFIG_ROOT,
GCONF_CLIENT_PRELOAD_ONELEVEL,
NULL);
- protocol_name = gconf_client_get_string (self->client, TOTEM_PUBLISH_CONFIG_PROTOCOL, NULL);
- service_pattern = gconf_client_get_string (self->client, TOTEM_PUBLISH_CONFIG_NAME, NULL);
+ protocol_name = gconf_client_get_string (priv->client, TOTEM_PUBLISH_CONFIG_PROTOCOL, NULL);
+ service_pattern = gconf_client_get_string (priv->client, TOTEM_PUBLISH_CONFIG_NAME, NULL);
if (!protocol_name) {
protocol_name = g_strdup ("http");
- gconf_client_set_string (self->client,
+ gconf_client_set_string (priv->client,
TOTEM_PUBLISH_CONFIG_PROTOCOL,
protocol_name, NULL);
}
if (!service_pattern) {
service_pattern = g_strdup ("%a of %u on %h");
- gconf_client_set_string (self->client,
+ gconf_client_set_string (priv->client,
TOTEM_PUBLISH_CONFIG_NAME,
service_pattern, NULL);
}
- self->name_id = gconf_client_notify_add (self->client,
+ priv->name_id = gconf_client_notify_add (priv->client,
TOTEM_PUBLISH_CONFIG_NAME,
totem_publish_plugin_name_changed_cb,
- self, NULL, NULL);
- self->protocol_id = gconf_client_notify_add (self->client,
+ plugin, NULL, NULL);
+ priv->protocol_id = gconf_client_notify_add (priv->client,
TOTEM_PUBLISH_CONFIG_PROTOCOL,
totem_publish_plugin_protocol_changed_cb,
- self, NULL, NULL);
+ plugin, NULL, NULL);
protocol = epc_protocol_from_name (protocol_name, EPC_PROTOCOL_HTTPS);
service_name = epc_publisher_expand_name (service_pattern, &internal_error);
@@ -587,105 +577,106 @@ impl_activate (PeasActivatable *plugin, GObject *object)
g_clear_error (&internal_error);
}
- self->monitor = epc_service_monitor_new ("totem", NULL, EPC_PROTOCOL_UNKNOWN);
- epc_service_monitor_set_skip_our_own (self->monitor, TRUE);
+ priv->monitor = epc_service_monitor_new ("totem", NULL, EPC_PROTOCOL_UNKNOWN);
+ epc_service_monitor_set_skip_our_own (priv->monitor, TRUE);
- ev_sidebar_add_page (EV_SIDEBAR (self->totem->sidebar), "neighbours", _("Neighbors"),
- totem_publish_plugin_create_neigbours_page (self, builder));
+ ev_sidebar_add_page (EV_SIDEBAR (priv->totem->sidebar), "neighbours", _("Neighbors"),
+ totem_publish_plugin_create_neigbours_page (TOTEM_PUBLISH_PLUGIN (plugin), builder));
g_object_unref (builder);
- self->publisher = epc_publisher_new (service_name, "totem", NULL);
- epc_publisher_set_protocol (self->publisher, protocol);
+ priv->publisher = epc_publisher_new (service_name, "totem", NULL);
+ epc_publisher_set_protocol (priv->publisher, protocol);
g_free (protocol_name);
g_free (service_name);
- epc_publisher_add_handler (self->publisher, "playlist.pls",
+ epc_publisher_add_handler (priv->publisher, "playlist.pls",
totem_publish_plugin_playlist_cb,
- self, NULL);
- epc_publisher_add_bookmark (self->publisher, "playlist.pls", NULL);
+ plugin, NULL);
+ epc_publisher_add_bookmark (priv->publisher, "playlist.pls", NULL);
- self->item_added_id = g_signal_connect (self->totem->playlist, "changed",
- G_CALLBACK (totem_publish_plugin_playlist_changed_cb), self);
- self->item_added_id = g_signal_connect (self->totem->playlist, "item-added",
- G_CALLBACK (totem_publish_plugin_playlist_item_added_cb), self);
- self->item_removed_id = g_signal_connect (self->totem->playlist, "item-removed",
- G_CALLBACK (totem_publish_plugin_playlist_item_removed_cb), self);
+ priv->item_added_id = g_signal_connect (priv->totem->playlist, "changed",
+ G_CALLBACK (totem_publish_plugin_playlist_changed_cb), plugin);
+ priv->item_added_id = g_signal_connect (priv->totem->playlist, "item-added",
+ G_CALLBACK (totem_publish_plugin_playlist_item_added_cb), plugin);
+ priv->item_removed_id = g_signal_connect (priv->totem->playlist, "item-removed",
+ G_CALLBACK (totem_publish_plugin_playlist_item_removed_cb), plugin);
G_UNLOCK (totem_publish_plugin_lock);
- totem_playlist_foreach (self->totem->playlist,
- totem_publish_plugin_playlist_item_added_cb, self);
+ totem_playlist_foreach (priv->totem->playlist,
+ totem_publish_plugin_playlist_item_added_cb, plugin);
- totem_publish_plugin_playlist_changed_cb (self->totem->playlist, self);
+ totem_publish_plugin_playlist_changed_cb (priv->totem->playlist, plugin);
- epc_publisher_run_async (self->publisher, NULL);
+ epc_publisher_run_async (priv->publisher, NULL);
return;
}
static void
-impl_deactivate (PeasActivatable *plugin, GObject *totem)
+impl_deactivate (PeasActivatable *plugin)
{
- TotemPublishPlugin *self = TOTEM_PUBLISH_PLUGIN (plugin);
+ TotemPublishPluginPrivate *priv = TOTEM_PUBLISH_PLUGIN (plugin)->priv;
TotemPlaylist *playlist = NULL;
G_LOCK (totem_publish_plugin_lock);
- if (self->totem)
- playlist = self->totem->playlist;
+ if (priv->totem)
+ playlist = priv->totem->playlist;
- if (self->scanning_id) {
- g_source_remove (self->scanning_id);
- self->scanning_id = 0;
+ if (priv->scanning_id) {
+ g_source_remove (priv->scanning_id);
+ priv->scanning_id = 0;
}
- if (playlist && self->item_added_id) {
- g_signal_handler_disconnect (playlist, self->item_added_id);
- self->item_added_id = 0;
+ if (playlist && priv->item_added_id) {
+ g_signal_handler_disconnect (playlist, priv->item_added_id);
+ priv->item_added_id = 0;
}
- if (playlist && self->item_removed_id) {
- g_signal_handler_disconnect (playlist, self->item_removed_id);
- self->item_removed_id = 0;
+ if (playlist && priv->item_removed_id) {
+ g_signal_handler_disconnect (playlist, priv->item_removed_id);
+ priv->item_removed_id = 0;
}
- if (self->monitor) {
- g_object_unref (self->monitor);
- self->monitor = NULL;
+ if (priv->monitor) {
+ g_object_unref (priv->monitor);
+ priv->monitor = NULL;
}
- if (self->publisher) {
- epc_publisher_quit (self->publisher);
- g_object_unref (self->publisher);
- self->publisher = NULL;
+ if (priv->publisher) {
+ epc_publisher_quit (priv->publisher);
+ g_object_unref (priv->publisher);
+ priv->publisher = NULL;
}
- if (self->totem) {
- gconf_client_notify_remove (self->client, self->name_id);
- gconf_client_notify_remove (self->client, self->protocol_id);
- gconf_client_remove_dir (self->client, TOTEM_PUBLISH_CONFIG_ROOT, NULL);
-
- ev_sidebar_remove_page (EV_SIDEBAR (self->totem->sidebar), "neighbours");
+ if (priv->totem)
+ ev_sidebar_remove_page (EV_SIDEBAR (priv->totem->sidebar), "neighbours");
- g_object_unref (self->totem);
- self->totem = NULL;
+ if (priv->settings) {
+ gtk_widget_destroy (priv->settings);
+ priv->settings = NULL;
}
- if (self->settings) {
- gtk_widget_destroy (self->settings);
- self->settings = NULL;
+ if (priv->playlist) {
+ g_slist_foreach (priv->playlist, (GFunc) g_free, NULL);
+ g_slist_free (priv->playlist);
+ priv->playlist = NULL;
}
- if (self->playlist) {
- g_slist_foreach (self->playlist, (GFunc) g_free, NULL);
- g_slist_free (self->playlist);
- self->playlist = NULL;
+ if (priv->client != NULL) {
+ gconf_client_notify_remove (priv->client, priv->name_id);
+ gconf_client_notify_remove (priv->client, priv->protocol_id);
+ gconf_client_remove_dir (priv->client, TOTEM_PUBLISH_CONFIG_ROOT, NULL);
+
+ g_object_unref (priv->client);
}
+ priv->client = NULL;
G_UNLOCK (totem_publish_plugin_lock);
- self->scanning = NULL;
+ priv->scanning = NULL;
}
static GtkWidget *
@@ -719,30 +710,3 @@ impl_create_configure_widget (PeasUIConfigurable *configurable)
return widget;
}
-
-static void
-totem_publish_plugin_init (TotemPublishPlugin *self)
-{
- self->client = gconf_client_get_default ();
-}
-
-static void
-totem_publish_plugin_dispose (GObject *object)
-{
- TotemPublishPlugin *self = TOTEM_PUBLISH_PLUGIN (object);
-
- if (self->client != NULL) {
- g_object_unref (self->client);
- self->client = NULL;
- }
-
- G_OBJECT_CLASS (totem_publish_plugin_parent_class)->dispose (object);
-}
-
-static void
-totem_publish_plugin_class_init (TotemPublishPluginClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = totem_publish_plugin_dispose;
-}
-
diff --git a/src/plugins/pythonconsole/pythonconsole.py b/src/plugins/pythonconsole/pythonconsole.py
index 84971e4..71bdadb 100644
--- a/src/plugins/pythonconsole/pythonconsole.py
+++ b/src/plugins/pythonconsole/pythonconsole.py
@@ -69,13 +69,16 @@ ui_str = """
class PythonConsolePlugin(gobject.GObject, Peas.Activatable):
__gtype_name__ = 'PythonConsolePlugin'
+ object = gobject.property(type = gobject.GObject)
+
def __init__(self):
+ self.totem = self.object
self.window = None
- def do_activate(self, totem_object):
+ def do_activate(self):
data = dict()
- manager = totem_object.get_ui_manager()
+ manager = self.totem.get_ui_manager()
data['action_group'] = Gtk.ActionGroup(name = 'Python')
@@ -85,13 +88,13 @@ class PythonConsolePlugin(gobject.GObject, Peas.Activatable):
action = Gtk.Action(name = 'PythonConsole', label = _('_Python Console'),
tooltip = _("Show Totem's Python console"),
stock_id = 'gnome-mime-text-x-python')
- action.connect('activate', self.show_console, totem_object)
+ action.connect('activate', self.show_console, self.totem)
data['action_group'].add_action(action)
action = Gtk.Action(name = 'PythonDebugger', label = _('Python Debugger'),
tooltip = _("Enable remote Python debugging with rpdb2"))
if have_rpdb2:
- action.connect('activate', self.enable_debugging, totem_object)
+ action.connect('activate', self.enable_debugging, self.totem)
else:
action.set_visible(False)
data['action_group'].add_action(action)
@@ -100,13 +103,13 @@ class PythonConsolePlugin(gobject.GObject, Peas.Activatable):
data['ui_id'] = manager.add_ui_from_string(ui_str)
manager.ensure_update()
- totem_object.set_data('PythonConsolePluginInfo', data)
+ self.totem.set_data('PythonConsolePluginInfo', data)
- def show_console(self, action, totem_object):
+ def show_console(self, action):
if not self.window:
console = PythonConsole(namespace = {'__builtins__' : __builtins__,
'Totem' : Totem,
- 'totem_object' : totem_object},
+ 'totem_object' : self.totem},
destroy_cb = self.destroy_console)
console.set_size_request(600, 400)
@@ -122,7 +125,7 @@ class PythonConsolePlugin(gobject.GObject, Peas.Activatable):
self.window.show_all()
self.window.grab_focus()
- def enable_debugging(self, action, totem_object):
+ def enable_debugging(self, action):
msg = _("After you press OK, Totem will wait until you connect to it with winpdb or rpdb2. If you have not set a debugger password in GConf, it will use the default password ('totem').")
dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonType.OK_CANCEL, msg)
if dialog.run() == Gtk.ResponseType.OK:
@@ -139,15 +142,15 @@ class PythonConsolePlugin(gobject.GObject, Peas.Activatable):
self.window.destroy()
self.window = None
- def do_deactivate(self, totem_object):
- data = totem_object.get_data('PythonConsolePluginInfo')
+ def do_deactivate(self):
+ data = self.totem.get_data('PythonConsolePluginInfo')
- manager = totem_object.get_ui_manager()
+ manager = self.totem.get_ui_manager()
manager.remove_ui(data['ui_id'])
manager.remove_action_group(data['action_group'])
manager.ensure_update()
- totem_object.set_data('PythonConsolePluginInfo', None)
+ self.totem.set_data('PythonConsolePluginInfo', None)
if self.window is not None:
self.window.destroy()
diff --git a/src/plugins/sample-python/sample-python.py b/src/plugins/sample-python/sample-python.py
index 5b67255..3956cf8 100644
--- a/src/plugins/sample-python/sample-python.py
+++ b/src/plugins/sample-python/sample-python.py
@@ -7,9 +7,11 @@ from gi.repository import Totem
class SamplePython(gobject.GObject, Peas.Activatable):
__gtype_name__ = 'SamplePython'
- def do_activate(self, totem):
+ object = gobject.property(type = gobject.GObject)
+
+ def do_activate(self):
print "Activating sample Python plugin"
- totem.action_fullscreen_toggle()
+ self.object.action_fullscreen_toggle()
- def do_deactivate(self, totem):
+ def do_deactivate(self):
print "Deactivating sample Python plugin"
diff --git a/src/plugins/screensaver/totem-screensaver.c b/src/plugins/screensaver/totem-screensaver.c
index 2935a03..4cd1ecd 100644
--- a/src/plugins/screensaver/totem-screensaver.c
+++ b/src/plugins/screensaver/totem-screensaver.c
@@ -48,9 +48,7 @@
#define TOTEM_IS_SCREENSAVER_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_SCREENSAVER_PLUGIN))
#define TOTEM_SCREENSAVER_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_SCREENSAVER_PLUGIN, TotemScreensaverPluginClass))
-typedef struct
-{
- PeasExtensionBase parent;
+typedef struct {
TotemObject *totem;
BaconVideoWidget *bvw;
@@ -58,50 +56,13 @@ typedef struct
guint handler_id_playing;
guint handler_id_metadata;
guint handler_id_gconf;
-} TotemScreensaverPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemScreensaverPluginClass;
-
-
-GType totem_screensaver_plugin_get_type (void) G_GNUC_CONST;
-
-static void totem_screensaver_plugin_finalize (GObject *object);
+} TotemScreensaverPluginPrivate;
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_SCREENSAVER_PLUGIN,
TotemScreensaverPlugin,
totem_screensaver_plugin)
static void
-totem_screensaver_plugin_class_init (TotemScreensaverPluginClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = totem_screensaver_plugin_finalize;
-}
-
-static void
-totem_screensaver_plugin_init (TotemScreensaverPlugin *plugin)
-{
- plugin->scr = totem_scrsaver_new ();
- g_object_set (plugin->scr,
- "reason", _("Playing a movie"),
- NULL);
-}
-
-static void
-totem_screensaver_plugin_finalize (GObject *object)
-{
- TotemScreensaverPlugin *plugin = TOTEM_SCREENSAVER_PLUGIN (object);
-
- g_object_unref (plugin->scr);
-
- G_OBJECT_CLASS (totem_screensaver_plugin_parent_class)->finalize (object);
-}
-
-static void
totem_screensaver_update_from_state (TotemObject *totem,
TotemScreensaverPlugin *pi)
{
@@ -118,11 +79,11 @@ totem_screensaver_update_from_state (TotemObject *totem,
can_get_frames = bacon_video_widget_can_get_frames (bvw, NULL);
if (totem_is_playing (totem) != FALSE && can_get_frames)
- totem_scrsaver_disable (pi->scr);
+ totem_scrsaver_disable (pi->priv->scr);
else if (totem_is_playing (totem) != FALSE && !lock_screensaver_on_audio)
- totem_scrsaver_disable (pi->scr);
+ totem_scrsaver_disable (pi->priv->scr);
else
- totem_scrsaver_enable (pi->scr);
+ totem_scrsaver_enable (pi->priv->scr);
g_object_unref (gc);
}
@@ -138,73 +99,72 @@ property_notify_cb (TotemObject *totem,
static void
got_metadata_cb (BaconVideoWidget *bvw, TotemScreensaverPlugin *pi)
{
- totem_screensaver_update_from_state (pi->totem, pi);
+ totem_screensaver_update_from_state (pi->priv->totem, pi);
}
static void
lock_screensaver_on_audio_changed_cb (GConfClient *client, guint cnxn_id,
GConfEntry *entry, TotemScreensaverPlugin *pi)
{
- totem_screensaver_update_from_state (pi->totem, pi);
+ totem_screensaver_update_from_state (pi->priv->totem, pi);
}
static void
-impl_activate (PeasActivatable *plugin,
- GObject *object)
+impl_activate (PeasActivatable *plugin)
{
- TotemScreensaverPlugin *pi = TOTEM_SCREENSAVER_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemScreensaverPluginPrivate *priv = TOTEM_SCREENSAVER_PLUGIN (plugin)->priv;
GConfClient *gc;
- pi->bvw = BACON_VIDEO_WIDGET (totem_get_video_widget (totem));
+ priv->scr = totem_scrsaver_new ();
+ g_object_set (priv->scr,
+ "reason", _("Playing a movie"),
+ NULL);
+
+ priv->bvw = BACON_VIDEO_WIDGET (totem_get_video_widget (priv->totem));
gc = gconf_client_get_default ();
gconf_client_add_dir (gc, GCONF_PREFIX,
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
- pi->handler_id_gconf = gconf_client_notify_add (gc, GCONF_PREFIX"/lock_screensaver_on_audio",
+ priv->handler_id_gconf = gconf_client_notify_add (gc, GCONF_PREFIX"/lock_screensaver_on_audio",
(GConfClientNotifyFunc) lock_screensaver_on_audio_changed_cb,
plugin, NULL, NULL);
g_object_unref (gc);
- pi->handler_id_playing = g_signal_connect (G_OBJECT (totem),
+ priv->handler_id_playing = g_signal_connect (G_OBJECT (priv->totem),
"notify::playing",
G_CALLBACK (property_notify_cb),
- pi);
- pi->handler_id_metadata = g_signal_connect (G_OBJECT (pi->bvw),
+ plugin);
+ priv->handler_id_metadata = g_signal_connect (G_OBJECT (priv->bvw),
"got-metadata",
G_CALLBACK (got_metadata_cb),
- pi);
-
- pi->totem = g_object_ref (totem);
+ plugin);
/* Force setting the current status */
- totem_screensaver_update_from_state (totem, pi);
+ totem_screensaver_update_from_state (priv->totem, TOTEM_SCREENSAVER_PLUGIN (plugin));
}
static void
-impl_deactivate (PeasActivatable *plugin,
- GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
- TotemScreensaverPlugin *pi = TOTEM_SCREENSAVER_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemScreensaverPluginPrivate *priv = TOTEM_SCREENSAVER_PLUGIN (plugin)->priv;
GConfClient *gc;
gc = gconf_client_get_default ();
- gconf_client_notify_remove (gc, pi->handler_id_gconf);
+ gconf_client_notify_remove (gc, priv->handler_id_gconf);
g_object_unref (gc);
- if (pi->handler_id_playing != 0) {
- g_signal_handler_disconnect (G_OBJECT (totem), pi->handler_id_playing);
- pi->handler_id_playing = 0;
+ if (priv->handler_id_playing != 0) {
+ g_signal_handler_disconnect (G_OBJECT (priv->totem), priv->handler_id_playing);
+ priv->handler_id_playing = 0;
}
- if (pi->handler_id_metadata != 0) {
- g_signal_handler_disconnect (G_OBJECT (pi->bvw), pi->handler_id_metadata);
- pi->handler_id_metadata = 0;
+ if (priv->handler_id_metadata != 0) {
+ g_signal_handler_disconnect (G_OBJECT (priv->bvw), priv->handler_id_metadata);
+ priv->handler_id_metadata = 0;
}
- g_object_unref (pi->totem);
- g_object_unref (pi->bvw);
+ g_object_unref (priv->bvw);
- totem_scrsaver_enable (pi->scr);
+ totem_scrsaver_enable (priv->scr);
+ g_object_unref (priv->scr);
}
diff --git a/src/plugins/screenshot/totem-gallery.c b/src/plugins/screenshot/totem-gallery.c
index c05b7c2..6b2b510 100644
--- a/src/plugins/screenshot/totem-gallery.c
+++ b/src/plugins/screenshot/totem-gallery.c
@@ -64,7 +64,7 @@ totem_gallery_init (TotemGallery *self)
}
TotemGallery *
-totem_gallery_new (Totem *totem, TotemScreenshotPlugin *plugin)
+totem_gallery_new (Totem *totem)
{
TotemGallery *gallery;
GtkWidget *container;
diff --git a/src/plugins/screenshot/totem-gallery.h b/src/plugins/screenshot/totem-gallery.h
index 7ebcb71..69d27b3 100644
--- a/src/plugins/screenshot/totem-gallery.h
+++ b/src/plugins/screenshot/totem-gallery.h
@@ -32,7 +32,6 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include "totem-screenshot-plugin.h"
#include "totem.h"
G_BEGIN_DECLS
@@ -56,7 +55,7 @@ typedef struct {
} TotemGalleryClass;
GType totem_gallery_get_type (void);
-TotemGallery *totem_gallery_new (Totem *totem, TotemScreenshotPlugin *plugin);
+TotemGallery *totem_gallery_new (Totem *totem);
G_END_DECLS
diff --git a/src/plugins/screenshot/totem-screenshot-plugin.c b/src/plugins/screenshot/totem-screenshot-plugin.c
index 7d2e999..7300f84 100644
--- a/src/plugins/screenshot/totem-screenshot-plugin.c
+++ b/src/plugins/screenshot/totem-screenshot-plugin.c
@@ -45,8 +45,15 @@
#include "totem-uri.h"
#include "backend/bacon-video-widget.h"
-struct TotemScreenshotPluginPrivate {
- Totem *totem;
+#define TOTEM_TYPE_SCREENSHOT_PLUGIN (totem_screenshot_plugin_get_type ())
+#define TOTEM_SCREENSHOT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TOTEM_TYPE_SCREENSHOT_PLUGIN, TotemScreenshotPlugin))
+#define TOTEM_SCREENSHOT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TOTEM_TYPE_SCREENSHOT_PLUGIN, TotemScreenshotPluginClass))
+#define TOTEM_IS_SCREENSHOT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TOTEM_TYPE_SCREENSHOT_PLUGIN))
+#define TOTEM_IS_SCREENSHOT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_SCREENSHOT_PLUGIN))
+#define TOTEM_SCREENSHOT_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_SCREENSHOT_PLUGIN, TotemScreenshotPluginClass))
+
+typedef struct {
+ TotemObject *totem;
BaconVideoWidget *bvw;
gulong got_metadata_signal;
@@ -58,27 +65,13 @@ struct TotemScreenshotPluginPrivate {
guint ui_merge_id;
GtkActionGroup *action_group;
-};
+} TotemScreenshotPluginPrivate;
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_SCREENSHOT_PLUGIN,
TotemScreenshotPlugin,
totem_screenshot_plugin)
static void
-totem_screenshot_plugin_class_init (TotemScreenshotPluginClass *klass)
-{
- g_type_class_add_private (klass, sizeof (TotemScreenshotPluginPrivate));
-}
-
-static void
-totem_screenshot_plugin_init (TotemScreenshotPlugin *plugin)
-{
- plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
- TOTEM_TYPE_SCREENSHOT_PLUGIN,
- TotemScreenshotPluginPrivate);
-}
-
-static void
take_screenshot_action_cb (GtkAction *action, TotemScreenshotPlugin *self)
{
TotemScreenshotPluginPrivate *priv = self->priv;
@@ -104,7 +97,7 @@ take_screenshot_action_cb (GtkAction *action, TotemScreenshotPlugin *self)
return;
}
- dialog = totem_screenshot_new (priv->totem, self, pixbuf);
+ dialog = totem_screenshot_new (priv->totem, pixbuf);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -129,7 +122,7 @@ take_gallery_action_cb (GtkAction *action, TotemScreenshotPlugin *self)
if (bacon_video_widget_get_logo_mode (self->priv->bvw) != FALSE)
return;
- dialog = GTK_DIALOG (totem_gallery_new (totem, self));
+ dialog = GTK_DIALOG (totem_gallery_new (totem));
g_signal_connect (dialog, "response",
G_CALLBACK (take_gallery_response_cb), self);
@@ -195,43 +188,41 @@ disable_save_to_disk_changed_cb (GConfClient *client, guint connection_id, GConf
}
static void
-impl_activate (PeasActivatable *plugin,
- GObject *totem)
+impl_activate (PeasActivatable *plugin)
{
+ TotemScreenshotPluginPrivate *priv = TOTEM_SCREENSHOT_PLUGIN (plugin)->priv;
GtkWindow *window;
GtkUIManager *manager;
GConfClient *client;
- TotemScreenshotPlugin *self = TOTEM_SCREENSHOT_PLUGIN (plugin);
- TotemScreenshotPluginPrivate *priv = self->priv;
+
const GtkActionEntry menu_entries[] = {
{ "take-screenshot", "camera-photo", N_("Take _Screenshot..."), "<Ctrl>S", N_("Take a screenshot"), G_CALLBACK (take_screenshot_action_cb) },
{ "take-gallery", NULL, N_("Create Screenshot _Gallery..."), NULL, N_("Create a gallery of screenshots"), G_CALLBACK (take_gallery_action_cb) }
};
- priv->totem = TOTEM_OBJECT (totem);
priv->bvw = BACON_VIDEO_WIDGET (totem_get_video_widget (priv->totem));
priv->got_metadata_signal = g_signal_connect (G_OBJECT (priv->bvw),
"got-metadata",
G_CALLBACK (got_metadata_cb),
- self);
+ plugin);
priv->notify_logo_mode_signal = g_signal_connect (G_OBJECT (priv->bvw),
"notify::logo-mode",
G_CALLBACK (notify_logo_mode_cb),
- self);
+ plugin);
/* Key press handler */
window = totem_get_main_window (priv->totem);
priv->key_press_event_signal = g_signal_connect (G_OBJECT (window),
"key-press-event",
G_CALLBACK (window_key_press_event_cb),
- self);
+ plugin);
g_object_unref (window);
/* Install the menu */
priv->action_group = gtk_action_group_new ("screenshot_group");
gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions (priv->action_group, menu_entries,
- G_N_ELEMENTS (menu_entries), self);
+ G_N_ELEMENTS (menu_entries), plugin);
manager = totem_get_ui_manager (priv->totem);
@@ -253,17 +244,16 @@ impl_activate (PeasActivatable *plugin,
client = gconf_client_get_default ();
priv->gconf_id = gconf_client_notify_add (client, "/desktop/gnome/lockdown/disable_save_to_disk",
(GConfClientNotifyFunc) disable_save_to_disk_changed_cb,
- self, NULL, NULL);
- disable_save_to_disk_changed_cb (client, priv->gconf_id, NULL, self);
+ plugin, NULL, NULL);
+ disable_save_to_disk_changed_cb (client, priv->gconf_id, NULL, TOTEM_SCREENSHOT_PLUGIN (plugin));
g_object_unref (client);
/* Update the menu entries' states */
- update_state (self);
+ update_state (TOTEM_SCREENSHOT_PLUGIN (plugin));
}
static void
-impl_deactivate (PeasActivatable *plugin,
- GObject *totem)
+impl_deactivate (PeasActivatable *plugin)
{
TotemScreenshotPluginPrivate *priv = TOTEM_SCREENSHOT_PLUGIN (plugin)->priv;
GtkWindow *window;
diff --git a/src/plugins/screenshot/totem-screenshot-plugin.h b/src/plugins/screenshot/totem-screenshot-plugin.h
index 4f0c48e..9a3fb6d 100644
--- a/src/plugins/screenshot/totem-screenshot-plugin.h
+++ b/src/plugins/screenshot/totem-screenshot-plugin.h
@@ -30,32 +30,8 @@
#include <glib.h>
-#include "totem.h"
-#include <libpeas/peas-extension-base.h>
-#include <libpeas/peas-object-module.h>
-
G_BEGIN_DECLS
-#define TOTEM_TYPE_SCREENSHOT_PLUGIN (totem_screenshot_plugin_get_type ())
-#define TOTEM_SCREENSHOT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TOTEM_TYPE_SCREENSHOT_PLUGIN, TotemScreenshotPlugin))
-#define TOTEM_SCREENSHOT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TOTEM_TYPE_SCREENSHOT_PLUGIN, TotemScreenshotPluginClass))
-#define TOTEM_IS_SCREENSHOT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TOTEM_TYPE_SCREENSHOT_PLUGIN))
-#define TOTEM_IS_SCREENSHOT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_SCREENSHOT_PLUGIN))
-#define TOTEM_SCREENSHOT_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_SCREENSHOT_PLUGIN, TotemScreenshotPluginClass))
-
-typedef struct TotemScreenshotPluginPrivate TotemScreenshotPluginPrivate;
-
-typedef struct {
- PeasExtensionBase parent;
- TotemScreenshotPluginPrivate *priv;
-} TotemScreenshotPlugin;
-
-typedef struct {
- PeasExtensionBaseClass parent_class;
-} TotemScreenshotPluginClass;
-
-GType totem_screenshot_plugin_get_type (void) G_GNUC_CONST;
-
gchar *totem_screenshot_plugin_setup_file_chooser (const char *filename_format, const char *movie_name) G_GNUC_WARN_UNUSED_RESULT;
void totem_screenshot_plugin_update_file_chooser (const char *filename);
diff --git a/src/plugins/screenshot/totem-screenshot.c b/src/plugins/screenshot/totem-screenshot.c
index 4cdf0f2..b4cb1e4 100644
--- a/src/plugins/screenshot/totem-screenshot.c
+++ b/src/plugins/screenshot/totem-screenshot.c
@@ -146,7 +146,7 @@ totem_screenshot_init (TotemScreenshot *screenshot)
}
GtkWidget *
-totem_screenshot_new (Totem *totem, TotemScreenshotPlugin *screenshot_plugin, GdkPixbuf *screen_image)
+totem_screenshot_new (Totem *totem, GdkPixbuf *screen_image)
{
TotemScreenshot *screenshot;
GtkContainer *content_area;
diff --git a/src/plugins/screenshot/totem-screenshot.h b/src/plugins/screenshot/totem-screenshot.h
index 651c95e..4032f12 100644
--- a/src/plugins/screenshot/totem-screenshot.h
+++ b/src/plugins/screenshot/totem-screenshot.h
@@ -30,7 +30,8 @@
#define TOTEM_SCREENSHOT_H
#include <gtk/gtk.h>
-#include "totem-screenshot-plugin.h"
+
+#include "totem.h"
G_BEGIN_DECLS
@@ -54,7 +55,7 @@ struct TotemScreenshotClass {
};
GType totem_screenshot_get_type (void) G_GNUC_CONST;
-GtkWidget *totem_screenshot_new (Totem *totem, TotemScreenshotPlugin *screenshot_plugin, GdkPixbuf *screen_image) G_GNUC_WARN_UNUSED_RESULT;
+GtkWidget *totem_screenshot_new (Totem *totem, GdkPixbuf *screen_image) G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS
diff --git a/src/plugins/sidebar-test/totem-sidebar-test.c b/src/plugins/sidebar-test/totem-sidebar-test.c
index dd6c57f..d0df4ab 100644
--- a/src/plugins/sidebar-test/totem-sidebar-test.c
+++ b/src/plugins/sidebar-test/totem-sidebar-test.c
@@ -45,39 +45,19 @@
typedef struct
{
- PeasExtensionBase parent;
-} TotemSidebarTestPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemSidebarTestPluginClass;
-
-
-GType totem_sidebar_test_plugin_get_type (void) G_GNUC_CONST;
+ TotemObject *totem;
+} TotemSidebarTestPluginPrivate;
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_SIDEBAR_TEST_PLUGIN, TotemSidebarTestPlugin, totem_sidebar_test_plugin)
static void
-totem_sidebar_test_plugin_class_init (TotemSidebarTestPluginClass *klass)
-{
-}
-
-static void
-totem_sidebar_test_plugin_init (TotemSidebarTestPlugin *plugin)
-{
-}
-
-static void
-impl_activate (PeasActivatable *plugin,
- GObject *object)
+impl_activate (PeasActivatable *plugin)
{
GtkWidget *label;
- TotemObject *totem = TOTEM_OBJECT (object);
label = gtk_label_new ("This is a test sidebar main widget");
gtk_widget_show (label);
- totem_add_sidebar_page (totem,
+ totem_add_sidebar_page (TOTEM_SIDEBAR_TEST_PLUGIN (plugin)->priv->totem,
"sidebar-test",
"Sidebar Test",
label);
@@ -85,12 +65,9 @@ impl_activate (PeasActivatable *plugin,
}
static void
-impl_deactivate (PeasActivatable *plugin,
- GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
- TotemObject *totem = TOTEM_OBJECT (object);
-
- totem_remove_sidebar_page (totem, "sidebar-test");
+ totem_remove_sidebar_page (TOTEM_SIDEBAR_TEST_PLUGIN (plugin)->priv->totem, "sidebar-test");
g_message ("Just removed a test sidebar");
}
diff --git a/src/plugins/skipto/Makefile.am b/src/plugins/skipto/Makefile.am
index 54c2ae0..56c45cb 100644
--- a/src/plugins/skipto/Makefile.am
+++ b/src/plugins/skipto/Makefile.am
@@ -25,7 +25,6 @@ common_defines = \
libskipto_la_SOURCES = \
totem-skipto-plugin.c \
- totem-skipto-plugin.h \
totem-time-entry.c \
totem-time-entry.h \
totem-skipto.c \
diff --git a/src/plugins/skipto/totem-skipto-plugin.c b/src/plugins/skipto/totem-skipto-plugin.c
index d167161..436f1e3 100644
--- a/src/plugins/skipto/totem-skipto-plugin.c
+++ b/src/plugins/skipto/totem-skipto-plugin.c
@@ -36,42 +36,28 @@
#include <libpeas/peas-activatable.h>
#include "totem-plugin.h"
-#include "totem-skipto-plugin.h"
#include "totem-skipto.h"
-struct TotemSkiptoPluginPrivate
-{
+#define TOTEM_TYPE_SKIPTO_PLUGIN (totem_skipto_plugin_get_type ())
+#define TOTEM_SKIPTO_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TOTEM_TYPE_SKIPTO_PLUGIN, TotemSkiptoPlugin))
+#define TOTEM_SKIPTO_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TOTEM_TYPE_SKIPTO_PLUGIN, TotemSkiptoPluginClass))
+#define TOTEM_IS_SKIPTO_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TOTEM_TYPE_SKIPTO_PLUGIN))
+#define TOTEM_IS_SKIPTO_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_SKIPTO_PLUGIN))
+#define TOTEM_SKIPTO_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_SKIPTO_PLUGIN, TotemSkiptoPluginClass))
+
+typedef struct {
+ TotemObject *totem;
TotemSkipto *st;
guint handler_id_stream_length;
guint handler_id_seekable;
guint handler_id_key_press;
guint ui_merge_id;
GtkActionGroup *action_group;
-};
-
-static void totem_skipto_plugin_finalize (GObject *object);
+} TotemSkiptoPluginPrivate;
TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_SKIPTO_PLUGIN, TotemSkiptoPlugin, totem_skipto_plugin)
static void
-totem_skipto_plugin_class_init (TotemSkiptoPluginClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (TotemSkiptoPluginPrivate));
-
- object_class->finalize = totem_skipto_plugin_finalize;
-}
-static void
-totem_skipto_plugin_init (TotemSkiptoPlugin *plugin)
-{
- plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
- TOTEM_TYPE_SKIPTO_PLUGIN,
- TotemSkiptoPluginPrivate);
- plugin->priv->st = NULL;
-}
-
-static void
destroy_dialog (TotemSkiptoPlugin *plugin)
{
TotemSkiptoPluginPrivate *priv = plugin->priv;
@@ -85,16 +71,6 @@ destroy_dialog (TotemSkiptoPlugin *plugin)
}
static void
-totem_skipto_plugin_finalize (GObject *object)
-{
- TotemSkiptoPlugin *plugin = TOTEM_SKIPTO_PLUGIN (object);
-
- destroy_dialog (plugin);
-
- G_OBJECT_CLASS (totem_skipto_plugin_parent_class)->finalize (object);
-}
-
-static void
totem_skipto_update_from_state (TotemObject *totem,
TotemSkiptoPlugin *plugin)
{
@@ -136,7 +112,7 @@ skip_to_response_callback (GtkDialog *dialog, gint response, TotemSkiptoPlugin *
gtk_widget_hide (GTK_WIDGET (dialog));
- totem_action_seek_time (plugin->totem,
+ totem_action_seek_time (plugin->priv->totem,
totem_skipto_get_range (plugin->priv->st),
TRUE);
destroy_dialog (plugin);
@@ -147,26 +123,26 @@ run_skip_to_dialog (TotemSkiptoPlugin *plugin)
{
TotemSkiptoPluginPrivate *priv = plugin->priv;
- if (totem_is_seekable (plugin->totem) == FALSE)
+ if (totem_is_seekable (priv->totem) == FALSE)
return;
if (priv->st != NULL) {
gtk_window_present (GTK_WINDOW (priv->st));
totem_skipto_set_current (priv->st, totem_get_current_time
- (plugin->totem));
+ (priv->totem));
return;
}
- priv->st = TOTEM_SKIPTO (totem_skipto_new (plugin));
+ priv->st = TOTEM_SKIPTO (totem_skipto_new (priv->totem));
g_signal_connect (G_OBJECT (priv->st), "delete-event",
G_CALLBACK (gtk_widget_destroy), NULL);
g_signal_connect (G_OBJECT (priv->st), "response",
G_CALLBACK (skip_to_response_callback), plugin);
g_object_add_weak_pointer (G_OBJECT (priv->st),
(gpointer *)&(priv->st));
- totem_skipto_update_from_state (plugin->totem, plugin);
+ totem_skipto_update_from_state (priv->totem, plugin);
totem_skipto_set_current (priv->st,
- totem_get_current_time (plugin->totem));
+ totem_get_current_time (priv->totem));
}
static void
@@ -195,44 +171,42 @@ on_window_key_press_event (GtkWidget *window, GdkEventKey *event, TotemSkiptoPlu
}
static void
-impl_activate (PeasActivatable *plugin,
- GObject *object)
+impl_activate (PeasActivatable *plugin)
{
+ TotemSkiptoPluginPrivate *priv = TOTEM_SKIPTO_PLUGIN (plugin)->priv;
GtkWindow *window;
GtkUIManager *manager;
- TotemSkiptoPlugin *pi = TOTEM_SKIPTO_PLUGIN (plugin);
- TotemSkiptoPluginPrivate *priv = pi->priv;
- TotemObject *totem = TOTEM_OBJECT (object);
const GtkActionEntry menu_entries[] = {
{ "skip-to", GTK_STOCK_JUMP_TO, N_("_Skip to..."), "<Control>K", N_("Skip to a specific time"), G_CALLBACK (skip_to_action_callback) }
};
- pi->totem = totem;
- priv->handler_id_stream_length = g_signal_connect (G_OBJECT (totem),
+ priv->st = NULL;
+
+ priv->handler_id_stream_length = g_signal_connect (G_OBJECT (priv->totem),
"notify::stream-length",
G_CALLBACK (property_notify_cb),
- pi);
- priv->handler_id_seekable = g_signal_connect (G_OBJECT (totem),
+ plugin);
+ priv->handler_id_seekable = g_signal_connect (G_OBJECT (priv->totem),
"notify::seekable",
G_CALLBACK (property_notify_cb),
- pi);
+ plugin);
/* Key press handler */
- window = totem_get_main_window (totem);
+ window = totem_get_main_window (priv->totem);
priv->handler_id_key_press = g_signal_connect (G_OBJECT(window),
"key-press-event",
G_CALLBACK (on_window_key_press_event),
- pi);
+ plugin);
g_object_unref (window);
/* Install the menu */
priv->action_group = gtk_action_group_new ("skip-to_group");
gtk_action_group_set_translation_domain (priv->action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions (priv->action_group, menu_entries,
- G_N_ELEMENTS (menu_entries), pi);
+ G_N_ELEMENTS (menu_entries), plugin);
- manager = totem_get_ui_manager (totem);
+ manager = totem_get_ui_manager (priv->totem);
gtk_ui_manager_insert_action_group (manager, priv->action_group, -1);
g_object_unref (priv->action_group);
@@ -242,25 +216,23 @@ impl_activate (PeasActivatable *plugin,
"/ui/tmw-menubar/go/skip-forward", "skip-to",
"skip-to", GTK_UI_MANAGER_AUTO, TRUE);
- totem_skipto_update_from_state (totem, pi);
+ totem_skipto_update_from_state (priv->totem, TOTEM_SKIPTO_PLUGIN (plugin));
}
static void
-impl_deactivate (PeasActivatable *plugin,
- GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
+ TotemSkiptoPluginPrivate *priv = TOTEM_SKIPTO_PLUGIN (plugin)->priv;
GtkWindow *window;
GtkUIManager *manager;
- TotemObject *totem = TOTEM_OBJECT (object);
- TotemSkiptoPluginPrivate *priv = TOTEM_SKIPTO_PLUGIN (plugin)->priv;
- g_signal_handler_disconnect (G_OBJECT (totem),
+ g_signal_handler_disconnect (G_OBJECT (priv->totem),
priv->handler_id_stream_length);
- g_signal_handler_disconnect (G_OBJECT (totem),
+ g_signal_handler_disconnect (G_OBJECT (priv->totem),
priv->handler_id_seekable);
if (priv->handler_id_key_press != 0) {
- window = totem_get_main_window (totem);
+ window = totem_get_main_window (priv->totem);
g_signal_handler_disconnect (G_OBJECT(window),
priv->handler_id_key_press);
priv->handler_id_key_press = 0;
@@ -268,8 +240,10 @@ impl_deactivate (PeasActivatable *plugin,
}
/* Remove the menu */
- manager = totem_get_ui_manager (totem);
+ manager = totem_get_ui_manager (priv->totem);
gtk_ui_manager_remove_ui (manager, priv->ui_merge_id);
gtk_ui_manager_remove_action_group (manager, priv->action_group);
+
+ destroy_dialog (TOTEM_SKIPTO_PLUGIN (plugin));
}
diff --git a/src/plugins/skipto/totem-skipto.c b/src/plugins/skipto/totem-skipto.c
index 0758b84..73c7a6a 100644
--- a/src/plugins/skipto/totem-skipto.c
+++ b/src/plugins/skipto/totem-skipto.c
@@ -38,7 +38,6 @@
#include "totem-dirs.h"
#include "totem-skipto.h"
-#include "totem-skipto-plugin.h"
#include "totem-uri.h"
#include "video-utils.h"
#include "bacon-video-widget.h"
@@ -150,14 +149,14 @@ time_entry_activate_cb (GtkEntry *entry, TotemSkipto *skipto)
}
GtkWidget *
-totem_skipto_new (TotemSkiptoPlugin *plugin)
+totem_skipto_new (TotemObject *totem)
{
TotemSkipto *skipto;
GtkWidget *container;
skipto = TOTEM_SKIPTO (g_object_new (TOTEM_TYPE_SKIPTO, NULL));
- skipto->priv->totem = plugin->totem;
+ skipto->priv->totem = totem;
skipto->priv->xml = totem_plugin_load_interface ("skipto",
"skipto.ui", TRUE,
NULL, skipto);
@@ -190,7 +189,7 @@ totem_skipto_new (TotemSkiptoPlugin *plugin)
0); /* padding */
gtk_window_set_transient_for (GTK_WINDOW (skipto),
- totem_get_main_window (plugin->totem));
+ totem_get_main_window (totem));
gtk_widget_show_all (GTK_WIDGET (skipto));
diff --git a/src/plugins/skipto/totem-skipto.h b/src/plugins/skipto/totem-skipto.h
index 0e12d50..d306ab5 100644
--- a/src/plugins/skipto/totem-skipto.h
+++ b/src/plugins/skipto/totem-skipto.h
@@ -33,7 +33,6 @@
#include <gtk/gtk.h>
#include "totem.h"
-#include "totem-skipto-plugin.h"
G_BEGIN_DECLS
@@ -59,7 +58,7 @@ struct TotemSkiptoClass {
};
GType totem_skipto_get_type (void);
-GtkWidget *totem_skipto_new (TotemSkiptoPlugin *plugin);
+GtkWidget *totem_skipto_new (TotemObject *totem);
gint64 totem_skipto_get_range (TotemSkipto *skipto);
void totem_skipto_update_range (TotemSkipto *skipto, gint64 _time);
void totem_skipto_set_seekable (TotemSkipto *skipto, gboolean seekable);
diff --git a/src/plugins/thumbnail/totem-thumbnail.c b/src/plugins/thumbnail/totem-thumbnail.c
index 7d244c4..066a17b 100644
--- a/src/plugins/thumbnail/totem-thumbnail.c
+++ b/src/plugins/thumbnail/totem-thumbnail.c
@@ -54,34 +54,7 @@ typedef struct
TotemObject *totem;
} TotemThumbnailPluginPrivate;
-typedef struct
-{
- PeasExtensionBase parent;
- TotemThumbnailPluginPrivate *priv;
-} TotemThumbnailPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemThumbnailPluginClass;
-
-GType totem_thumbnail_plugin_get_type (void) G_GNUC_CONST;
-
-TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_THUMBNAIL_PLUGIN, TotemThumbnailPlugin, totem_thumbnail_plugin)
-
-static void
-totem_thumbnail_plugin_class_init (TotemThumbnailPluginClass *klass)
-{
- g_type_class_add_private (klass, sizeof (TotemThumbnailPluginPrivate));
-}
-
-static void
-totem_thumbnail_plugin_init (TotemThumbnailPlugin *plugin)
-{
- plugin->priv = G_TYPE_INSTANCE_GET_PRIVATE (plugin,
- TOTEM_TYPE_THUMBNAIL_PLUGIN,
- TotemThumbnailPluginPrivate);
-}
+TOTEM_PLUGIN_REGISTER (TOTEM_TYPE_THUMBNAIL_PLUGIN, TotemThumbnailPlugin, totem_thumbnail_plugin)
static void
set_icon_to_default (TotemObject *totem)
@@ -169,42 +142,37 @@ file_closed_cb (TotemObject *totem,
}
static void
-impl_activate (PeasActivatable *plugin,
- GObject *object)
+impl_activate (PeasActivatable *plugin)
{
TotemThumbnailPlugin *pi = TOTEM_THUMBNAIL_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
char *mrl;
- pi->priv->window = totem_get_main_window (totem);
- pi->priv->totem = totem;
+ pi->priv->window = totem_get_main_window (pi->priv->totem);
- pi->priv->file_opened_handler_id = g_signal_connect (G_OBJECT (totem),
+ pi->priv->file_opened_handler_id = g_signal_connect (G_OBJECT (pi->priv->totem),
"file-opened",
G_CALLBACK (file_opened_cb),
pi);
- pi->priv->file_closed_handler_id = g_signal_connect (G_OBJECT (totem),
+ pi->priv->file_closed_handler_id = g_signal_connect (G_OBJECT (pi->priv->totem),
"file-closed",
G_CALLBACK (file_closed_cb),
pi);
- g_object_get (totem, "current-mrl", &mrl, NULL);
+ g_object_get (pi->priv->totem, "current-mrl", &mrl, NULL);
- update_from_state (pi->priv, totem, mrl);
+ update_from_state (pi->priv, pi->priv->totem, mrl);
g_free (mrl);
}
static void
-impl_deactivate (PeasActivatable *plugin,
- GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
TotemThumbnailPlugin *pi = TOTEM_THUMBNAIL_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
- g_signal_handler_disconnect (totem, pi->priv->file_opened_handler_id);
- g_signal_handler_disconnect (totem, pi->priv->file_closed_handler_id);
+ g_signal_handler_disconnect (pi->priv->totem, pi->priv->file_opened_handler_id);
+ g_signal_handler_disconnect (pi->priv->totem, pi->priv->file_closed_handler_id);
- set_icon_to_default (totem);
+ set_icon_to_default (pi->priv->totem);
}
diff --git a/src/plugins/tracker/totem-tracker.c b/src/plugins/tracker/totem-tracker.c
index fb25583..0817ab8 100644
--- a/src/plugins/tracker/totem-tracker.c
+++ b/src/plugins/tracker/totem-tracker.c
@@ -46,45 +46,26 @@
#define TOTEM_IS_TRACKER_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_TRACKER_PLUGIN))
#define TOTEM_TRACKER_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_TRACKER_PLUGIN, TotemTrackerPluginClass))
-typedef struct
-{
- PeasExtensionBase parent;
-} TotemTrackerPlugin;
-
-typedef struct
-{
- PeasExtensionBaseClass parent_class;
-} TotemTrackerPluginClass;
-
-G_MODULE_EXPORT GType register_totem_plugin (GTypeModule *module);
-GType totem_tracker_plugin_get_type (void) G_GNUC_CONST;
+typedef struct {
+ TotemObject *totem;
+} TotemTrackerPluginPrivate;
TOTEM_PLUGIN_REGISTER (TOTEM_TYPE_TRACKER_PLUGIN, TotemTrackerPlugin, totem_tracker_plugin);
static void
-totem_tracker_plugin_class_init (TotemTrackerPluginClass *klass)
-{
-}
-
-static void
-totem_tracker_plugin_init (TotemTrackerPlugin *plugin)
-{
-}
-
-static void
-impl_activate (PeasActivatable *plugin, GObject *object)
+impl_activate (PeasActivatable *plugin)
{
+ TotemTrackerPluginPrivate *priv = TOTEM_TRACKER_PLUGIN (plugin)->priv;
GtkWidget *widget;
- TotemObject *totem = TOTEM_OBJECT (object);
- widget = totem_tracker_widget_new (totem);
+ widget = totem_tracker_widget_new (priv->totem);
gtk_widget_show (widget);
- totem_add_sidebar_page (totem, "tracker", _("Local Search"), widget);
+ totem_add_sidebar_page (priv->totem, "tracker", _("Local Search"), widget);
}
static void
-impl_deactivate (PeasActivatable *plugin, GObject *object)
+impl_deactivate (PeasActivatable *plugin)
{
- totem_remove_sidebar_page (TOTEM_OBJECT (object), "tracker");
+ totem_remove_sidebar_page (TOTEM_TRACKER_PLUGIN (plugin)->priv->totem, "tracker");
}
diff --git a/src/plugins/youtube/totem-youtube.c b/src/plugins/youtube/totem-youtube.c
index 6882bda..0ceaa11 100644
--- a/src/plugins/youtube/totem-youtube.c
+++ b/src/plugins/youtube/totem-youtube.c
@@ -62,8 +62,7 @@ enum {
#define TOTEM_YOUTUBE_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_YOUTUBE_PLUGIN, TotemYouTubePluginClass))
typedef struct {
- PeasExtensionBase parent;
- Totem *totem;
+ TotemObject *totem;
GDataYouTubeService *service;
BaconVideoWidget *bvw;
@@ -84,13 +83,9 @@ typedef struct {
GtkListStore *list_store[NUM_TREE_VIEWS];
GtkTreeView *tree_view[NUM_TREE_VIEWS];
GtkWidget *cancel_button;
-} TotemYouTubePlugin;
+} TotemYouTubePluginPrivate;
-typedef struct {
- PeasExtensionBaseClass parent_class;
-} TotemYouTubePluginClass;
-
-GType totem_youtube_plugin_get_type (void) G_GNUC_CONST;
+TOTEM_PLUGIN_REGISTER (TOTEM_TYPE_YOUTUBE_PLUGIN, TotemYouTubePlugin, totem_youtube_plugin);
/* GtkBuilder callbacks */
void notebook_switch_page_cb (GtkNotebook *notebook, gpointer *page, guint page_num, TotemYouTubePlugin *self);
@@ -103,18 +98,6 @@ void open_in_web_browser_activate_cb (GtkAction *action, TotemYouTubePlugin *sel
void value_changed_cb (GtkAdjustment *adjustment, TotemYouTubePlugin *self);
gboolean starting_video_cb (TotemVideoList *video_list, GtkTreePath *path, TotemYouTubePlugin *self);
-TOTEM_PLUGIN_REGISTER (TOTEM_TYPE_YOUTUBE_PLUGIN, TotemYouTubePlugin, totem_youtube_plugin);
-
-static void
-totem_youtube_plugin_class_init (TotemYouTubePluginClass *klass)
-{
-}
-
-static void
-totem_youtube_plugin_init (TotemYouTubePlugin *plugin)
-{
-}
-
/* ----------------------------------------------------------------------------------------------------------------- */
/* Copied from http://bugzilla.gnome.org/show_bug.cgi?id=575900 while waiting for them to be committed to gdk-pixbuf */
@@ -269,6 +252,7 @@ totem_gdk_pixbuf_new_from_stream_finish (GAsyncResult *async_result,
static void
set_up_tree_view (TotemYouTubePlugin *self, GtkBuilder *builder, guint key)
{
+ TotemYouTubePluginPrivate *priv = self->priv;
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
GtkAction *action, *menu_item;
@@ -288,17 +272,17 @@ set_up_tree_view (TotemYouTubePlugin *self, GtkBuilder *builder, guint key)
if (key == SEARCH_TREE_VIEW) {
tree_view = GTK_WIDGET (gtk_builder_get_object (builder, "yt_treeview_search"));
vscroll = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (gtk_builder_get_object (builder, "yt_scrolled_window_search")));
- self->list_store[key] = GTK_LIST_STORE (gtk_builder_get_object (builder, "yt_list_store_search"));
- self->tree_view[key] = GTK_TREE_VIEW (tree_view);
- self->progress_bar[key] = GTK_PROGRESS_BAR (gtk_builder_get_object (builder, "yt_progress_bar_search"));
+ priv->list_store[key] = GTK_LIST_STORE (gtk_builder_get_object (builder, "yt_list_store_search"));
+ priv->tree_view[key] = GTK_TREE_VIEW (tree_view);
+ priv->progress_bar[key] = GTK_PROGRESS_BAR (gtk_builder_get_object (builder, "yt_progress_bar_search"));
} else {
tree_view = GTK_WIDGET (gtk_builder_get_object (builder, "yt_treeview_related"));
vscroll = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (gtk_builder_get_object (builder, "yt_scrolled_window_related")));
- self->list_store[key] = GTK_LIST_STORE (gtk_builder_get_object (builder, "yt_list_store_related"));
- self->tree_view[key] = GTK_TREE_VIEW (tree_view);
- self->progress_bar[key] = GTK_PROGRESS_BAR (gtk_builder_get_object (builder, "yt_progress_bar_related"));
+ priv->list_store[key] = GTK_LIST_STORE (gtk_builder_get_object (builder, "yt_list_store_related"));
+ priv->tree_view[key] = GTK_TREE_VIEW (tree_view);
+ priv->progress_bar[key] = GTK_PROGRESS_BAR (gtk_builder_get_object (builder, "yt_progress_bar_related"));
}
- g_object_set (tree_view, "totem", self->totem, NULL);
+ g_object_set (tree_view, "totem", priv->totem, NULL);
g_signal_connect (vscroll, "button-press-event", G_CALLBACK (button_press_event_cb), self);
g_signal_connect (vscroll, "button-release-event", G_CALLBACK (button_release_event_cb), self);
@@ -321,71 +305,68 @@ set_up_tree_view (TotemYouTubePlugin *self, GtkBuilder *builder, guint key)
g_signal_connect (menu_item, "activate", G_CALLBACK (open_in_web_browser_activate_cb), self);
/* Connect to more scroll events */
- self->vadjust[key] = gtk_tree_view_get_vadjustment (GTK_TREE_VIEW (tree_view));
- g_signal_connect (self->vadjust[key], "value-changed", G_CALLBACK (value_changed_cb), self);
+ priv->vadjust[key] = gtk_tree_view_get_vadjustment (GTK_TREE_VIEW (tree_view));
+ g_signal_connect (priv->vadjust[key], "value-changed", G_CALLBACK (value_changed_cb), self);
- self->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "yt_cancel_button"));
+ priv->cancel_button = GTK_WIDGET (gtk_builder_get_object (builder, "yt_cancel_button"));
}
static void
-impl_activate (PeasActivatable *plugin, GObject *object)
+impl_activate (PeasActivatable *plugin)
{
- TotemYouTubePlugin *self = TOTEM_YOUTUBE_PLUGIN (plugin);
- TotemObject *totem = TOTEM_OBJECT (object);
+ TotemYouTubePluginPrivate *priv = TOTEM_YOUTUBE_PLUGIN (plugin)->priv;
GtkWindow *main_window;
GtkBuilder *builder;
guint i;
- self->totem = g_object_ref (totem);
- self->bvw = BACON_VIDEO_WIDGET (totem_get_video_widget (totem));
+ priv->bvw = BACON_VIDEO_WIDGET (totem_get_video_widget (priv->totem));
/* Set up the interface */
- main_window = totem_get_main_window (totem);
- builder = totem_plugin_load_interface ("youtube", "youtube.ui", TRUE, main_window, self);
+ main_window = totem_get_main_window (priv->totem);
+ builder = totem_plugin_load_interface ("youtube", "youtube.ui", TRUE, main_window, plugin);
g_object_unref (main_window);
- self->search_entry = GTK_ENTRY (gtk_builder_get_object (builder, "yt_search_entry"));
- self->search_button = GTK_BUTTON (gtk_builder_get_object (builder, "yt_search_button"));
- self->notebook = GTK_NOTEBOOK (gtk_builder_get_object (builder, "yt_notebook"));
+ priv->search_entry = GTK_ENTRY (gtk_builder_get_object (builder, "yt_search_entry"));
+ priv->search_button = GTK_BUTTON (gtk_builder_get_object (builder, "yt_search_button"));
+ priv->notebook = GTK_NOTEBOOK (gtk_builder_get_object (builder, "yt_notebook"));
/* Set up the tree view pages */
for (i = 0; i < NUM_TREE_VIEWS; i++)
- set_up_tree_view (self, builder, i);
- self->current_tree_view = SEARCH_TREE_VIEW;
+ set_up_tree_view (TOTEM_YOUTUBE_PLUGIN (plugin), builder, i);
+ priv->current_tree_view = SEARCH_TREE_VIEW;
- self->vbox = GTK_WIDGET (gtk_builder_get_object (builder, "yt_vbox"));
- gtk_widget_show_all (self->vbox);
+ priv->vbox = GTK_WIDGET (gtk_builder_get_object (builder, "yt_vbox"));
+ gtk_widget_show_all (priv->vbox);
/* Add the sidebar page */
- totem_add_sidebar_page (totem, "youtube", _("YouTube"), self->vbox);
+ totem_add_sidebar_page (priv->totem, "youtube", _("YouTube"), priv->vbox);
g_object_unref (builder);
}
static void
-impl_deactivate (PeasActivatable *plugin, GObject *totem)
+impl_deactivate (PeasActivatable *plugin)
{
+ TotemYouTubePluginPrivate *priv = TOTEM_YOUTUBE_PLUGIN (plugin)->priv;
guint i;
- TotemYouTubePlugin *self = TOTEM_YOUTUBE_PLUGIN (plugin);
- totem_remove_sidebar_page (self->totem, "youtube");
+ totem_remove_sidebar_page (priv->totem, "youtube");
for (i = 0; i < NUM_TREE_VIEWS; i++) {
/* Cancel any queries which are still underway */
- if (self->cancellable[i] != NULL)
- g_cancellable_cancel (self->cancellable[i]);
+ if (priv->cancellable[i] != NULL)
+ g_cancellable_cancel (priv->cancellable[i]);
- if (self->query[i] != NULL)
- g_object_unref (self->query[i]);
+ if (priv->query[i] != NULL)
+ g_object_unref (priv->query[i]);
}
- if (self->playing_video != NULL)
- g_object_unref (self->playing_video);
- if (self->service != NULL)
- g_object_unref (self->service);
- g_object_unref (self->bvw);
- g_object_unref (self->totem);
- if (self->regex != NULL)
- g_regex_unref (self->regex);
+ if (priv->playing_video != NULL)
+ g_object_unref (priv->playing_video);
+ if (priv->service != NULL)
+ g_object_unref (priv->service);
+ g_object_unref (priv->bvw);
+ if (priv->regex != NULL)
+ g_regex_unref (priv->regex);
}
typedef struct {
@@ -396,26 +377,27 @@ typedef struct {
static gboolean
progress_bar_pulse_cb (ProgressBarData *data)
{
- TotemYouTubePlugin *self = data->plugin;
+ TotemYouTubePluginPrivate *priv = data->plugin->priv;
- if (self->progress_bar_increment[data->tree_view] != 0.0) {
+ if (priv->progress_bar_increment[data->tree_view] != 0.0) {
g_slice_free (ProgressBarData, data);
return FALSE; /* The first entry has been retrieved */
}
- gtk_progress_bar_pulse (self->progress_bar[data->tree_view]);
+ gtk_progress_bar_pulse (priv->progress_bar[data->tree_view]);
return TRUE;
}
static void
set_progress_bar_text (TotemYouTubePlugin *self, const gchar *text, guint tree_view)
{
+ TotemYouTubePluginPrivate *priv = self->priv;
ProgressBarData *data;
GdkCursor *cursor;
/* Set the cursor to a watch */
cursor = gdk_cursor_new (GDK_WATCH);
- gdk_window_set_cursor (gtk_widget_get_window (self->vbox), cursor);
+ gdk_window_set_cursor (gtk_widget_get_window (priv->vbox), cursor);
gdk_cursor_unref (cursor);
/* Call the pulse method */
@@ -423,30 +405,31 @@ set_progress_bar_text (TotemYouTubePlugin *self, const gchar *text, guint tree_v
data->plugin = self;
data->tree_view = tree_view;
- gtk_progress_bar_set_text (self->progress_bar[tree_view], text);
- gtk_progress_bar_set_fraction (self->progress_bar[tree_view], 0.0);
- self->progress_bar_increment[tree_view] = 0.0;
+ gtk_progress_bar_set_text (priv->progress_bar[tree_view], text);
+ gtk_progress_bar_set_fraction (priv->progress_bar[tree_view], 0.0);
+ priv->progress_bar_increment[tree_view] = 0.0;
g_timeout_add (PULSE_INTERVAL, (GSourceFunc) progress_bar_pulse_cb, data);
}
static void
increment_progress_bar_fraction (TotemYouTubePlugin *self, guint tree_view)
{
- gdouble new_value = MIN (gtk_progress_bar_get_fraction (self->progress_bar[tree_view]) + self->progress_bar_increment[tree_view], 1.0);
+ TotemYouTubePluginPrivate *priv = self->priv;
+ gdouble new_value = MIN (gtk_progress_bar_get_fraction (priv->progress_bar[tree_view]) + priv->progress_bar_increment[tree_view], 1.0);
- g_debug ("Incrementing progress bar by %f (new value: %f)", self->progress_bar_increment[tree_view], new_value);
- gtk_progress_bar_set_fraction (self->progress_bar[tree_view], new_value);
+ g_debug ("Incrementing progress bar by %f (new value: %f)", priv->progress_bar_increment[tree_view], new_value);
+ gtk_progress_bar_set_fraction (priv->progress_bar[tree_view], new_value);
/* Change the text if the operation's been cancelled */
- if (self->cancellable[tree_view] == NULL || g_cancellable_is_cancelled (self->cancellable[tree_view]) == TRUE)
- gtk_progress_bar_set_text (self->progress_bar[tree_view], _("Cancelling queryâ?¦"));
+ if (priv->cancellable[tree_view] == NULL || g_cancellable_is_cancelled (priv->cancellable[tree_view]) == TRUE)
+ gtk_progress_bar_set_text (priv->progress_bar[tree_view], _("Cancelling queryâ?¦"));
/* Update the UI */
- if (gtk_progress_bar_get_fraction (self->progress_bar[tree_view]) == 1.0) {
+ if (gtk_progress_bar_get_fraction (priv->progress_bar[tree_view]) == 1.0) {
/* The entire search process (including loading thumbnails and t params) is finished, so update the progress bar */
- gdk_window_set_cursor (gtk_widget_get_window (self->vbox), NULL);
- gtk_progress_bar_set_text (self->progress_bar[tree_view], "");
- gtk_progress_bar_set_fraction (self->progress_bar[tree_view], 0.0);
+ gdk_window_set_cursor (gtk_widget_get_window (priv->vbox), NULL);
+ gtk_progress_bar_set_text (priv->progress_bar[tree_view], "");
+ gtk_progress_bar_set_fraction (priv->progress_bar[tree_view], 0.0);
}
}
@@ -477,13 +460,13 @@ static const guint fmt_preferences[] = {
static void
resolve_t_param_cb (GObject *source_object, GAsyncResult *result, TParamData *data)
{
+ TotemYouTubePluginPrivate *priv = data->plugin->priv;
gchar *contents, *video_uri = NULL;
const gchar *video_id;
gsize length;
GMatchInfo *match_info;
GError *error = NULL;
GtkTreeIter iter;
- TotemYouTubePlugin *self = data->plugin;
/* Finish loading the page */
if (g_file_load_contents_finish (G_FILE (source_object), result, &contents, &length, NULL, &error) == FALSE) {
@@ -496,7 +479,7 @@ resolve_t_param_cb (GObject *source_object, GAsyncResult *result, TParamData *da
}
/* Couldn't load the page contents; error */
- window = totem_get_main_window (data->plugin->totem);
+ window = totem_get_main_window (priv->totem);
totem_interface_error (_("Error Looking Up Video URI"), error->message, window);
g_object_unref (window);
g_error_free (error);
@@ -506,7 +489,7 @@ resolve_t_param_cb (GObject *source_object, GAsyncResult *result, TParamData *da
video_id = gdata_youtube_video_get_video_id (GDATA_YOUTUBE_VIDEO (data->entry));
/* Check for the fmt_url_map parameter */
- g_regex_match (self->regex, contents, 0, &match_info);
+ g_regex_match (priv->regex, contents, 0, &match_info);
if (g_match_info_matches (match_info) == TRUE) {
gchar *fmt_url_map_escaped, *fmt_url_map;
gchar **mappings, **i;
@@ -556,7 +539,7 @@ resolve_t_param_cb (GObject *source_object, GAsyncResult *result, TParamData *da
g_strfreev (mappings);
/* Starting with the highest connection speed we support, look for video URIs matching our connection speed. */
- connection_speed = MIN (bacon_video_widget_get_connection_speed (self->bvw), (gint) G_N_ELEMENTS (fmt_preferences) - 1);
+ connection_speed = MIN (bacon_video_widget_get_connection_speed (priv->bvw), (gint) G_N_ELEMENTS (fmt_preferences) - 1);
for (; connection_speed >= 0; connection_speed--) {
guint idx = (guint) connection_speed;
video_uri = g_strdup (g_hash_table_lookup (fmt_table, GUINT_TO_POINTER (fmt_preferences [idx])));
@@ -592,8 +575,8 @@ resolve_t_param_cb (GObject *source_object, GAsyncResult *result, TParamData *da
g_free (contents);
/* Update the tree view with the new MRL */
- if (gtk_tree_model_get_iter (GTK_TREE_MODEL (self->list_store[data->tree_view]), &iter, data->path) == TRUE) {
- gtk_list_store_set (self->list_store[data->tree_view], &iter, 2, video_uri, -1);
+ if (gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->list_store[data->tree_view]), &iter, data->path) == TRUE) {
+ gtk_list_store_set (priv->list_store[data->tree_view], &iter, 2, video_uri, -1);
g_debug ("Updated list store with new video URI (\"%s\") for entry %s", video_uri, video_id);
}
@@ -601,7 +584,7 @@ resolve_t_param_cb (GObject *source_object, GAsyncResult *result, TParamData *da
free_data:
/* Update the progress bar */
- increment_progress_bar_fraction (self, data->tree_view);
+ increment_progress_bar_fraction (data->plugin, data->tree_view);
g_object_unref (data->plugin);
g_object_unref (data->entry);
@@ -623,7 +606,7 @@ resolve_t_param (TotemYouTubePlugin *self, GDataEntry *entry, GtkTreeIter *iter,
data = g_slice_new (TParamData);
data->plugin = g_object_ref (self);
data->entry = g_object_ref (entry);
- data->path = gtk_tree_model_get_path (GTK_TREE_MODEL (self->list_store[tree_view]), iter);
+ data->path = gtk_tree_model_get_path (GTK_TREE_MODEL (self->priv->list_store[tree_view]), iter);
data->tree_view = tree_view;
video_page = g_file_new_for_uri (gdata_link_get_uri (page_link));
@@ -641,10 +624,10 @@ typedef struct {
static void
thumbnail_loaded_cb (GObject *source_object, GAsyncResult *result, ThumbnailData *data)
{
+ TotemYouTubePluginPrivate *priv = data->plugin->priv;
GdkPixbuf *thumbnail;
GError *error = NULL;
GtkTreeIter iter;
- TotemYouTubePlugin *self = data->plugin;
/* Finish loading the thumbnail */
thumbnail = totem_gdk_pixbuf_new_from_stream_finish (result, &error);
@@ -665,8 +648,8 @@ thumbnail_loaded_cb (GObject *source_object, GAsyncResult *result, ThumbnailData
g_debug ("Finished creating thumbnail from stream");
/* Update the tree view */
- if (gtk_tree_model_get_iter (GTK_TREE_MODEL (self->list_store[data->tree_view]), &iter, data->path) == TRUE) {
- gtk_list_store_set (self->list_store[data->tree_view], &iter, 0, thumbnail, -1);
+ if (gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->list_store[data->tree_view]), &iter, data->path) == TRUE) {
+ gtk_list_store_set (priv->list_store[data->tree_view], &iter, 0, thumbnail, -1);
g_debug ("Updated list store with new thumbnail");
}
@@ -674,7 +657,7 @@ thumbnail_loaded_cb (GObject *source_object, GAsyncResult *result, ThumbnailData
free_data:
/* Update the progress bar */
- increment_progress_bar_fraction (self, data->tree_view);
+ increment_progress_bar_fraction (data->plugin, data->tree_view);
g_object_unref (data->plugin);
g_object_unref (data->cancellable);
@@ -733,18 +716,18 @@ query_data_free (QueryData *data)
static void
query_finished_cb (GObject *source_object, GAsyncResult *result, QueryData *data)
{
+ TotemYouTubePluginPrivate *priv = data->plugin->priv;
GtkWindow *window;
GDataFeed *feed;
GError *error = NULL;
- TotemYouTubePlugin *self = data->plugin;
g_debug ("Search finished!");
- feed = gdata_service_query_finish (GDATA_SERVICE (self->service), result, &error);
+ feed = gdata_service_query_finish (GDATA_SERVICE (priv->service), result, &error);
/* Stop the progress bar; a little hacky, but it works */
- self->progress_bar_increment[data->tree_view] = 1.0;
- increment_progress_bar_fraction (self, data->tree_view);
+ priv->progress_bar_increment[data->tree_view] = 1.0;
+ increment_progress_bar_fraction (data->plugin, data->tree_view);
if (feed != NULL) {
/* Success! */
@@ -766,7 +749,7 @@ query_finished_cb (GObject *source_object, GAsyncResult *result, QueryData *data
}
/* Error! */
- window = totem_get_main_window (data->plugin->totem);
+ window = totem_get_main_window (priv->totem);
if (g_error_matches (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_PROTOCOL_ERROR) == TRUE) {
/* Hide the ugly technical message libgdata gives behind a nice one telling them it's out of date (which it likely is
* if we're receiving a protocol error). */
@@ -790,20 +773,20 @@ finish:
static void
query_progress_cb (GDataEntry *entry, guint entry_key, guint entry_count, QueryData *data)
{
+ TotemYouTubePluginPrivate *priv = data->plugin->priv;
GList *thumbnails;
GDataMediaThumbnail *thumbnail = NULL;
gint delta = G_MININT;
GtkTreeIter iter;
const gchar *title, *id;
GtkProgressBar *progress_bar;
- TotemYouTubePlugin *self = data->plugin;
/* Add the entry to the tree view */
title = gdata_entry_get_title (entry);
id = gdata_youtube_video_get_video_id (GDATA_YOUTUBE_VIDEO (entry));
- gtk_list_store_append (self->list_store[data->tree_view], &iter);
- gtk_list_store_set (self->list_store[data->tree_view], &iter,
+ gtk_list_store_append (priv->list_store[data->tree_view], &iter);
+ gtk_list_store_set (priv->list_store[data->tree_view], &iter,
0, NULL, /* the thumbnail will be downloaded asynchronously and added to the tree view later */
1, title,
2, NULL, /* the video URI will be resolved asynchronously and added to the tree view later */
@@ -813,15 +796,15 @@ query_progress_cb (GDataEntry *entry, guint entry_key, guint entry_count, QueryD
/* Update the progress bar; we have three steps for each entry in the results: the entry, its thumbnail, and its t parameter */
g_assert (entry_count > 0);
- progress_bar = self->progress_bar[data->tree_view];
- self->progress_bar_increment[data->tree_view] = 1.0 / (entry_count * 3.0);
- g_debug ("Setting progress_bar_increment to 1.0 / (%u * 3.0) = %f", entry_count, self->progress_bar_increment[data->tree_view]);
- gtk_progress_bar_set_fraction (progress_bar, gtk_progress_bar_get_fraction (progress_bar) + self->progress_bar_increment[data->tree_view]);
+ progress_bar = priv->progress_bar[data->tree_view];
+ priv->progress_bar_increment[data->tree_view] = 1.0 / (entry_count * 3.0);
+ g_debug ("Setting progress_bar_increment to 1.0 / (%u * 3.0) = %f", entry_count, priv->progress_bar_increment[data->tree_view]);
+ gtk_progress_bar_set_fraction (progress_bar, gtk_progress_bar_get_fraction (progress_bar) + priv->progress_bar_increment[data->tree_view]);
/* Resolve the t parameter for the video, which is required before it can be played */
/* This will be cancelled if the main query is cancelled, in query_finished_cb() */
data->t_param_cancellable = g_cancellable_new ();
- resolve_t_param (self, entry, &iter, data->tree_view, data->t_param_cancellable);
+ resolve_t_param (data->plugin, entry, &iter, data->tree_view, data->t_param_cancellable);
/* Download the entry's thumbnail, ready for adding it to the tree view.
* Find the thumbnail size which is closest to the wanted size (THUMBNAIL_WIDTH), so that we:
@@ -852,8 +835,8 @@ query_progress_cb (GDataEntry *entry, guint entry_key, guint entry_count, QueryD
ThumbnailData *t_data;
t_data = g_slice_new (ThumbnailData);
- t_data->plugin = g_object_ref (self);
- t_data->path = gtk_tree_model_get_path (GTK_TREE_MODEL (self->list_store[data->tree_view]), &iter);
+ t_data->plugin = g_object_ref (data->plugin);
+ t_data->path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->list_store[data->tree_view]), &iter);
t_data->tree_view = data->tree_view;
/* We can use the same cancellable for reading the file and making a pixbuf out of it, as they're consecutive operations */
@@ -873,38 +856,42 @@ query_progress_cb (GDataEntry *entry, guint entry_key, guint entry_count, QueryD
static void
cancellable_notify_cb (TotemYouTubePlugin *self, GCancellable *old_cancellable)
{
+ TotemYouTubePluginPrivate *priv = self->priv;
guint i;
/* Disable the "Cancel" button, if it applies to the current tree view */
- if (self->cancellable[self->current_tree_view] == old_cancellable)
- gtk_widget_set_sensitive (self->cancel_button, FALSE);
+ if (priv->cancellable[priv->current_tree_view] == old_cancellable)
+ gtk_widget_set_sensitive (priv->cancel_button, FALSE);
/* NULLify the cancellable */
for (i = 0; i < NUM_TREE_VIEWS; i++) {
- if (self->cancellable[i] == old_cancellable)
- self->cancellable[i] = NULL;
+ if (priv->cancellable[i] == old_cancellable)
+ priv->cancellable[i] = NULL;
}
}
static void
set_current_operation (TotemYouTubePlugin *self, guint tree_view, GCancellable *cancellable)
{
+ TotemYouTubePluginPrivate *priv = self->priv;
+
/* Cancel previous searches on this tree view */
- if (self->cancellable[tree_view] != NULL)
- g_cancellable_cancel (self->cancellable[tree_view]);
+ if (priv->cancellable[tree_view] != NULL)
+ g_cancellable_cancel (priv->cancellable[tree_view]);
/* Make this the current cancellable action for the given tab */
g_object_weak_ref (G_OBJECT (cancellable), (GWeakNotify) cancellable_notify_cb, self);
- self->cancellable[tree_view] = cancellable;
+ priv->cancellable[tree_view] = cancellable;
/* Enable the "Cancel" button if it applies to the current tree view */
- if (self->current_tree_view == tree_view)
- gtk_widget_set_sensitive (self->cancel_button, TRUE);
+ if (priv->current_tree_view == tree_view)
+ gtk_widget_set_sensitive (priv->cancel_button, TRUE);
}
static void
execute_query (TotemYouTubePlugin *self, guint tree_view, gboolean clear_tree_view)
{
+ TotemYouTubePluginPrivate *priv = self->priv;
QueryData *data;
/* Set up the query */
@@ -920,14 +907,14 @@ execute_query (TotemYouTubePlugin *self, guint tree_view, gboolean clear_tree_vi
/* Clear the tree views */
if (clear_tree_view == TRUE)
- gtk_list_store_clear (self->list_store[tree_view]);
+ gtk_list_store_clear (priv->list_store[tree_view]);
if (tree_view == SEARCH_TREE_VIEW) {
- gdata_youtube_service_query_videos_async (self->service, self->query[tree_view], data->query_cancellable,
+ gdata_youtube_service_query_videos_async (priv->service, priv->query[tree_view], data->query_cancellable,
(GDataQueryProgressCallback) query_progress_cb, data,
(GAsyncReadyCallback) query_finished_cb, data);
} else {
- gdata_youtube_service_query_related_async (self->service, self->playing_video, self->query[tree_view], data->query_cancellable,
+ gdata_youtube_service_query_related_async (priv->service, priv->playing_video, priv->query[tree_view], data->query_cancellable,
(GDataQueryProgressCallback) query_progress_cb, data,
(GAsyncReadyCallback) query_finished_cb, data);
}
@@ -936,97 +923,104 @@ execute_query (TotemYouTubePlugin *self, guint tree_view, gboolean clear_tree_vi
void
search_button_clicked_cb (GtkButton *button, TotemYouTubePlugin *self)
{
+ TotemYouTubePluginPrivate *priv = self->priv;
const gchar *search_terms;
- search_terms = gtk_entry_get_text (self->search_entry);
+ search_terms = gtk_entry_get_text (priv->search_entry);
g_debug ("Searching for \"%s\"", search_terms);
/* Focus the "Search" page */
- gtk_notebook_set_current_page (self->notebook, SEARCH_TREE_VIEW);
+ gtk_notebook_set_current_page (priv->notebook, SEARCH_TREE_VIEW);
/* Update the UI */
set_progress_bar_text (self, _("Fetching search resultsâ?¦"), SEARCH_TREE_VIEW);
/* Clear details pertaining to related videos, since we're doing a new search */
- gtk_list_store_clear (self->list_store[RELATED_TREE_VIEW]);
- if (self->playing_video != NULL)
- g_object_unref (self->playing_video);
- self->playing_video = NULL;
+ gtk_list_store_clear (priv->list_store[RELATED_TREE_VIEW]);
+ if (priv->playing_video != NULL)
+ g_object_unref (priv->playing_video);
+ priv->playing_video = NULL;
/* If this is the first query, set up some stuff which we didn't do before to save memory */
- if (self->query[SEARCH_TREE_VIEW] == NULL) {
+ if (priv->query[SEARCH_TREE_VIEW] == NULL) {
/* If this is the first query, compile the regex used to resolve the t param. Doing this here rather than when
* activating the plugin means we don't waste cycles if the plugin's never used. It also means we don't waste
* cycles repeatedly creating new regexes for each video whose t param we resolve. */
/* We're looking for a line of the form:
* var swfHTML = (isIE) ? "<object...econds=194&t=vjVQa1PpcFP36LLlIaDqZIG1w6e30b-7WVBgsQLLA3s%3D&rv.6.id=OzLjC6Pm... */
- self->regex = g_regex_new ("swfHTML = .*&fmt_url_map=([^&]+)&", G_REGEX_OPTIMIZE, 0, NULL);
- g_assert (self->regex != NULL);
+ priv->regex = g_regex_new ("swfHTML = .*&fmt_url_map=([^&]+)&", G_REGEX_OPTIMIZE, 0, NULL);
+ g_assert (priv->regex != NULL);
/* Set up the GData service (needed for the tree views' queries) */
- self->service = gdata_youtube_service_new (DEVELOPER_KEY, CLIENT_ID);
+ priv->service = gdata_youtube_service_new (DEVELOPER_KEY, CLIENT_ID);
/* Set up network timeouts, if they're supported by our version of libgdata.
* This will return from queries with %GDATA_SERVICE_ERROR_NETWORK_ERROR if network operations take longer than 30 seconds. */
#ifdef HAVE_LIBGDATA_0_7
- gdata_service_set_timeout (GDATA_SERVICE (self->service), 30);
+ gdata_service_set_timeout (GDATA_SERVICE (priv->service), 30);
#endif /* HAVE_LIBGDATA_0_7 */
/* Set up the queries */
- self->query[SEARCH_TREE_VIEW] = gdata_query_new_with_limits (NULL, 0, MAX_RESULTS);
- self->query[RELATED_TREE_VIEW] = gdata_query_new_with_limits (NULL, 0, MAX_RESULTS);
+ priv->query[SEARCH_TREE_VIEW] = gdata_query_new_with_limits (NULL, 0, MAX_RESULTS);
+ priv->query[RELATED_TREE_VIEW] = gdata_query_new_with_limits (NULL, 0, MAX_RESULTS);
}
/* Do the query */
- gdata_query_set_q (self->query[SEARCH_TREE_VIEW], search_terms);
+ gdata_query_set_q (priv->query[SEARCH_TREE_VIEW], search_terms);
execute_query (self, SEARCH_TREE_VIEW, TRUE);
}
void
cancel_button_clicked_cb (GtkButton *button, TotemYouTubePlugin *self)
{
+ TotemYouTubePluginPrivate *priv = self->priv;
+
/* It's possible for the operation to finish (and consequently the cancellable to disappear) while the GtkButton is deciding whether the
* user is actually pressing it (in its timeout). */
- if (self->cancellable[self->current_tree_view] == NULL)
+ if (priv->cancellable[priv->current_tree_view] == NULL)
return;
g_debug ("Cancelling search");
- g_cancellable_cancel (self->cancellable[self->current_tree_view]);
+ g_cancellable_cancel (priv->cancellable[priv->current_tree_view]);
}
void
search_entry_activate_cb (GtkEntry *entry, TotemYouTubePlugin *self)
{
- search_button_clicked_cb (self->search_button, self);
+ search_button_clicked_cb (self->priv->search_button, self);
}
static void
load_related_videos (TotemYouTubePlugin *self)
{
- g_assert (self->playing_video != NULL);
- g_debug ("Loading related videos for %s", gdata_youtube_video_get_video_id (self->playing_video));
+ TotemYouTubePluginPrivate *priv = self->priv;
+
+ g_assert (priv->playing_video != NULL);
+ g_debug ("Loading related videos for %s", gdata_youtube_video_get_video_id (priv->playing_video));
/* Update the UI */
set_progress_bar_text (self, _("Fetching related videosâ?¦"), RELATED_TREE_VIEW);
/* Clear the existing results and do the query */
- gtk_list_store_clear (self->list_store[RELATED_TREE_VIEW]);
+ gtk_list_store_clear (priv->list_store[RELATED_TREE_VIEW]);
execute_query (self, RELATED_TREE_VIEW, FALSE);
}
void
notebook_switch_page_cb (GtkNotebook *notebook, gpointer *page, guint page_num, TotemYouTubePlugin *self)
{
+ TotemYouTubePluginPrivate *priv = self->priv;
+
/* Change the tree view */
- self->current_tree_view = page_num;
+ priv->current_tree_view = page_num;
/* Sort out the "Cancel" button's sensitivity */
- gtk_widget_set_sensitive (self->cancel_button, (self->cancellable[page_num] != NULL) ? TRUE : FALSE);
+ gtk_widget_set_sensitive (priv->cancel_button, (priv->cancellable[page_num] != NULL) ? TRUE : FALSE);
/* If we're changing to the "Related Videos" tree view and have played a video, load
* the related videos for that video; but only if the related tree view's empty first */
- if (page_num == RELATED_TREE_VIEW && self->playing_video != NULL &&
- gtk_tree_model_iter_n_children (GTK_TREE_MODEL (self->list_store[RELATED_TREE_VIEW]), NULL) == 0) {
+ if (page_num == RELATED_TREE_VIEW && priv->playing_video != NULL &&
+ gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->list_store[RELATED_TREE_VIEW]), NULL) == 0) {
load_related_videos (self);
}
}
@@ -1034,11 +1028,12 @@ notebook_switch_page_cb (GtkNotebook *notebook, gpointer *page, guint page_num,
void
open_in_web_browser_activate_cb (GtkAction *action, TotemYouTubePlugin *self)
{
+ TotemYouTubePluginPrivate *priv = self->priv;
GtkTreeSelection *selection;
GtkTreeModel *model;
GList *paths, *path;
- selection = gtk_tree_view_get_selection (self->tree_view[self->current_tree_view]);
+ selection = gtk_tree_view_get_selection (priv->tree_view[priv->current_tree_view]);
paths = gtk_tree_selection_get_selected_rows (selection, &model);
for (path = paths; path != NULL; path = path->next) {
@@ -1056,9 +1051,9 @@ open_in_web_browser_activate_cb (GtkAction *action, TotemYouTubePlugin *self)
g_object_unref (video);
/* Display the page */
- if (gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (self->bvw)), gdata_link_get_uri (page_link),
+ if (gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (priv->bvw)), gdata_link_get_uri (page_link),
GDK_CURRENT_TIME, &error) == FALSE) {
- GtkWindow *window = totem_get_main_window (self->totem);
+ GtkWindow *window = totem_get_main_window (priv->totem);
totem_interface_error (_("Error Opening Video in Web Browser"), error->message, window);
g_object_unref (window);
g_error_free (error);
@@ -1072,51 +1067,54 @@ open_in_web_browser_activate_cb (GtkAction *action, TotemYouTubePlugin *self)
void
value_changed_cb (GtkAdjustment *adjustment, TotemYouTubePlugin *self)
{
- if (self->button_down == FALSE &&
- gtk_tree_model_iter_n_children (GTK_TREE_MODEL (self->list_store[self->current_tree_view]), NULL) >= MAX_RESULTS &&
+ TotemYouTubePluginPrivate *priv = self->priv;
+
+ if (priv->button_down == FALSE &&
+ gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->list_store[priv->current_tree_view]), NULL) >= MAX_RESULTS &&
(gtk_adjustment_get_value (adjustment) + gtk_adjustment_get_page_size (adjustment)) / gtk_adjustment_get_upper (adjustment) > 0.8) {
/* Only load more results if we're not already querying */
- if (self->cancellable[self->current_tree_view] != NULL)
+ if (priv->cancellable[priv->current_tree_view] != NULL)
return;
- set_progress_bar_text (self, _("Fetching more videosâ?¦"), self->current_tree_view);
- gdata_query_next_page (self->query[self->current_tree_view]);
- execute_query (self, self->current_tree_view, FALSE);
+ set_progress_bar_text (self, _("Fetching more videosâ?¦"), priv->current_tree_view);
+ gdata_query_next_page (priv->query[priv->current_tree_view]);
+ execute_query (self, priv->current_tree_view, FALSE);
}
}
gboolean
button_press_event_cb (GtkWidget *widget, GdkEventButton *event, TotemYouTubePlugin *self)
{
- self->button_down = TRUE;
+ self->priv->button_down = TRUE;
return FALSE;
}
gboolean
button_release_event_cb (GtkWidget *widget, GdkEventButton *event, TotemYouTubePlugin *self)
{
- self->button_down = FALSE;
- value_changed_cb (self->vadjust[self->current_tree_view], self);
+ self->priv->button_down = FALSE;
+ value_changed_cb (self->priv->vadjust[self->priv->current_tree_view], self);
return FALSE;
}
gboolean
starting_video_cb (TotemVideoList *video_list, GtkTreePath *path, TotemYouTubePlugin *self)
{
+ TotemYouTubePluginPrivate *priv = self->priv;
GtkTreeIter iter;
GDataYouTubeVideo *video_entry;
/* Store the current entry */
- if (gtk_tree_model_get_iter (GTK_TREE_MODEL (self->list_store[self->current_tree_view]), &iter, path) == FALSE)
+ if (gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->list_store[priv->current_tree_view]), &iter, path) == FALSE)
return FALSE;
- gtk_tree_model_get (GTK_TREE_MODEL (self->list_store[self->current_tree_view]), &iter, 3, &video_entry, -1);
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->list_store[priv->current_tree_view]), &iter, 3, &video_entry, -1);
- if (self->playing_video != NULL)
- g_object_unref (self->playing_video);
- self->playing_video = g_object_ref (video_entry);
+ if (priv->playing_video != NULL)
+ g_object_unref (priv->playing_video);
+ priv->playing_video = g_object_ref (video_entry);
/* If we're currently viewing the related videos page, load the new related videos */
- if (self->current_tree_view == RELATED_TREE_VIEW)
+ if (priv->current_tree_view == RELATED_TREE_VIEW)
load_related_videos (self);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]