aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-account-widget.c
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy-gtk/empathy-account-widget.c')
-rw-r--r--libempathy-gtk/empathy-account-widget.c75
1 files changed, 70 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c
index 641ef00ba..079f3b2a0 100644
--- a/libempathy-gtk/empathy-account-widget.c
+++ b/libempathy-gtk/empathy-account-widget.c
@@ -30,6 +30,10 @@
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
+#ifdef HAVE_NBTK
+#include <nbtk/nbtk-gtk.h>
+#endif
+
#include <libempathy/empathy-utils.h>
#include <libempathy/empathy-account.h>
@@ -617,8 +621,14 @@ account_widget_applied_cb (GObject *source_object,
{
gboolean enabled_checked;
- enabled_checked = gtk_toggle_button_get_active (
- GTK_TOGGLE_BUTTON (priv->enabled_checkbox));
+ enabled_checked =
+#ifndef HAVE_NBTK
+ gtk_toggle_button_get_active (
+ GTK_TOGGLE_BUTTON (priv->enabled_checkbox));
+#else
+ nbtk_gtk_light_switch_get_active (
+ NBTK_GTK_LIGHT_SWITCH (priv->enabled_checkbox));
+#endif
if (empathy_account_is_enabled (account) && enabled_checked)
{
@@ -1055,14 +1065,26 @@ empathy_account_widget_enabled_cb (EmpathyAccount *account,
if (priv->enabled_checkbox != NULL)
{
+#ifndef HAVE_NBTK
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->enabled_checkbox),
enabled);
+#else
+ nbtk_gtk_light_switch_set_active (
+ NBTK_GTK_LIGHT_SWITCH (priv->enabled_checkbox),
+ enabled);
+#endif /* HAVE_NBTK */
}
}
static void
+#ifndef HAVE_NBTK
account_widget_enabled_released_cb (GtkToggleButton *toggle_button,
gpointer user_data)
+#else
+account_widget_switch_flipped_cb (NbtkGtkLightSwitch *sw,
+ gboolean state,
+ gpointer user_data)
+#endif /* HAVE_NBTK */
{
account_widget_handle_control_buttons_sensitivity (
EMPATHY_ACCOUNT_WIDGET (user_data));
@@ -1258,15 +1280,33 @@ do_constructed (GObject *obj)
/* handle the "Enabled" checkbox. We only add it when modifying an account */
if (!priv->creating_account && priv->table_common_settings != NULL)
{
+#ifdef HAVE_NBTK
+ GtkWidget *w;
+#endif
guint nb_rows, nb_columns;
- priv->enabled_checkbox =
- gtk_check_button_new_with_label (_("Enabled"));
priv->original_enabled_checkbox_value =
empathy_account_is_enabled (account);
+
+#ifndef HAVE_NBTK
+ priv->enabled_checkbox =
+ gtk_check_button_new_with_label (_("Enabled"));
+
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (priv->enabled_checkbox),
priv->original_enabled_checkbox_value);
+#else
+ w = gtk_label_new (_("Account:"));
+ gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5);
+
+ priv->enabled_checkbox = nbtk_gtk_light_switch_new ();
+
+ nbtk_gtk_light_switch_set_active (
+ NBTK_GTK_LIGHT_SWITCH (priv->enabled_checkbox),
+ priv->original_enabled_checkbox_value);
+
+ gtk_widget_show (w);
+#endif /* HAVE_NBTK */
g_object_get (priv->table_common_settings, "n-rows", &nb_rows,
"n-columns", &nb_columns, NULL);
@@ -1274,14 +1314,31 @@ do_constructed (GObject *obj)
gtk_table_resize (GTK_TABLE (priv->table_common_settings), ++nb_rows,
nb_columns);
+#ifndef HAVE_NBTK
gtk_table_attach (GTK_TABLE (priv->table_common_settings),
- priv->enabled_checkbox, 0, nb_columns, nb_rows - 1, nb_rows,
+ priv->enabled_checkbox,
+ 0, nb_columns, nb_rows - 1, nb_rows,
GTK_EXPAND | GTK_FILL, 0, 0, 0);
+#else
+ gtk_table_attach (GTK_TABLE (priv->table_common_settings),
+ w,
+ 0, 1, nb_rows - 1, nb_rows,
+ GTK_FILL, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE (priv->table_common_settings),
+ priv->enabled_checkbox,
+ 1, nb_columns, nb_rows - 1, nb_rows,
+ GTK_EXPAND | GTK_FILL, 0, 0, 0);
+#endif /* HAVE_NBTK */
gtk_widget_show (priv->enabled_checkbox);
+#ifndef HAVE_NBTK
g_signal_connect (G_OBJECT (priv->enabled_checkbox), "released",
G_CALLBACK (account_widget_enabled_released_cb), self);
+#else
+ g_signal_connect (G_OBJECT (priv->enabled_checkbox), "switch-flipped",
+ G_CALLBACK (account_widget_switch_flipped_cb), self);
+#endif /* HAVE_NBTK */
}
/* hook up to widget destruction to unref ourselves */
@@ -1421,8 +1478,16 @@ empathy_account_widget_discard_pending_changes
EmpathyAccountWidgetPriv *priv = GET_PRIV (widget);
empathy_account_settings_discard_changes (priv->settings);
+
+#ifndef HAVE_NBTK
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->enabled_checkbox),
priv->original_enabled_checkbox_value);
+#else
+ nbtk_gtk_light_switch_set_active (
+ NBTK_GTK_LIGHT_SWITCH (priv->enabled_checkbox),
+ priv->original_enabled_checkbox_value);
+#endif /* HAVE_NBTK */
+
priv->contains_pending_changes = FALSE;
}