From: Sjoerd Simons Date: Tue, 28 Jul 2009 09:20:27 +0000 (+0200) Subject: Merge commit 'upstream/master' into mc5 X-Git-Url: https://git.0d.be/?p=empathy.git;a=commitdiff_plain;h=1d153c1cf91edce537bc64efb01b5a496b35518e Merge commit 'upstream/master' into mc5 Conflicts: libempathy-gtk/empathy-account-widget.c src/empathy.c --- 1d153c1cf91edce537bc64efb01b5a496b35518e diff --cc libempathy-gtk/empathy-account-widget-irc.c index 4bca9107,c0699b23..c04f3463 --- a/libempathy-gtk/empathy-account-widget-irc.c +++ b/libempathy-gtk/empathy-account-widget-irc.c @@@ -429,9 -430,9 +429,9 @@@ empathy_account_widget_irc_new (Empathy gchar *filename; settings = g_slice_new0 (EmpathyAccountWidgetIrc); - settings->account = g_object_ref (account); + settings->settings = g_object_ref (account_settings); - dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL); + dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL); g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR); user_file_with_path = g_build_filename (dir, IRC_NETWORKS_FILENAME, NULL); g_free (dir); diff --cc libempathy/empathy-log-store-empathy.c index d0487e76,b814defe..4bb17e42 --- a/libempathy/empathy-log-store-empathy.c +++ b/libempathy/empathy-log-store-empathy.c @@@ -27,10 -27,15 +27,17 @@@ #include #include #include + + /* FIXME: g_mapped_file_free has been deprecated in GLib 2.22, but the + * replacement symbol, g_mapped_file_unref is not available in older Glib + * and we're not ready to bump our version requirement just for this. When + * we're ready to bump our version requirement, just revert this patch. */ + #undef G_DISABLE_DEPRECATED #include + #define G_DISABLE_DEPRECATED +#include + #include "empathy-log-store.h" #include "empathy-log-store-empathy.h" #include "empathy-log-manager.h" diff --cc src/empathy.c index 3d8fe6e1,0754eb7a..4e824bcb --- a/src/empathy.c +++ b/src/empathy.c @@@ -308,40 -321,67 +308,101 @@@ create_salut_account_if_needed (Empathy g_object_unref (book); } +static void +connection_managers_ready_cb (EmpathyConnectionManagers *managers, + GParamSpec *spec, gpointer user_data) +{ + if (empathy_connection_managers_is_ready (managers)) + { + create_salut_account_if_needed (managers); + g_object_unref (managers); + managers = NULL; + } +} + +static void +create_salut_account (void) +{ + EmpathyConnectionManagers *managers; + + if (!should_create_salut_account ()) + return; + + managers = empathy_connection_managers_dup_singleton (); + + if (empathy_connection_managers_is_ready (managers)) + { + create_salut_account_if_needed (managers); + g_object_unref (managers); + } + else + { + g_signal_connect (managers, "notify::ready", + G_CALLBACK (connection_managers_ready_cb), NULL); + } +} + + static void + migrate_config_to_xdg_dir (void) + { + gchar *xdg_dir, *old_dir, *xdg_filename, *old_filename; + int i; + GFile *xdg_file, *old_file; + static const gchar* filenames[] = { + "geometry.ini", + "irc-networks.xml", + "chatrooms.xml", + "contact-groups.xml", + "status-presets.xml", + "accels.txt", + NULL + }; + + xdg_dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL); + if (g_file_test (xdg_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) { + /* xdg config dir already exists */ + g_free (xdg_dir); + return; + } + + old_dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL); + if (!g_file_test (old_dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) { + /* old config dir didn't exist */ + g_free (xdg_dir); + g_free (old_dir); + return; + } + + if (g_mkdir_with_parents (xdg_dir, (S_IRUSR | S_IWUSR | S_IXUSR)) == -1) { + DEBUG ("Failed to create configuration directory; aborting migration"); + g_free (xdg_dir); + g_free (old_dir); + return; + } + + for (i = 0; filenames[i]; i++) { + old_filename = g_build_filename (old_dir, filenames[i], NULL); + if (!g_file_test (old_filename, G_FILE_TEST_EXISTS)) { + g_free (old_filename); + continue; + } + xdg_filename = g_build_filename (xdg_dir, filenames[i], NULL); + old_file = g_file_new_for_path (old_filename); + xdg_file = g_file_new_for_path (xdg_filename); + if (!g_file_move (old_file, xdg_file, G_FILE_COPY_NONE, + NULL, NULL, NULL, NULL)) { + DEBUG ("Failed to migrate %s", filenames[i]); + } + g_free (old_filename); + g_free (xdg_filename); + g_object_unref (old_file); + g_object_unref (xdg_file); + } + + g_free (xdg_dir); + g_free (old_dir); + } + /* The code that handles single-instance and startup notification is * copied from gedit. * @@@ -662,14 -695,13 +723,16 @@@ main (int argc, char *argv[] if (autoconnect && ! no_connect && tp_connection_presence_type_cmp_availability (empathy_idle_get_state (idle), TP_CONNECTION_PRESENCE_TYPE_OFFLINE) <= 0) { - empathy_idle_set_state (idle, MC_PRESENCE_AVAILABLE); + empathy_idle_set_state (idle, TP_CONNECTION_PRESENCE_TYPE_AVAILABLE); } + /* account management */ + account_manager = empathy_account_manager_dup_singleton (); + g_signal_connect (account_manager, "notify::ready", + G_CALLBACK (account_manager_ready_cb), NULL); + migrate_config_to_xdg_dir (); - create_salut_account (); + /* Setting up UI */ window = empathy_main_window_show (); icon = empathy_status_icon_new (GTK_WINDOW (window), hide_contact_list);