[empathy] Turn EmpathyAccountWidget to a proper GtkWidget
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] Turn EmpathyAccountWidget to a proper GtkWidget
- Date: Tue, 8 May 2012 07:17:28 +0000 (UTC)
commit d86e51de57197b0f0ce77fac46fc113713aa9033
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Fri May 4 14:53:34 2012 +0200
Turn EmpathyAccountWidget to a proper GtkWidget
https://bugzilla.gnome.org/show_bug.cgi?id=640417
libempathy-gtk/empathy-account-widget-irc.c | 10 +-
libempathy-gtk/empathy-account-widget-irc.h | 6 +-
libempathy-gtk/empathy-account-widget-private.h | 2 -
libempathy-gtk/empathy-account-widget-sip.c | 4 +-
libempathy-gtk/empathy-account-widget-sip.h | 2 +-
libempathy-gtk/empathy-account-widget.c | 156 ++++++++++----------
libempathy-gtk/empathy-account-widget.h | 6 +-
.../empathy-local-xmpp-assistant-widget.c | 17 +--
libempathy-gtk/empathy-new-account-dialog.c | 30 ++--
src/empathy-accounts-dialog.c | 52 +++----
10 files changed, 139 insertions(+), 146 deletions(-)
---
diff --git a/libempathy-gtk/empathy-account-widget-irc.c b/libempathy-gtk/empathy-account-widget-irc.c
index d7282b1..a4343e1 100644
--- a/libempathy-gtk/empathy-account-widget-irc.c
+++ b/libempathy-gtk/empathy-account-widget-irc.c
@@ -139,7 +139,8 @@ entry_password_changed_cb (GtkEntry *entry,
EmpathyIrcNetworkChooser *
empathy_account_widget_irc_build (EmpathyAccountWidget *self,
const char *filename,
- GtkWidget **table_common_settings)
+ GtkWidget **table_common_settings,
+ GtkWidget **box)
{
EmpathyAccountWidgetIrc *settings;
EmpathyAccountSettings *ac_settings;
@@ -151,7 +152,7 @@ empathy_account_widget_irc_build (EmpathyAccountWidget *self,
self->ui_details->gui = empathy_builder_get_file (filename,
"table_irc_settings", table_common_settings,
- "vbox_irc", &self->ui_details->widget,
+ "vbox_irc", box,
"table_irc_settings", &settings->vbox_settings,
"entry_password", &entry_password,
NULL);
@@ -204,7 +205,8 @@ empathy_account_widget_irc_build (EmpathyAccountWidget *self,
EmpathyIrcNetworkChooser *
empathy_account_widget_irc_build_simple (EmpathyAccountWidget *self,
- const char *filename)
+ const char *filename,
+ GtkWidget **box)
{
EmpathyAccountWidgetIrc *settings;
EmpathyAccountSettings *ac_settings;
@@ -214,7 +216,7 @@ empathy_account_widget_irc_build_simple (EmpathyAccountWidget *self,
settings->self = self;
self->ui_details->gui = empathy_builder_get_file (filename,
- "vbox_irc_simple", &self->ui_details->widget,
+ "vbox_irc_simple", box,
"alignment_network_simple", &alignment,
NULL);
diff --git a/libempathy-gtk/empathy-account-widget-irc.h b/libempathy-gtk/empathy-account-widget-irc.h
index cc5dfff..bcd45b7 100644
--- a/libempathy-gtk/empathy-account-widget-irc.h
+++ b/libempathy-gtk/empathy-account-widget-irc.h
@@ -30,11 +30,13 @@ G_BEGIN_DECLS
EmpathyIrcNetworkChooser * empathy_account_widget_irc_build (
EmpathyAccountWidget *self,
const char *filename,
- GtkWidget **table_common_settings);
+ GtkWidget **table_common_settings,
+ GtkWidget **box);
EmpathyIrcNetworkChooser * empathy_account_widget_irc_build_simple (
EmpathyAccountWidget *self,
- const char *filename);
+ const char *filename,
+ GtkWidget **box);
G_END_DECLS
diff --git a/libempathy-gtk/empathy-account-widget-private.h b/libempathy-gtk/empathy-account-widget-private.h
index db8dc7d..988b098 100644
--- a/libempathy-gtk/empathy-account-widget-private.h
+++ b/libempathy-gtk/empathy-account-widget-private.h
@@ -29,8 +29,6 @@
G_BEGIN_DECLS
struct _EmpathyAccountWidgetUIDetails {
- GtkWidget *widget;
-
GtkBuilder *gui;
char *default_focus;
diff --git a/libempathy-gtk/empathy-account-widget-sip.c b/libempathy-gtk/empathy-account-widget-sip.c
index ed2f445..8aa4e89 100644
--- a/libempathy-gtk/empathy-account-widget-sip.c
+++ b/libempathy-gtk/empathy-account-widget-sip.c
@@ -108,7 +108,7 @@ checkbutton_tel_toggled (
empathy_account_widget_changed (sip_settings->self);
}
-void
+GtkWidget *
empathy_account_widget_sip_build (EmpathyAccountWidget *self,
const char *filename,
GtkWidget **grid_common_settings)
@@ -265,5 +265,5 @@ empathy_account_widget_sip_build (EmpathyAccountWidget *self,
gtk_widget_show (settings->combobox_keep_alive_mechanism);
}
- self->ui_details->widget = vbox_settings;
+ return vbox_settings;
}
diff --git a/libempathy-gtk/empathy-account-widget-sip.h b/libempathy-gtk/empathy-account-widget-sip.h
index 7673a5b..84e96e7 100644
--- a/libempathy-gtk/empathy-account-widget-sip.h
+++ b/libempathy-gtk/empathy-account-widget-sip.h
@@ -26,7 +26,7 @@
G_BEGIN_DECLS
-void empathy_account_widget_sip_build (EmpathyAccountWidget *self,
+GtkWidget * empathy_account_widget_sip_build (EmpathyAccountWidget *self,
const char *filename,
GtkWidget **grid_common_settings);
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index 7494fa0..6848c87 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -50,7 +50,7 @@
#define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
#include <libempathy/empathy-debug.h>
-G_DEFINE_TYPE (EmpathyAccountWidget, empathy_account_widget, G_TYPE_OBJECT)
+G_DEFINE_TYPE (EmpathyAccountWidget, empathy_account_widget, GTK_TYPE_BOX)
typedef enum
{
@@ -1049,15 +1049,15 @@ account_widget_settings_ready_cb (EmpathyAccountSettings *settings,
account_widget_setup_generic (self);
}
-static void
+static GtkWidget *
account_widget_build_generic (EmpathyAccountWidget *self,
const char *filename)
{
- GtkWidget *expander_advanced;
+ GtkWidget *expander_advanced, *box;
self->ui_details->gui = empathy_builder_get_file (filename,
"grid_common_settings", &self->priv->grid_common_settings,
- "vbox_generic_settings", &self->ui_details->widget,
+ "vbox_generic_settings", &box,
"expander_advanced_settings", &expander_advanced,
NULL);
@@ -1071,17 +1071,19 @@ account_widget_build_generic (EmpathyAccountWidget *self,
else
g_signal_connect (self->priv->settings, "notify::ready",
G_CALLBACK (account_widget_settings_ready_cb), self);
+
+ return box;
}
-static void
+static GtkWidget *
account_widget_build_salut (EmpathyAccountWidget *self,
const char *filename)
{
- GtkWidget *expander_advanced;
+ GtkWidget *expander_advanced, *box;
self->ui_details->gui = empathy_builder_get_file (filename,
"grid_common_settings", &self->priv->grid_common_settings,
- "vbox_salut_settings", &self->ui_details->widget,
+ "vbox_salut_settings", &box,
"expander_advanced_settings", &expander_advanced,
NULL);
@@ -1098,12 +1100,16 @@ account_widget_build_salut (EmpathyAccountWidget *self,
gtk_widget_hide (expander_advanced);
self->ui_details->default_focus = g_strdup ("entry_first_name");
+
+ return box;
}
-static void
+static GtkWidget *
account_widget_build_irc (EmpathyAccountWidget *self,
const char *filename)
{
+ GtkWidget *box;
+
empathy_account_settings_set_regex (self->priv->settings, "account",
ACCOUNT_REGEX_IRC);
empathy_account_settings_set_regex (self->priv->settings, "username",
@@ -1112,20 +1118,24 @@ account_widget_build_irc (EmpathyAccountWidget *self,
if (self->priv->simple)
{
self->priv->irc_network_chooser = empathy_account_widget_irc_build_simple
- (self, filename);
+ (self, filename, &box);
}
else
{
self->priv->irc_network_chooser = empathy_account_widget_irc_build (self,
- filename, &self->priv->grid_common_settings);
+ filename, &self->priv->grid_common_settings, &box);
}
+
+ return box;
}
-static void
+static GtkWidget *
account_widget_build_sip (EmpathyAccountWidget *self,
const char *filename)
{
- empathy_account_widget_sip_build (self, filename,
+ GtkWidget *box;
+
+ box = empathy_account_widget_sip_build (self, filename,
&self->priv->grid_common_settings);
if (self->priv->simple)
@@ -1139,19 +1149,23 @@ account_widget_build_sip (EmpathyAccountWidget *self,
self->priv->remember_password_widget = GTK_WIDGET (
gtk_builder_get_object (self->ui_details->gui, "remember_password"));
}
+
+ return box;
}
-static void
+static GtkWidget *
account_widget_build_msn (EmpathyAccountWidget *self,
const char *filename)
{
+ GtkWidget *box;
+
empathy_account_settings_set_regex (self->priv->settings, "account",
ACCOUNT_REGEX_MSN);
if (self->priv->simple)
{
self->ui_details->gui = empathy_builder_get_file (filename,
- "vbox_msn_simple", &self->ui_details->widget,
+ "vbox_msn_simple", &box,
NULL);
empathy_account_widget_handle_params (self,
@@ -1169,7 +1183,7 @@ account_widget_build_msn (EmpathyAccountWidget *self,
{
self->ui_details->gui = empathy_builder_get_file (filename,
"grid_common_msn_settings", &self->priv->grid_common_settings,
- "vbox_msn_settings", &self->ui_details->widget,
+ "vbox_msn_settings", &box,
NULL);
empathy_account_widget_handle_params (self,
@@ -1184,6 +1198,8 @@ account_widget_build_msn (EmpathyAccountWidget *self,
self->priv->remember_password_widget = GTK_WIDGET (
gtk_builder_get_object (self->ui_details->gui, "remember_password"));
}
+
+ return box;
}
static void
@@ -1277,7 +1293,7 @@ account_widget_get_service (EmpathyAccountWidget *self)
return NO_SERVICE;
}
-static void
+static GtkWidget *
account_widget_build_jabber (EmpathyAccountWidget *self,
const char *filename)
{
@@ -1289,6 +1305,7 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
GtkWidget *label_example;
GtkWidget *expander_advanced;
GtkWidget *entry_id;
+ GtkWidget *box;
Service service;
service = account_widget_get_service (self);
@@ -1300,7 +1317,7 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
{
/* Simple widget for XMPP */
self->ui_details->gui = empathy_builder_get_file (filename,
- "vbox_jabber_simple", &self->ui_details->widget,
+ "vbox_jabber_simple", &box,
"label_id_simple", &label_id,
"label_id_create", &label_id_create,
"label_password_simple", &label_password,
@@ -1331,7 +1348,7 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
{
/* Simple widget for Google Talk */
self->ui_details->gui = empathy_builder_get_file (filename,
- "vbox_gtalk_simple", &self->ui_details->widget,
+ "vbox_gtalk_simple", &box,
NULL);
empathy_account_widget_handle_params (self,
@@ -1349,7 +1366,7 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
{
/* Simple widget for Facebook */
self->ui_details->gui = empathy_builder_get_file (filename,
- "vbox_fb_simple", &self->ui_details->widget,
+ "vbox_fb_simple", &box,
"entry_id_fb_simple", &entry_id,
NULL);
@@ -1372,7 +1389,7 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
/* Full widget for XMPP, Google Talk and Facebook*/
self->ui_details->gui = empathy_builder_get_file (filename,
"grid_common_settings", &self->priv->grid_common_settings,
- "vbox_jabber_settings", &self->ui_details->widget,
+ "vbox_jabber_settings", &box,
"spinbutton_port", &spinbutton_port,
"checkbutton_ssl", &checkbutton_ssl,
"label_username_f_example", &label_example_fb,
@@ -1434,13 +1451,16 @@ account_widget_build_jabber (EmpathyAccountWidget *self,
if (!info.show_advanced)
gtk_widget_hide (expander_advanced);
}
+
+ return box;
}
-static void
+static GtkWidget *
account_widget_build_icq (EmpathyAccountWidget *self,
const char *filename)
{
GtkWidget *spinbutton_port;
+ GtkWidget *box;
empathy_account_settings_set_regex (self->priv->settings, "account",
ACCOUNT_REGEX_ICQ);
@@ -1448,7 +1468,7 @@ account_widget_build_icq (EmpathyAccountWidget *self,
if (self->priv->simple)
{
self->ui_details->gui = empathy_builder_get_file (filename,
- "vbox_icq_simple", &self->ui_details->widget,
+ "vbox_icq_simple", &box,
NULL);
empathy_account_widget_handle_params (self,
@@ -1466,7 +1486,7 @@ account_widget_build_icq (EmpathyAccountWidget *self,
{
self->ui_details->gui = empathy_builder_get_file (filename,
"grid_common_settings", &self->priv->grid_common_settings,
- "vbox_icq_settings", &self->ui_details->widget,
+ "vbox_icq_settings", &box,
"spinbutton_port", &spinbutton_port,
NULL);
@@ -1483,18 +1503,20 @@ account_widget_build_icq (EmpathyAccountWidget *self,
self->priv->remember_password_widget = GTK_WIDGET (
gtk_builder_get_object (self->ui_details->gui, "remember_password"));
}
+
+ return box;
}
-static void
+static GtkWidget *
account_widget_build_aim (EmpathyAccountWidget *self,
const char *filename)
{
- GtkWidget *spinbutton_port;
+ GtkWidget *spinbutton_port, *box;
if (self->priv->simple)
{
self->ui_details->gui = empathy_builder_get_file (filename,
- "vbox_aim_simple", &self->ui_details->widget,
+ "vbox_aim_simple", &box,
NULL);
empathy_account_widget_handle_params (self,
@@ -1512,7 +1534,7 @@ account_widget_build_aim (EmpathyAccountWidget *self,
{
self->ui_details->gui = empathy_builder_get_file (filename,
"grid_common_settings", &self->priv->grid_common_settings,
- "vbox_aim_settings", &self->ui_details->widget,
+ "vbox_aim_settings", &box,
"spinbutton_port", &spinbutton_port,
NULL);
@@ -1528,19 +1550,23 @@ account_widget_build_aim (EmpathyAccountWidget *self,
self->priv->remember_password_widget = GTK_WIDGET (
gtk_builder_get_object (self->ui_details->gui, "remember_password"));
}
+
+ return box;
}
-static void
+static GtkWidget *
account_widget_build_yahoo (EmpathyAccountWidget *self,
const char *filename)
{
+ GtkWidget *box;
+
empathy_account_settings_set_regex (self->priv->settings, "account",
ACCOUNT_REGEX_YAHOO);
if (self->priv->simple)
{
self->ui_details->gui = empathy_builder_get_file (filename,
- "vbox_yahoo_simple", &self->ui_details->widget,
+ "vbox_yahoo_simple", &box,
NULL);
empathy_account_widget_handle_params (self,
@@ -1558,7 +1584,7 @@ account_widget_build_yahoo (EmpathyAccountWidget *self,
{
self->ui_details->gui = empathy_builder_get_file (filename,
"grid_common_settings", &self->priv->grid_common_settings,
- "vbox_yahoo_settings", &self->ui_details->widget,
+ "vbox_yahoo_settings", &box,
NULL);
empathy_account_widget_handle_params (self,
@@ -1575,16 +1601,20 @@ account_widget_build_yahoo (EmpathyAccountWidget *self,
self->priv->remember_password_widget = GTK_WIDGET (
gtk_builder_get_object (self->ui_details->gui, "remember_password"));
}
+
+ return box;
}
-static void
+static GtkWidget *
account_widget_build_groupwise (EmpathyAccountWidget *self,
const char *filename)
{
+ GtkWidget *box;
+
if (self->priv->simple)
{
self->ui_details->gui = empathy_builder_get_file (filename,
- "vbox_groupwise_simple", &self->ui_details->widget,
+ "vbox_groupwise_simple", &box,
NULL);
empathy_account_widget_handle_params (self,
@@ -1602,7 +1632,7 @@ account_widget_build_groupwise (EmpathyAccountWidget *self,
{
self->ui_details->gui = empathy_builder_get_file (filename,
"grid_common_groupwise_settings", &self->priv->grid_common_settings,
- "vbox_groupwise_settings", &self->ui_details->widget,
+ "vbox_groupwise_settings", &box,
NULL);
empathy_account_widget_handle_params (self,
@@ -1617,16 +1647,8 @@ account_widget_build_groupwise (EmpathyAccountWidget *self,
self->priv->remember_password_widget = GTK_WIDGET (
gtk_builder_get_object (self->ui_details->gui, "remember_password"));
}
-}
-
-static void
-account_widget_destroy_cb (GtkWidget *widget,
- EmpathyAccountWidget *self)
-{
- /* set the destroyed flag - workaround */
- self->priv->destroyed = TRUE;
- g_object_unref (self);
+ return box;
}
void
@@ -1788,7 +1810,6 @@ add_register_buttons (EmpathyAccountWidget *self,
{
const TpConnectionManagerProtocol *protocol;
GtkWidget *radiobutton_register;
- GtkWidget *vbox = self->ui_details->widget;
if (!self->priv->creating_account)
return;
@@ -1813,11 +1834,11 @@ add_register_buttons (EmpathyAccountWidget *self,
GTK_RADIO_BUTTON (self->priv->radiobutton_reuse)),
_("Create a new account on the server"));
- gtk_box_pack_start (GTK_BOX (vbox), self->priv->radiobutton_reuse, FALSE,
+ gtk_box_pack_start (GTK_BOX (self), self->priv->radiobutton_reuse, FALSE,
FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), radiobutton_register, FALSE, FALSE, 0);
- gtk_box_reorder_child (GTK_BOX (vbox), self->priv->radiobutton_reuse, 0);
- gtk_box_reorder_child (GTK_BOX (vbox), radiobutton_register, 1);
+ gtk_box_pack_start (GTK_BOX (self), radiobutton_register, FALSE, FALSE, 0);
+ gtk_box_reorder_child (GTK_BOX (self), self->priv->radiobutton_reuse, 0);
+ gtk_box_reorder_child (GTK_BOX (self), radiobutton_register, 1);
gtk_widget_show (self->priv->radiobutton_reuse);
gtk_widget_show (radiobutton_register);
}
@@ -1873,7 +1894,7 @@ do_constructed (GObject *obj)
const gchar *cm_name;
const gchar *protocol;
const char *file;
- void (*func)(EmpathyAccountWidget *self, const gchar *filename);
+ GtkWidget * (*func)(EmpathyAccountWidget *self, const gchar *filename);
} widgets [] = {
{ "salut", "local-xmpp", "empathy-account-widget-local-xmpp.ui",
account_widget_build_salut },
@@ -1887,6 +1908,7 @@ do_constructed (GObject *obj)
WIDGET (sofiasip, sip),
};
const gchar *protocol, *cm_name;
+ GtkWidget *box;
account = empathy_account_settings_get_account (self->priv->settings);
@@ -1902,7 +1924,7 @@ do_constructed (GObject *obj)
filename = empathy_file_lookup (widgets[i].file,
"libempathy-gtk");
- widgets[i].func (self, filename);
+ box = widgets[i].func (self, filename);
g_free (filename);
break;
@@ -1913,10 +1935,12 @@ do_constructed (GObject *obj)
{
gchar *filename = empathy_file_lookup (
"empathy-account-widget-generic.ui", "libempathy-gtk");
- account_widget_build_generic (self, filename);
+ box = account_widget_build_generic (self, filename);
g_free (filename);
}
+ gtk_container_add (GTK_CONTAINER (self), box);
+
/* handle default focus */
if (self->ui_details->default_focus != NULL)
{
@@ -1994,7 +2018,7 @@ do_constructed (GObject *obj)
gtk_box_pack_end (GTK_BOX (self->priv->hbox_buttons),
self->priv->cancel_button, TRUE, TRUE, 3);
- gtk_box_pack_end (GTK_BOX (self->ui_details->widget), self->priv->hbox_buttons, FALSE,
+ gtk_box_pack_end (GTK_BOX (self), self->priv->hbox_buttons, FALSE,
FALSE, 3);
g_signal_connect (self->priv->cancel_button, "clicked",
@@ -2016,16 +2040,7 @@ do_constructed (GObject *obj)
add_register_buttons (self, account);
- /* hook up to widget destruction to unref ourselves */
- g_signal_connect (self->ui_details->widget, "destroy",
- G_CALLBACK (account_widget_destroy_cb), self);
-
- if (self->ui_details->gui != NULL)
- {
- empathy_builder_unref_and_keep_widget (self->ui_details->gui,
- self->ui_details->widget);
- self->ui_details->gui = NULL;
- }
+ g_clear_object (&self->ui_details->gui);
display_name = empathy_account_settings_get_display_name (
self->priv->settings);
@@ -2180,28 +2195,19 @@ empathy_account_widget_handle_params (EmpathyAccountWidget *self,
va_end (args);
}
-GtkWidget *
-empathy_account_widget_get_widget (EmpathyAccountWidget *widget)
-{
- return widget->ui_details->widget;
-}
-
EmpathyAccountWidget *
empathy_account_widget_new_for_protocol (EmpathyAccountSettings *settings,
gboolean simple)
{
- EmpathyAccountWidget *self;
-
g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), NULL);
- self = g_object_new
- (EMPATHY_TYPE_ACCOUNT_WIDGET,
- "settings", settings, "simple", simple,
+ return g_object_new (EMPATHY_TYPE_ACCOUNT_WIDGET,
+ "orientation", GTK_ORIENTATION_VERTICAL,
+ "settings", settings,
+ "simple", simple,
"creating-account",
- empathy_account_settings_get_account (settings) == NULL,
+ empathy_account_settings_get_account (settings) == NULL,
NULL);
-
- return self;
}
gchar *
diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h
index 5279d75..acc8a05 100644
--- a/libempathy-gtk/empathy-account-widget.h
+++ b/libempathy-gtk/empathy-account-widget.h
@@ -46,7 +46,7 @@ typedef struct _EmpathyAccountWidgetPriv EmpathyAccountWidgetPriv;
typedef struct _EmpathyAccountWidgetUIDetails EmpathyAccountWidgetUIDetails;
typedef struct {
- GObject parent;
+ GtkBox parent;
EmpathyAccountWidgetUIDetails *ui_details;
@@ -54,13 +54,11 @@ typedef struct {
} EmpathyAccountWidget;
typedef struct {
- GObjectClass parent_class;
+ GtkBoxClass parent_class;
} EmpathyAccountWidgetClass;
GType empathy_account_widget_get_type (void);
-GtkWidget *empathy_account_widget_get_widget (EmpathyAccountWidget *widget);
-
EmpathyAccountWidget * empathy_account_widget_new_for_protocol (
EmpathyAccountSettings *settings,
gboolean simple);
diff --git a/libempathy-gtk/empathy-local-xmpp-assistant-widget.c b/libempathy-gtk/empathy-local-xmpp-assistant-widget.c
index 9caca7d..cf38039 100644
--- a/libempathy-gtk/empathy-local-xmpp-assistant-widget.c
+++ b/libempathy-gtk/empathy-local-xmpp-assistant-widget.c
@@ -137,8 +137,7 @@ empathy_local_xmpp_assistant_widget_constructed (GObject *object)
object;
GtkWidget *w;
GdkPixbuf *pix;
- GtkWidget *account_widget;
- EmpathyAccountWidget *widget_object;
+ EmpathyAccountWidget *account_widget;
gchar *markup;
G_OBJECT_CLASS (empathy_local_xmpp_assistant_widget_parent_class)->
@@ -165,17 +164,15 @@ empathy_local_xmpp_assistant_widget_constructed (GObject *object)
self->priv->settings = create_salut_account_settings ();
- widget_object = empathy_account_widget_new_for_protocol (self->priv->settings,
- TRUE);
- empathy_account_widget_hide_buttons (widget_object);
+ account_widget = empathy_account_widget_new_for_protocol (
+ self->priv->settings, TRUE);
+ empathy_account_widget_hide_buttons (account_widget);
- account_widget = empathy_account_widget_get_widget (widget_object);
-
- g_signal_connect (widget_object, "handle-apply",
+ g_signal_connect (account_widget, "handle-apply",
G_CALLBACK (handle_apply_cb), self);
- gtk_grid_attach (GTK_GRID (self), account_widget, 0, 1, 2, 1);
- gtk_widget_show (account_widget);
+ gtk_grid_attach (GTK_GRID (self), GTK_WIDGET (account_widget), 0, 1, 2, 1);
+ gtk_widget_show (GTK_WIDGET (account_widget));
w = gtk_label_new (NULL);
markup = g_strdup_printf (
diff --git a/libempathy-gtk/empathy-new-account-dialog.c b/libempathy-gtk/empathy-new-account-dialog.c
index cab22ea..180cc41 100644
--- a/libempathy-gtk/empathy-new-account-dialog.c
+++ b/libempathy-gtk/empathy-new-account-dialog.c
@@ -34,11 +34,10 @@ G_DEFINE_TYPE (EmpathyNewAccountDialog, empathy_new_account_dialog, \
struct _EmpathyNewAccountDialogPrivate
{
GtkWidget *chooser;
- GtkWidget *current_account_widget;
+ EmpathyAccountWidget *current_account_widget;
GtkWidget *main_vbox;
GtkWidget *connect_button;
- EmpathyAccountWidget *current_widget_object;
EmpathyAccountSettings *settings;
};
@@ -62,8 +61,7 @@ protocol_changed_cb (GtkComboBox *chooser,
EmpathyNewAccountDialog *self)
{
EmpathyAccountSettings *settings;
- GtkWidget *account_widget;
- EmpathyAccountWidget *widget_object;
+ EmpathyAccountWidget *account_widget;
gchar *password = NULL, *account = NULL;
settings = empathy_protocol_chooser_create_account_settings (
@@ -84,45 +82,43 @@ protocol_changed_cb (GtkComboBox *chooser,
g_object_unref (self->priv->settings);
}
- widget_object = empathy_account_widget_new_for_protocol (settings, TRUE);
- account_widget = empathy_account_widget_get_widget (widget_object);
+ account_widget = empathy_account_widget_new_for_protocol (settings, TRUE);
if (self->priv->current_account_widget != NULL)
{
- g_signal_handlers_disconnect_by_func (self->priv->current_widget_object,
+ g_signal_handlers_disconnect_by_func (self->priv->current_account_widget,
account_created_cb, self);
- g_signal_handlers_disconnect_by_func (self->priv->current_widget_object,
+ g_signal_handlers_disconnect_by_func (self->priv->current_account_widget,
cancelled_cb, self);
- gtk_widget_destroy (self->priv->current_account_widget);
+ gtk_widget_destroy (GTK_WIDGET (self->priv->current_account_widget));
}
self->priv->current_account_widget = account_widget;
- self->priv->current_widget_object = widget_object;
self->priv->settings = settings;
- g_signal_connect (self->priv->current_widget_object, "account-created",
+ g_signal_connect (self->priv->current_account_widget, "account-created",
G_CALLBACK (account_created_cb), self);
- g_signal_connect (self->priv->current_widget_object, "cancelled",
+ g_signal_connect (self->priv->current_account_widget, "cancelled",
G_CALLBACK (cancelled_cb), self);
/* Restore "account" and "password" parameters in the new widget */
if (account != NULL)
{
- empathy_account_widget_set_account_param (widget_object, account);
+ empathy_account_widget_set_account_param (account_widget, account);
g_free (account);
}
if (password != NULL)
{
- empathy_account_widget_set_password_param (widget_object, password);
+ empathy_account_widget_set_password_param (account_widget, password);
g_free (password);
}
- gtk_box_pack_start (GTK_BOX (self->priv->main_vbox), account_widget,
- FALSE, FALSE, 0);
- gtk_widget_show (account_widget);
+ gtk_box_pack_start (GTK_BOX (self->priv->main_vbox),
+ GTK_WIDGET (account_widget), FALSE, FALSE, 0);
+ gtk_widget_show (GTK_WIDGET (account_widget));
}
static void
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index a0d101c..9c5715b 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -123,7 +123,7 @@ typedef struct {
* That's kinda ugly; cf bgo #640417.
*
* */
- EmpathyAccountWidget *setting_widget_object;
+ EmpathyAccountWidget *setting_widget;
gboolean connecting_show;
guint connecting_id;
@@ -540,7 +540,7 @@ empathy_account_dialog_cancel (EmpathyAccountsDialog *dialog)
COL_ACCOUNT_SETTINGS, &settings,
COL_ACCOUNT, &account, -1);
- empathy_account_widget_discard_pending_changes (priv->setting_widget_object);
+ empathy_account_widget_discard_pending_changes (priv->setting_widget);
if (account == NULL)
{
@@ -580,7 +580,7 @@ accounts_dialog_has_valid_accounts (EmpathyAccountsDialog *dialog)
GtkTreeIter iter;
gboolean creating;
- g_object_get (priv->setting_widget_object,
+ g_object_get (priv->setting_widget,
"creating-account", &creating, NULL);
if (!creating)
@@ -599,7 +599,7 @@ account_dialog_create_edit_params_dialog (EmpathyAccountsDialog *dialog)
{
EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
EmpathyAccountSettings *settings;
- GtkWidget *subdialog, *content, *content_area, *align;
+ GtkWidget *subdialog, *content_area, *align;
settings = accounts_dialog_model_get_selected_settings (dialog);
if (settings == NULL)
@@ -610,22 +610,20 @@ account_dialog_create_edit_params_dialog (EmpathyAccountsDialog *dialog)
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
NULL, NULL);
- priv->setting_widget_object =
+ priv->setting_widget = (EmpathyAccountWidget *)
empathy_account_widget_new_for_protocol (settings, FALSE);
- g_object_add_weak_pointer (G_OBJECT (priv->setting_widget_object),
- (gpointer *) &priv->setting_widget_object);
+ g_object_add_weak_pointer (G_OBJECT (priv->setting_widget),
+ (gpointer *) &priv->setting_widget);
if (accounts_dialog_has_valid_accounts (dialog))
empathy_account_widget_set_other_accounts_exist (
- priv->setting_widget_object, TRUE);
+ priv->setting_widget, TRUE);
- content = empathy_account_widget_get_widget (priv->setting_widget_object);
-
- g_signal_connect (priv->setting_widget_object, "cancelled",
+ g_signal_connect (priv->setting_widget, "cancelled",
G_CALLBACK (empathy_account_dialog_widget_cancelled_cb), dialog);
- g_signal_connect_swapped (priv->setting_widget_object, "close",
+ g_signal_connect_swapped (priv->setting_widget, "close",
G_CALLBACK (gtk_widget_destroy), subdialog);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (subdialog));
@@ -633,10 +631,10 @@ account_dialog_create_edit_params_dialog (EmpathyAccountsDialog *dialog)
align = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_alignment_set_padding (GTK_ALIGNMENT (align), 6, 0, 6, 6);
- gtk_container_add (GTK_CONTAINER (align), content);
+ gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (priv->setting_widget));
gtk_box_pack_start (GTK_BOX (content_area), align, TRUE, TRUE, 0);
- gtk_widget_show (content);
+ gtk_widget_show (GTK_WIDGET (priv->setting_widget));
gtk_widget_show (align);
gtk_widget_show (subdialog);
}
@@ -826,10 +824,6 @@ account_dialog_create_dialog_content (EmpathyAccountsDialog *dialog,
account = empathy_account_settings_get_account (settings);
- // if (priv->setting_widget_object != NULL)
- // g_object_remove_weak_pointer (G_OBJECT (priv->setting_widget_object),
- // (gpointer *) &priv->setting_widget_object);
-
priv->dialog_content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_add (GTK_CONTAINER (priv->alignment_settings),
priv->dialog_content);
@@ -929,9 +923,9 @@ accounts_dialog_has_pending_change (EmpathyAccountsDialog *dialog,
if (gtk_tree_selection_get_selected (selection, &model, &iter))
gtk_tree_model_get (model, &iter, COL_ACCOUNT, account, -1);
- return priv->setting_widget_object != NULL
+ return priv->setting_widget != NULL
&& empathy_account_widget_contains_pending_changes (
- priv->setting_widget_object);
+ priv->setting_widget);
}
static void
@@ -1475,9 +1469,9 @@ accounts_dialog_model_selection_changed (GtkTreeSelection *selection,
if (settings != NULL)
g_object_unref (settings);
- if (priv->setting_widget_object != NULL)
+ if (priv->setting_widget != NULL)
{
- g_object_get (priv->setting_widget_object,
+ g_object_get (priv->setting_widget,
"creating-account", &creating, NULL);
}
@@ -1506,7 +1500,7 @@ accounts_dialog_selection_change_response_cb (GtkDialog *message_dialog,
priv->force_change_row = TRUE;
empathy_account_widget_discard_pending_changes (
- priv->setting_widget_object);
+ priv->setting_widget);
path = gtk_tree_row_reference_get_path (priv->destination_row);
selection = gtk_tree_view_get_selection (
@@ -2043,11 +2037,11 @@ accounts_dialog_accounts_model_row_inserted_cb (GtkTreeModel *model,
{
EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
- if (priv->setting_widget_object != NULL &&
+ if (priv->setting_widget != NULL &&
accounts_dialog_has_valid_accounts (dialog))
{
empathy_account_widget_set_other_accounts_exist (
- priv->setting_widget_object, TRUE);
+ priv->setting_widget, TRUE);
}
}
@@ -2058,11 +2052,11 @@ accounts_dialog_accounts_model_row_deleted_cb (GtkTreeModel *model,
{
EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
- if (priv->setting_widget_object != NULL &&
+ if (priv->setting_widget != NULL &&
!accounts_dialog_has_valid_accounts (dialog))
{
empathy_account_widget_set_other_accounts_exist (
- priv->setting_widget_object, FALSE);
+ priv->setting_widget, FALSE);
}
}
@@ -2744,10 +2738,10 @@ empathy_accounts_dialog_is_creating (EmpathyAccountsDialog *dialog)
EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
gboolean result = FALSE;
- if (priv->setting_widget_object == NULL)
+ if (priv->setting_widget == NULL)
goto out;
- g_object_get (priv->setting_widget_object,
+ g_object_get (priv->setting_widget,
"creating-account", &result, NULL);
out:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]