totem r5071 - in trunk: . src src/plugins src/plugins/properties src/plugins/skipto src/plugins/tracker
- From: pwithnall svn gnome org
- To: svn-commits-list gnome org
- Subject: totem r5071 - in trunk: . src src/plugins src/plugins/properties src/plugins/skipto src/plugins/tracker
- Date: Tue, 5 Feb 2008 07:06:54 +0000 (GMT)
Author: pwithnall
Date: Tue Feb 5 07:06:53 2008
New Revision: 5071
URL: http://svn.gnome.org/viewvc/totem?rev=5071&view=rev
Log:
2008-02-05 Philip Withnall <pwithnall svn gnome org>
* src/plugins/properties/totem-movie-properties.c:
(totem_movie_properties_plugin_class_init):
* src/plugins/skipto/totem-skipto.c: (totem_skipto_class_init),
(totem_skipto_dispose):
* src/plugins/totem-module.c: (totem_module_finalize):
* src/plugins/totem-plugin.c: (totem_get_plugin_paths):
* src/plugins/totem-plugins-engine.c:
(totem_plugins_engine_load):
* src/plugins/tracker/totem-tracker-widget.c: (populate_result):
* src/totem-fullscreen.c: (totem_fullscreen_move_popups),
(totem_fullscreen_new), (totem_fullscreen_set_video_widget),
(totem_fullscreen_set_parent_window), (totem_fullscreen_init),
(totem_fullscreen_dispose), (totem_fullscreen_finalize),
(totem_fullscreen_class_init):
* src/totem-fullscreen.h:
* src/totem-menu.c: (add_device_to_menu),
(show_controls_action_callback):
* src/totem-open-location.c: (totem_open_location_class_init),
(totem_open_location_init), (totem_open_location_dispose),
(totem_open_location_new):
* src/totem-time-label.c: (totem_time_label_init),
(totem_time_label_new), (totem_time_label_class_init),
(totem_time_label_set_time):
* src/totem-time-label.h:
* src/totem-uri.c: (totem_setup_file_filters),
(totem_destroy_file_filters):
* src/totem-video-list.c: (totem_video_list_new),
(totem_video_list_class_init), (totem_video_list_init),
(totem_video_list_dispose): Clean up a couple of memory leaks,
clean up disposal/finalization on a few classes, and fix some
style issues. Also, fix user plugins being disabled when enabled
in GConf. (Closes: #513757)
Modified:
trunk/ChangeLog
trunk/src/plugins/properties/totem-movie-properties.c
trunk/src/plugins/skipto/totem-skipto.c
trunk/src/plugins/totem-module.c
trunk/src/plugins/totem-plugin.c
trunk/src/plugins/totem-plugins-engine.c
trunk/src/plugins/tracker/totem-tracker-widget.c
trunk/src/totem-fullscreen.c
trunk/src/totem-fullscreen.h
trunk/src/totem-menu.c
trunk/src/totem-open-location.c
trunk/src/totem-time-label.c
trunk/src/totem-time-label.h
trunk/src/totem-uri.c
trunk/src/totem-video-list.c
Modified: trunk/src/plugins/properties/totem-movie-properties.c
==============================================================================
--- trunk/src/plugins/properties/totem-movie-properties.c (original)
+++ trunk/src/plugins/properties/totem-movie-properties.c Tue Feb 5 07:06:53 2008
@@ -62,7 +62,6 @@
GType totem_movie_properties_plugin_get_type (void) G_GNUC_CONST;
static void totem_movie_properties_plugin_init (TotemMoviePropertiesPlugin *plugin);
-static void totem_movie_properties_plugin_finalize (GObject *object);
static gboolean impl_activate (TotemPlugin *plugin, TotemObject *totem, GError **error);
static void impl_deactivate (TotemPlugin *plugin, TotemObject *totem);
@@ -71,11 +70,8 @@
static void
totem_movie_properties_plugin_class_init (TotemMoviePropertiesPluginClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
TotemPluginClass *plugin_class = TOTEM_PLUGIN_CLASS (klass);
- object_class->finalize = totem_movie_properties_plugin_finalize;
-
plugin_class->activate = impl_activate;
plugin_class->deactivate = impl_deactivate;
}
@@ -86,12 +82,6 @@
}
static void
-totem_movie_properties_plugin_finalize (GObject *object)
-{
- G_OBJECT_CLASS (totem_movie_properties_plugin_parent_class)->finalize (object);
-}
-
-static void
stream_length_notify_cb (TotemObject *totem,
GParamSpec *arg1,
TotemMoviePropertiesPlugin *plugin)
Modified: trunk/src/plugins/skipto/totem-skipto.c
==============================================================================
--- trunk/src/plugins/skipto/totem-skipto.c (original)
+++ trunk/src/plugins/skipto/totem-skipto.c Tue Feb 5 07:06:53 2008
@@ -43,10 +43,9 @@
#include "video-utils.h"
#include "bacon-video-widget.h"
-static GObjectClass *parent_class = NULL;
static void totem_skipto_class_init (TotemSkiptoClass *class);
static void totem_skipto_init (TotemSkipto *ggo);
-static void totem_skipto_finalize (GObject *object);
+static void totem_skipto_dispose (GObject *object);
/* Callback functions for GtkBuilder */
void spin_button_activate_cb (GtkEntry *entry, TotemSkipto *skipto);
@@ -61,16 +60,16 @@
};
TOTEM_PLUGIN_DEFINE_TYPE (TotemSkipto, totem_skipto, GTK_TYPE_DIALOG)
+#define TOTEM_SKIPTO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TOTEM_TYPE_SKIPTO, TotemSkiptoPrivate))
static void
totem_skipto_class_init (TotemSkiptoClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (TotemSkiptoPrivate));
- object_class->finalize = totem_skipto_finalize;
+ object_class->dispose = totem_skipto_dispose;
}
static void
@@ -92,11 +91,16 @@
}
static void
-totem_skipto_finalize (GObject *object)
+totem_skipto_dispose (GObject *object)
{
- g_return_if_fail (object != NULL);
+ TotemSkiptoPrivate *priv = TOTEM_SKIPTO_GET_PRIVATE (object);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ if (priv->xml != NULL) {
+ g_object_unref (priv->xml);
+ priv->xml = NULL;
+ }
+
+ G_OBJECT_CLASS (totem_skipto_parent_class)->dispose (object);
}
void
Modified: trunk/src/plugins/totem-module.c
==============================================================================
--- trunk/src/plugins/totem-module.c (original)
+++ trunk/src/plugins/totem-module.c Tue Feb 5 07:06:53 2008
@@ -137,6 +137,7 @@
TotemModule *module = TOTEM_MODULE (object);
g_free (module->path);
+ g_free (module->name);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
Modified: trunk/src/plugins/totem-plugin.c
==============================================================================
--- trunk/src/plugins/totem-plugin.c (original)
+++ trunk/src/plugins/totem-plugin.c Tue Feb 5 07:06:53 2008
@@ -214,7 +214,7 @@
paths = NULL;
client = gconf_client_get_default ();
- if (gconf_client_get_bool (client, GCONF_PREFIX"/disable_user_plugins", NULL) != FALSE) {
+ if (gconf_client_get_bool (client, GCONF_PREFIX"/disable_user_plugins", NULL) == FALSE) {
path = g_build_filename (totem_dot_dir (), "plugins", NULL);
paths = g_list_prepend (paths, path);
}
Modified: trunk/src/plugins/totem-plugins-engine.c
==============================================================================
--- trunk/src/plugins/totem-plugins-engine.c (original)
+++ trunk/src/plugins/totem-plugins-engine.c Tue Feb 5 07:06:53 2008
@@ -162,6 +162,7 @@
#ifndef ENABLE_PYTHON
g_debug ("Cannot load Python extension '%s', Totem was not "
"compiled with Python support", file);
+ g_free (str);
goto error;
#endif
} else {
Modified: trunk/src/plugins/tracker/totem-tracker-widget.c
==============================================================================
--- trunk/src/plugins/tracker/totem-tracker-widget.c (original)
+++ trunk/src/plugins/tracker/totem-tracker-widget.c Tue Feb 5 07:06:53 2008
@@ -162,6 +162,8 @@
g_free (thumbnail_path);
g_free (file_uri);
+ if (thumbnail != NULL)
+ g_object_unref (thumbnail);
} else {
/* Display an error */
char *message = g_strdup_printf (_("Could not get metadata for file %s."), result);
Modified: trunk/src/totem-fullscreen.c
==============================================================================
--- trunk/src/totem-fullscreen.c (original)
+++ trunk/src/totem-fullscreen.c Tue Feb 5 07:06:53 2008
@@ -39,12 +39,11 @@
#define FULLSCREEN_POPUP_TIMEOUT 5
-static GObjectClass *parent_class = NULL;
-
-static void totem_fullscreen_class_init (TotemFullscreenClass *class);
-static void totem_fullscreen_init (TotemFullscreen *parser);
-static void totem_fullscreen_finalize (GObject *object);
-static gboolean totem_fullscreen_popup_hide (TotemFullscreen *fs);
+static void totem_fullscreen_class_init (TotemFullscreenClass *class);
+static void totem_fullscreen_init (TotemFullscreen *parser);
+static void totem_fullscreen_dispose (GObject *object);
+static void totem_fullscreen_finalize (GObject *object);
+static gboolean totem_fullscreen_popup_hide (TotemFullscreen *fs);
/* Callback functions for GtkBuilder */
gboolean totem_fullscreen_vol_slider_pressed_cb (GtkWidget *widget, GdkEventButton *event, TotemFullscreen *fs);
@@ -52,7 +51,7 @@
gboolean totem_fullscreen_seek_slider_pressed_cb (GtkWidget *widget, GdkEventButton *event, TotemFullscreen *fs);
gboolean totem_fullscreen_seek_slider_released_cb (GtkWidget *widget, GdkEventButton *event, TotemFullscreen *fs);
-struct TotemFullscreenPrivate {
+struct _TotemFullscreenPrivate {
BaconVideoWidget *bvw;
GtkWidget *parent_window;
@@ -70,7 +69,9 @@
GtkBuilder *xml;
};
-G_DEFINE_TYPE(TotemFullscreen, totem_fullscreen, G_TYPE_OBJECT)
+#define TOTEM_FULLSCREEN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TOTEM_TYPE_FULLSCREEN, TotemFullscreenPrivate))
+
+G_DEFINE_TYPE (TotemFullscreen, totem_fullscreen, G_TYPE_OBJECT)
gboolean
totem_fullscreen_is_fullscreen (TotemFullscreen *fs)
@@ -90,10 +91,12 @@
GdkRectangle fullscreen_rect;
TotemFullscreenPrivate *priv = fs->priv;
+ g_return_if_fail (priv->parent_window != NULL);
+
/* Obtain the screen rectangle */
- screen = gtk_window_get_screen (GTK_WINDOW (fs->priv->parent_window));
+ screen = gtk_window_get_screen (GTK_WINDOW (priv->parent_window));
gdk_screen_get_monitor_geometry (screen,
- gdk_screen_get_monitor_at_window (screen, fs->priv->parent_window->window),
+ gdk_screen_get_monitor_at_window (screen, priv->parent_window->window),
&fullscreen_rect);
/* Get the popup window sizes */
@@ -336,46 +339,30 @@
TotemFullscreen *
totem_fullscreen_new (GtkWindow *toplevel_window)
{
- TotemFullscreenPrivate * priv;
-
TotemFullscreen *fs = TOTEM_FULLSCREEN (g_object_new
(TOTEM_TYPE_FULLSCREEN, NULL));
+ if (fs->priv->xml == NULL) {
+ g_object_unref (fs);
+ return NULL;
+ }
- priv = fs->priv;
- priv->seek_lock = FALSE;
- priv->xml = totem_interface_load ("fullscreen.ui", TRUE, NULL, fs);
+ totem_fullscreen_set_parent_window (fs, toplevel_window);
- priv->exit_popup = GTK_WIDGET (gtk_builder_get_object (priv->xml,
- "totem_exit_fullscreen_window"));
- priv->control_popup = GTK_WIDGET (gtk_builder_get_object (priv->xml,
- "totem_controls_window"));
- fs->time_label = GTK_WIDGET (gtk_builder_get_object (priv->xml,
+ fs->time_label = GTK_WIDGET (gtk_builder_get_object (fs->priv->xml,
"tcw_time_display_label"));
fs->buttons_box = GTK_WIDGET (gtk_builder_get_object (fs->priv->xml,
"tcw_buttons_hbox"));
- fs->exit_button = GTK_WIDGET (gtk_builder_get_object (priv->xml,
+ fs->exit_button = GTK_WIDGET (gtk_builder_get_object (fs->priv->xml,
"tefw_fs_exit_button"));
- fs->priv->parent_window = GTK_WIDGET (toplevel_window);
-
- /* Screen size and Theme changes */
- g_signal_connect (fs->priv->parent_window, "realize",
- G_CALLBACK (totem_fullscreen_window_realize_cb), fs);
- g_signal_connect (fs->priv->parent_window, "unrealize",
- G_CALLBACK (totem_fullscreen_window_unrealize_cb), fs);
- g_signal_connect (G_OBJECT (fs->priv->parent_window), "notify::is-active",
- G_CALLBACK (totem_fullscreen_parent_window_notify), fs);
-
/* Volume */
- fs->volume = GTK_WIDGET (gtk_builder_get_object (priv->xml, "tcw_volume_button"));
+ fs->volume = GTK_WIDGET (gtk_builder_get_object (fs->priv->xml, "tcw_volume_button"));
/* Seek */
- fs->seek = GTK_WIDGET (gtk_builder_get_object (priv->xml, "tcw_seek_hscale"));
+ fs->seek = GTK_WIDGET (gtk_builder_get_object (fs->priv->xml, "tcw_seek_hscale"));
/* Motion notify */
- gtk_widget_add_events (priv->exit_popup, GDK_POINTER_MOTION_MASK);
- gtk_widget_add_events (priv->control_popup, GDK_POINTER_MOTION_MASK);
gtk_widget_add_events (fs->seek, GDK_POINTER_MOTION_MASK);
gtk_widget_add_events (fs->exit_button, GDK_POINTER_MOTION_MASK);
@@ -388,6 +375,7 @@
{
g_return_if_fail (TOTEM_IS_FULLSCREEN (fs));
g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
+ g_return_if_fail (fs->priv->bvw == NULL);
fs->priv->bvw = bvw;
@@ -397,10 +385,58 @@
}
}
+void
+totem_fullscreen_set_parent_window (TotemFullscreen *fs, GtkWindow *parent_window)
+{
+ g_return_if_fail (TOTEM_IS_FULLSCREEN (fs));
+ g_return_if_fail (GTK_IS_WINDOW (parent_window));
+ g_return_if_fail (fs->priv->parent_window == NULL);
+
+ fs->priv->parent_window = GTK_WIDGET (parent_window);
+
+ /* Screen size and Theme changes */
+ g_signal_connect (fs->priv->parent_window, "realize",
+ G_CALLBACK (totem_fullscreen_window_realize_cb), fs);
+ g_signal_connect (fs->priv->parent_window, "unrealize",
+ G_CALLBACK (totem_fullscreen_window_unrealize_cb), fs);
+ g_signal_connect (G_OBJECT (fs->priv->parent_window), "notify::is-active",
+ G_CALLBACK (totem_fullscreen_parent_window_notify), fs);
+}
+
static void
-totem_fullscreen_init (TotemFullscreen *fs)
+totem_fullscreen_init (TotemFullscreen *self)
{
- fs->priv = g_new0 (TotemFullscreenPrivate, 1);
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, TOTEM_TYPE_FULLSCREEN, TotemFullscreenPrivate);
+
+ self->priv->seek_lock = FALSE;
+ self->priv->xml = totem_interface_load ("fullscreen.ui", TRUE, NULL, self);
+
+ if (self->priv->xml == NULL)
+ return;
+
+ self->priv->exit_popup = GTK_WIDGET (gtk_builder_get_object (self->priv->xml,
+ "totem_exit_fullscreen_window"));
+ self->priv->control_popup = GTK_WIDGET (gtk_builder_get_object (self->priv->xml,
+ "totem_controls_window"));
+
+ /* Motion notify */
+ gtk_widget_add_events (self->priv->exit_popup, GDK_POINTER_MOTION_MASK);
+ gtk_widget_add_events (self->priv->control_popup, GDK_POINTER_MOTION_MASK);
+}
+
+static void
+totem_fullscreen_dispose (GObject *object)
+{
+ TotemFullscreenPrivate *priv = TOTEM_FULLSCREEN_GET_PRIVATE (object);
+
+ if (priv->xml != NULL) {
+ g_object_unref (priv->xml);
+ priv->xml = NULL;
+ gtk_widget_destroy (priv->exit_popup);
+ gtk_widget_destroy (priv->control_popup);
+ }
+
+ G_OBJECT_CLASS (totem_fullscreen_parent_class)->dispose (object);
}
static void
@@ -415,9 +451,7 @@
fs->priv->motion_handler_id = 0;
}
- g_free (fs->priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ G_OBJECT_CLASS (totem_fullscreen_parent_class)->finalize (object);
}
static void
@@ -425,8 +459,9 @@
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (TotemFullscreenPrivate));
+ object_class->dispose = totem_fullscreen_dispose;
object_class->finalize = totem_fullscreen_finalize;
}
Modified: trunk/src/totem-fullscreen.h
==============================================================================
--- trunk/src/totem-fullscreen.h (original)
+++ trunk/src/totem-fullscreen.h Tue Feb 5 07:06:53 2008
@@ -43,7 +43,7 @@
typedef struct TotemFullscreen TotemFullscreen;
typedef struct TotemFullscreenClass TotemFullscreenClass;
-typedef struct TotemFullscreenPrivate TotemFullscreenPrivate;
+typedef struct _TotemFullscreenPrivate TotemFullscreenPrivate;
struct TotemFullscreen {
GObject parent;
@@ -70,6 +70,8 @@
TotemFullscreen * totem_fullscreen_new (GtkWindow *toplevel_window);
void totem_fullscreen_set_video_widget (TotemFullscreen *fs,
BaconVideoWidget *bvw);
+void totem_fullscreen_set_parent_window (TotemFullscreen *fs,
+ GtkWindow *parent_window);
gboolean totem_fullscreen_motion_notify (GtkWidget *widget,
GdkEventMotion *event,
TotemFullscreen *fs);
Modified: trunk/src/totem-menu.c
==============================================================================
--- trunk/src/totem-menu.c (original)
+++ trunk/src/totem-menu.c Tue Feb 5 07:06:53 2008
@@ -823,8 +823,10 @@
g_free (label);
g_free (icon_name);
- if (disabled != FALSE)
+ if (disabled != FALSE) {
+ g_free (device_path);
return;
+ }
g_object_set_data_full (G_OBJECT (action),
"device_path", device_path,
@@ -1239,8 +1241,6 @@
show = gtk_toggle_action_get_active (action);
- g_message ("show_controls_action_callback %d", show);
-
/* Let's update our controls visibility */
if (show)
totem->controls_visibility = TOTEM_CONTROLS_VISIBLE;
Modified: trunk/src/totem-open-location.c
==============================================================================
--- trunk/src/totem-open-location.c (original)
+++ trunk/src/totem-open-location.c Tue Feb 5 07:06:53 2008
@@ -40,10 +40,9 @@
#include "totem-open-location.h"
#include "totem-interface.h"
-static GObjectClass *parent_class = NULL;
static void totem_open_location_class_init (TotemOpenLocationClass *class);
static void totem_open_location_init (TotemOpenLocation *open_location);
-static void totem_open_location_finalize (GObject *object);
+static void totem_open_location_dispose (GObject *object);
struct TotemOpenLocationPrivate
{
@@ -51,6 +50,8 @@
GtkEntry *uri_entry;
};
+#define TOTEM_OPEN_LOCATION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TOTEM_TYPE_OPEN_LOCATION, TotemOpenLocationPrivate))
+
G_DEFINE_TYPE (TotemOpenLocation, totem_open_location, GTK_TYPE_DIALOG)
static void
@@ -58,24 +59,30 @@
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (TotemOpenLocationPrivate));
-
- object_class->finalize = totem_open_location_finalize;
+ object_class->dispose = totem_open_location_dispose;
}
static void
-totem_open_location_init (TotemOpenLocation *open_location)
+totem_open_location_init (TotemOpenLocation *self)
{
- open_location->priv = G_TYPE_INSTANCE_GET_PRIVATE (open_location, TOTEM_TYPE_OPEN_LOCATION, TotemOpenLocationPrivate);
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, TOTEM_TYPE_OPEN_LOCATION, TotemOpenLocationPrivate);
+
+ self->priv->xml = totem_interface_load ("uri.ui", FALSE, NULL, self);
+ self->priv->uri_entry = GTK_ENTRY (gtk_builder_get_object (self->priv->xml, "uri"));
}
static void
-totem_open_location_finalize (GObject *object)
+totem_open_location_dispose (GObject *object)
{
- g_return_if_fail (object != NULL);
+ TotemOpenLocationPrivate *priv = TOTEM_OPEN_LOCATION_GET_PRIVATE (object);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ if (priv->xml != NULL) {
+ g_object_unref (priv->xml);
+ priv->xml = NULL;
+ }
+
+ G_OBJECT_CLASS (totem_open_location_parent_class)->dispose (object);
}
static gboolean
@@ -158,14 +165,10 @@
open_location = TOTEM_OPEN_LOCATION (g_object_new (TOTEM_TYPE_OPEN_LOCATION, NULL));
- open_location->priv->xml = totem_interface_load ("uri.ui", FALSE, totem_get_main_window (totem),
- open_location);
- if (open_location->priv->xml == NULL)
- {
- totem_open_location_finalize (G_OBJECT (open_location));
+ if (open_location->priv->xml == NULL) {
+ g_object_unref (open_location);
return NULL;
}
- open_location->priv->uri_entry = GTK_ENTRY (gtk_builder_get_object (open_location->priv->xml, "uri"));
gtk_window_set_title (GTK_WINDOW (open_location), _("Open Location..."));
gtk_dialog_set_has_separator (GTK_DIALOG (open_location), FALSE);
Modified: trunk/src/totem-time-label.c
==============================================================================
--- trunk/src/totem-time-label.c (original)
+++ trunk/src/totem-time-label.c Tue Feb 5 07:06:53 2008
@@ -8,26 +8,25 @@
static void totem_time_label_class_init (TotemTimeLabelClass *class);
static void totem_time_label_init (TotemTimeLabel *label);
-struct TotemTimeLabelPrivate {
+struct _TotemTimeLabelPrivate {
gint64 time;
gint64 length;
gboolean seeking;
};
-static GObjectClass *parent_class = NULL;
-
G_DEFINE_TYPE (TotemTimeLabel, totem_time_label, GTK_TYPE_LABEL)
+#define TOTEM_TIME_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TOTEM_TYPE_TIME_LABEL, TotemTimeLabelPrivate))
static void
totem_time_label_init (TotemTimeLabel *label)
{
char *time;
+ label->priv = G_TYPE_INSTANCE_GET_PRIVATE (label, TOTEM_TYPE_TIME_LABEL, TotemTimeLabelPrivate);
time = totem_time_to_string (0);
gtk_label_set_text (GTK_LABEL (label), time);
g_free (time);
- label->priv = g_new0 (TotemTimeLabelPrivate, 1);
label->priv->time = 0;
label->priv->length = -1;
label->priv->seeking = FALSE;
@@ -36,21 +35,13 @@
GtkWidget*
totem_time_label_new (void)
{
- TotemTimeLabel *label;
-
- label = g_object_new (TOTEM_TYPE_TIME_LABEL, NULL);
-
- return GTK_WIDGET (label);
+ return GTK_WIDGET (g_object_new (TOTEM_TYPE_TIME_LABEL, NULL));
}
static void
totem_time_label_class_init (TotemTimeLabelClass *klass)
{
- GtkWidgetClass *widget_class;
-
- parent_class = g_type_class_peek_parent (klass);
-
- widget_class = GTK_WIDGET_CLASS (klass);
+ g_type_class_add_private (klass, sizeof (TotemTimeLabelPrivate));
}
void
@@ -58,18 +49,19 @@
{
char *label_str;
+ g_return_if_fail (TOTEM_IS_TIME_LABEL (label));
+
if (time / 1000 == label->priv->time / 1000
&& length / 1000 == label->priv->length / 1000)
return;
- if (length <= 0)
- {
+ if (length <= 0) {
label_str = totem_time_to_string (time);
} else {
char *time_str, *length_str;
time_str = totem_time_to_string (time);
- length_str = totem_time_to_string (length);
+ length_str = totem_time_to_string (length);
if (label->priv->seeking == FALSE)
/* Elapsed / Total Length */
label_str = g_strdup_printf (_("%s / %s"), time_str, length_str);
@@ -90,7 +82,7 @@
void
totem_time_label_set_seeking (TotemTimeLabel *label, gboolean seeking)
{
- g_return_if_fail (TOTEM_IS_TIME_LABEL (label));
-
- label->priv->seeking = seeking;
+ g_return_if_fail (TOTEM_IS_TIME_LABEL (label));
+
+ label->priv->seeking = seeking;
}
Modified: trunk/src/totem-time-label.h
==============================================================================
--- trunk/src/totem-time-label.h (original)
+++ trunk/src/totem-time-label.h Tue Feb 5 07:06:53 2008
@@ -12,7 +12,7 @@
typedef struct TotemTimeLabel TotemTimeLabel;
typedef struct TotemTimeLabelClass TotemTimeLabelClass;
-typedef struct TotemTimeLabelPrivate TotemTimeLabelPrivate;
+typedef struct _TotemTimeLabelPrivate TotemTimeLabelPrivate;
struct TotemTimeLabel {
GtkLabel parent;
Modified: trunk/src/totem-uri.c
==============================================================================
--- trunk/src/totem-uri.c (original)
+++ trunk/src/totem-uri.c Tue Feb 5 07:06:53 2008
@@ -404,7 +404,7 @@
filter_all = gtk_file_filter_new ();
gtk_file_filter_set_name (filter_all, _("All files"));
gtk_file_filter_add_pattern (filter_all, "*");
- g_object_ref (filter_all);
+ g_object_ref_sink (filter_all);
filter_supported = gtk_file_filter_new ();
gtk_file_filter_set_name (filter_supported, _("Supported files"));
@@ -415,7 +415,7 @@
/* Add the special Disc-as-files formats */
gtk_file_filter_add_mime_type (filter_supported, "application/x-cd-image");
gtk_file_filter_add_mime_type (filter_supported, "application/x-cue");
- g_object_ref (filter_supported);
+ g_object_ref_sink (filter_supported);
/* Audio files */
filter_audio = gtk_file_filter_new ();
@@ -423,7 +423,7 @@
for (i = 0; i < G_N_ELEMENTS (audio_mime_types); i++) {
gtk_file_filter_add_mime_type (filter_audio, audio_mime_types[i]);
}
- g_object_ref (filter_audio);
+ g_object_ref_sink (filter_audio);
/* Video files */
filter_video = gtk_file_filter_new ();
@@ -433,7 +433,7 @@
}
gtk_file_filter_add_mime_type (filter_video, "application/x-cd-image");
gtk_file_filter_add_mime_type (filter_video, "application/x-cue");
- g_object_ref (filter_video);
+ g_object_ref_sink (filter_video);
/* Subtitles files */
filter_subs = gtk_file_filter_new ();
@@ -444,8 +444,7 @@
gtk_file_filter_add_mime_type (filter_subs, "text/x-microdvd"); /* *.sub */
gtk_file_filter_add_mime_type (filter_subs, "text/x-mpsub"); /* *.sub */
gtk_file_filter_add_mime_type (filter_subs, "text/x-ssa"); /* *.ssa, *.ass */
- g_object_ref (filter_subs);
-
+ g_object_ref_sink (filter_subs);
}
void
@@ -454,18 +453,10 @@
if (filter_all != NULL) {
g_object_unref (filter_all);
filter_all = NULL;
- }
- if (filter_supported != NULL) {
g_object_unref (filter_supported);
- filter_supported = NULL;
- }
- if (filter_audio != NULL) {
g_object_unref (filter_audio);
- filter_audio = NULL;
- }
- if (filter_video != NULL) {
g_object_unref (filter_video);
- filter_video = NULL;
+ g_object_unref (filter_subs);
}
}
Modified: trunk/src/totem-video-list.c
==============================================================================
--- trunk/src/totem-video-list.c (original)
+++ trunk/src/totem-video-list.c Tue Feb 5 07:06:53 2008
@@ -39,7 +39,6 @@
#include "totem-interface.h"
struct _TotemVideoListPrivate {
- gboolean dispose_has_run;
gint tooltip_column;
gint mrl_column;
Totem *totem;
@@ -87,7 +86,7 @@
video_list = TOTEM_VIDEO_LIST (g_object_new (TOTEM_TYPE_VIDEO_LIST, NULL));
if (video_list->priv->xml == NULL || video_list->priv->ui_manager == NULL) {
- totem_video_list_dispose (G_OBJECT (video_list));
+ g_object_unref (video_list);
return NULL;
}
@@ -103,6 +102,7 @@
object_class->set_property = totem_video_list_set_property;
object_class->get_property = totem_video_list_get_property;
+ object_class->dispose = totem_video_list_dispose;
g_object_class_install_property (object_class, PROP_TOOLTIP_COLUMN,
g_param_spec_int ("tooltip-column", NULL, NULL,
@@ -131,7 +131,6 @@
GtkTreeSelection *selection;
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, TOTEM_TYPE_VIDEO_LIST, TotemVideoListPrivate);
- self->priv->dispose_has_run = FALSE;
self->priv->totem = NULL;
self->priv->tooltip_column = -1;
self->priv->mrl_column = -1;
@@ -164,15 +163,14 @@
{
TotemVideoListPrivate *priv = TOTEM_VIDEO_LIST_GET_PRIVATE (object);
- /* Make sure we only run once */
- if (priv->dispose_has_run)
- return;
- priv->dispose_has_run = TRUE;
-
- g_object_unref (priv->totem);
- g_object_unref (priv->xml);
- g_object_unref (G_OBJECT (priv->ui_manager));
- g_object_unref (G_OBJECT (priv->action_group));
+ if (priv->totem != NULL) {
+ g_object_unref (priv->totem);
+ priv->totem = NULL;
+ g_object_unref (priv->xml);
+ /* priv->xml automatically unrefs and destroys its widgets,
+ * since we haven't reffed them ourselves, and neither has
+ * gtk_builder_get_object. */
+ }
G_OBJECT_CLASS (totem_video_list_parent_class)->dispose (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]