#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"
* 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)
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
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));
}
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 */
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);
+ }
+}
#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"
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,
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;