diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-03-10 19:20:01 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-03-10 19:20:01 +0800 |
commit | 788470113896a3d6c7ff441b0ea031568029f83c (patch) | |
tree | f0d77d836f9c4ebabccd86d35f5f05189441b209 /src | |
parent | e70e095faa901c8b1aa061ec61a3206178ef47f5 (diff) | |
download | gsoc2013-empathy-788470113896a3d6c7ff441b0ea031568029f83c.tar gsoc2013-empathy-788470113896a3d6c7ff441b0ea031568029f83c.tar.gz gsoc2013-empathy-788470113896a3d6c7ff441b0ea031568029f83c.tar.bz2 gsoc2013-empathy-788470113896a3d6c7ff441b0ea031568029f83c.tar.lz gsoc2013-empathy-788470113896a3d6c7ff441b0ea031568029f83c.tar.xz gsoc2013-empathy-788470113896a3d6c7ff441b0ea031568029f83c.tar.zst gsoc2013-empathy-788470113896a3d6c7ff441b0ea031568029f83c.zip |
Make the "Import Accounts" button insensitive if there's nothing to import.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
svn path=/trunk/; revision=2665
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-accounts-dialog.c | 16 | ||||
-rw-r--r-- | src/empathy-import-dialog.c | 6 | ||||
-rw-r--r-- | src/empathy-import-dialog.h | 1 | ||||
-rw-r--r-- | src/empathy-import-pidgin.c | 16 | ||||
-rw-r--r-- | src/empathy-import-pidgin.h | 1 |
5 files changed, 35 insertions, 5 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index 892f24235..4d9456684 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -1153,11 +1153,17 @@ empathy_accounts_dialog_show (GtkWindow *parent, empathy_conf_get_bool (empathy_conf_get (), EMPATHY_PREFS_IMPORT_ASKED, &import_asked); - if (!import_asked) { - empathy_conf_set_bool (empathy_conf_get (), - EMPATHY_PREFS_IMPORT_ASKED, TRUE); - empathy_import_dialog_show (GTK_WINDOW (dialog->window), - FALSE); + + if (empathy_import_dialog_accounts_to_import ()) { + + if (!import_asked) { + empathy_conf_set_bool (empathy_conf_get (), + EMPATHY_PREFS_IMPORT_ASKED, TRUE); + empathy_import_dialog_show (GTK_WINDOW (dialog->window), + FALSE); + } + } else { + gtk_widget_set_sensitive (dialog->button_import, FALSE); } return dialog->window; diff --git a/src/empathy-import-dialog.c b/src/empathy-import-dialog.c index 80e2d747a..955e07b9c 100644 --- a/src/empathy-import-dialog.c +++ b/src/empathy-import-dialog.c @@ -347,6 +347,12 @@ import_dialog_destroy_cb (GtkWidget *widget, g_slice_free (EmpathyImportDialog, dialog); } +gboolean +empathy_import_dialog_accounts_to_import (void) +{ + return empathy_import_pidgin_accounts_to_import (); +} + void empathy_import_dialog_show (GtkWindow *parent, gboolean warning) diff --git a/src/empathy-import-dialog.h b/src/empathy-import-dialog.h index 1d616e387..278afc701 100644 --- a/src/empathy-import-dialog.h +++ b/src/empathy-import-dialog.h @@ -38,6 +38,7 @@ typedef struct EmpathyImportAccountData *empathy_import_account_data_new (const gchar *source); void empathy_import_account_data_free (EmpathyImportAccountData *data); +gboolean empathy_import_dialog_accounts_to_import (void); void empathy_import_dialog_show (GtkWindow *parent, gboolean warning); G_END_DECLS diff --git a/src/empathy-import-pidgin.c b/src/empathy-import-pidgin.c index 6c40bccf6..76295c702 100644 --- a/src/empathy-import-pidgin.c +++ b/src/empathy-import-pidgin.c @@ -303,3 +303,19 @@ FILENAME: return accounts; } +gboolean +empathy_import_pidgin_accounts_to_import (void) +{ + gchar *filename; + gboolean out; + GFile *file; + + filename = g_build_filename (g_get_home_dir (), ".purple", "accounts.xml", NULL); + file = g_file_new_for_path (filename); + out = g_file_query_exists (file, NULL); + + g_free (filename); + g_object_unref (file); + + return out; +} diff --git a/src/empathy-import-pidgin.h b/src/empathy-import-pidgin.h index 4f1bd5a3a..fc7d2e491 100644 --- a/src/empathy-import-pidgin.h +++ b/src/empathy-import-pidgin.h @@ -27,6 +27,7 @@ G_BEGIN_DECLS GList *empathy_import_pidgin_load (void); +gboolean empathy_import_pidgin_accounts_to_import (void); G_END_DECLS |