aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2010-03-10 12:54:51 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2010-03-10 18:43:43 +0800
commit77c57d35a578027d6f5ffea14483ba8762ad995a (patch)
treeac08b0486329570e81f3644f64ec0bf0c3d97b55 /src
parentc2cd8fbabc39ee82f28e9617a33c2ae603f711b7 (diff)
downloadgsoc2013-empathy-77c57d35a578027d6f5ffea14483ba8762ad995a.tar
gsoc2013-empathy-77c57d35a578027d6f5ffea14483ba8762ad995a.tar.gz
gsoc2013-empathy-77c57d35a578027d6f5ffea14483ba8762ad995a.tar.bz2
gsoc2013-empathy-77c57d35a578027d6f5ffea14483ba8762ad995a.tar.lz
gsoc2013-empathy-77c57d35a578027d6f5ffea14483ba8762ad995a.tar.xz
gsoc2013-empathy-77c57d35a578027d6f5ffea14483ba8762ad995a.tar.zst
gsoc2013-empathy-77c57d35a578027d6f5ffea14483ba8762ad995a.zip
empathy-accounts: make CcPage insensitive when assistant is being shown
Also destroy assistant when CcPanel becomes inactive.
Diffstat (limited to 'src')
-rw-r--r--src/cc-empathy-accounts-page.c35
-rw-r--r--src/cc-empathy-accounts-page.h1
-rw-r--r--src/cc-empathy-accounts-panel.c26
-rw-r--r--src/empathy-account-assistant.c2
4 files changed, 59 insertions, 5 deletions
diff --git a/src/cc-empathy-accounts-page.c b/src/cc-empathy-accounts-page.c
index 383e20d41..48330f6f0 100644
--- a/src/cc-empathy-accounts-page.c
+++ b/src/cc-empathy-accounts-page.c
@@ -32,6 +32,9 @@
#include <libempathy/empathy-connection-managers.h>
#include <libempathy-gtk/empathy-ui-utils.h>
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
+#include <libempathy/empathy-debug.h>
+
#include "cc-empathy-accounts-page.h"
#include "empathy-accounts-common.h"
#include "empathy-account-assistant.h"
@@ -45,6 +48,8 @@ struct CcEmpathyAccountsPagePrivate
* destroyed in our finalize(), since it invalidates its children (even if
* they've already been reparented by the time it is destroyed) */
GtkWidget *accounts_window;
+
+ GtkWidget *assistant;
};
G_DEFINE_TYPE (CcEmpathyAccountsPage, cc_empathy_accounts_page, CC_TYPE_PAGE)
@@ -87,6 +92,9 @@ account_assistant_closed_cb (GtkWidget *widget,
empathy_account_dialog_cancel (
EMPATHY_ACCOUNTS_DIALOG (page->priv->accounts_window));
}
+
+ gtk_widget_set_sensitive (GTK_WIDGET (page), TRUE);
+ page->priv->assistant = NULL;
}
static void
@@ -112,10 +120,14 @@ connection_managers_prepare (GObject *source,
if (!empathy_accounts_has_non_salut_accounts (account_mgr))
{
- GtkWidget *w;
- w = empathy_account_assistant_show (NULL, cm_mgr);
+ GtkWindow *parent;
- empathy_signal_connect_weak (w, "hide",
+ parent = empathy_get_toplevel_window (GTK_WIDGET (page));
+ page->priv->assistant = empathy_account_assistant_show (parent, cm_mgr);
+
+ gtk_widget_set_sensitive (GTK_WIDGET (page), FALSE);
+
+ empathy_signal_connect_weak (page->priv->assistant, "hide",
G_CALLBACK (account_assistant_closed_cb),
G_OBJECT (page));
}
@@ -172,6 +184,8 @@ active_changed (CcPage *base_page,
CcEmpathyAccountsPage *page = CC_EMPATHY_ACCOUNTS_PAGE (base_page);
TpAccountManager *account_manager;
+ DEBUG ("%s: active = %i", G_STRLOC, is_active);
+
if (is_active)
{
/* unref'd in final endpoint callbacks */
@@ -232,3 +246,18 @@ cc_empathy_accounts_page_new (void)
return CC_PAGE (object);
}
+
+void
+cc_empathy_accounts_page_destroy_dialogs (CcEmpathyAccountsPage *self)
+{
+ /* This function is really kludgey, it is called by the AccountPanel to
+ * remove any child dialogs (i.e. this assistant). I personally feel this
+ * would be better in active_changed, but the Page doesn't seem to receive
+ * that signal when the panel does. */
+
+ if (self->priv->assistant != NULL)
+ {
+ DEBUG ("Destroying assistant");
+ gtk_widget_destroy (self->priv->assistant);
+ }
+}
diff --git a/src/cc-empathy-accounts-page.h b/src/cc-empathy-accounts-page.h
index 7c360874e..4139a33f8 100644
--- a/src/cc-empathy-accounts-page.h
+++ b/src/cc-empathy-accounts-page.h
@@ -48,6 +48,7 @@ typedef struct
GType cc_empathy_accounts_page_get_type (void);
CcPage* cc_empathy_accounts_page_new (void);
+void cc_empathy_accounts_page_destroy_dialogs (CcEmpathyAccountsPage *self);
G_END_DECLS
diff --git a/src/cc-empathy-accounts-panel.c b/src/cc-empathy-accounts-panel.c
index 63500e66c..d69325b7b 100644
--- a/src/cc-empathy-accounts-panel.c
+++ b/src/cc-empathy-accounts-panel.c
@@ -28,6 +28,9 @@
#include <gconf/gconf-client.h>
+#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
+#include <libempathy/empathy-debug.h>
+
#include "cc-empathy-accounts-panel.h"
#include "cc-empathy-accounts-page.h"
@@ -55,6 +58,24 @@ setup_panel (CcEmpathyAccountsPanel *panel)
NULL);
}
+static void
+cc_empathy_accounts_panel_active_changed (CcPanel *self,
+ gboolean is_active)
+{
+ DEBUG ("%s: active = %i", G_STRLOC, is_active);
+
+ if (!is_active)
+ {
+ /* why doesn't control-center call active-changed on the Page? */
+ cc_empathy_accounts_page_destroy_dialogs (
+ CC_EMPATHY_ACCOUNTS_PAGE (
+ CC_EMPATHY_ACCOUNTS_PANEL (self)->priv->empathy_accounts_page));
+ }
+
+ CC_PANEL_CLASS (cc_empathy_accounts_panel_parent_class)->active_changed (
+ self, is_active);
+}
+
static GObject *
cc_empathy_accounts_panel_constructor (GType type,
guint n_construct_properties,
@@ -96,7 +117,10 @@ cc_empathy_accounts_panel_finalize (GObject *object)
static void
cc_empathy_accounts_panel_class_init (CcEmpathyAccountsPanelClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ panel_class->active_changed = cc_empathy_accounts_panel_active_changed;
object_class->constructor = cc_empathy_accounts_panel_constructor;
object_class->finalize = cc_empathy_accounts_panel_finalize;
diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c
index e5c5e80c2..63949ed26 100644
--- a/src/empathy-account-assistant.c
+++ b/src/empathy-account-assistant.c
@@ -1320,7 +1320,7 @@ empathy_account_assistant_show (GtkWindow *window,
if (dialog == NULL)
{
- dialog = g_object_new (EMPATHY_TYPE_ACCOUNT_ASSISTANT,
+ dialog = g_object_new (EMPATHY_TYPE_ACCOUNT_ASSISTANT,
"parent-window", window,
"connection-managers", connection_mgrs,
NULL);