GtkWidget *dialog;
GtkWidget *box;
GConfClient *gconf;
+ guint notify_id;
};
HD_DEFINE_PLUGIN_MODULE (TweakrProfileStatusPlugin,
basename = g_path_get_basename (path);
hildon_button_set_value (HILDON_BUTTON (plugin->priv->button), basename);
gconf_client_set_string (plugin->priv->gconf,
- "/system/tweakr/current-preset", basename, NULL);
+ GCONF_PATH "/current-preset", basename, NULL);
g_free (basename);
gtk_dialog_response (GTK_DIALOG (plugin->priv->dialog), GTK_RESPONSE_OK);
}
static void
+_create_main_button (TweakrProfileStatusPlugin *plugin)
+{
+ gchar *current;
+ GtkWidget *image;
+
+ plugin->priv->button = hildon_button_new
+ (HILDON_SIZE_AUTO | HILDON_SIZE_FINGER_HEIGHT,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL);
+ hildon_button_set_title (HILDON_BUTTON (plugin->priv->button),
+ _("Profile preset"));
+
+ current = gconf_client_get_string (plugin->priv->gconf,
+ GCONF_PATH "/current-preset",
+ NULL);
+
+ hildon_button_set_value (HILDON_BUTTON (plugin->priv->button), current);
+ g_free (current);
+ gtk_button_set_alignment (GTK_BUTTON (plugin->priv->button), 0.0f, 0.5f);
+
+ image = gtk_image_new_from_icon_name ("control_tweakr",
+ GTK_ICON_SIZE_BUTTON);
+ hildon_button_set_image (HILDON_BUTTON (plugin->priv->button), image);
+
+ g_signal_connect (G_OBJECT (plugin->priv->button), "clicked",
+ G_CALLBACK (_button_clicked), plugin);
+
+ gtk_container_add (GTK_CONTAINER (plugin), plugin->priv->button);
+ gtk_widget_show_all (plugin->priv->button);
+}
+
+static void
+_current_preset_changed_cb (GConfClient *client, guint notify_id,
+ GConfEntry *entry,
+ TweakrProfileStatusPlugin *plugin)
+{
+ if (plugin->priv->button == NULL)
+ {
+ _create_main_button (plugin);
+ gtk_widget_show (GTK_WIDGET (plugin));
+ }
+ else
+ {
+ hildon_button_set_value (HILDON_BUTTON (plugin->priv->button),
+ gconf_value_get_string (entry->value));
+ }
+}
+
+
+static void
tweakr_profile_status_plugin_class_finalize
(TweakrProfileStatusPluginClass *klass)
{
if (plugin->priv->gconf != NULL)
{
+ if (plugin->priv->notify_id)
+ {
+ gconf_client_notify_remove (plugin->priv->gconf,
+ plugin->priv->notify_id);
+ plugin->priv->notify_id = 0;
+ }
+
+ gconf_client_remove_dir (plugin->priv->gconf, GCONF_PATH, NULL);
g_object_unref (plugin->priv->gconf);
plugin->priv->gconf = NULL;
}
tweakr_profile_status_plugin_init (TweakrProfileStatusPlugin *plugin)
{
gchar *current;
- GtkWidget *image;
plugin->priv = TWEAKR_PROFILE_STATUS_PLUGIN_GET_PRIVATE (plugin);
plugin->priv->gconf = gconf_client_get_default ();
- plugin->priv->button = hildon_button_new
- (HILDON_SIZE_AUTO | HILDON_SIZE_FINGER_HEIGHT,
- HILDON_BUTTON_ARRANGEMENT_VERTICAL);
- hildon_button_set_title (HILDON_BUTTON (plugin->priv->button),
- _("Tweakr profile preset"));
+ gconf_client_add_dir (plugin->priv->gconf, GCONF_PATH,
+ GCONF_CLIENT_PRELOAD_NONE, NULL);
+ plugin->priv->notify_id = gconf_client_notify_add
+ (plugin->priv->gconf, GCONF_PATH "/current-preset",
+ (GConfClientNotifyFunc) _current_preset_changed_cb, plugin,
+ NULL, NULL);
current = gconf_client_get_string (plugin->priv->gconf,
- "/system/tweakr/current-preset",
+ GCONF_PATH "/current-preset",
NULL);
- hildon_button_set_value (HILDON_BUTTON (plugin->priv->button), current);
- g_free (current);
- gtk_button_set_alignment (GTK_BUTTON (plugin->priv->button), 0.0f, 0.5f);
- image = gtk_image_new_from_icon_name ("control_tweakr",
- GTK_ICON_SIZE_BUTTON);
- hildon_button_set_image (HILDON_BUTTON (plugin->priv->button), image);
-
- g_signal_connect (G_OBJECT (plugin->priv->button), "clicked",
- G_CALLBACK (_button_clicked), plugin);
-
- gtk_container_add (GTK_CONTAINER (plugin), plugin->priv->button);
- gtk_widget_show_all (plugin->priv->button);
+ if (current == NULL)
+ return;
+ _create_main_button (plugin);
gtk_widget_show (GTK_WIDGET (plugin));
+ g_free (current);
}
(TWEAKR_SECTION (section)),
GTK_TYPE_WINDOW));
dialog = gtk_dialog_new_with_buttons
- (_("Save current profile with new name"),
+ (_("Preset name"),
parent,
GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
GTK_STOCK_OK, GTK_RESPONSE_OK,
/* Save the settings to our own gconf directory. */
gconf = gconf_client_get_default ();
+ gconf_client_set_string (gconf, GCONF_PATH "/current-preset",
+ _("None"), NULL);
values = profile_get_values ("general");
for (values_iter = values;
values_iter->pv_key != NULL;
TweakrSection *iface;
iface = TWEAKR_SECTION (section);
- iface->name = _("Profiles");
+ iface->name = _("Profile presets");
iface->widget = gtk_vbox_new (FALSE, 0);
section->preset_button = _build_save_preset_button (section);
"a \"Ignora\" vuol dire che l'unico modo per spegnere "
"il telefono sarĂ rimuovere la batteria. Continuare?"
-# tweakr-profile-section.c
-msgid "general"
-msgstr "Generale"
+# tweakr-profile.c
+msgid "Profile presets"
+msgstr "Varianti di profilo"
-msgid "silent"
-msgstr "Silenzioso"
+msgid "Preset name"
+msgstr "Nome della variante"
-msgid "Meeting"
-msgstr "Riunione"
+msgid "Enter the name first."
+msgstr "Inserire prima il nome"
-msgid "Night"
-msgstr "Notte"
+msgid "Preset saved. Use the status menu to select it."
+msgstr "Variante del profilo salvata. Puoi selezionarla nel menu di stato."
-msgid "User custom profile"
-msgstr "User custom profile"
+msgid "Save current General profile to new preset"
+msgstr "Nuova variante del profilo Generale"
-msgid "Profiles"
-msgstr "Profiles"
+# tweakr-profile-status-menu-widget.c
+msgid "Preset activated."
+msgstr "Variante attivata."
+
+msgid "Select preset"
+msgstr "Selezionare una variante"
+
+msgid "Profile preset"
+msgstr "Variante di profilo"
+
+msgid "None"
+msgstr "Nessuna"