goobox r375 - in trunk: . m4 src



Author: paobac
Date: Sun Apr 12 18:10:21 2009
New Revision: 375
URL: http://svn.gnome.org/viewvc/goobox?rev=375&view=rev

Log:
2009-04-12  Paolo Bacchilega  <paobac svn gnome org>

	* src/dlg-cover-chooser.c (search_result_saved_cb): 
	* src/gconf-utils.c (eel_gconf_handle_error): added a format argument.

2009-04-12  Paolo Bacchilega  <paobac svn gnome org>
	
	* src/goo-window.c: 
	* src/goo-volume-tool-button.c: 
	* src/goo-player-info.c: 
	* src/goo-player.c: 
	* src/goo-cdrom.c: 

	Fixed bug #572212 â use type macros to define types
	Patch by Felix Riemann


Modified:
   trunk/ChangeLog
   trunk/m4/   (props changed)
   trunk/src/dlg-cover-chooser.c
   trunk/src/gconf-utils.c
   trunk/src/goo-cdrom.c
   trunk/src/goo-player-info.c
   trunk/src/goo-player.c
   trunk/src/goo-volume-tool-button.c
   trunk/src/goo-window.c

Modified: trunk/src/dlg-cover-chooser.c
==============================================================================
--- trunk/src/dlg-cover-chooser.c	(original)
+++ trunk/src/dlg-cover-chooser.c	Sun Apr 12 18:10:21 2009
@@ -445,6 +445,7 @@
 	if (! success) {
 		_gtk_error_dialog_run (GTK_WINDOW (data->dialog),
 				       _("Could not search for a cover on Internet"),
+				       "%s",
 				       gnome_vfs_result_to_string (data->vfs_result));
 		return;
 	}

Modified: trunk/src/gconf-utils.c
==============================================================================
--- trunk/src/gconf-utils.c	(original)
+++ trunk/src/gconf-utils.c	Sun Apr 12 18:10:21 2009
@@ -106,6 +106,7 @@
 					       "GConf error:\n  %s\n"
 					       "All further errors "
 					       "shown only on terminal",
+					       "%s",
 					       (*error)->message);
 		}
 		g_error_free (*error);

Modified: trunk/src/goo-cdrom.c
==============================================================================
--- trunk/src/goo-cdrom.c	(original)
+++ trunk/src/goo-cdrom.c	Sun Apr 12 18:10:21 2009
@@ -50,40 +50,15 @@
 	PROP_DEFAULT_DEVICE
 };
 
-static GObjectClass *parent_class = NULL;
 static guint goo_cdrom_signals[LAST_SIGNAL] = { 0 };
 
-static void goo_cdrom_class_init  (GooCdromClass *class);
-static void goo_cdrom_init        (GooCdrom *cdrom);
 static void goo_cdrom_finalize    (GObject *object);
 
+#define GOO_CDROM_GET_PRIVATE_DATA(object) \
+	(G_TYPE_INSTANCE_GET_PRIVATE ((object), GOO_TYPE_CDROM, GooCdromPrivateData))
 
-GType
-goo_cdrom_get_type ()
-{
-        static GType type = 0;
-
-        if (! type) {
-                GTypeInfo type_info = {
-			sizeof (GooCdromClass),
-			NULL,
-			NULL,
-			(GClassInitFunc) goo_cdrom_class_init,
-			NULL,
-			NULL,
-			sizeof (GooCdrom),
-			0,
-			(GInstanceInitFunc) goo_cdrom_init
-		};
-
-		type = g_type_register_static (G_TYPE_OBJECT,
-					       "GooCdrom",
-					       &type_info,
-					       0);
-	}
+G_DEFINE_TYPE (GooCdrom, goo_cdrom, G_TYPE_OBJECT)
 
-        return type;
-}
 
 
 static gboolean
@@ -173,8 +148,6 @@
 {
         GObjectClass *gobject_class = G_OBJECT_CLASS (class);
 
-        parent_class = g_type_class_peek_parent (class);
-
 	goo_cdrom_signals[STATE_CHANGED] =
                 g_signal_new ("state_changed",
 			      G_TYPE_FROM_CLASS (class),
@@ -202,6 +175,8 @@
 	class->is_cdrom_device  = base_goo_cdrom_is_cdrom_device;
 
 	class->state_changed = NULL;
+
+	g_type_class_add_private (class, sizeof (GooCdromPrivateData));
 }
 
 
@@ -210,7 +185,7 @@
 {
 	GooCdromPrivateData *priv;
 
-	cdrom->priv = g_new0 (GooCdromPrivateData, 1);
+	cdrom->priv = GOO_CDROM_GET_PRIVATE_DATA (cdrom);
 	priv = cdrom->priv;
 
 	priv->error = NULL;
@@ -237,11 +212,10 @@
 		g_free (priv->device);
 		g_free (priv->default_device);
 
-		g_free (cdrom->priv);
 		cdrom->priv = NULL;
 	}
 
-	G_OBJECT_CLASS (parent_class)->finalize (object);
+	G_OBJECT_CLASS (goo_cdrom_parent_class)->finalize (object);
 }
 
 

