diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/ephy-dialog.c | 403 | ||||
-rw-r--r-- | lib/ephy-dialog.h | 9 | ||||
-rw-r--r-- | lib/ephy-prefs-utils.c | 285 | ||||
-rw-r--r-- | lib/ephy-prefs-utils.h | 61 | ||||
-rw-r--r-- | lib/ephy-prefs.h | 21 |
6 files changed, 366 insertions, 415 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 3aab867c7..8829123cb 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -46,8 +46,6 @@ libephy_la_SOURCES = \ ephy-node-db.c \ ephy-node-db.h \ ephy-prefs.h \ - ephy-prefs-utils.c \ - ephy-prefs-utils.h \ ephy-state.c \ ephy-state.h \ ephy-string.c \ diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c index 9f484704c..a21e03bba 100644 --- a/lib/ephy-dialog.c +++ b/lib/ephy-dialog.c @@ -19,8 +19,8 @@ #include "ephy-dialog.h" #include "ephy-glade.h" #include "ephy-state.h" -#include "ephy-prefs-utils.h" #include "ephy-gui.h" +#include "eel-gconf-extensions.h" #include <string.h> #include <gtk/gtktogglebutton.h> @@ -95,6 +95,7 @@ typedef struct const char *pref; int *sg; PropertyType type; + GList *string_enum; } PropertyInfo; struct EphyDialogPrivate @@ -108,6 +109,7 @@ struct EphyDialogPrivate int spin_item_id; GTimer *spin_timer; + gboolean initialized; }; #define SPIN_DELAY 0.20 @@ -177,6 +179,282 @@ ephy_dialog_class_init (EphyDialogClass *klass) G_PARAM_READWRITE)); } +static void +set_config_from_editable (GtkWidget *editable, const char *config_name) +{ + GConfValue *gcvalue = eel_gconf_get_value (config_name); + GConfValueType value_type; + char *value; + gint ivalue; + gfloat fvalue; + + if (gcvalue == NULL) { + /* ugly hack around what appears to be a gconf bug + * it returns a NULL GConfValue for a valid string pref + * which is "" by default */ + value_type = GCONF_VALUE_STRING; + } else { + value_type = gcvalue->type; + gconf_value_free (gcvalue); + } + + /* get all the text into a new string */ + value = gtk_editable_get_chars (GTK_EDITABLE(editable), 0, -1); + + switch (value_type) { + case GCONF_VALUE_STRING: + eel_gconf_set_string (config_name, + value); + break; + /* FIXME : handle possible errors in the input for int and float */ + case GCONF_VALUE_INT: + ivalue = atoi (value); + eel_gconf_set_integer (config_name, ivalue); + break; + case GCONF_VALUE_FLOAT: + fvalue = strtod (value, (char**)NULL); + eel_gconf_set_float (config_name, fvalue); + break; + default: + break; + } + + /* free the allocated strings */ + g_free (value); +} + +static void +set_config_from_optionmenu (GtkWidget *optionmenu, const char *config_name, GList *senum) +{ + int index = gtk_option_menu_get_history (GTK_OPTION_MENU (optionmenu)); + + if (senum) + { + eel_gconf_set_string (config_name, g_list_nth_data (senum, index)); + } + else + { + eel_gconf_set_integer (config_name, index); + } +} + +static void +set_config_from_radiobuttongroup (GtkWidget *radiobutton, const char *config_name, GList *senum) +{ + gint index; + + /* get value from radio button group */ + index = ephy_gui_gtk_radio_button_get (GTK_RADIO_BUTTON (radiobutton)); + + if (senum) + { + eel_gconf_set_string (config_name, g_list_nth_data (senum, index)); + } + else + { + eel_gconf_set_integer (config_name, index); + } +} + +static void +set_config_from_spin_button (GtkWidget *spinbutton, const char *config_name) +{ + gdouble value; + gboolean use_int; + + /* read the value as an integer */ + value = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spinbutton)); + + use_int = (gtk_spin_button_get_digits (GTK_SPIN_BUTTON(spinbutton)) == 0); + + if (use_int) + { + eel_gconf_set_integer (config_name, value); + } + else + { + eel_gconf_set_float (config_name, value); + } +} + +static void +set_config_from_togglebutton (GtkWidget *togglebutton, const char *config_name) +{ + gboolean value; + + /* read the value */ + value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(togglebutton)); + + eel_gconf_set_boolean (config_name, value); +} + +static void +set_config_from_color (GtkWidget *colorpicker, const char *config_name) +{ + guint8 r, g, b, a; + gchar color_string[9]; + + /* get color values from color picker */ + gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (colorpicker), + &r, &g, &b, &a); + + /* write into string (bounded size) */ + snprintf (color_string, 9, "#%02X%02X%02X", r, g, b); + + /* set the configuration value */ + eel_gconf_set_string (config_name, color_string); +} + +static void +set_editable_from_config (GtkWidget *editable, const char *config_name) +{ + GConfValue *gcvalue = eel_gconf_get_value (config_name); + GConfValueType value_type; + gchar *value; + + if (gcvalue == NULL) + { + /* ugly hack around what appears to be a gconf bug + * it returns a NULL GConfValue for a valid string pref + * which is "" by default */ + value_type = GCONF_VALUE_STRING; + } + else + { + value_type = gcvalue->type; + gconf_value_free (gcvalue); + } + + switch (value_type) + { + case GCONF_VALUE_STRING: + value = eel_gconf_get_string (config_name); + break; + case GCONF_VALUE_INT: + value = g_strdup_printf ("%d",eel_gconf_get_integer (config_name)); + break; + case GCONF_VALUE_FLOAT: + value = g_strdup_printf ("%.2f",eel_gconf_get_float (config_name)); + break; + default: + value = NULL; + } + + /* set this string value in the widget */ + if (value) + { + gtk_entry_set_text(GTK_ENTRY(editable), value); + } + + + /* free the allocated string */ + g_free (value); +} + +static void +set_optionmenu_from_config (GtkWidget *optionmenu, const char *config_name, GList *senum) +{ + int index; + + if (senum) + { + char *val; + GList *s; + + val = eel_gconf_get_string (config_name); + + s = g_list_find_custom (senum, val, (GCompareFunc)strcmp); + + index = g_list_position (senum, s); + } + else + { + index = eel_gconf_get_integer (config_name); + } + + gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), index); +} + +static void +set_radiobuttongroup_from_config (GtkWidget *radiobutton, const char *config_name, GList *senum) +{ + int index; + + if (senum) + { + char *val; + GList *s; + + val = eel_gconf_get_string (config_name); + + s = g_list_find_custom (senum, val, (GCompareFunc)strcmp); + + index = g_list_position (senum, s); + } + else + { + index = eel_gconf_get_integer (config_name); + } + + /* set it (finds the group for us) */ + ephy_gui_gtk_radio_button_set (GTK_RADIO_BUTTON (radiobutton), index); +} + +static void +set_spin_button_from_config (GtkWidget *spinbutton, const char *config_name) +{ + gdouble value; + gint use_int; + + use_int = (gtk_spin_button_get_digits (GTK_SPIN_BUTTON(spinbutton)) == 0); + + if (use_int) + { + /* get the current value from the configuration space */ + value = eel_gconf_get_integer (config_name); + } + else + { + /* get the current value from the configuration space */ + value = eel_gconf_get_float (config_name); + } + + /* set this option value in the widget */ + gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbutton), value); +} + +static void +set_togglebutton_from_config (GtkWidget *togglebutton, const char *config_name) +{ + gboolean value; + + /* get the current value from the configuration space */ + value = eel_gconf_get_boolean (config_name); + + /* set this option value in the widget */ + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (togglebutton), value); +} + +static void +set_color_from_config (GtkWidget *colorpicker, const char *config_name) +{ + gchar *color_string; + guint r, g, b; + + /* get the string from config */ + color_string = eel_gconf_get_string (config_name); + + if (color_string) + { + /* parse it and setup the color picker */ + sscanf (color_string, "#%2X%2X%2X", &r, &g, &b); + gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (colorpicker), + r, g, b, 0); + /* free the string */ + g_free (color_string); + } +} + static PrefType get_pref_type_from_widget (GtkWidget *widget) { @@ -279,7 +557,7 @@ prefs_togglebutton_clicked_cb (GtkWidget *widget, PropertyInfo *pi) { if (pi->type == PT_AUTOAPPLY) { - ephy_pu_set_config_from_togglebutton (widget, pi->pref); + set_config_from_togglebutton (widget, pi->pref); } prefs_set_group_sensitivity (widget, pi->type, pi->sg); @@ -295,7 +573,7 @@ prefs_radiobutton_clicked_cb (GtkWidget *widget, PropertyInfo *pi) if (pi->type == PT_AUTOAPPLY) { - ephy_pu_set_config_from_radiobuttongroup (widget, pi->pref); + set_config_from_radiobuttongroup (widget, pi->pref, pi->string_enum); } prefs_set_group_sensitivity (widget, pi->type, pi->sg); @@ -325,8 +603,7 @@ prefs_spinbutton_timeout_cb (EphyDialog *dialog) gtk_spin_button_update (GTK_SPIN_BUTTON(pi.widget)); /* set */ - ephy_pu_set_config_from_spin_button (pi.widget, - pi.pref); + set_config_from_spin_button (pi.widget, pi.pref); /* done now */ return FALSE; @@ -367,7 +644,7 @@ prefs_color_changed_cb (GtkWidget *widget, guint r, guint g, { if (pi->type == PT_AUTOAPPLY) { - ephy_pu_set_config_from_color (widget, pi->pref); + set_config_from_color (widget, pi->pref); } } @@ -376,7 +653,7 @@ prefs_entry_changed_cb (GtkWidget *widget, PropertyInfo *pi) { if (pi->type == PT_AUTOAPPLY) { - ephy_pu_set_config_from_editable (widget, pi->pref); + set_config_from_editable (widget, pi->pref); } } @@ -385,7 +662,7 @@ prefs_optionmenu_selected_cb (GtkWidget *widget, PropertyInfo *pi) { if (pi->type == PT_AUTOAPPLY) { - ephy_pu_set_config_from_optionmenu (widget, pi->pref); + set_config_from_optionmenu (widget, pi->pref, pi->string_enum); } } @@ -468,6 +745,7 @@ ephy_dialog_init (EphyDialog *dialog) dialog->priv->props = NULL; dialog->priv->spin_timer = NULL; dialog->priv->name = NULL; + dialog->priv->initialized = FALSE; } static void @@ -504,33 +782,35 @@ load_props (PropertyInfo *props) if (GTK_IS_SPIN_BUTTON(props[i].widget)) { - ephy_pu_set_spin_button_from_config (props[i].widget, - props[i].pref); + set_spin_button_from_config (props[i].widget, + props[i].pref); } else if (GTK_IS_RADIO_BUTTON(props[i].widget)) { - ephy_pu_set_radiobuttongroup_from_config (props[i].widget, - props[i].pref); + set_radiobuttongroup_from_config (props[i].widget, + props[i].pref, + props[i].string_enum); } else if (GTK_IS_TOGGLE_BUTTON(props[i].widget)) { - ephy_pu_set_togglebutton_from_config (props[i].widget, - props[i].pref); + set_togglebutton_from_config (props[i].widget, + props[i].pref); } else if (GTK_IS_EDITABLE(props[i].widget)) { - ephy_pu_set_editable_from_config (props[i].widget, - props[i].pref); + set_editable_from_config (props[i].widget, + props[i].pref); } else if (GTK_IS_OPTION_MENU(props[i].widget)) { - ephy_pu_set_optionmenu_from_config (props[i].widget, - props[i].pref); + set_optionmenu_from_config (props[i].widget, + props[i].pref, + props[i].string_enum); } else if (GNOME_IS_COLOR_PICKER(props[i].widget)) { - ephy_pu_set_color_from_config (props[i].widget, - props[i].pref); + set_color_from_config (props[i].widget, + props[i].pref); } } @@ -549,38 +829,52 @@ save_props (PropertyInfo *props) if (GTK_IS_SPIN_BUTTON(props[i].widget)) { - ephy_pu_set_config_from_spin_button (props[i].widget, - props[i].pref); + set_config_from_spin_button (props[i].widget, + props[i].pref); } else if (GTK_IS_RADIO_BUTTON(props[i].widget)) { - ephy_pu_set_config_from_radiobuttongroup (props[i].widget, - props[i].pref); + set_config_from_radiobuttongroup (props[i].widget, + props[i].pref, + props[i].string_enum); } else if (GTK_IS_TOGGLE_BUTTON(props[i].widget)) { - ephy_pu_set_config_from_togglebutton (props[i].widget, - props[i].pref); + set_config_from_togglebutton (props[i].widget, + props[i].pref); } else if (GTK_IS_EDITABLE(props[i].widget)) { - ephy_pu_set_config_from_editable (props[i].widget, - props[i].pref); + set_config_from_editable (props[i].widget, + props[i].pref); } else if (GTK_IS_OPTION_MENU(props[i].widget)) { - ephy_pu_set_config_from_optionmenu (props[i].widget, - props[i].pref); + set_config_from_optionmenu (props[i].widget, + props[i].pref, + props[i].string_enum); } else if (GNOME_IS_COLOR_PICKER(props[i].widget)) { - ephy_pu_set_config_from_color (props[i].widget, - props[i].pref); + set_config_from_color (props[i].widget, + props[i].pref); } } } static void +free_props (PropertyInfo *properties) +{ + int i; + + for (i = 0; properties[i].string_enum != NULL; i++) + { + g_list_foreach (properties[i].string_enum, (GFunc)g_free, NULL); + g_list_free (properties[i].string_enum); + } +} + +static void ephy_dialog_finalize (GObject *object) { EphyDialog *dialog; @@ -597,6 +891,8 @@ ephy_dialog_finalize (GObject *object) ephy_dialog_destruct (dialog); } + free_props (dialog->priv->props); + g_free (dialog->priv->name); g_free (dialog->priv->props); g_free (dialog->priv); @@ -669,21 +965,21 @@ ephy_dialog_new_with_parent (GtkWidget *parent_window) NULL)); } -void ephy_dialog_show_embedded (EphyDialog *dialog, - GtkWidget *container) -{ - dialog->priv->container = container; - gtk_container_add (GTK_CONTAINER(container), - dialog->priv->dialog); - gtk_widget_show (dialog->priv->dialog); -} - void -ephy_dialog_remove_embedded (EphyDialog *dialog) +ephy_dialog_add_enum (EphyDialog *dialog, + int id, + guint n_items, + const char **items) { - g_object_ref (G_OBJECT(dialog->priv->dialog)); - gtk_container_remove (GTK_CONTAINER(dialog->priv->container), - dialog->priv->dialog); + int i = 0; + GList *l = NULL; + + for (i = 0; i < n_items; i++) + { + l = g_list_append (l, g_strdup (items[i])); + } + + dialog->priv->props[id].string_enum = l; } static PropertyInfo * @@ -704,6 +1000,7 @@ init_props (const EphyDialogProperty *properties, GladeXML *gxml) props[i].pref = properties[i].state_pref; props[i].sg = properties[i].sg; props[i].type = properties[i].type; + props[i].string_enum = NULL; } props[i].id = -1; @@ -711,6 +1008,7 @@ init_props (const EphyDialogProperty *properties, GladeXML *gxml) props[i].pref = NULL; props[i].sg = NULL; props[i].type = 0; + props[i].string_enum = NULL; return props; } @@ -765,13 +1063,6 @@ impl_construct (EphyDialog *dialog, g_object_weak_ref (G_OBJECT(dialog->priv->dialog), (GWeakNotify)dialog_destruction_notify, dialog); - - if (dialog->priv->props) - { - load_props (dialog->priv->props); - prefs_connect_signals (dialog); - prefs_set_sensitivity (dialog->priv->props); - } } static void @@ -857,6 +1148,14 @@ impl_run (EphyDialog *dialog) static void impl_show (EphyDialog *dialog) { + if (dialog->priv->props && !dialog->priv->initialized) + { + load_props (dialog->priv->props); + prefs_connect_signals (dialog); + prefs_set_sensitivity (dialog->priv->props); + dialog->priv->initialized = TRUE; + } + setup_default_size (dialog); if (dialog->priv->parent) diff --git a/lib/ephy-dialog.h b/lib/ephy-dialog.h index 24cb2cf5c..0a6f16a2d 100644 --- a/lib/ephy-dialog.h +++ b/lib/ephy-dialog.h @@ -83,9 +83,9 @@ struct EphyDialogClass GType ephy_dialog_get_type (void); -EphyDialog *ephy_dialog_new (void); +EphyDialog *ephy_dialog_new (void); -EphyDialog *ephy_dialog_new_with_parent (GtkWidget *parent_window); +EphyDialog *ephy_dialog_new_with_parent (GtkWidget *parent_window); void ephy_dialog_construct (EphyDialog *dialog, const EphyDialogProperty *properties, @@ -94,6 +94,11 @@ void ephy_dialog_construct (EphyDialog *dialog, void ephy_dialog_destruct (EphyDialog *dialog); +void ephy_dialog_add_enum (EphyDialog *dialog, + int id, + guint n_items, + const char **items); + gint ephy_dialog_run (EphyDialog *dialog); void ephy_dialog_show (EphyDialog *dialog); diff --git a/lib/ephy-prefs-utils.c b/lib/ephy-prefs-utils.c deleted file mode 100644 index 0e0cf4a50..000000000 --- a/lib/ephy-prefs-utils.c +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (C) 2000 Marco Pesenti Gritti - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "ephy-prefs-utils.h" -#include "ephy-gui.h" -#include "eel-gconf-extensions.h" - -#include <string.h> -#include <stdlib.h> -#include <stdio.h> -#include <gtk/gtkmenu.h> -#include <gtk/gtkmenushell.h> -#include <gtk/gtkspinbutton.h> -#include <gtk/gtktogglebutton.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtklist.h> -#include <libgnomeui/gnome-color-picker.h> - -void -ephy_pu_set_config_from_editable (GtkWidget *editable, const char *config_name) -{ - GConfValue *gcvalue = eel_gconf_get_value (config_name); - GConfValueType value_type; - char *value; - gint ivalue; - gfloat fvalue; - - if (gcvalue == NULL) { - /* ugly hack around what appears to be a gconf bug - * it returns a NULL GConfValue for a valid string pref - * which is "" by default */ - value_type = GCONF_VALUE_STRING; - } else { - value_type = gcvalue->type; - gconf_value_free (gcvalue); - } - - /* get all the text into a new string */ - value = gtk_editable_get_chars (GTK_EDITABLE(editable), 0, -1); - - switch (value_type) { - case GCONF_VALUE_STRING: - eel_gconf_set_string (config_name, - value); - break; - /* FIXME : handle possible errors in the input for int and float */ - case GCONF_VALUE_INT: - ivalue = atoi (value); - eel_gconf_set_integer (config_name, ivalue); - break; - case GCONF_VALUE_FLOAT: - fvalue = strtod (value, (char**)NULL); - eel_gconf_set_float (config_name, fvalue); - break; - default: - break; - } - - /* free the allocated strings */ - g_free (value); -} - -void -ephy_pu_set_config_from_optionmenu (GtkWidget *optionmenu, const char *config_name) -{ - int index = ephy_pu_get_int_from_optionmenu (optionmenu); - - eel_gconf_set_integer (config_name, index); -} - -void -ephy_pu_set_config_from_radiobuttongroup (GtkWidget *radiobutton, const char *config_name) -{ - gint index; - - /* get value from radio button group */ - index = ephy_gui_gtk_radio_button_get (GTK_RADIO_BUTTON (radiobutton)); - - eel_gconf_set_integer (config_name, index); -} - -void -ephy_pu_set_config_from_spin_button (GtkWidget *spinbutton, const char *config_name) -{ - gdouble value; - gboolean use_int; - - /* read the value as an integer */ - value = gtk_spin_button_get_value (GTK_SPIN_BUTTON(spinbutton)); - - use_int = (gtk_spin_button_get_digits (GTK_SPIN_BUTTON(spinbutton)) == 0); - - if (use_int) - { - eel_gconf_set_integer (config_name, value); - } - else - { - eel_gconf_set_float (config_name, value); - } -} - -void -ephy_pu_set_config_from_togglebutton (GtkWidget *togglebutton, const char *config_name) -{ - gboolean value; - - /* read the value */ - value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(togglebutton)); - - eel_gconf_set_boolean (config_name, value); -} - -void -ephy_pu_set_config_from_color (GtkWidget *colorpicker, const char *config_name) -{ - guint8 r, g, b, a; - gchar color_string[9]; - - /* get color values from color picker */ - gnome_color_picker_get_i8 (GNOME_COLOR_PICKER (colorpicker), - &r, &g, &b, &a); - - /* write into string (bounded size) */ - snprintf (color_string, 9, "#%02X%02X%02X", r, g, b); - - /* set the configuration value */ - eel_gconf_set_string (config_name, color_string); -} - -void -ephy_pu_set_editable_from_config (GtkWidget *editable, const char *config_name) -{ - GConfValue *gcvalue = eel_gconf_get_value (config_name); - GConfValueType value_type; - gchar *value; - - if (gcvalue == NULL) - { - /* ugly hack around what appears to be a gconf bug - * it returns a NULL GConfValue for a valid string pref - * which is "" by default */ - value_type = GCONF_VALUE_STRING; - } - else - { - value_type = gcvalue->type; - gconf_value_free (gcvalue); - } - - switch (value_type) - { - case GCONF_VALUE_STRING: - value = eel_gconf_get_string (config_name); - break; - case GCONF_VALUE_INT: - value = g_strdup_printf ("%d",eel_gconf_get_integer (config_name)); - break; - case GCONF_VALUE_FLOAT: - value = g_strdup_printf ("%.2f",eel_gconf_get_float (config_name)); - break; - default: - value = NULL; - } - - /* set this string value in the widget */ - if (value) - { - gtk_entry_set_text(GTK_ENTRY(editable), value); - } - - /* free the allocated string */ - g_free (value); -} - -void -ephy_pu_set_optionmenu_from_config (GtkWidget *optionmenu, const char *config_name) -{ - gint index; - - /* get the current value from the configuration space */ - index = eel_gconf_get_integer (config_name); - - /* set this option value in the widget */ - gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), index); -} - -void -ephy_pu_set_radiobuttongroup_from_config (GtkWidget *radiobutton, const char *config_name) -{ - gint index; - - /* get the current value from the configuration space */ - index = eel_gconf_get_integer (config_name); - - /* set it (finds the group for us) */ - ephy_gui_gtk_radio_button_set (GTK_RADIO_BUTTON (radiobutton), index); -} - -void -ephy_pu_set_spin_button_from_config (GtkWidget *spinbutton, const char *config_name) -{ - gdouble value; - gint use_int; - - use_int = (gtk_spin_button_get_digits (GTK_SPIN_BUTTON(spinbutton)) == 0); - - if (use_int) - { - /* get the current value from the configuration space */ - value = eel_gconf_get_integer (config_name); - } - else - { - /* get the current value from the configuration space */ - value = eel_gconf_get_float (config_name); - } - - /* set this option value in the widget */ - gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbutton), value); -} - -void -ephy_pu_set_togglebutton_from_config (GtkWidget *togglebutton, const char *config_name) -{ - gboolean value; - - /* get the current value from the configuration space */ - value = eel_gconf_get_boolean (config_name); - - /* set this option value in the widget */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (togglebutton), value); -} - -void -ephy_pu_set_color_from_config (GtkWidget *colorpicker, const char *config_name) -{ - gchar *color_string; - guint r, g, b; - - /* get the string from config */ - color_string = eel_gconf_get_string (config_name); - - if (color_string) - { - /* parse it and setup the color picker */ - sscanf (color_string, "#%2X%2X%2X", &r, &g, &b); - gnome_color_picker_set_i8 (GNOME_COLOR_PICKER (colorpicker), - r, g, b, 0); - /* free the string */ - g_free (color_string); - } -} - -int -ephy_pu_get_int_from_optionmenu (GtkWidget *optionmenu) -{ - GtkWidget *menu; - GList *list; - gpointer item; - gint index; - - /* extract the selection */ - menu = GTK_OPTION_MENU(optionmenu)->menu; - list = GTK_MENU_SHELL(menu)->children; - item = gtk_menu_get_active (GTK_MENU(menu)); - index = g_list_index (list, item); - - return index; -} diff --git a/lib/ephy-prefs-utils.h b/lib/ephy-prefs-utils.h deleted file mode 100644 index 13ac1e4d7..000000000 --- a/lib/ephy-prefs-utils.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2000 Marco Pesenti Gritti - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <gtk/gtkwidget.h> - -G_BEGIN_DECLS - -void ephy_pu_set_config_from_editable (GtkWidget *editable, - const char *config_name); - -void ephy_pu_set_config_from_optionmenu (GtkWidget *optionmenu, - const char *config_name); - -void ephy_pu_set_config_from_radiobuttongroup (GtkWidget *radiobutton, - const char *config_name); - -void ephy_pu_set_config_from_spin_button (GtkWidget *spinbutton, - const char *config_name); - -void ephy_pu_set_config_from_togglebutton (GtkWidget *togglebutton, - const char *config_name); - -void ephy_pu_set_config_from_color (GtkWidget *colorpicker, - const char *config_name); - -void ephy_pu_set_editable_from_config (GtkWidget *editable, - const char *config_name); - -void ephy_pu_set_optionmenu_from_config (GtkWidget *optionmenu, - const char *config_name); - -void ephy_pu_set_radiobuttongroup_from_config (GtkWidget *radiobutton, - const char *config_name); - -void ephy_pu_set_togglebutton_from_config (GtkWidget *togglebutton, - const char *config_name); - -void ephy_pu_set_spin_button_from_config (GtkWidget *spinbutton, - const char *config_name); - -void ephy_pu_set_color_from_config (GtkWidget *colorpicker, - const char *config_name); - -int ephy_pu_get_int_from_optionmenu (GtkWidget *optionmenu); - -G_END_DECLS diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h index 6e16f4359..3b6233f6d 100644 --- a/lib/ephy-prefs.h +++ b/lib/ephy-prefs.h @@ -22,24 +22,19 @@ G_BEGIN_DECLS /* General */ -#define CONF_GENERAL_HOMEPAGE "/apps/epiphany/general/start_page" - -/* Interface */ -#define CONF_TABS_TABBED "/apps/epiphany/interface/open_in_tab" -#define CONF_WINDOWS_SHOW_TOOLBARS "/apps/epiphany/interface/show_toolbars" -#define CONF_WINDOWS_SHOW_BOOKMARKS_BAR "/apps/epiphany/interface/show_bookmarks_bar" -#define CONF_WINDOWS_SHOW_STATUSBAR "/apps/epiphany/interface/show_statusbar" -#define CONF_INTERFACE_MIDDLE_CLICK_OPEN_URL "/apps/epiphany/interface/middle_click_open_url" -#define CONF_ASK_DOWNLOAD_DEST "/apps/epiphany/interface/ask_download_dest" - -/* Downloader */ -#define CONF_DOWNLOADING_SHOW_DETAILS "/apps/epiphany/downloader/show_details" +#define CONF_GENERAL_HOMEPAGE "/apps/epiphany/general/homepage" +#define CONF_ASK_DOWNLOAD_DEST "/apps/epiphany/general/ask_download_dest" +#define CONF_TABS_TABBED "/apps/epiphany/general/open_in_tab" +#define CONF_WINDOWS_SHOW_TOOLBARS "/apps/epiphany/general/show_toolbars" +#define CONF_WINDOWS_SHOW_BOOKMARKS_BAR "/apps/epiphany/general/show_bookmarks_bar" +#define CONF_WINDOWS_SHOW_STATUSBAR "/apps/epiphany/general/show_statusbar" +#define CONF_INTERFACE_MIDDLE_CLICK_OPEN_URL "/apps/epiphany/general/middle_click_open_url" /* Directories */ #define CONF_STATE_SAVE_DIR "/apps/epiphany/directories/save" #define CONF_STATE_SAVE_IMAGE_DIR "/apps/epiphany/directories/saveimage" #define CONF_STATE_OPEN_DIR "/apps/epiphany/directories/open" -#define CONF_STATE_DOWNLOADING_DIR "/apps/epiphany/directories/downloading" +#define CONF_STATE_DOWNLOADING_DIR "/apps/epiphany/directories/download" /* System prefs */ #define CONF_DESKTOP_FTP_HANDLER "/desktop/gnome/url-handlers/ftp/command" |