#include <libintl.h>
#include <libosso.h>
+#include <gconf/gconf-client.h>
#include <hildon/hildon.h>
#include <hildon-cp-plugin/hildon-cp-plugin-interface.h>
+#include "azimuth-gconf.h"
+
+static GtkWidget* button_enabled = NULL;
+static GConfClient *gconf_client;
+
+static void
+enabled_toggled (HildonCheckButton *button, gpointer user_data)
+{
+ gboolean active;
+
+ active = hildon_check_button_get_active (button);
+ if (active)
+ /* TODO: unblur other widgets */
+ g_debug ("Publishing position is enabled");
+ else
+ /* TODO: blur other widgets */
+ g_debug ("Publishing position is disabled");
+}
+
static GtkWidget*
create_main_dialog (gpointer window, osso_context_t *osso)
{
GtkWidget *dialog;
GtkWidget *bSave;
+ gboolean enabled;
dialog = g_object_new (GTK_TYPE_DIALOG,
"transient-for", GTK_WINDOW (window),
dgettext ("hildon-libs", "wdgt_bd_save"),
GTK_RESPONSE_OK);
+ button_enabled = hildon_check_button_new (HILDON_SIZE_FINGER_HEIGHT |
+ HILDON_SIZE_AUTO_WIDTH);
+ gtk_button_set_label (GTK_BUTTON (button_enabled),
+ "Enable Position Publishing");
+ g_signal_connect (button_enabled, "toggled", G_CALLBACK (enabled_toggled),
+ NULL);
+ enabled = gconf_client_get_bool (gconf_client, AZIMUTH_GCONF_KEY_ENABLED,
+ NULL);
+ hildon_check_button_set_active (HILDON_CHECK_BUTTON (button_enabled),
+ enabled);
+
+ gtk_box_pack_end (GTK_BOX (GTK_DIALOG(dialog)->vbox), button_enabled, FALSE,
+ FALSE, 0);
+
gtk_widget_show_all (dialog);
return dialog;
}
+static void
+save (void)
+{
+ gboolean enabled;
+
+ enabled = hildon_check_button_get_active (HILDON_CHECK_BUTTON (
+ button_enabled));
+ gconf_client_set_bool (gconf_client, AZIMUTH_GCONF_KEY_ENABLED, enabled,
+ NULL);
+}
+
osso_return_t
execute (osso_context_t *osso, gpointer data,
gboolean user_activated)
GtkWidget *dialog;
gint ret;
+ gconf_client = gconf_client_get_default ();
+
dialog = create_main_dialog (data, osso);
ret = gtk_dialog_run (GTK_DIALOG (dialog));
+ if (ret == GTK_RESPONSE_OK)
+ save ();
+
gtk_widget_destroy (dialog);
+ g_object_unref (gconf_client);
+ gconf_client = NULL;
return OSSO_OK;
}
-