aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2009-04-16 20:27:52 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-04-16 20:27:52 +0800
commiteacb73133ebf891a92938751619776fb9dedd29d (patch)
treeb712659c819cb6cc014d304c1ad2c25b82006165
parent11e07f923c7bc1655cfd1609024304fa1c8fe2c3 (diff)
downloadgsoc2013-empathy-eacb73133ebf891a92938751619776fb9dedd29d.tar
gsoc2013-empathy-eacb73133ebf891a92938751619776fb9dedd29d.tar.gz
gsoc2013-empathy-eacb73133ebf891a92938751619776fb9dedd29d.tar.bz2
gsoc2013-empathy-eacb73133ebf891a92938751619776fb9dedd29d.tar.lz
gsoc2013-empathy-eacb73133ebf891a92938751619776fb9dedd29d.tar.xz
gsoc2013-empathy-eacb73133ebf891a92938751619776fb9dedd29d.tar.zst
gsoc2013-empathy-eacb73133ebf891a92938751619776fb9dedd29d.zip
Port account widgets to new API
From: Xavier Claessens <xclaesse@gmail.com> svn path=/trunk/; revision=2842
-rw-r--r--libempathy-gtk/empathy-account-widget-irc.c17
-rw-r--r--libempathy-gtk/empathy-account-widget-sip.c19
-rw-r--r--libempathy-gtk/empathy-account-widget.c183
-rw-r--r--libempathy-gtk/empathy-account-widget.h7
-rw-r--r--src/empathy-accounts-dialog.c1
5 files changed, 107 insertions, 120 deletions
diff --git a/libempathy-gtk/empathy-account-widget-irc.c b/libempathy-gtk/empathy-account-widget-irc.c
index a5111381c..043f05dc8 100644
--- a/libempathy-gtk/empathy-account-widget-irc.c
+++ b/libempathy-gtk/empathy-account-widget-irc.c
@@ -26,7 +26,6 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#include <glade/glade.h>
#include <libmissioncontrol/mc-account.h>
#include <libmissioncontrol/mc-protocol.h>
@@ -429,7 +428,7 @@ empathy_account_widget_irc_new (McAccount *account)
{
EmpathyAccountWidgetIrc *settings;
gchar *dir, *user_file_with_path, *global_file_with_path;
- GladeXML *glade;
+ GtkBuilder *gui;
GtkListStore *store;
GtkCellRenderer *renderer;
gchar *filename;
@@ -458,11 +457,9 @@ empathy_account_widget_irc_new (McAccount *account)
g_free (global_file_with_path);
g_free (user_file_with_path);
- filename = empathy_file_lookup ("empathy-account-widget-irc.glade",
+ filename = empathy_file_lookup ("empathy-account-widget-irc.ui",
"libempathy-gtk");
- glade = empathy_glade_get_file (filename,
- "vbox_irc_settings",
- NULL,
+ gui = empathy_builder_get_file (filename,
"vbox_irc_settings", &settings->vbox_settings,
"combobox_network", &settings->combobox_network,
"button_network", &settings->button_network,
@@ -493,14 +490,14 @@ empathy_account_widget_irc_new (McAccount *account)
account_widget_irc_setup (settings);
- empathy_account_widget_handle_params (account, glade,
+ empathy_account_widget_handle_params (account, gui,
"entry_nick", "account",
"entry_fullname", "fullname",
"entry_password", "password",
"entry_quit_message", "quit-message",
NULL);
- empathy_glade_connect (glade, settings,
+ empathy_builder_connect (gui, settings,
"vbox_irc_settings", "destroy", account_widget_irc_destroy_cb,
"button_network", "clicked", account_widget_irc_button_edit_network_clicked_cb,
"button_add_network", "clicked", account_widget_irc_button_add_network_clicked_cb,
@@ -508,7 +505,9 @@ empathy_account_widget_irc_new (McAccount *account)
"combobox_network", "changed", account_widget_irc_combobox_network_changed_cb,
NULL);
- g_object_unref (glade);
+ g_object_ref (settings->vbox_settings);
+ g_object_force_floating (G_OBJECT (settings->vbox_settings));
+ g_object_unref (gui);
return settings->vbox_settings;
}
diff --git a/libempathy-gtk/empathy-account-widget-sip.c b/libempathy-gtk/empathy-account-widget-sip.c
index c5224df73..ffac231d6 100644
--- a/libempathy-gtk/empathy-account-widget-sip.c
+++ b/libempathy-gtk/empathy-account-widget-sip.c
@@ -27,7 +27,6 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
-#include <glade/glade.h>
#include <libmissioncontrol/mc-account.h>
#include <libmissioncontrol/mc-protocol.h>
@@ -80,17 +79,15 @@ GtkWidget *
empathy_account_widget_sip_new (McAccount *account)
{
EmpathyAccountWidgetSip *settings;
- GladeXML *glade;
+ GtkBuilder *gui;
gchar *filename;
settings = g_slice_new0 (EmpathyAccountWidgetSip);
settings->account = g_object_ref (account);
- filename = empathy_file_lookup ("empathy-account-widget-sip.glade",
+ filename = empathy_file_lookup ("empathy-account-widget-sip.ui",
"libempathy-gtk");
- glade = empathy_glade_get_file (filename,
- "vbox_sip_settings",
- NULL,
+ gui = empathy_builder_get_file (filename,
"vbox_sip_settings", &settings->vbox_settings,
"entry_stun-server", &settings->entry_stun_server,
"spinbutton_stun-port", &settings->spinbutton_stun_part,
@@ -98,7 +95,7 @@ empathy_account_widget_sip_new (McAccount *account)
NULL);
g_free (filename);
- empathy_account_widget_handle_params (account, glade,
+ empathy_account_widget_handle_params (account, gui,
"entry_userid", "account",
"entry_password", "password",
"checkbutton_discover-stun", "discover-stun",
@@ -106,19 +103,21 @@ empathy_account_widget_sip_new (McAccount *account)
"spinbutton_stun-port", "stun-port",
NULL);
- empathy_account_widget_add_forget_button (account, glade,
+ empathy_account_widget_add_forget_button (account, gui,
"button_forget",
"entry_password");
account_widget_sip_discover_stun_toggled_cb (settings->checkbutton_discover_stun,
settings);
- empathy_glade_connect (glade, settings,
+ empathy_builder_connect (gui, settings,
"vbox_sip_settings", "destroy", account_widget_sip_destroy_cb,
"checkbutton_discover-stun", "toggled", account_widget_sip_discover_stun_toggled_cb,
NULL);
- g_object_unref (glade);
+ g_object_ref (settings->vbox_settings);
+ g_object_force_floating (G_OBJECT (settings->vbox_settings));
+ g_object_unref (gui);
return settings->vbox_settings;
}
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index b48d19e53..e57fb2802 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -310,6 +310,7 @@ accounts_widget_generic_setup (McAccount *account,
n_rows - 1, n_rows,
GTK_FILL, 0,
0, 0);
+ gtk_widget_show (widget);
widget = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table_settings),
@@ -318,6 +319,7 @@ accounts_widget_generic_setup (McAccount *account,
n_rows - 1, n_rows,
GTK_FILL | GTK_EXPAND, 0,
0, 0);
+ gtk_widget_show (widget);
}
/* int types: ynqiuxt. double type is 'd' */
else if (param->signature[0] == 'y' ||
@@ -355,6 +357,7 @@ accounts_widget_generic_setup (McAccount *account,
n_rows - 1, n_rows,
GTK_FILL, 0,
0, 0);
+ gtk_widget_show (widget);
widget = gtk_spin_button_new_with_range (minint, maxint, step);
gtk_table_attach (GTK_TABLE (table_settings),
@@ -363,6 +366,7 @@ accounts_widget_generic_setup (McAccount *account,
n_rows - 1, n_rows,
GTK_FILL | GTK_EXPAND, 0,
0, 0);
+ gtk_widget_show (widget);
}
else if (param->signature[0] == 'b') {
widget = gtk_check_button_new_with_label (param_name_formatted);
@@ -372,6 +376,7 @@ accounts_widget_generic_setup (McAccount *account,
n_rows - 1, n_rows,
GTK_FILL | GTK_EXPAND, 0,
0, 0);
+ gtk_widget_show (widget);
} else {
DEBUG ("Unknown signature for param %s: %s",
param_name_formatted, param->signature);
@@ -391,58 +396,56 @@ accounts_widget_generic_setup (McAccount *account,
static void
account_widget_handle_params_valist (McAccount *account,
- GladeXML *gui,
- const gchar *first_widget_name,
+ GtkBuilder *gui,
+ const gchar *first_widget,
va_list args)
{
- GtkWidget *widget;
- const gchar *widget_name;
+ GObject *object;
+ const gchar *name;
- for (widget_name = first_widget_name; widget_name; widget_name = va_arg (args, gchar*)) {
+ for (name = first_widget; name; name = va_arg (args, const gchar *)) {
const gchar *param_name;
- param_name = va_arg (args, gchar*);
+ param_name = va_arg (args, const gchar *);
+ object = gtk_builder_get_object (gui, name);
- widget = glade_xml_get_widget (gui, widget_name);
-
- if (!widget) {
- g_warning ("Glade is missing widget '%s'.", widget_name);
+ if (!object) {
+ g_warning ("Builder is missing object '%s'.", name);
continue;
}
- account_widget_setup_widget (widget, account, param_name);
+ account_widget_setup_widget (GTK_WIDGET (object), account, param_name);
}
}
void
empathy_account_widget_handle_params (McAccount *account,
- GladeXML *gui,
- const gchar *first_widget_name,
+ GtkBuilder *gui,
+ const gchar *first_widget,
...)
{
va_list args;
g_return_if_fail (MC_IS_ACCOUNT (account));
+ g_return_if_fail (GTK_IS_BUILDER (gui));
- va_start (args, first_widget_name);
- account_widget_handle_params_valist (account, gui,
- first_widget_name,
- args);
+ va_start (args, first_widget);
+ account_widget_handle_params_valist (account, gui, first_widget, args);
va_end (args);
}
void
empathy_account_widget_add_forget_button (McAccount *account,
- GladeXML *glade,
+ GtkBuilder *gui,
const gchar *button,
const gchar *entry)
{
GtkWidget *button_forget;
GtkWidget *entry_password;
- gchar *password = NULL;
+ gchar *password = NULL;
- button_forget = glade_xml_get_widget (glade, button);
- entry_password = glade_xml_get_widget (glade, entry);
+ button_forget = GTK_WIDGET (gtk_builder_get_object (gui, button));
+ entry_password = GTK_WIDGET (gtk_builder_get_object (gui, entry));
mc_account_get_param_string (account, "password", &password);
gtk_widget_set_sensitive (button_forget, !EMP_STR_EMPTY (password));
@@ -459,7 +462,7 @@ empathy_account_widget_add_forget_button (McAccount *account,
GtkWidget *
empathy_account_widget_generic_new (McAccount *account)
{
- GladeXML *glade;
+ GtkBuilder *gui;
GtkWidget *widget;
GtkWidget *table_common_settings;
GtkWidget *table_advanced_settings;
@@ -467,11 +470,9 @@ empathy_account_widget_generic_new (McAccount *account)
g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
- filename = empathy_file_lookup ("empathy-account-widget-generic.glade",
+ filename = empathy_file_lookup ("empathy-account-widget-generic.ui",
"libempathy-gtk");
- glade = empathy_glade_get_file (filename,
- "vbox_generic_settings",
- NULL,
+ gui = empathy_builder_get_file (filename,
"vbox_generic_settings", &widget,
"table_common_settings", &table_common_settings,
"table_advanced_settings", &table_advanced_settings,
@@ -480,9 +481,9 @@ empathy_account_widget_generic_new (McAccount *account)
accounts_widget_generic_setup (account, table_common_settings, table_advanced_settings);
- g_object_unref (glade);
-
- gtk_widget_show_all (widget);
+ g_object_ref (widget);
+ g_object_force_floating (G_OBJECT (widget));
+ g_object_unref (gui);
return widget;
}
@@ -490,20 +491,18 @@ empathy_account_widget_generic_new (McAccount *account)
GtkWidget *
empathy_account_widget_salut_new (McAccount *account)
{
- GladeXML *glade;
+ GtkBuilder *gui;
GtkWidget *widget;
gchar *filename;
- filename = empathy_file_lookup ("empathy-account-widget-salut.glade",
+ filename = empathy_file_lookup ("empathy-account-widget-salut.ui",
"libempathy-gtk");
- glade = empathy_glade_get_file (filename,
- "vbox_salut_settings",
- NULL,
+ gui = empathy_builder_get_file (filename,
"vbox_salut_settings", &widget,
NULL);
g_free (filename);
- empathy_account_widget_handle_params (account, glade,
+ empathy_account_widget_handle_params (account, gui,
"entry_published", "published-name",
"entry_nickname", "nickname",
"entry_first_name", "first-name",
@@ -512,9 +511,11 @@ empathy_account_widget_salut_new (McAccount *account)
"entry_jid", "jid",
NULL);
- g_object_unref (glade);
+ g_object_unref (gui);
- gtk_widget_show (widget);
+ g_object_ref (widget);
+ g_object_force_floating (G_OBJECT (widget));
+ g_object_unref (gui);
return widget;
}
@@ -522,33 +523,31 @@ empathy_account_widget_salut_new (McAccount *account)
GtkWidget *
empathy_account_widget_msn_new (McAccount *account)
{
- GladeXML *glade;
+ GtkBuilder *gui;
GtkWidget *widget;
gchar *filename;
- filename = empathy_file_lookup ("empathy-account-widget-msn.glade",
+ filename = empathy_file_lookup ("empathy-account-widget-msn.ui",
"libempathy-gtk");
- glade = empathy_glade_get_file (filename,
- "vbox_msn_settings",
- NULL,
+ gui = empathy_builder_get_file (filename,
"vbox_msn_settings", &widget,
NULL);
g_free (filename);
- empathy_account_widget_handle_params (account, glade,
+ empathy_account_widget_handle_params (account, gui,
"entry_id", "account",
"entry_password", "password",
"entry_server", "server",
"spinbutton_port", "port",
NULL);
- empathy_account_widget_add_forget_button (account, glade,
+ empathy_account_widget_add_forget_button (account, gui,
"button_forget",
"entry_password");
- g_object_unref (glade);
-
- gtk_widget_show (widget);
+ g_object_ref (widget);
+ g_object_force_floating (G_OBJECT (widget));
+ g_object_unref (gui);
return widget;
}
@@ -556,24 +555,22 @@ empathy_account_widget_msn_new (McAccount *account)
GtkWidget *
empathy_account_widget_jabber_new (McAccount *account)
{
- GladeXML *glade;
+ GtkBuilder *gui;
GtkWidget *widget;
GtkWidget *spinbutton_port;
GtkWidget *checkbutton_ssl;
gchar *filename;
- filename = empathy_file_lookup ("empathy-account-widget-jabber.glade",
+ filename = empathy_file_lookup ("empathy-account-widget-jabber.ui",
"libempathy-gtk");
- glade = empathy_glade_get_file (filename,
- "vbox_jabber_settings",
- NULL,
+ gui = empathy_builder_get_file (filename,
"vbox_jabber_settings", &widget,
"spinbutton_port", &spinbutton_port,
"checkbutton_ssl", &checkbutton_ssl,
NULL);
g_free (filename);
- empathy_account_widget_handle_params (account, glade,
+ empathy_account_widget_handle_params (account, gui,
"entry_id", "account",
"entry_password", "password",
"entry_resource", "resource",
@@ -585,7 +582,7 @@ empathy_account_widget_jabber_new (McAccount *account)
"checkbutton_encryption", "require-encryption",
NULL);
- empathy_account_widget_add_forget_button (account, glade,
+ empathy_account_widget_add_forget_button (account, gui,
"button_forget",
"entry_password");
@@ -593,9 +590,9 @@ empathy_account_widget_jabber_new (McAccount *account)
G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
spinbutton_port);
- g_object_unref (glade);
-
- gtk_widget_show (widget);
+ g_object_ref (widget);
+ g_object_force_floating (G_OBJECT (widget));
+ g_object_unref (gui);
return widget;
}
@@ -603,22 +600,20 @@ empathy_account_widget_jabber_new (McAccount *account)
GtkWidget *
empathy_account_widget_icq_new (McAccount *account)
{
- GladeXML *glade;
+ GtkBuilder *gui;
GtkWidget *widget;
GtkWidget *spinbutton_port;
gchar *filename;
- filename = empathy_file_lookup ("empathy-account-widget-icq.glade",
+ filename = empathy_file_lookup ("empathy-account-widget-icq.ui",
"libempathy-gtk");
- glade = empathy_glade_get_file (filename,
- "vbox_icq_settings",
- NULL,
+ gui = empathy_builder_get_file (filename,
"vbox_icq_settings", &widget,
"spinbutton_port", &spinbutton_port,
NULL);
g_free (filename);
- empathy_account_widget_handle_params (account, glade,
+ empathy_account_widget_handle_params (account, gui,
"entry_uin", "account",
"entry_password", "password",
"entry_server", "server",
@@ -626,13 +621,13 @@ empathy_account_widget_icq_new (McAccount *account)
"entry_charset", "charset",
NULL);
- empathy_account_widget_add_forget_button (account, glade,
+ empathy_account_widget_add_forget_button (account, gui,
"button_forget",
"entry_password");
- g_object_unref (glade);
-
- gtk_widget_show (widget);
+ g_object_ref (widget);
+ g_object_force_floating (G_OBJECT (widget));
+ g_object_unref (gui);
return widget;
}
@@ -640,35 +635,33 @@ empathy_account_widget_icq_new (McAccount *account)
GtkWidget *
empathy_account_widget_aim_new (McAccount *account)
{
- GladeXML *glade;
+ GtkBuilder *gui;
GtkWidget *widget;
GtkWidget *spinbutton_port;
gchar *filename;
- filename = empathy_file_lookup ("empathy-account-widget-aim.glade",
+ filename = empathy_file_lookup ("empathy-account-widget-aim.ui",
"libempathy-gtk");
- glade = empathy_glade_get_file (filename,
- "vbox_aim_settings",
- NULL,
+ gui = empathy_builder_get_file (filename,
"vbox_aim_settings", &widget,
"spinbutton_port", &spinbutton_port,
NULL);
g_free (filename);
- empathy_account_widget_handle_params (account, glade,
+ empathy_account_widget_handle_params (account, gui,
"entry_screenname", "account",
"entry_password", "password",
"entry_server", "server",
"spinbutton_port", "port",
NULL);
- empathy_account_widget_add_forget_button (account, glade,
+ empathy_account_widget_add_forget_button (account, gui,
"button_forget",
"entry_password");
- g_object_unref (glade);
-
- gtk_widget_show (widget);
+ g_object_ref (widget);
+ g_object_force_floating (G_OBJECT (widget));
+ g_object_unref (gui);
return widget;
}
@@ -676,20 +669,18 @@ empathy_account_widget_aim_new (McAccount *account)
GtkWidget *
empathy_account_widget_yahoo_new (McAccount *account)
{
- GladeXML *glade;
+ GtkBuilder *gui;
GtkWidget *widget;
gchar *filename;
- filename = empathy_file_lookup ("empathy-account-widget-yahoo.glade",
+ filename = empathy_file_lookup ("empathy-account-widget-yahoo.ui",
"libempathy-gtk");
- glade = empathy_glade_get_file (filename,
- "vbox_yahoo_settings",
- NULL,
+ gui = empathy_builder_get_file (filename,
"vbox_yahoo_settings", &widget,
NULL);
g_free (filename);
- empathy_account_widget_handle_params (account, glade,
+ empathy_account_widget_handle_params (account, gui,
"entry_id", "account",
"entry_password", "password",
"entry_server", "server",
@@ -700,13 +691,13 @@ empathy_account_widget_yahoo_new (McAccount *account)
"checkbutton_ignore_invites", "ignore-invites",
NULL);
- empathy_account_widget_add_forget_button (account, glade,
+ empathy_account_widget_add_forget_button (account, gui,
"button_forget",
"entry_password");
- g_object_unref (glade);
-
- gtk_widget_show (widget);
+ g_object_ref (widget);
+ g_object_force_floating (G_OBJECT (widget));
+ g_object_unref (gui);
return widget;
}
@@ -714,33 +705,31 @@ empathy_account_widget_yahoo_new (McAccount *account)
GtkWidget *
empathy_account_widget_groupwise_new (McAccount *account)
{
- GladeXML *glade;
+ GtkBuilder *gui;
GtkWidget *widget;
gchar *filename;
- filename = empathy_file_lookup ("empathy-account-widget-groupwise.glade",
+ filename = empathy_file_lookup ("empathy-account-widget-groupwise.ui",
"libempathy-gtk");
- glade = empathy_glade_get_file (filename,
- "vbox_groupwise_settings",
- NULL,
+ gui = empathy_builder_get_file (filename,
"vbox_groupwise_settings", &widget,
NULL);
g_free (filename);
- empathy_account_widget_handle_params (account, glade,
+ empathy_account_widget_handle_params (account, gui,
"entry_id", "account",
"entry_password", "password",
"entry_server", "server",
"spinbutton_port", "port",
NULL);
- empathy_account_widget_add_forget_button (account, glade,
+ empathy_account_widget_add_forget_button (account, gui,
"button_forget",
"entry_password");
- g_object_unref (glade);
-
- gtk_widget_show (widget);
+ g_object_ref (widget);
+ g_object_force_floating (G_OBJECT (widget));
+ g_object_unref (gui);
return widget;
}
diff --git a/libempathy-gtk/empathy-account-widget.h b/libempathy-gtk/empathy-account-widget.h
index 52e907d00..038439ee5 100644
--- a/libempathy-gtk/empathy-account-widget.h
+++ b/libempathy-gtk/empathy-account-widget.h
@@ -26,18 +26,17 @@
#define __EMPATHY_ACCOUNT_WIDGET_GENERIC_H__
#include <gtk/gtk.h>
-#include <glade/glade.h>
#include <libmissioncontrol/mc-account.h>
G_BEGIN_DECLS
void empathy_account_widget_handle_params (McAccount *account,
- GladeXML *glade,
- const gchar *first_widget_name,
+ GtkBuilder *gui,
+ const gchar *first_widget,
...);
void empathy_account_widget_add_forget_button (McAccount *account,
- GladeXML *glade,
+ GtkBuilder *gui,
const gchar *button,
const gchar *entry);
GtkWidget *empathy_account_widget_generic_new (McAccount *account);
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index 4d9456684..b1baf6f2c 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -260,6 +260,7 @@ accounts_dialog_update_account (EmpathyAccountsDialog *dialog,
gtk_container_add (GTK_CONTAINER (dialog->alignment_settings),
dialog->settings_widget);
+ gtk_widget_show (dialog->settings_widget);
gtk_image_set_from_icon_name (GTK_IMAGE (dialog->image_type),