Modified: trunk/src/goo-player-info.c
==============================================================================
--- trunk/src/goo-player-info.c	(original)
+++ trunk/src/goo-player-info.c	Sun Apr 12 18:10:21 2009
@@ -77,7 +77,6 @@
         LAST_SIGNAL
 };
 
-static GtkHBoxClass *parent_class = NULL;
 static guint goo_player_info_signals[LAST_SIGNAL] = { 0 };
 
 enum { TARGET_URL };
@@ -86,38 +85,12 @@
 };
 static guint n_targets = sizeof (target_table) / sizeof (target_table[0]);
 
-static void goo_player_info_class_init  (GooPlayerInfoClass *class);
-static void goo_player_info_init        (GooPlayerInfo *player);
 static void goo_player_info_finalize    (GObject *object);
 
+#define GOO_PLAYER_INFO_GET_PRIVATE_DATA(object) \
+	(G_TYPE_INSTANCE_GET_PRIVATE ((object), GOO_TYPE_PLAYER_INFO, GooPlayerInfoPrivateData))
 
-GType
-goo_player_info_get_type ()
-{
-        static GType type = 0;
-
-        if (! type) {
-                GTypeInfo type_info = {
-			sizeof (GooPlayerInfoClass),
-			NULL,
-			NULL,
-			(GClassInitFunc) goo_player_info_class_init,
-			NULL,
-			NULL,
-			sizeof (GooPlayerInfo),
-			0,
-			(GInstanceInitFunc) goo_player_info_init
-		};
-
-		type = g_type_register_static (GTK_TYPE_HBOX,
-					       "GooPlayerInfo",
-					       &type_info,
-					       0);
-	}
-
-        return type;
-}
-
+G_DEFINE_TYPE (GooPlayerInfo, goo_player_info, GTK_TYPE_HBOX)
 
 static void
 goo_player_info_size_request (GtkWidget      *widget,
@@ -125,8 +98,8 @@
 {	
 	GooPlayerInfo *info;
 	
-	if (GTK_WIDGET_CLASS (parent_class)->size_request)
-		(* GTK_WIDGET_CLASS (parent_class)->size_request) (widget, requisition);
+	if (GTK_WIDGET_CLASS (goo_player_info_parent_class)->size_request)
+		(* GTK_WIDGET_CLASS (goo_player_info_parent_class)->size_request) (widget, requisition);
 	
 	info = (GooPlayerInfo *) widget;
 	if (info->priv->interactive)
@@ -142,8 +115,6 @@
         GObjectClass   *gobject_class;
 	GtkWidgetClass *widget_class;
 
-        parent_class = g_type_class_peek_parent (class);
-
 	goo_player_info_signals[COVER_CLICKED] =
                 g_signal_new ("cover_clicked",
 			      G_TYPE_FROM_CLASS (class),
@@ -169,6 +140,8 @@
 
 	widget_class = GTK_WIDGET_CLASS (class);
 	widget_class->size_request = goo_player_info_size_request;
+
+	g_type_class_add_private (class, sizeof (GooPlayerInfoPrivateData));
 }
 
 
@@ -436,7 +409,7 @@
 static void 
 goo_player_info_init (GooPlayerInfo *info)
 {
-	info->priv = g_new0 (GooPlayerInfoPrivateData, 1);
+	info->priv = GOO_PLAYER_INFO_GET_PRIVATE_DATA (info);
 }
 
 
@@ -623,11 +596,10 @@
 			info->priv->update_id = 0;
 		}
 		gtk_object_unref (GTK_OBJECT (info->priv->tips));
-		g_free (info->priv);
 		info->priv = NULL;
 	}
 
-	G_OBJECT_CLASS (parent_class)->finalize (object);
+	G_OBJECT_CLASS (goo_player_info_parent_class)->finalize (object);
 }
 
 

Modified: trunk/src/goo-player.c
==============================================================================
--- trunk/src/goo-player.c	(original)
+++ trunk/src/goo-player.c	Sun Apr 12 18:10:21 2009
@@ -86,40 +86,14 @@
         LAST_SIGNAL
 };
 
