Updated Portuguese translation
[empathy-mirror.git] / src / empathy-accounts-common.c
blob772e6868e16bc892972fe843a06b4f1fc36756e0
1 /*
2 * Copyright (C) 2005-2007 Imendio AB
3 * Copyright (C) 2007-2010 Collabora Ltd.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301 USA
20 * Authors: Martyn Russell <martyn@imendio.com>
21 * Xavier Claessens <xclaesse@gmail.com>
22 * Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
23 * Jonathan Tellier <jonathan.tellier@gmail.com>
24 * Travis Reitter <travis.reitter@collabora.co.uk>
27 #include "config.h"
28 #include "empathy-accounts-common.h"
30 #include "empathy-accounts-dialog.h"
32 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
33 #include "empathy-debug.h"
35 gboolean
36 empathy_accounts_has_non_salut_accounts (TpAccountManager *manager)
38 gboolean ret = FALSE;
39 GList *accounts, *l;
41 accounts = tp_account_manager_dup_valid_accounts (manager);
43 for (l = accounts ; l != NULL; l = g_list_next (l))
45 if (tp_strdiff (tp_account_get_protocol_name (l->data), "local-xmpp"))
47 ret = TRUE;
48 break;
52 g_list_free_full (accounts, g_object_unref);
54 return ret;
57 gboolean
58 empathy_accounts_has_accounts (TpAccountManager *manager)
60 GList *accounts;
61 gboolean has_accounts;
63 accounts = tp_account_manager_dup_valid_accounts (manager);
64 has_accounts = (accounts != NULL);
65 g_list_free_full (accounts, g_object_unref);
67 return has_accounts;
70 void
71 empathy_accounts_show_accounts_ui (TpAccountManager *manager,
72 TpAccount *account,
73 GApplication *app)
75 static GtkWidget *accounts_window = NULL;
77 g_return_if_fail (TP_IS_ACCOUNT_MANAGER (manager));
78 g_return_if_fail (!account || TP_IS_ACCOUNT (account));
80 if (accounts_window == NULL)
82 accounts_window = empathy_accounts_dialog_show (NULL, account);
84 gtk_application_add_window (GTK_APPLICATION (app),
85 GTK_WINDOW (accounts_window));
88 gtk_window_present (GTK_WINDOW (accounts_window));