empathy r1971 - in trunk: libempathy libempathy-gtk src tests



Author: xclaesse
Date: Fri Dec 12 15:49:38 2008
New Revision: 1971
URL: http://svn.gnome.org/viewvc/empathy?rev=1971&view=rev

Log:
gtk_init and g_thread_init shouldn't be called by libraries. Let applications do it.

Modified:
   trunk/libempathy-gtk/empathy-ui-utils.c
   trunk/libempathy-gtk/empathy-ui-utils.h
   trunk/libempathy/empathy-utils.c
   trunk/src/empathy-logs.c
   trunk/src/empathy.c
   trunk/tests/contact-manager.c

Modified: trunk/libempathy-gtk/empathy-ui-utils.c
==============================================================================
--- trunk/libempathy-gtk/empathy-ui-utils.c	(original)
+++ trunk/libempathy-gtk/empathy-ui-utils.c	Fri Dec 12 15:49:38 2008
@@ -49,52 +49,19 @@
 #include <libempathy/empathy-utils.h>
 #include <libempathy/empathy-dispatcher.h>
 
-static gboolean
-init (gboolean abort_if_fail,
-      int *argc,
-      char ***argv,
-      char *parameter_string,
-      GOptionEntry *entries,
-      char *translation_domain,
-      GError **error)
+void
+empathy_gtk_init (void)
 {
 	static gboolean initialized = FALSE;
-	gboolean ret = TRUE;
 
 	if (initialized)
-		return TRUE;
+		return;
 
 	empathy_init ();
-	if (abort_if_fail) {
-		gtk_init (argc, argv);
-	} else {
-		ret = gtk_init_with_args (argc, argv, parameter_string, entries,
-					  translation_domain, error);
-	}
 	gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
 					   PKGDATADIR G_DIR_SEPARATOR_S "icons");
 
 	initialized = TRUE;
-
-	return ret;
-}
-
-void
-empathy_gtk_init (int *argc, char ***argv)
-{
-	init (FALSE, argc, argv, NULL, NULL, NULL, NULL);
-}
-
-gboolean
-empathy_gtk_init_with_args (int *argc,
-			    char ***argv,
-			    char *parameter_string,
-			    GOptionEntry *entries,
-			    char *translation_domain,
-			    GError **error)
-{
-	return init (TRUE, argc, argv, parameter_string, entries,
-		     translation_domain, error);
 }
 
 struct SizeData {

Modified: trunk/libempathy-gtk/empathy-ui-utils.h
==============================================================================
--- trunk/libempathy-gtk/empathy-ui-utils.h	(original)
+++ trunk/libempathy-gtk/empathy-ui-utils.h	Fri Dec 12 15:49:38 2008
@@ -46,14 +46,7 @@
 
 #define G_STR_EMPTY(x) ((x) == NULL || (x)[0] == '\0')
 
-void            empathy_gtk_init                        (int *argc,
-                                                         char ***argv);
-gboolean        empathy_gtk_init_with_args              (int *argc,
-                                                         char ***argv,
-                                                         char *parameter_string,
-                                                         GOptionEntry *entries,
-                                                         char *translation_domain,
-                                                         GError **error);
+void            empathy_gtk_init                        (void);
 /* Glade */
 void            empathy_glade_get_file_simple           (const gchar      *filename,
 							 const gchar      *root,

Modified: trunk/libempathy/empathy-utils.c
==============================================================================
--- trunk/libempathy/empathy-utils.c	(original)
+++ trunk/libempathy/empathy-utils.c	Fri Dec 12 15:49:38 2008
@@ -51,10 +51,6 @@
 	if (initialized)
 		return;
 
-	/* Setup glib. Threads are required for async GIO. */
-	if (!g_thread_supported ()) {
-		g_thread_init (NULL);
-	}
 	g_type_init ();
 
 	/* Setup gettext */

Modified: trunk/src/empathy-logs.c
==============================================================================
--- trunk/src/empathy-logs.c	(original)
+++ trunk/src/empathy-logs.c	Fri Dec 12 15:49:38 2008
@@ -41,7 +41,9 @@
 {
 	GtkWidget *window;
 
-	empathy_gtk_init (&argc, &argv);
+	g_thread_init (NULL);
+	gtk_init (&argc, &argv);
+	empathy_gtk_init ();
 	g_set_application_name (PACKAGE_NAME);
 	gtk_window_set_default_icon_name ("empathy");
 

Modified: trunk/src/empathy.c
==============================================================================
--- trunk/src/empathy.c	(original)
+++ trunk/src/empathy.c	Fri Dec 12 15:49:38 2008
@@ -401,19 +401,21 @@
 		{ NULL }
 	};
 
-	startup_timestamp = get_startup_timestamp ();
-
-	if (!empathy_gtk_init_with_args (&argc, &argv,
-					 _("- Empathy Instant Messenger"),
-					 options, GETTEXT_PACKAGE, &error)) {
+	/* Init */
+	g_thread_init (NULL);
+	if (!gtk_init_with_args (&argc, &argv,
+				 _("- Empathy Instant Messenger"),
+				 options, GETTEXT_PACKAGE, &error)) {
 		g_warning ("Error in empathy init: %s", error->message);
 		return EXIT_FAILURE;
 	}
+	empathy_gtk_init ();
 	g_set_application_name (PACKAGE_NAME);
 	gtk_window_set_default_icon_name ("empathy");
 	textdomain (GETTEXT_PACKAGE);
 
         /* Setting up the bacon connection */
+	startup_timestamp = get_startup_timestamp ();
 	connection = bacon_message_connection_new ("empathy");
 	if (connection != NULL) {
 		if (!bacon_message_connection_get_is_server (connection)) {

Modified: trunk/tests/contact-manager.c
==============================================================================
--- trunk/tests/contact-manager.c	(original)
+++ trunk/tests/contact-manager.c	Fri Dec 12 15:49:38 2008
@@ -18,7 +18,8 @@
 	GtkWidget *window;
 	GtkCellRenderer *renderer;
 
-	empathy_gtk_init (&argc, &argv);
+	gtk_init (&argc, &argv);
+	empathy_gtk_init ();
 
 	empathy_debug_set_flags (g_getenv ("EMPATHY_DEBUG"));
 	main_loop = g_main_loop_new (NULL, FALSE);



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