aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ephy-dialog.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-01-17 07:51:41 +0800
committerChristian Persch <chpe@src.gnome.org>2006-01-17 07:51:41 +0800
commit5a9945adda3cd770a0d72f13e55f11950fd66015 (patch)
tree5290aba17884b7d98a754aab198b597380b7fd0d /lib/ephy-dialog.c
parente469aef9ea4efd1098ad6982f0da77fed594faf1 (diff)
downloadgsoc2013-epiphany-5a9945adda3cd770a0d72f13e55f11950fd66015.tar
gsoc2013-epiphany-5a9945adda3cd770a0d72f13e55f11950fd66015.tar.gz
gsoc2013-epiphany-5a9945adda3cd770a0d72f13e55f11950fd66015.tar.bz2
gsoc2013-epiphany-5a9945adda3cd770a0d72f13e55f11950fd66015.tar.lz
gsoc2013-epiphany-5a9945adda3cd770a0d72f13e55f11950fd66015.tar.xz
gsoc2013-epiphany-5a9945adda3cd770a0d72f13e55f11950fd66015.tar.zst
gsoc2013-epiphany-5a9945adda3cd770a0d72f13e55f11950fd66015.zip
Fix number of /'s in URI.
2006-01-17 Christian Persch <chpe@cvs.gnome.org> * data/chrome/epiphany.manifest.in: Fix number of /'s in URI. * data/epiphany.schemas.in: Add new entries. * embed/mozilla/EphyAboutModule.cpp: Fix title. * data/glade/prefs-dialog.glade: * embed/ephy-embed-prefs.h: * embed/mozilla/mozilla-embed-single.cpp: * embed/mozilla/mozilla-notifiers.cpp: * embed/mozilla/mozilla-notifiers.h: * lib/eel-gconf-extensions.c: (eel_gconf_unset_key), (eel_gconf_notify): * lib/eel-gconf-extensions.h: * lib/egg/egg-editable-toolbar.c: (popup_context_menu_cb), (button_press_event_cb), (egg_editable_toolbar_set_ui_manager), (egg_editable_toolbar_set_selected): * lib/ephy-dialog.c: (set_value_from_pref), (set_pref_from_value), (set_value_from_togglebutton), (strcmp_with_null), (get_index_from_value), (compare_values), (set_togglebutton_from_value), (set_pref_from_info_and_emit), (spinbutton_changed_cb), (save_info): * lib/ephy-dialog.h: * lib/ephy-file-helpers.c: (ephy_file_monitor_timeout_cb), (ephy_file_monitor_cb), (ephy_file_monitor_add), (ephy_file_monitor_cancel): * lib/ephy-file-helpers.h: * src/ephy-extensions-manager.c: (ephy_extensions_manager_load_file): * src/ephy-window.c: * src/popup-commands.c: (popup_cmd_bookmark_link): * src/prefs-dialog.c: (prefs_dialog_finalize), (setup_font_combo), (fonts_language_changed_cb), (font_prefs_dialog_response_cb), (row_is_separator), (setup_fonts_dialog), (font_prefs_button_clicked_cb), (css_checkbox_toggled), (css_edit_button_clicked_cb), (prefs_dialog_init): Rework font prefs, and add user stylesheet setting. * src/bookmarks/ephy-bookmark-action-group.c: (node_added_cb): * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_get_local): * src/window-commands.c: (window_cmd_file_bookmark_page): Some build fixes.
Diffstat (limited to 'lib/ephy-dialog.c')
-rw-r--r--lib/ephy-dialog.c57
1 files changed, 47 insertions, 10 deletions
diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c
index f171d4dae..669f6d5d8 100644
--- a/lib/ephy-dialog.c
+++ b/lib/ephy-dialog.c
@@ -178,7 +178,7 @@ set_value_from_pref (PropertyInfo *info, GValue *value)
case G_TYPE_STRING:
g_value_init (value, G_TYPE_STRING);
text = eel_gconf_get_string (info->pref);
- g_value_take_string (value, text ? text : g_strdup (""));
+ g_value_take_string (value, text);
break;
case G_TYPE_INT:
g_value_init (value, G_TYPE_INT);
@@ -212,8 +212,18 @@ set_pref_from_value (PropertyInfo *info, GValue *value)
switch (info->data_type)
{
case G_TYPE_STRING:
- eel_gconf_set_string (pref, g_value_get_string (value));
+ {
+ const char *string = g_value_get_string (value);
+ if (string != NULL)
+ {
+ eel_gconf_set_string (pref, string);
+ }
+ else
+ {
+ eel_gconf_unset_key (pref);
+ }
break;
+ }
case G_TYPE_INT:
eel_gconf_set_integer (pref, g_value_get_int (value));
break;
@@ -412,6 +422,11 @@ set_value_from_togglebutton (PropertyInfo *info, GValue *value)
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (info->widget));
+ if (info->apply_type & PT_INVERTED)
+ {
+ active = !active;
+ }
+
if (info->data_type == G_TYPE_BOOLEAN)
{
g_value_init (value, info->data_type);
@@ -499,6 +514,26 @@ set_editable_from_value (PropertyInfo *info, const GValue *value)
}
static int
+strcmp_with_null (const char *key1,
+ const char *key2)
+{
+ if (key1 == NULL && key2 == NULL)
+ {
+ return 0;
+ }
+ if (key1 == NULL)
+ {
+ return -1;
+ }
+ if (key2 == NULL)
+ {
+ return 1;
+ }
+
+ return strcmp (key1, key2);
+}
+
+static int
get_index_from_value (const GValue *value, GList *string_enum)
{
int index = -1;
@@ -509,10 +544,7 @@ get_index_from_value (const GValue *value, GList *string_enum)
{
val = g_value_get_string (value);
- if (val)
- {
- s = g_list_find_custom (string_enum, val, (GCompareFunc) strcmp);
- }
+ s = g_list_find_custom (string_enum, val, (GCompareFunc) strcmp_with_null);
if (s)
{
@@ -538,7 +570,7 @@ compare_values (const GValue *a, const GValue *b)
ta = g_value_get_string (a);
tb = g_value_get_string (b);
- return (ta && tb && strcmp (ta, tb) == 0);
+ return (strcmp_with_null (ta, tb) == 0);
}
else if (G_VALUE_HOLDS (a, G_TYPE_INT))
{
@@ -689,6 +721,11 @@ set_togglebutton_from_value (PropertyInfo *info, const GValue *value)
active = g_value_get_boolean (value);
+ if (info->apply_type & PT_INVERTED)
+ {
+ active = !active;
+ }
+
info->sane_state = TRUE;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (info->widget), active);
@@ -740,7 +777,7 @@ set_pref_from_info_and_emit (PropertyInfo *info)
g_signal_emit (info->dialog, signals[CHANGED], g_quark_from_string (info->id), &value);
- if (info->apply_type == PT_AUTOAPPLY && info->pref != NULL)
+ if ((info->apply_type & PT_AUTOAPPLY) && info->pref != NULL)
{
set_pref_from_value (info, &value);
}
@@ -812,7 +849,7 @@ spinbutton_changed_cb (GtkWidget *widget, PropertyInfo *info)
{
GTimer *spin_timer;
- if (info->apply_type != PT_AUTOAPPLY) return;
+ if ((info->apply_type & PT_AUTOAPPLY) == 0) return;
spin_timer = g_object_get_data (G_OBJECT (info->widget), "timer");
@@ -977,7 +1014,7 @@ save_info (gpointer key, PropertyInfo *info, EphyDialog *dialog)
{
GValue value = { 0, };
- if (info->pref == NULL || info->apply_type != PT_NORMAL)
+ if (info->pref == NULL || (info->apply_type & PT_NORMAL) == 0)
{
return;
}