diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2009-09-28 22:39:59 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2009-09-28 22:39:59 +0800 |
commit | c637daaf5750c1809e05ff39fa2070591410aac3 (patch) | |
tree | 4f7689596e516a491b83e1ed06c513f9c0ec684c | |
parent | ea2be64bc7b7e5a7c2c15c38fe6f61b27ca2fb14 (diff) | |
parent | 51e36d3edfb6557c4cbafd81c534e6e633f393aa (diff) | |
download | gsoc2013-empathy-c637daaf5750c1809e05ff39fa2070591410aac3.tar gsoc2013-empathy-c637daaf5750c1809e05ff39fa2070591410aac3.tar.gz gsoc2013-empathy-c637daaf5750c1809e05ff39fa2070591410aac3.tar.bz2 gsoc2013-empathy-c637daaf5750c1809e05ff39fa2070591410aac3.tar.lz gsoc2013-empathy-c637daaf5750c1809e05ff39fa2070591410aac3.tar.xz gsoc2013-empathy-c637daaf5750c1809e05ff39fa2070591410aac3.tar.zst gsoc2013-empathy-c637daaf5750c1809e05ff39fa2070591410aac3.zip |
Merge branch 'moblin'
Conflicts:
libempathy-gtk/empathy-account-widget.c
-rw-r--r-- | configure.ac | 28 | ||||
-rw-r--r-- | libempathy-gtk/Makefile.am | 2 | ||||
-rw-r--r-- | libempathy-gtk/empathy-account-widget.c | 78 |
3 files changed, 103 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 79fc93f89..4df19bd12 100644 --- a/configure.ac +++ b/configure.ac @@ -327,6 +327,33 @@ AC_SUBST(GEOCLUE_CFLAGS) AC_SUBST(GEOCLUE_LIBS) # ----------------------------------------------------------- +# moblin widgets support +# ----------------------------------------------------------- +AC_ARG_ENABLE(moblin, + AS_HELP_STRING([--enable-moblin=@<:no/yes@:>@], + [Enable moblin widgets]), , + enable_moblin=no) + +if test "x$enable_moblin" != "xno"; then + PKG_CHECK_MODULES(MOBLIN, + [nbtk-gtk-1.2], have_nbtk="yes", have_nbtk="no") + + if test "x$have_nbtk" = "xyes"; then + AC_DEFINE(HAVE_NBTK, 1, [Define if you have nbtk]) + fi +else + have_nbtk="no" +fi + +if test "x$enable_moblin" = "xyes" -a "x$have_nbtk" != "xyes"; then + AC_MSG_ERROR([Couldn't find moblin dependencies.]) +fi + +AM_CONDITIONAL(HAVE_NBTK, test "x$have_nbtk" = "xyes") +AC_SUBST(MOBLIN_CFLAGS) +AC_SUBST(MOBLIN_LIBS) + +# ----------------------------------------------------------- # Megaphone # ----------------------------------------------------------- AC_ARG_ENABLE(megaphone, @@ -524,6 +551,7 @@ Configure summary: Display maps (libchamplain).: ${have_libchamplain} Location awareness (Geoclue): ${have_geoclue} Adium themes (Webkit).......: ${have_webkit} + Moblin widgets (Nbtk).......: ${have_nbtk} Connectivity: NetworkManager integration..: ${have_nm} diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am index fb7e431cd..25e3dc9d9 100644 --- a/libempathy-gtk/Makefile.am +++ b/libempathy-gtk/Makefile.am @@ -10,6 +10,7 @@ AM_CPPFLAGS = \ $(ENCHANT_CFLAGS) \ $(LIBCHAMPLAIN_CFLAGS) \ $(GEOCLUE_CFLAGS) \ + $(MOBLIN_CFLAGS) \ $(WEBKIT_CFLAGS) \ $(WARN_CFLAGS) \ $(DISABLE_DEPRECATED) @@ -78,6 +79,7 @@ libempathy_gtk_la_LIBADD = \ $(ENCHANT_LIBS) \ $(LIBCHAMPLAIN_LIBS) \ $(GEOCLUE_LIBS) \ + $(MOBLIN_LIBS) \ $(WEBKIT_LIBS) \ $(top_builddir)/libempathy/libempathy.la diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 136168020..02f5778d4 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) { @@ -1048,20 +1058,35 @@ 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 */ { EmpathyAccountWidgetPriv *priv = GET_PRIV (user_data); EmpathyAccount *account; +#ifndef HAVE_NBTK gboolean state; state = gtk_toggle_button_get_active (toggle_button); +#endif + account = empathy_account_settings_get_account (priv->settings); /* Enable the account according to the value of the "Enabled" checkbox */ @@ -1258,15 +1283,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 +1317,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, + 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, 0, nb_columns, nb_rows - 1, nb_rows, + 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 +1481,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; } |