diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-12-12 23:49:38 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-12-12 23:49:38 +0800 |
commit | cbedf400e93dd3526607df4aedd3e623a54199d3 (patch) | |
tree | 0532271104d323cb02d8e069db9c612854f4342e | |
parent | f3b9e7312962dae85b0476d7232db8a213bef856 (diff) | |
download | gsoc2013-empathy-cbedf400e93dd3526607df4aedd3e623a54199d3.tar gsoc2013-empathy-cbedf400e93dd3526607df4aedd3e623a54199d3.tar.gz gsoc2013-empathy-cbedf400e93dd3526607df4aedd3e623a54199d3.tar.bz2 gsoc2013-empathy-cbedf400e93dd3526607df4aedd3e623a54199d3.tar.lz gsoc2013-empathy-cbedf400e93dd3526607df4aedd3e623a54199d3.tar.xz gsoc2013-empathy-cbedf400e93dd3526607df4aedd3e623a54199d3.tar.zst gsoc2013-empathy-cbedf400e93dd3526607df4aedd3e623a54199d3.zip |
gtk_init and g_thread_init shouldn't be called by libraries. Let applications do it.
svn path=/trunk/; revision=1971
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.c | 39 | ||||
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.h | 9 | ||||
-rw-r--r-- | libempathy/empathy-utils.c | 4 | ||||
-rw-r--r-- | src/empathy-logs.c | 4 | ||||
-rw-r--r-- | src/empathy.c | 12 | ||||
-rw-r--r-- | tests/contact-manager.c | 3 |
6 files changed, 16 insertions, 55 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 91bbfe58b..b317671d2 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -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 { diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h index 777ce8ee0..1ec4f5da6 100644 --- a/libempathy-gtk/empathy-ui-utils.h +++ b/libempathy-gtk/empathy-ui-utils.h @@ -46,14 +46,7 @@ G_BEGIN_DECLS #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, diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 2e02fc6c4..c025f26da 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -51,10 +51,6 @@ empathy_init (void) if (initialized) return; - /* Setup glib. Threads are required for async GIO. */ - if (!g_thread_supported ()) { - g_thread_init (NULL); - } g_type_init (); /* Setup gettext */ diff --git a/src/empathy-logs.c b/src/empathy-logs.c index f805f9094..502be67d7 100644 --- a/src/empathy-logs.c +++ b/src/empathy-logs.c @@ -41,7 +41,9 @@ main (int argc, char *argv[]) { 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"); diff --git a/src/empathy.c b/src/empathy.c index 1e506ba6e..815b2b487 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -401,19 +401,21 @@ main (int argc, char *argv[]) { 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)) { diff --git a/tests/contact-manager.c b/tests/contact-manager.c index ac3b6bdc8..81c1a9ba4 100644 --- a/tests/contact-manager.c +++ b/tests/contact-manager.c @@ -18,7 +18,8 @@ main (int argc, char **argv) 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); |