-static GObjectClass *parent_class = NULL;
 static guint goo_player_signals[LAST_SIGNAL] = { 0 };
 
-static void goo_player_class_init  (GooPlayerClass *class);
-static void goo_player_init        (GooPlayer *player);
 static void goo_player_finalize    (GObject *object);
 
+#define GOO_PLAYER_GET_PRIVATE_DATA(object) \
+	(G_TYPE_INSTANCE_GET_PRIVATE ((object), GOO_TYPE_PLAYER, GooPlayerPrivateData))
 
-GType
-goo_player_get_type (void)
-{
-        static GType type = 0;
-
-        if (! type) {
-                GTypeInfo type_info = {
-			sizeof (GooPlayerClass),
-			NULL,
-			NULL,
-			(GClassInitFunc) goo_player_class_init,
-			NULL,
-			NULL,
-			sizeof (GooPlayer),
-			0,
-			(GInstanceInitFunc) goo_player_init
-		};
-
-		type = g_type_register_static (G_TYPE_OBJECT,
-					       "GooPlayer",
-					       &type_info,
-					       0);
-	}
-
-        return type;
-}
+G_DEFINE_TYPE (GooPlayer, goo_player, G_TYPE_OBJECT)
 
 
 static void
@@ -343,8 +317,6 @@
 {
 	GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
 
-        parent_class = g_type_class_peek_parent (class);
-
 	goo_player_signals[START] =
                 g_signal_new ("start",
 			      G_TYPE_FROM_CLASS (class),
@@ -393,6 +365,8 @@
 			      G_TYPE_NONE, 0);
 
         gobject_class->finalize = goo_player_finalize;
+
+	g_type_class_add_private (class, sizeof (GooPlayerPrivateData));
 }
 
 
@@ -401,7 +375,7 @@
 {
 	GooPlayerPrivateData *priv;
 
-	player->priv = g_new0 (GooPlayerPrivateData, 1);
+	player->priv = GOO_PLAYER_GET_PRIVATE_DATA (player);
 	priv = player->priv;
 
 	priv->state = GOO_PLAYER_STATE_STOPPED;
@@ -454,11 +428,10 @@
 		g_free (priv->discid);
 		album_info_unref (priv->album);
 
-		g_free (player->priv);
 		player->priv = NULL;
 	}
 
-	G_OBJECT_CLASS (parent_class)->finalize (object);
+	G_OBJECT_CLASS (goo_player_parent_class)->finalize (object);
 }
 
 

Modified: trunk/src/goo-volume-tool-button.c
==============================================================================
--- trunk/src/goo-volume-tool-button.c	(original)
+++ trunk/src/goo-volume-tool-button.c	Sun Apr 12 18:10:21 2009
@@ -86,9 +86,9 @@
         LAST_SIGNAL
 };
 
-static GObjectClass *parent_class = NULL;
 static guint goo_volume_tool_button_signals[LAST_SIGNAL] = { 0 };
 
+G_DEFINE_TYPE (GooVolumeToolButton, goo_volume_tool_button, GTK_TYPE_TOOL_BUTTON)
 
 static gboolean
 goo_volume_tool_button_set_tooltip (GtkToolItem *tool_item,
@@ -197,7 +197,7 @@
 	goo_volume_tool_button_construct_contents (GOO_VOLUME_TOOL_BUTTON (toolitem));
 	
 	/* chain up */
-	GTK_TOOL_ITEM_CLASS (parent_class)->toolbar_reconfigured (toolitem);
+	GTK_TOOL_ITEM_CLASS (goo_volume_tool_button_parent_class)->toolbar_reconfigured (toolitem);
 }
 
 
@@ -219,7 +219,7 @@
 
 	button = GOO_VOLUME_TOOL_BUTTON (object);
 	gtk_object_unref (GTK_OBJECT (button->priv->tips));
-	G_OBJECT_CLASS (parent_class)->finalize (object);
+	G_OBJECT_CLASS (goo_volume_tool_button_parent_class)->finalize (object);
 }
 
 
@@ -231,8 +231,6 @@
 	GtkToolButtonClass *toolbutton_class;
 	GtkWidgetClass     *gtkwidget_class;
 	
-	parent_class = g_type_class_peek_parent (klass);
-  
 	object_class = (GObjectClass *) klass;
 	toolitem_class = (GtkToolItemClass *) klass;
 	toolbutton_class = (GtkToolButtonClass *) klass;
@@ -255,34 +253,6 @@
 	g_type_class_add_private (object_class, sizeof (GooVolumeToolButtonPrivate));
 }
 
