aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy.c
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-28 17:20:27 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-28 17:20:27 +0800
commit1d153c1cf91edce537bc64efb01b5a496b35518e (patch)
treede8ba4359a0341bd0c8c6e1a7495f4f39fb565f1 /src/empathy.c
parentb50b7039d3b52f33df94e5a3526d9f43a51401ad (diff)
parent6df1c4bdd81fbbb288b8e49c3bea9a1dd2e005a6 (diff)
downloadgsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.tar
gsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.tar.gz
gsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.tar.bz2
gsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.tar.lz
gsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.tar.xz
gsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.tar.zst
gsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.zip
Merge commit 'upstream/master' into mc5
Conflicts: libempathy-gtk/empathy-account-widget.c src/empathy.c
Diffstat (limited to 'src/empathy.c')
-rw-r--r--src/empathy.c65
1 files changed, 64 insertions, 1 deletions
diff --git a/src/empathy.c b/src/empathy.c
index 3d8fe6e12..4e824bcb4 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -342,6 +342,67 @@ create_salut_account (void)
}
}
+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.
*
@@ -378,7 +439,7 @@ on_bacon_message_received (const char *message,
gtk_widget_realize (GTK_WIDGET (window));
}
- startup_timestamp = gdk_x11_get_server_time (window->window);
+ startup_timestamp = gdk_x11_get_server_time (gtk_widget_get_window (window));
}
gtk_window_present_with_time (GTK_WINDOW (window), startup_timestamp);
@@ -670,6 +731,8 @@ main (int argc, char *argv[])
g_signal_connect (account_manager, "notify::ready",
G_CALLBACK (account_manager_ready_cb), NULL);
+ migrate_config_to_xdg_dir ();
+
/* Setting up UI */
window = empathy_main_window_show ();
icon = empathy_status_icon_new (GTK_WINDOW (window), hide_contact_list);