2 * controlpanel-applet.c.c - Source for Azimuth's control panel applet
3 * Copyright (C) 2010 Collabora
4 * @author Alban Crequy <alban.crequy@collabora.co.uk>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <gconf/gconf-client.h>
24 #include <hildon/hildon.h>
25 #include <hildon-cp-plugin/hildon-cp-plugin-interface.h>
27 #include "azimuth-gconf.h"
29 static GtkWidget* button_enabled = NULL;
30 static GConfClient *gconf_client;
33 enabled_toggled (HildonCheckButton *button, gpointer user_data)
37 active = hildon_check_button_get_active (button);
39 /* TODO: unblur other widgets */
40 g_debug ("Publishing position is enabled");
42 /* TODO: blur other widgets */
43 g_debug ("Publishing position is disabled");
47 create_main_dialog (gpointer window, osso_context_t *osso)
53 dialog = g_object_new (GTK_TYPE_DIALOG,
54 "transient-for", GTK_WINDOW (window),
55 "destroy-with-parent", TRUE,
57 "has-separator", FALSE,
60 gtk_window_set_title (GTK_WINDOW (dialog),
63 bSave = gtk_dialog_add_button (GTK_DIALOG (dialog),
64 dgettext ("hildon-libs", "wdgt_bd_save"),
67 button_enabled = hildon_check_button_new (HILDON_SIZE_FINGER_HEIGHT |
68 HILDON_SIZE_AUTO_WIDTH);
69 gtk_button_set_label (GTK_BUTTON (button_enabled),
70 "Enable Position Publishing");
71 g_signal_connect (button_enabled, "toggled", G_CALLBACK (enabled_toggled),
73 enabled = gconf_client_get_bool (gconf_client, AZIMUTH_GCONF_KEY_ENABLED,
75 hildon_check_button_set_active (HILDON_CHECK_BUTTON (button_enabled),
78 gtk_box_pack_end (GTK_BOX (GTK_DIALOG(dialog)->vbox), button_enabled, FALSE,
81 gtk_widget_show_all (dialog);
91 enabled = hildon_check_button_get_active (HILDON_CHECK_BUTTON (
93 gconf_client_set_bool (gconf_client, AZIMUTH_GCONF_KEY_ENABLED, enabled,
98 execute (osso_context_t *osso, gpointer data,
99 gboolean user_activated)
104 gconf_client = gconf_client_get_default ();
106 dialog = create_main_dialog (data, osso);
108 ret = gtk_dialog_run (GTK_DIALOG (dialog));
110 if (ret == GTK_RESPONSE_OK)
113 gtk_widget_destroy (dialog);
115 g_object_unref (gconf_client);