-
-GType
-goo_volume_tool_button_get_type (void)
-{
-	static GType type = 0;
-
-	if (type == 0) {
-		static const GTypeInfo info = {
-			sizeof (GooVolumeToolButtonClass),
-			(GBaseInitFunc) 0,
-			(GBaseFinalizeFunc) 0,
-			(GClassInitFunc) goo_volume_tool_button_class_init,
-			(GClassFinalizeFunc) 0,
-			NULL,
-			sizeof (GooVolumeToolButton),
-			0, /* n_preallocs */
-			(GInstanceInitFunc) goo_volume_tool_button_init
-		};
-		
-		type = g_type_register_static (GTK_TYPE_TOOL_BUTTON,
-					       "GooVolumeToolButton",
-					       &info, 0);
-	}
-	
-	return type;
-}
-
-
 static void
 button_state_changed_cb (GtkWidget           *widget,
                          GtkStateType         previous_state,

Modified: trunk/src/goo-window.c
==============================================================================
--- trunk/src/goo-window.c	(original)
+++ trunk/src/goo-window.c	Sun Apr 12 18:10:21 2009
@@ -130,7 +130,6 @@
 static guint goo_window_signals[LAST_SIGNAL] = { 0 };
 
 static int icon_size = 0;
-static GnomeAppClass *parent_class = NULL;
 GList *window_list = NULL;
 
 
@@ -144,6 +143,11 @@
 	NUMBER_OF_COLUMNS
 };
 
+#define GOO_WINDOW_GET_PRIVATE_DATA(object) \
+	(G_TYPE_INSTANCE_GET_PRIVATE ((object), GOO_TYPE_WINDOW, GooWindowPrivateData))
+
+
+G_DEFINE_TYPE (GooWindow, goo_window, GNOME_TYPE_APP)
 
 static void
 set_active (GooWindow  *window,
@@ -578,11 +582,10 @@
 		path_list_free (priv->url_list);
 		priv->url_list = NULL;
 
-		g_free (window->priv);
 		window->priv = NULL;
 	}
 
-	G_OBJECT_CLASS (parent_class)->finalize (object);
+	G_OBJECT_CLASS (goo_window_parent_class)->finalize (object);
 }
 
 
@@ -1033,7 +1036,7 @@
 	preferences_set_sort_method (window->priv->sort_method);
 	preferences_set_sort_type (window->priv->sort_type);
 
-	GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
+	GTK_WIDGET_CLASS (goo_window_parent_class)->unrealize (widget);
 }
 
 
@@ -1057,7 +1060,7 @@
 	gboolean   view_foobar;
 
 	if (! HideShow) 
-		GTK_WIDGET_CLASS (parent_class)->show (widget);
+		GTK_WIDGET_CLASS (goo_window_parent_class)->show (widget);
 	else
 		HideShow = FALSE;
 
@@ -1080,7 +1083,6 @@
 	GObjectClass   *gobject_class;
 	GtkWidgetClass *widget_class;
 
-	parent_class = g_type_class_peek_parent (class);
 	widget_class = (GtkWidgetClass*) class;
 	gobject_class = (GObjectClass*) class;
 
@@ -1097,6 +1099,7 @@
 			      goo_marshal_VOID__VOID,
 			      G_TYPE_NONE, 
 			      0);
+	g_type_class_add_private (class, sizeof (GooWindowPrivateData));
 }
 
 
@@ -2209,7 +2212,7 @@
 static void
 goo_window_init (GooWindow *window)
 {
-	window->priv = g_new0 (GooWindowPrivateData, 1);
+	window->priv = GOO_WINDOW_GET_PRIVATE_DATA (window);
 	window->priv->exiting = FALSE;
 	window->priv->check_id = 0;
 	window->priv->url_list = NULL;
@@ -2650,35 +2653,6 @@
 					   window);
 }
 
-
-GType
-goo_window_get_type ()
-{
-        static GType type = 0;
-
-        if (! type) {
-                GTypeInfo type_info = {
-			sizeof (GooWindowClass),
-			NULL,
-			NULL,
-			(GClassInitFunc) goo_window_class_init,
-			NULL,
-			NULL,
-			sizeof (GooWindow),
-			0,
-			(GInstanceInitFunc) goo_window_init
-		};
-
-		type = g_type_register_static (GNOME_TYPE_APP,
-					       "GooWindow",
-					       &type_info,
-					       0);
-	}
-
-        return type;
-}
-
-
 GtkWindow * 
 goo_window_new (const char *device)
 {



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