aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac21
-rw-r--r--data/Makefile.am37
-rw-r--r--data/epiphany-lockdown.schemas.in119
-rw-r--r--data/epiphany.convert56
-rw-r--r--data/epiphany.schemas.in536
-rw-r--r--data/glade/prefs-dialog.ui17
-rw-r--r--data/org.gnome.epiphany.gschema.xml.in237
-rw-r--r--data/ui/epiphany-bookmark-editor-ui.xml2
-rw-r--r--embed/downloader-view.c44
-rw-r--r--embed/ephy-embed-prefs.c353
-rw-r--r--embed/ephy-embed-prefs.h23
-rw-r--r--embed/ephy-embed-single.c7
-rw-r--r--embed/ephy-embed.c10
-rw-r--r--embed/ephy-encodings.c42
-rw-r--r--embed/ephy-history.c23
-rw-r--r--embed/ephy-web-view.c14
-rw-r--r--lib/Makefile.am4
-rw-r--r--lib/eel-gconf-extensions.c724
-rw-r--r--lib/eel-gconf-extensions.h83
-rw-r--r--lib/ephy-dialog.c1144
-rw-r--r--lib/ephy-dialog.h38
-rw-r--r--lib/ephy-file-chooser.c12
-rw-r--r--lib/ephy-file-helpers.c5
-rw-r--r--lib/ephy-prefs.h126
-rw-r--r--lib/ephy-settings.c65
-rw-r--r--lib/ephy-settings.h44
-rw-r--r--po/POTFILES.in4
-rw-r--r--src/bookmarks/ephy-bookmark-properties.c6
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c126
-rw-r--r--src/bookmarks/ephy-bookmarks-import.c18
-rw-r--r--src/bookmarks/ephy-bookmarks-ui.c7
-rw-r--r--src/bookmarks/ephy-bookmarks.c31
-rw-r--r--src/ephy-activation.c5
-rw-r--r--src/ephy-encoding-dialog.c42
-rw-r--r--src/ephy-extensions-manager.c181
-rw-r--r--src/ephy-history-window.c256
-rw-r--r--src/ephy-home-action.c5
-rw-r--r--src/ephy-lockdown.c378
-rw-r--r--src/ephy-main.c12
-rw-r--r--src/ephy-net-monitor.c46
-rw-r--r--src/ephy-notebook.c24
-rw-r--r--src/ephy-session.c10
-rw-r--r--src/ephy-shell.c11
-rw-r--r--src/ephy-toolbar-editor.c14
-rw-r--r--src/ephy-toolbars-model.c24
-rw-r--r--src/ephy-window.c89
-rw-r--r--src/pdm-dialog.c77
-rw-r--r--src/popup-commands.c2
-rw-r--r--src/prefs-dialog.c548
-rw-r--r--src/window-commands.c12
50 files changed, 1564 insertions, 4150 deletions
diff --git a/configure.ac b/configure.ac
index 006c54001..64caf2b26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,6 +75,8 @@ AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
IT_PROG_INTLTOOL([0.40.0])
+GLIB_GSETTINGS
+
PKG_PROG_PKG_CONFIG
GNOME_DEBUG_CHECK
@@ -87,10 +89,10 @@ DEPRECATION_FLAGS=
if test "$enable_maintainer_mode" = "yes"; then
AC_DEFINE([MAINTAINER_MODE],[1],[Define to enable 'maintainer-only' behaviour])
enable_debug=yes
- DEPRECATION_FLAGS="-DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGCONF_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE"
+ DEPRECATION_FLAGS="-DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DPANGO_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE"
fi
-GLIB_REQUIRED=2.19.7
+GLIB_REQUIRED=2.25.13
GTK_REQUIRED=2.91.1
LIBXML_REQUIRED=2.6.12
LIBXSLT_REQUIRED=1.1.7
@@ -100,6 +102,7 @@ DBUS_GLIB_REQUIRED=0.35
WEBKIT_GTK_REQUIRED=1.3.2
LIBSOUP_GNOME_REQUIRED=2.29.91
GNOME_KEYRING_REQUIRED=2.26.0
+GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.0.2
PKG_CHECK_EXISTS([libnotify >= $LIBNOTIFY_REQUIRED],[have_libnotify=yes],[have_libnotify=no])
@@ -131,12 +134,12 @@ PKG_CHECK_MODULES([DEPENDENCIES], [
sm
libxml-2.0 >= $LIBXML_REQUIRED
libxslt >= $LIBXSLT_REQUIRED
- gconf-2.0
libstartup-notification-1.0 >= $LIBSTARTUP_NOTIFICATION_REQUIRED
$LIBNOTIFY_PACKAGE
webkitgtk-3.0 >= $WEBKIT_GTK_REQUIRED
libsoup-gnome-2.4 >= $LIBSOUP_GNOME_REQUIRED
gnome-keyring-1 >= $GNOME_KEYRING_REQUIRED
+ gsettings-desktop-schemas >= $GSETTINGS_DESKTOP_SCHEMAS_REQUIRED
])
# ****
@@ -151,18 +154,6 @@ if test "$DBUS_BINDING_TOOL" = "no"; then
AC_MSG_ERROR([dbus-binding-tool not found])
fi
-# *****
-# GConf
-# *****
-
-AM_GCONF_SOURCE_2
-
-AC_PATH_PROG([GCONFTOOL], [gconftool-2], [no])
-
-if test "$GCONFTOOL" = "no"; then
- AC_MSG_ERROR([gconftool-2 not found])
-fi
-
# ******************
# Portability checks
# ******************
diff --git a/data/Makefile.am b/data/Makefile.am
index 87f8c1d8e..e6ab83e4a 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -2,16 +2,21 @@ SUBDIRS = art glade icons ui
@INTLTOOL_SERVER_RULE@
@INTLTOOL_DESKTOP_RULE@
-@INTLTOOL_SCHEMAS_RULE@
-@INTLTOOL_XML_RULE@
desktop_in_files = epiphany.desktop.in.in bme.desktop.in.in
desktopdir = $(datadir)/applications
desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
-schemadir = $(GCONF_SCHEMA_FILE_DIR)
-schema_in_files = epiphany.schemas.in epiphany-lockdown.schemas.in
-schema_DATA = $(schema_in_files:.schemas.in=.schemas)
+convertdir = $(datarootdir)/GConf/gsettings
+convert_DATA = epiphany.convert
+
+gsettings_ENUM_NAMESPACE = org.gnome.Epiphany
+gsettings_ENUM_FILES = $(top_srcdir)/lib/ephy-prefs.h
+
+gsettings_files = org.gnome.epiphany.gschema.xml.in
+gsettings_SCHEMAS = $(gsettings_files:.xml.in=.xml)
+@INTLTOOL_XML_NOMERGE_RULE@
+@GSETTINGS_RULES@
aboutdir = $(pkgdatadir)
about_DATA = epiphany.xhtml
@@ -53,19 +58,9 @@ $(default_bookmarks_DATA): $(default_bookmarks_in_files) Makefile $(INTLTOOL_MER
sed -e "s|\@pkgdatadir\@|$(pkgdatadir)|g" $@.tmp > $@ || rm -f $@.tmp
rm -f $@.tmp
-install-data-local: $(schema_DATA)
-if GCONF_SCHEMAS_INSTALL
- if test -z "$(DESTDIR)" ; then \
- for p in $^ ; do \
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p 2>&1 > /dev/null; \
- done \
- fi
-endif
-
EXTRA_DIST = \
$(aboutdialog_DATA) \
$(service_in_files) \
- $(schema_in_files) \
$(desktop_in_files) \
$(about_DATA) \
$(mimepermission_DATA) \
@@ -74,12 +69,14 @@ EXTRA_DIST = \
$(service_DATA) \
$(m4data_DATA) \
$(default_bookmarks_in_files) \
+ $(gsettings_files) \
+ $(convert_DATA) \
epiphany-service.xml \
check-mime.py
DISTCLEANFILES = \
- $(service_DATA) \
- $(schema_in_files:.schemas.in=.schemas) \
- $(pkgconfig_DATA) \
- $(desktop_DATA) \
- $(default_bookmarks_DATA)
+ $(service_DATA) \
+ $(pkgconfig_DATA) \
+ $(desktop_DATA) \
+ $(default_bookmarks_DATA) \
+ $(gsettings_SCHEMAS)
diff --git a/data/epiphany-lockdown.schemas.in b/data/epiphany-lockdown.schemas.in
deleted file mode 100644
index f2959c293..000000000
--- a/data/epiphany-lockdown.schemas.in
+++ /dev/null
@@ -1,119 +0,0 @@
-<gconfschemafile>
- <schemalist>
- <schema>
- <key>/schemas/apps/epiphany/lockdown/disable_javascript_chrome</key>
- <applyto>/apps/epiphany/lockdown/disable_javascript_chrome</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Disable JavaScript chrome control</short>
- <long>Disable JavaScript's control over window chrome.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/lockdown/hide_menubar</key>
- <applyto>/apps/epiphany/lockdown/hide_menubar</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Hide menubar by default</short>
- <long>Hide the menubar by default.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/lockdown/disable_unsafe_protocols</key>
- <applyto>/apps/epiphany/lockdown/disable_unsafe_protocols</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Disable unsafe protocols</short>
- <long>Disables loading of content from unsafe protocols. Safe protocols
- are http and https.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/lockdown/additional_safe_protocols</key>
- <applyto>/apps/epiphany/lockdown/additional_safe_protocols</applyto>
- <owner>epiphany</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[]</default>
- <locale name="C">
- <short>Additional safe protocols</short>
- <long>A list of protocols to be considered safe in addition to the
- default, when disable_unsafe_protocols is enabled.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/lockdown/disable_arbitrary_url</key>
- <applyto>/apps/epiphany/lockdown/disable_arbitrary_url</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>0</default>
- <locale name="C">
- <short>Disable arbitrary URLs</short>
- <long>Disable the user's ability to type in a URL to Epiphany.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/lockdown/disable_bookmark_editing</key>
- <applyto>/apps/epiphany/lockdown/disable_bookmark_editing</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>0</default>
- <locale name="C">
- <short>Disable bookmark editing</short>
- <long>Disable the user's ability to add or edit bookmarks.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/lockdown/disable_toolbar_editing</key>
- <applyto>/apps/epiphany/lockdown/disable_toolbar_editing</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>0</default>
- <locale name="C">
- <short>Disable toolbar editing</short>
- <long>Disable the user's ability to edit toolbars.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/lockdown/disable_history</key>
- <applyto>/apps/epiphany/lockdown/disable_history</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>0</default>
- <locale name="C">
- <short>Disable history</short>
- <long>Disable all historical information by disabling back and
- forward navigation, not allowing the history dialog and hiding the
- most used bookmarks list.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/lockdown/fullscreen</key>
- <applyto>/apps/epiphany/lockdown/fullscreen</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>0</default>
- <locale name="C">
- <short>Lock in fullscreen mode</short>
- <long>Locks Epiphany in fullscreen mode.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/lockdown/disable_quit</key>
- <applyto>/apps/epiphany/lockdown/disable_quit</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>0</default>
- <locale name="C">
- <short>Epiphany cannot quit</short>
- <long>User is not allowed to close Epiphany</long>
- </locale>
- </schema>
- </schemalist>
-</gconfschemafile>
diff --git a/data/epiphany.convert b/data/epiphany.convert
new file mode 100644
index 000000000..c938c7639
--- /dev/null
+++ b/data/epiphany.convert
@@ -0,0 +1,56 @@
+[org.gnome.Epiphany]
+homepage-url = /apps/epiphany/general/homepage
+user-agent = /apps/epiphany/general/user_agent
+cache-size = /apps/epiphany/web/cache_size
+new-windows-in-tabs = /apps/epiphany/general/open_new_windows_in_tab
+automatic-downloads = /apps/epiphany/general/automatic_downloads
+warn-on-close-unsubmitted-data = /apps/epiphany/dialogs/warn_on_close_unsubmitted_data
+middle-click-opens-url = /apps/epiphany/general/middle_click_open_url
+remember-passwords = /apps/epiphany/general/remember_passwords
+keyword-search-url = /apps/epiphany/general/url_search
+managed-network = /apps/epiphany/general/managed_network
+enable-smooth-scrolling = /apps/epiphany/web/smooth_scroll
+enable-web-inspector = /apps/epiphany/web/inspector_enabled
+enable-caret-browsing = /apps/epiphany/web/browse_with_caret
+enabled-extensions = /apps/epiphany/general/active_extensions
+
+[org.gnome.Epiphany.ui]
+always-show-tabs-bar = /apps/epiphany/general/always_show_tabs_bar
+show-toolbars = /apps/epiphany/general/show_toolbars
+show-bookmarks-bar = /apps/epiphany/general/show_bookmarks_bar
+toolbar-style = /apps/epiphany/general/toolbar_style
+downloads-hidden = /apps/epiphany/dialogs/downloads_hidden
+
+[org.gnome.Epiphany.web]
+min-font-size = /apps/epiphany/web/minimum_font_size
+language = /apps/epiphany/web/language
+use-own-fonts = /apps/epiphany/web/use_own_fonts
+use-own-colors = /apps/epiphany/web/use_own_colors
+enable-user-css = /apps/epiphany/web/user_css_enabled
+enable-popups = /apps/epiphany/web/allow_popups
+enable-plugins = /apps/epiphany/web/plugins_enabled
+enable-javascript = /apps/epiphany/web/javascript_enabled
+image-animation-mode = /apps/epiphany/web/image_animation
+default-encoding = /apps/epiphany/web/default_encoding
+
+[org.gnome.Epiphany.state]
+save-dir = /apps/epiphany/directories/save
+save-image-dir = /apps/epiphany/directories/saveimage
+open-dir = /apps/epiphany/directories/open
+download-dir = /apps/epiphany/directories/downloads_folder
+upload-dir = /apps/epiphany/directories/upload
+recent-encodings =/apps/epiphany/general/recent_encodings
+
+[org.gnome.Epiphany.lockdown]
+disable-fullscreen = /apps/epiphany/lockdown/fullscreen
+disable-arbitrary-url = /apps/epiphany/lockdown/disable_arbitrary_url
+disable-bookmark-editing = /apps/epiphany/lockdown/disable_bookmark_editing
+disable-toolbar-editing = /apps/epiphany/lockdown/disable_toolbar_editing
+disable-history = /apps/epiphany/lockdown/disable_history
+disable-save-to-disk = /desktop/gnome/lockdown/disable_save_to_disk
+disable-printing = /desktop/gnome/lockdown/disable_printing
+disable-print-setup = /desktop/gnome/lockdown/disable_print_setup
+disable-command-line = /desktop/gnome/lockdown/disable_command_line
+disable-quit = /apps/epiphany/lockdown/disable_quit
+disable-javascript-chrome = /apps/epiphany/lockdown/disable_javascript_chrome
+disable-menubar = /apps/epiphany/lockdown/hide_menubar
diff --git a/data/epiphany.schemas.in b/data/epiphany.schemas.in
deleted file mode 100644
index 359b7a971..000000000
--- a/data/epiphany.schemas.in
+++ /dev/null
@@ -1,536 +0,0 @@
-<gconfschemafile>
- <schemalist>
- <schema>
- <key>/schemas/apps/epiphany/general/homepage</key>
- <applyto>/apps/epiphany/general/homepage</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default>http://www.google.com</default>
- <locale name="C">
- <short>Home page</short>
- <long>Address of the user's home page.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/url_search</key>
- <applyto>/apps/epiphany/general/url_search</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default>http://www.google.com/search?q=%s&amp;ie=UTF-8&amp;oe=UTF-8</default>
- <locale name="C">
- <short>URL Search</short>
- <long>Search string for keywords entered in the URL bar.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/history_date_filter</key>
- <applyto>/apps/epiphany/dialogs/history_date_filter</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default>ever</default>
- <locale name="C">
- <short>History pages time range</short>
- <long>Show the history pages visited "ever",
- "last_two_days", "last_three_days", "today".
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/bookmarks_view_details</key>
- <applyto>/apps/epiphany/dialogs/bookmarks_view_details</applyto>
- <owner>epiphany</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[title]</default>
- <locale name="C">
- <short>The bookmark information shown in the editor view</short>
- <long>
- The bookmark information shown in the editor view. Valid values
- in the list are "address" and "title".
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/history_view_details</key>
- <applyto>/apps/epiphany/dialogs/history_view_details</applyto>
- <owner>epiphany</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[ViewTitle,ViewAddress]</default>
- <locale name="C">
- <short>The page information shown in the history view</short>
- <long>
- The page information shown in the history view. Valid values
- in the list are "ViewTitle", "ViewAddress" and "ViewDateTime".
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/preferences_font_language</key>
- <applyto>/apps/epiphany/dialogs/preferences_font_language</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <locale name="C">
- <default>x-western</default>
- <short>The currently selected fonts language</short>
- <long>
- The currently selected fonts language. Valid values are "ar" (arabic),
- "x-baltic" (baltic languages), "x-central-euro" (central european languages),
- "x-cyrillic" (languages written with cyrillic alphabet), "el" (greek),
- "he" (hebrew), "ja" (japanese), "ko" (korean), "zh-CN" (simplified chinese),
- "th" (thai), "zh-TW" (traditional chinese), "tr" (turkish), "x-unicode" (other
- languages), "x-western" (languages written in latin script), "x-tamil" (tamil)
- and "x-devanagari" (devanagari).
- </long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/smooth_scroll</key>
- <applyto>/apps/epiphany/web/smooth_scroll</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Enable smooth scrolling</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/user_agent</key>
- <applyto>/apps/epiphany/general/user_agent</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>User agent</short>
- <long>String that will be used as user agent, to identify the browser to the web servers.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/minimum_font_size</key>
- <applyto>/apps/epiphany/web/minimum_font_size</applyto>
- <owner>epiphany</owner>
- <type>int</type>
- <default>7</default>
- <locale name="C">
- <short>Minimum font size</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/use_own_colors</key>
- <applyto>/apps/epiphany/web/use_own_colors</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Use own colors</short>
- <long>Use your own colors instead of the colors the page
- requests.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/use_own_fonts</key>
- <applyto>/apps/epiphany/web/use_own_fonts</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Use own fonts</short>
- <long>Use your own fonts instead of the fonts the page
- requests.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/always_show_tabs_bar</key>
- <applyto>/apps/epiphany/general/always_show_tabs_bar</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Always show the tab bar</short>
- <long>Show the tab bar also when there is only one tab open.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/automatic_downloads</key>
- <applyto>/apps/epiphany/general/automatic_downloads</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Automatic downloads</short>
- <long>When files cannot be opened by the browser they are
- automatically downloaded to the download folder and opened
- with the appropriate application.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/middle_click_open_url</key>
- <applyto>/apps/epiphany/general/middle_click_open_url</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Middle click to open the web page pointed to by the currently
- selected text</short>
- <long>Middle clicking on the main view pane will open the web page
- pointed to by the currently selected text.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/toolbar_style</key>
- <applyto>/apps/epiphany/general/toolbar_style</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default></default>
- <locale name="C">
- <short>Toolbar style</short>
- <long>Toolbar style. Allowed values are "" (use GNOME default style),
- "both" (text and icons), "both-horiz" (text besides icons),
- "icons", and "text".</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/open_new_windows_in_tab</key>
- <applyto>/apps/epiphany/general/open_new_windows_in_tab</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Force new windows to be opened in tabs</short>
- <long>Force new window requests to be opened in tabs instead
- of using a new window.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/show_toolbars</key>
- <applyto>/apps/epiphany/general/show_toolbars</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Show toolbars by default</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/show_bookmarks_bar</key>
- <applyto>/apps/epiphany/general/show_bookmarks_bar</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Show bookmarks bar by default</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/show_statusbar</key>
- <applyto>/apps/epiphany/general/show_statusbar</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Show statusbar by default</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/active_extensions</key>
- <applyto>/apps/epiphany/general/active_extensions</applyto>
- <owner>epiphany</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[extensions-manager-ui]</default>
- <locale name="C">
- <short>Active extensions</short>
- <long>Lists the active extensions.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/default_encoding</key>
- <applyto>/apps/epiphany/web/default_encoding</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <locale name="C">
- <default><!-- Translators: this is the default encoding used by Epiphany for Web pages display -->ISO-8859-1</default>
- <short>Default encoding</short>
- <long>Default encoding. Accepted values are: "armscii-8", "Big5",
- "Big5-HKSCS", "EUC-JP", "EUC-KR", "gb18030", "GB2312", "geostd8",
- "HZ-GB-2312", "IBM850", "IBM852", "IBM855", "IBM857", "IBM862",
- "IBM864", "IBM866", "ISO-2022-CN", "ISO-2022-JP", "ISO-2022-KR",
- "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5",
- "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-8-I", "ISO-8859-9",
- "ISO-8859-10", "ISO-8859-11", "ISO-8859-13", "ISO-8859-14",
- "ISO-8859-15", "ISO-8859-16", "ISO-IR-111", "KOI8-R", "KOI8-U",
- "Shift_JIS", "TIS-620", "UTF-7", "UTF-8", "VISCII", "windows-874",
- "windows-1250", "windows-1251", "windows-1252", "windows-1253",
- "windows-1254", "windows-1255", "windows-1256", "windows-1257",
- "windows-1258", "x-euc-tw", "x-gbk", "x-johab", "x-mac-arabic",
- "x-mac-ce", "x-mac-croatian", "x-mac-cyrillic", "x-mac-devanagari",
- "x-mac-farsi", "x-mac-greek", "x-mac-gujarati", "x-mac-gurmukhi",
- "x-mac-hebrew", "x-mac-icelandic", "x-mac-roman", "x-mac-romanian",
- "x-mac-turkish", "x-mac-ukrainian", "x-user-defined", "x-viet-tcvn5712",
- "x-viet-vps" and "x-windows-949".</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/cache_size</key>
- <applyto>/apps/epiphany/web/cache_size</applyto>
- <owner>epiphany</owner>
- <type>int</type>
- <default>50</default>
- <locale name="C">
- <short>Size of disk cache</short>
- <long>Size of disk cache, in MB.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/language</key>
- <applyto>/apps/epiphany/web/language</applyto>
- <owner>epiphany</owner>
- <type>list</type>
- <list_type>string</list_type>
- <default>[]</default>
- <locale name="C">
- <short>Languages</short>
- <long>Preferred languages, two letter codes.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/print_page_title</key>
- <applyto>/apps/epiphany/dialogs/print_page_title</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Whether to print the page title in the header</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/print_page_url</key>
- <applyto>/apps/epiphany/dialogs/print_page_url</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Whether to print the page address in the header</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/print_date</key>
- <applyto>/apps/epiphany/dialogs/print_date</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Whether to print the date in the footer</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/print_background_colors</key>
- <applyto>/apps/epiphany/dialogs/print_background_colors</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Whether to print the background color</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/print_background_images</key>
- <applyto>/apps/epiphany/dialogs/print_background_images</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Whether to print the background images</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/print_page_numbers</key>
- <applyto>/apps/epiphany/dialogs/print_page_numbers</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Whether to print the page numbers (x of total) in the footer</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/print_frames</key>
- <applyto>/apps/epiphany/dialogs/print_frames</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default>normal</default>
- <locale name="C">
- <short>How to print frames</short>
- <long>How to print pages containing frames. Allowed values are "normal", "separately" and "selected".</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/directories/open</key>
- <applyto>/apps/epiphany/directories/open</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default>~</default>
- <locale name="C">
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/directories/save</key>
- <applyto>/apps/epiphany/directories/save</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default>~</default>
- <locale name="C">
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/directories/saveimage</key>
- <applyto>/apps/epiphany/directories/saveimage</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default>~</default>
- <locale name="C">
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/directories/upload</key>
- <applyto>/apps/epiphany/directories/upload</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default>~</default>
- <locale name="C">
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/directories/downloads_folder</key>
- <applyto>/apps/epiphany/directories/downloads_folder</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default>Downloads</default>
- <locale name="C">
- <short>The downloads folder</short>
- <long>The path of the folder where to download files to; or "Downloads" to use the default downloads folder, or "Desktop" to use the desktop folder.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/cookie_accept</key>
- <applyto>/apps/epiphany/web/cookie_accept</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default>current site</default>
- <locale name="C">
- <short>Cookie accept</short>
- <long>Where to accept cookies from. Possible values are "anywhere",
- "current site" and "nowhere".</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/image_animation</key>
- <applyto>/apps/epiphany/web/image_animation</applyto>
- <owner>epiphany</owner>
- <type>string</type>
- <default>normal</default>
- <locale name="C">
- <short>Image animation mode</short>
- <long>How to present animated images. Possible values are "normal",
- "once" and "disabled".</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/remember_passwords</key>
- <applyto>/apps/epiphany/general/remember_passwords</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Remember passwords</short>
- <long>Whether to store and prefill passwords in web sites.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/allow_popups</key>
- <applyto>/apps/epiphany/web/allow_popups</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Allow popups</short>
- <long>Allow sites to open new windows using JavaScript (if JavaScript
- is enabled).</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/plugins_enabled</key>
- <applyto>/apps/epiphany/web/plugins_enabled</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Enable Plugins</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/javascript_enabled</key>
- <applyto>/apps/epiphany/web/javascript_enabled</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Enable JavaScript</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/browse_with_caret</key>
- <applyto>/apps/epiphany/web/browse_with_caret</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Browse with caret</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/general/managed_network</key>
- <applyto>/apps/epiphany/general/managed_network</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Automatically manage offline status with NetworkManager</short>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/downloads_hidden</key>
- <applyto>/apps/epiphany/dialogs/downloads_hidden</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Visibility of the downloads window</short>
- <long>Hide or show the downloads window. When hidden, a notification will be shown when new downloads are started.</long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/dialogs/warn_on_close_unsubmitted_data</key>
- <applyto>/apps/epiphany/dialogs/warn_on_close_unsubmitted_data</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short></short>
- <long></long>
- </locale>
- </schema>
- <schema>
- <key>/schemas/apps/epiphany/web/inspector_enabled</key>
- <applyto>/apps/epiphany/web/inspector_enabled</applyto>
- <owner>epiphany</owner>
- <type>bool</type>
- <default>false</default>
- <locale name="C">
- <short>Enable Web Inspector</short>
- <long></long>
- </locale>
- </schema>
-
- </schemalist>
-</gconfschemafile>
diff --git a/data/glade/prefs-dialog.ui b/data/glade/prefs-dialog.ui
index 81c247896..32a9e1368 100644
--- a/data/glade/prefs-dialog.ui
+++ b/data/glade/prefs-dialog.ui
@@ -555,8 +555,9 @@
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <object class="GtkRadioButton" id="cookies_radiobutton">
+ <object class="GtkRadioButton" id="cookies_always_radiobutton">
<property name="label" translatable="yes">_Always accept</property>
+ <property name="name">always</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -570,14 +571,15 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="radiobutton58">
+ <object class="GtkRadioButton" id="cookies_no_third_party_radiobutton">
<property name="label" translatable="yes">Only _from sites you visit</property>
+ <property name="name">no-third-party</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- <property name="group">cookies_radiobutton</property>
+ <property name="group">cookies_always_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -605,14 +607,15 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="radiobutton59">
+ <object class="GtkRadioButton" id="cookies_never_radiobutton">
<property name="label" translatable="yes">_Never accept</property>
+ <property name="name">never</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- <property name="group">cookies_radiobutton</property>
+ <property name="group">cookies_always_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -707,7 +710,7 @@
<property name="visible">True</property>
<property name="label" translatable="yes">_Disk space:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">disk_cache_spin</property>
+ <property name="mnemonic_widget">disk_cache_spinbutton</property>
</object>
<packing>
<property name="expand">False</property>
@@ -720,7 +723,7 @@
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
- <object class="GtkSpinButton" id="disk_cache_spin">
+ <object class="GtkSpinButton" id="disk_cache_spinbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="adjustment">adjustment2</property>
diff --git a/data/org.gnome.epiphany.gschema.xml.in b/data/org.gnome.epiphany.gschema.xml.in
new file mode 100644
index 000000000..6bc4089da
--- /dev/null
+++ b/data/org.gnome.epiphany.gschema.xml.in
@@ -0,0 +1,237 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist>
+ <schema path="/apps/epiphany/" id="org.gnome.Epiphany">
+ <child schema="org.gnome.Epiphany.ui" name="ui"/>
+ <child schema="org.gnome.Epiphany.web" name="web"/>
+ <child schema="org.gnome.Epiphany.state" name="state"/>
+ <child schema="org.gnome.Epiphany.lockdown" name="lockdown"/>
+ <key type="b" name="enable-caret-browsing">
+ <default>false</default>
+ <summary>Browse with caret</summary>
+ </key>
+ <key type="b" name="enable-web-inspector">
+ <default>false</default>
+ <summary>Enable Web Inspector</summary>
+ </key>
+ <key type="s" name="homepage-url">
+ <default>'http://www.google.com'</default>
+ <summary>Home page</summary>
+ <description>Address of the user's home page.</description>
+ </key>
+ <key type="s" name="keyword-search-url">
+ <default>'http://www.google.com/search?q=%s&amp;ie=UTF-8&amp;oe=UTF-8'
+ </default>
+ <summary>URL Search</summary>
+ <description>Search string for keywords entered in the URL bar.</description>
+ </key>
+ <key type="s" name="user-agent">
+ <default>''</default>
+ <summary>User agent</summary>
+ <description>String that will be used as user agent, to identify the browser to the web servers.</description>
+ </key>
+ <key type="b" name="automatic-downloads">
+ <default>true</default>
+ <summary>Automatic downloads</summary>
+ <description>When files cannot be opened by the browser they are automatically downloaded to the download folder and opened with the appropriate application.</description>
+ </key>
+ <key type="b" name="middle-click-opens-url">
+ <default>false</default>
+ <summary>Middle click to open the web page pointed to by the currently selected text</summary>
+ <description>Middle clicking on the main view pane will open the web page pointed to by the currently selected text.</description>
+ </key>
+ <key type="b" name="new-windows-in-tabs">
+ <default>false</default>
+ <summary>Force new windows to be opened in tabs</summary>
+ <description>Force new window requests to be opened in tabs instead of using a new window.</description>
+ </key>
+ <key type="b" name="remember-passwords">
+ <default>true</default>
+ <summary>Remember passwords</summary>
+ <description>Whether to store and prefill passwords in web sites.</description>
+ </key>
+ <key type="b" name="managed-network">
+ <default>true</default>
+ <summary>Automatically manage offline status with NetworkManager</summary>
+ </key>
+ <key type="b" name="warn-on-close-unsubmitted-data">
+ <default>true</default>
+ </key>
+ <key type="b" name="enable-smooth-scrolling">
+ <default>false</default>
+ <summary>Enable smooth scrolling</summary>
+ </key>
+ <key type="as" name="enabled-extensions">
+ <default>['extensions-manager-ui' ]</default>
+ <summary>Active extensions</summary>
+ <description>Lists the active extensions.</description>
+ </key>
+ </schema>
+ <schema path="/apps/epiphany/ui/" id="org.gnome.Epiphany.ui">
+ <key type="b" name="show-toolbars">
+ <default>true</default>
+ <summary>Show toolbars by default</summary>
+ </key>
+ <key type="b" name="show-bookmarks-bar">
+ <default>false</default>
+ <summary>Show bookmarks bar by default</summary>
+ </key>
+ <key name="toolbar-style" enum="org.gnome.Epiphany.EphyPrefsUIToolbarStyle">
+ <default>'both-horiz'</default>
+ <summary>Toolbar style</summary>
+ <description>Toolbar style. Allowed values are "" (use GNOME default style), "both" (text and icons), "both-horiz" (text besides icons), "icons", and "text".</description>
+ </key>
+ <key type="b" name="always-show-tabs-bar">
+ <default>false</default>
+ <summary>Always show the tab bar</summary>
+ <description>Show the tab bar also when there is only one tab open.</description>
+ </key>
+ <key type="b" name="downloads-hidden">
+ <default>false</default>
+ <summary>Visibility of the downloads window</summary>
+ <description>Hide or show the downloads window. When hidden, a notification will be shown when new downloads are started.</description>
+ </key>
+ </schema>
+ <schema path="/apps/epiphany/web/" id="org.gnome.Epiphany.web">
+ <key type="i" name="min-font-size">
+ <default>7</default>
+ <summary>Minimum font size</summary>
+ </key>
+ <key type="b" name="use-own-colors">
+ <default>false</default>
+ <summary>Use own colors</summary>
+ <description>Use your own colors instead of the colors the page requests.</description>
+ </key>
+ <key type="b" name="use-own-fonts">
+ <default>false</default>
+ <summary>Use own fonts</summary>
+ <description>Use your own fonts instead of the fonts the page requests.</description>
+ </key>
+ <key type="b" name="enable-user-css">
+ <default>false</default>
+ <summary>Use a custom CSS</summary>
+ <description>Use a custom CSS file to modify websites own CSS.</description>
+ </key>
+ <key type="s" name="default-encoding">
+ <default>'UTF-8'</default>
+ <summary>Default encoding</summary>
+ <description>Default encoding. Accepted values are the ones WebKitGTK+ can understand.</description>
+ </key>
+ <key type="i" name="cache-size">
+ <default>50</default>
+ <summary>Size of disk cache</summary>
+ <description>Size of disk cache, in MB.</description>
+ </key>
+ <key type="as" name="language">
+ <default>[]</default>
+ <summary>Languages</summary>
+ <description>Preferred languages, two letter codes.</description>
+ </key>
+ <key name="cookies-policy" enum="org.gnome.Epiphany.EphyPrefsWebCookiesPolicy">
+ <default>'no-third-party'</default>
+ <summary>Cookie accept</summary>
+ <description>Where to accept cookies from. Possible values are "anywhere", "current site" and "nowhere".</description>
+ </key>
+ <key type="s" name="image-animation-mode">
+ <default>'normal'</default>
+ <summary>Image animation mode</summary>
+ <description>How to present animated images. Possible values are "normal", "once" and "disabled".</description>
+ </key>
+ <key type="b" name="enable-popups">
+ <default>true</default>
+ <summary>Allow popups</summary>
+ <description>Allow sites to open new windows using JavaScript (if JavaScript is enabled).</description>
+ </key>
+ <key type="b" name="enable-plugins">
+ <default>true</default>
+ <summary>Enable Plugins</summary>
+ </key>
+ <key type="b" name="enable-javascript">
+ <default>true</default>
+ <summary>Enable JavaScript</summary>
+ </key>
+ </schema>
+ <schema path="/apps/epiphany/state/" id="org.gnome.Epiphany.state">
+ <key type="s" name="open-dir">
+ <default>'~'</default>
+ </key>
+ <key type="s" name="save-dir">
+ <default>'~'</default>
+ </key>
+ <key type="s" name="save-image-dir">
+ <default>'~'</default>
+ </key>
+ <key type="s" name="upload-dir">
+ <default>'~'</default>
+ </key>
+ <key type="s" name="download-dir">
+ <default>'Downloads'</default>
+ <summary>The downloads folder</summary>
+ <description>The path of the folder where to download files to; or "Downloads" to use the default downloads folder, or "Desktop" to use the desktop folder.</description>
+ </key>
+ <key type="as" name="recent-encodings">
+ <default>['' ]</default>
+ </key>
+ <key type="i" name="history-date-filter">
+ <default>1</default>
+ <summary>History pages time range</summary>
+ </key>
+ <key type="b" name="history-view-title">
+ <default>true</default>
+ <summary>Whether to show the title column in the history window.</summary>
+ </key>
+ <key type="b" name="history-view-address">
+ <default>true</default>
+ <summary>Whether to show the address column in the history window.</summary>
+ </key>
+ <key type="b" name="history-view-date">
+ <default>false</default>
+ <summary>Whether to show the date-time column in the history window.</summary>
+ </key>
+ <key type="b" name="bookmarks-view-title">
+ <default>true</default>
+ <summary>Whether to show the title column in the bookmarks window.</summary>
+ </key>
+ <key type="b" name="bookmarks-view-address">
+ <default>false</default>
+ <summary>Whether to show the address column in the bookmarks window.</summary>
+ </key>
+ </schema>
+ <schema path="/apps/epiphany/lockdown/" id="org.gnome.Epiphany.lockdown">
+ <key type="b" name="disable-fullscreen">
+ <default>false</default>
+ </key>
+ <key type="b" name="disable-arbitrary-url">
+ <default>false</default>
+ </key>
+ <key type="b" name="disable-bookmark-editing">
+ <default>false</default>
+ </key>
+ <key type="b" name="disable-toolbar-editing">
+ <default>false</default>
+ </key>
+ <key type="b" name="disable-history">
+ <default>false</default>
+ </key>
+ <key type="b" name="disable-save-to-disk">
+ <default>false</default>
+ </key>
+ <key type="b" name="disable-printing">
+ <default>false</default>
+ </key>
+ <key type="b" name="disable-print-setup">
+ <default>false</default>
+ </key>
+ <key type="b" name="disable-command-line">
+ <default>false</default>
+ </key>
+ <key type="b" name="disable-quit">
+ <default>false</default>
+ </key>
+ <key type="b" name="disable-javascript-chrome">
+ <default>false</default>
+ </key>
+ <key type="b" name="disable-menubar">
+ <default>false</default>
+ </key>
+ </schema>
+</schemalist>
diff --git a/data/ui/epiphany-bookmark-editor-ui.xml b/data/ui/epiphany-bookmark-editor-ui.xml
index 7475a79be..ac4ae962a 100644
--- a/data/ui/epiphany-bookmark-editor-ui.xml
+++ b/data/ui/epiphany-bookmark-editor-ui.xml
@@ -29,7 +29,7 @@
<menu name="ViewMenu" action="View">
<menuitem action="ViewTitle"/>
- <menuitem action="ViewTitleAddress"/>
+ <menuitem action="ViewAddress"/>
</menu>
<menu name="HelpMenu" action="Help">
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index e62064a45..698a0fe6e 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -28,7 +28,7 @@
#include "ephy-gui.h"
#include "ephy-debug.h"
#include "ephy-prefs.h"
-#include "eel-gconf-extensions.h"
+#include "ephy-settings.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@@ -76,25 +76,6 @@ struct _DownloaderViewPrivate
enum
{
- PROP_WINDOW,
- PROP_TREEVIEW,
- PROP_PAUSE_BUTTON,
- PROP_ABORT_BUTTON,
-};
-
-static const
-EphyDialogProperty properties [] =
-{
- { "download_manager_dialog", NULL, PT_NORMAL, 0 },
- { "clist", NULL, PT_NORMAL, 0 },
- { "pause_button", NULL, PT_NORMAL, 0 },
- { "abort_button", NULL, PT_NORMAL, 0 },
-
- { NULL }
-};
-
-enum
-{
RESPONSE_PAUSE = 1,
RESPONSE_STOP = 2
};
@@ -146,12 +127,14 @@ show_downloader_cb (DownloaderView *dv)
if (!gtk_window_has_toplevel_focus (GTK_WINDOW (dv->priv->window)))
{
ephy_dialog_show (EPHY_DIALOG (dv));
- eel_gconf_set_boolean (CONF_DOWNLOADS_HIDDEN, FALSE);
+ g_settings_set_boolean (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_DOWNLOADS_HIDDEN, FALSE);
}
else
{
ephy_dialog_hide (EPHY_DIALOG (dv));
- eel_gconf_set_boolean (CONF_DOWNLOADS_HIDDEN, TRUE);
+ g_settings_set_boolean (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_DOWNLOADS_HIDDEN, TRUE);
}
}
@@ -752,7 +735,8 @@ downloader_view_add_download (DownloaderView *dv,
return;
}
- if (eel_gconf_get_boolean (CONF_DOWNLOADS_HIDDEN) && !visible)
+ if (g_settings_get_boolean (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_DOWNLOADS_HIDDEN) && !visible)
{
#ifdef HAVE_LIBNOTIFY
char *name;
@@ -864,19 +848,17 @@ downloader_view_build_ui (DownloaderView *dv)
GtkTreeSelection *selection;
ephy_dialog_construct (d,
- properties,
ephy_file ("epiphany.ui"),
"download_manager_dialog",
NULL);
/* lookup needed widgets */
- ephy_dialog_get_controls
- (d,
- properties[PROP_WINDOW].id, &priv->window,
- properties[PROP_TREEVIEW].id, &priv->treeview,
- properties[PROP_PAUSE_BUTTON].id, &priv->pause_button,
- properties[PROP_ABORT_BUTTON].id, &priv->abort_button,
- NULL);
+ ephy_dialog_get_controls (d,
+ "download_manager_dialog", &priv->window,
+ "clist", &priv->treeview,
+ "pause_button", &priv->pause_button,
+ "abort_button", &priv->abort_button,
+ NULL);
g_signal_connect (priv->window, "response",
G_CALLBACK (download_dialog_response_cb), dv);
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index b39238b08..2b43f69ea 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -1,4 +1,5 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
+/* vim: set sw=2 ts=2 sts=2 et: */
/* Copyright © 2008 Xan Lopez <xan@gnome.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -22,105 +23,34 @@
#include <glib.h>
#include <webkit/webkit.h>
-#include "eel-gconf-extensions.h"
#include "ephy-embed-prefs.h"
+#include "ephy-embed-shell.h"
#include "ephy-embed-utils.h"
#include "ephy-file-helpers.h"
#include "ephy-langs.h"
+#include "ephy-prefs.h"
+#include "ephy-settings.h"
typedef struct
{
- char *gconf_key;
+ char *schema;
+ char *key;
char *webkit_pref;
- GConfClientNotifyFunc func;
- guint cnxn_id;
+ GCallback callback;
} PrefData;
-static WebKitWebSettings *settings = NULL;
-static guint *connections = NULL;
+static WebKitWebSettings *webkit_settings = NULL;
static void
-webkit_pref_callback_int (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer data)
-{
- GConfValue *gcvalue;
- gint value = 0;
- char *webkit_pref = data;
-
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_INT) {
- value = gconf_value_get_int (gcvalue);
- value = MAX (value, 0);
- }
-
- g_object_set (settings, webkit_pref, value, NULL);
-}
-
-static void
-webkit_pref_callback_boolean (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer data)
-{
- GConfValue *gcvalue;
- gboolean value = FALSE;
- char *webkit_pref = data;
-
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_BOOL) {
- value = gconf_value_get_bool (gcvalue);
- }
-
- g_object_set (settings, webkit_pref, value, NULL);
-}
-
-static void
-webkit_pref_callback_string (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer data)
-{
- GConfValue *gcvalue;
- const char *value = NULL;
- char *webkit_pref = data;
-
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_STRING) {
- value = gconf_value_get_string (gcvalue);
- }
-
- g_object_set (settings, webkit_pref, value, NULL);
-}
-
-static void
-webkit_pref_callback_user_stylesheet (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+webkit_pref_callback_user_stylesheet (GSettings *settings,
+ char *key,
gpointer data)
{
- GConfValue *gcvalue;
gboolean value = FALSE;
char *uri = NULL;
char *webkit_pref = data;
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_BOOL) {
- value = gconf_value_get_bool (gcvalue);
- }
+ value = g_settings_get_boolean (settings, key);
if (value)
/* We need the leading file://, so use g_strconcat instead
@@ -130,7 +60,8 @@ webkit_pref_callback_user_stylesheet (GConfClient *client,
G_DIR_SEPARATOR_S,
USER_STYLESHEET_FILENAME,
NULL);
- g_object_set (settings, webkit_pref, uri, NULL);
+
+ g_object_set (webkit_settings, webkit_pref, uri, NULL);
g_free (uri);
}
@@ -175,7 +106,7 @@ webkit_pref_get_internal_user_agent (void)
g_key_file_free (branding_keyfile);
- g_object_get (settings, "user-agent", &webkit_user_agent, NULL);
+ g_object_get (webkit_settings, "user-agent", &webkit_user_agent, NULL);
user_agent = g_strconcat (webkit_user_agent, " ",
vendor_user_agent ? vendor_user_agent : "",
@@ -190,51 +121,37 @@ webkit_pref_get_internal_user_agent (void)
}
static void
-webkit_pref_callback_user_agent (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+webkit_pref_callback_user_agent (GSettings *settings,
+ char *key,
gpointer data)
{
- GConfValue *gcvalue;
- const char *value = NULL;
+ char *value = NULL;
static char *internal_user_agent = NULL;
char *webkit_pref = data;
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_STRING) {
- value = gconf_value_get_string (gcvalue);
- }
+ value = g_settings_get_string (settings, key);
if (value == NULL || value[0] == '\0') {
if (internal_user_agent == NULL)
internal_user_agent = webkit_pref_get_internal_user_agent ();
- g_object_set (settings, webkit_pref, internal_user_agent, NULL);
+ g_object_set (webkit_settings, webkit_pref, internal_user_agent, NULL);
} else
- g_object_set (settings, webkit_pref, value, NULL);
+ g_object_set (webkit_settings, webkit_pref, value, NULL);
+
+ g_free (value);
}
static void
-webkit_pref_callback_font_size (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+webkit_pref_callback_font_size (GSettings *settings,
+ char *key,
gpointer data)
{
- GConfValue *gcvalue;
char *webkit_pref = data;
- const char *value = NULL;
+ char *value = NULL;
int size = 9; /* FIXME: What to use here? */
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_STRING) {
- value = gconf_value_get_string (gcvalue);
- }
+ value = g_settings_get_string (settings, key);
if (value) {
PangoFontDescription* desc;
@@ -246,26 +163,19 @@ webkit_pref_callback_font_size (GConfClient *client,
pango_font_description_free (desc);
}
- g_object_set (settings, webkit_pref, size, NULL);
+ g_object_set (webkit_settings, webkit_pref, size, NULL);
+ g_free (value);
}
static void
-webkit_pref_callback_font_family (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+webkit_pref_callback_font_family (GSettings *settings,
+ char *key,
gpointer data)
{
- GConfValue *gcvalue;
char *webkit_pref = data;
- const char *value = NULL;
-
- gcvalue = gconf_entry_get_value (entry);
+ char *value = NULL;
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_STRING) {
- value = gconf_value_get_string (gcvalue);
- }
+ value = g_settings_get_string (settings, key);
if (value) {
PangoFontDescription* desc;
@@ -273,9 +183,11 @@ webkit_pref_callback_font_family (GConfClient *client,
desc = pango_font_description_from_string (value);
family = pango_font_description_get_family (desc);
- g_object_set (settings, webkit_pref, family, NULL);
+ g_object_set (webkit_settings, webkit_pref, family, NULL);
pango_font_description_free (desc);
}
+
+ g_free (value);
}
/* Part of this code taken from libsoup (soup-session.c) */
@@ -324,40 +236,31 @@ build_accept_languages_header (GArray *languages)
/* Based on Christian Persch's code from gecko backend of epiphany
(old transform_accept_languages_list() function) */
static void
-webkit_pref_callback_accept_languages (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+webkit_pref_callback_accept_languages (GSettings *settings,
+ char *key,
gpointer data)
{
SoupSession *session;
- GConfValue *gcvalue;
GArray *array;
- GSList *languages, *l;
- char **array_data;
+ char **languages;
char *langs_str;
char *webkit_pref;
+ int i;
webkit_pref = data;
- gcvalue = gconf_entry_get_value (entry);
- if (gcvalue == NULL ||
- gcvalue->type != GCONF_VALUE_LIST ||
- gconf_value_get_list_type (gcvalue) != GCONF_VALUE_STRING)
- return;
- languages = gconf_value_get_list (gcvalue);
+ languages = g_settings_get_strv (settings, key);
array = g_array_new (TRUE, FALSE, sizeof (char *));
- for (l = languages; l != NULL; l = l->next) {
- const char *lang = gconf_value_get_string ((GConfValue *) l->data);
-
- if ((lang != NULL) && !g_strcmp0 (lang, "system")) {
- ephy_langs_append_languages (array);
- } else if (lang != NULL && lang[0] != '\0') {
- char *str = g_ascii_strdown (lang, -1);
- g_array_append_val (array, str);
- }
- }
+ for (i = 0; languages[i]; i++) {
+ if (!g_strcmp0 (languages[i], "system")) {
+ ephy_langs_append_languages (array);
+ } else if (languages[i][0] != '\0') {
+ char *str = g_ascii_strdown (languages[i], -1);
+ g_array_append_val (array, str);
+ }
+ }
ephy_langs_sanitise (array);
@@ -367,26 +270,24 @@ webkit_pref_callback_accept_languages (GConfClient *client,
session = webkit_get_default_session ();
g_object_set (G_OBJECT (session), webkit_pref, langs_str, NULL);
- /* Free memory */
- array_data = (char **) g_array_free (array, FALSE);
- g_strfreev (array_data);
+ g_strfreev (languages);
g_free (langs_str);
}
void
ephy_embed_prefs_set_cookie_jar_policy (SoupCookieJar *jar,
- const char *gconf_policy)
+ const char *settings_policy)
{
SoupCookieJarAcceptPolicy policy;
g_return_if_fail (SOUP_IS_COOKIE_JAR (jar));
- g_return_if_fail (gconf_policy != NULL);
+ g_return_if_fail (settings_policy != NULL);
- if (g_str_equal (gconf_policy, "nowhere"))
+ if (g_str_equal (settings_policy, "never"))
policy = SOUP_COOKIE_JAR_ACCEPT_NEVER;
- else if (g_str_equal (gconf_policy, "anywhere"))
+ else if (g_str_equal (settings_policy, "always"))
policy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS;
- else if (g_str_equal (gconf_policy, "current site"))
+ else if (g_str_equal (settings_policy, "no-third-party"))
policy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY;
else {
g_warn_if_reached ();
@@ -397,25 +298,16 @@ ephy_embed_prefs_set_cookie_jar_policy (SoupCookieJar *jar,
}
static void
-webkit_pref_callback_cookie_accept_policy (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+webkit_pref_callback_cookie_accept_policy (GSettings *settings,
+ char *key,
gpointer data)
{
SoupSession *session;
char *webkit_pref;
- GConfValue *gcvalue;
- const char *value = NULL;
+ char *value = NULL;
webkit_pref = data;
-
- gcvalue = gconf_entry_get_value (entry);
-
- /* happens on initial notify if the key doesn't exist */
- if (gcvalue != NULL &&
- gcvalue->type == GCONF_VALUE_STRING) {
- value = gconf_value_get_string (gcvalue);
- }
+ value = g_settings_get_string (settings, key);
if (value) {
SoupSessionFeature *jar;
@@ -427,58 +319,48 @@ webkit_pref_callback_cookie_accept_policy (GConfClient *client,
ephy_embed_prefs_set_cookie_jar_policy (SOUP_COOKIE_JAR (jar), value);
}
+
+ g_free (value);
}
static const PrefData webkit_pref_entries[] =
{
- { CONF_RENDERING_FONT_MIN_SIZE,
- "minimum-logical-font-size",
- webkit_pref_callback_int },
- { CONF_DESKTOP_FONT_VAR_NAME,
+ { "org.gnome.desktop.interface",
+ "font-name",
"default-font-size",
- webkit_pref_callback_font_size },
- { CONF_DESKTOP_FONT_VAR_NAME,
+ G_CALLBACK (webkit_pref_callback_font_size) },
+ { "org.gnome.desktop.interface",
+ "font-name",
"default-font-family",
- webkit_pref_callback_font_family },
- { CONF_DESKTOP_FONT_VAR_NAME,
+ G_CALLBACK (webkit_pref_callback_font_family) },
+ { "org.gnome.desktop.interface",
+ "font-name",
"sans-serif-font-family",
- webkit_pref_callback_font_family },
- { CONF_DESKTOP_FONT_FIXED_NAME,
+ G_CALLBACK (webkit_pref_callback_font_family) },
+ { "org.gnome.desktop.interface",
+ "monospace-font-name",
"default-monospace-font-size",
- webkit_pref_callback_font_size },
- { CONF_DESKTOP_FONT_FIXED_NAME,
+ G_CALLBACK (webkit_pref_callback_font_size) },
+ { "org.gnome.desktop.interface",
+ "monospace-font-name",
"monospace-font-family",
- webkit_pref_callback_font_family },
- { CONF_SECURITY_JAVASCRIPT_ENABLED,
- "enable-scripts",
- webkit_pref_callback_boolean },
- { CONF_LANGUAGE_DEFAULT_ENCODING,
- "default-encoding",
- webkit_pref_callback_string },
- { CONF_WEB_INSPECTOR_ENABLED,
- "enable-developer-extras",
- webkit_pref_callback_boolean },
- { CONF_USER_CSS_ENABLED,
+ G_CALLBACK (webkit_pref_callback_font_family) },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_ENABLE_USER_CSS,
"user-stylesheet-uri",
- webkit_pref_callback_user_stylesheet },
- { CONF_CARET_BROWSING_ENABLED,
- "enable-caret-browsing",
- webkit_pref_callback_boolean },
- { CONF_SECURITY_ALLOW_POPUPS,
- "javascript-can-open-windows-automatically",
- webkit_pref_callback_boolean },
- { CONF_RENDERING_LANGUAGE,
+ G_CALLBACK (webkit_pref_callback_user_stylesheet) },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_LANGUAGE,
"accept-language",
- webkit_pref_callback_accept_languages },
- { CONF_USER_AGENT,
+ G_CALLBACK (webkit_pref_callback_accept_languages) },
+ { EPHY_PREFS_SCHEMA,
+ EPHY_PREFS_USER_AGENT,
"user-agent",
- webkit_pref_callback_user_agent },
- { CONF_SECURITY_COOKIES_ACCEPT,
+ G_CALLBACK (webkit_pref_callback_user_agent) },
+ { EPHY_PREFS_WEB_SCHEMA,
+ EPHY_PREFS_WEB_COOKIES_POLICY,
"accept-policy",
- webkit_pref_callback_cookie_accept_policy },
- { CONF_SECURITY_PLUGINS_ENABLED,
- "enable-plugins",
- webkit_pref_callback_boolean }
+ G_CALLBACK (webkit_pref_callback_cookie_accept_policy) },
};
static void
@@ -493,12 +375,10 @@ ephy_embed_prefs_init (void)
{
int i;
- eel_gconf_monitor_add ("/apps/epiphany/web");
-
- settings = webkit_web_settings_new ();
+ webkit_settings = webkit_web_settings_new ();
/* Hardcoded settings */
- g_object_set (settings,
+ g_object_set (webkit_settings,
"auto-shrink-images", FALSE,
"enable-default-context-menu", FALSE,
"enable-site-specific-quirks", TRUE,
@@ -506,33 +386,58 @@ ephy_embed_prefs_init (void)
"auto-resize-window", TRUE,
NULL);
- /* Connections */
- connections = g_malloc (sizeof (guint) * G_N_ELEMENTS (webkit_pref_entries));
-
for (i = 0; i < G_N_ELEMENTS (webkit_pref_entries); i++) {
- connections[i] = eel_gconf_notification_add (webkit_pref_entries[i].gconf_key,
- webkit_pref_entries[i].func,
- webkit_pref_entries[i].webkit_pref);
+ GSettings *settings;
+ char *key;
+
+ settings = ephy_settings_get (webkit_pref_entries[i].schema);
+ key = g_strconcat ("changed::", webkit_pref_entries[i].key, NULL);
- eel_gconf_notify (webkit_pref_entries[i].gconf_key);
+ g_signal_connect (settings, key,
+ webkit_pref_entries[i].callback,
+ webkit_pref_entries[i].webkit_pref);
+ g_free (key);
}
+
+ g_settings_bind (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_ENABLE_JAVASCRIPT,
+ webkit_settings, "enable-scripts",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLE_WEB_INSPECTOR,
+ webkit_settings, "enable-developer-extras",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLE_CARET_BROWSING,
+ webkit_settings, "enable-caret-browsing",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_ENABLE_POPUPS,
+ webkit_settings, "javascript-can-open-windows-automatically",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_ENABLE_PLUGINS,
+ webkit_settings, "enable-plugins",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_FONT_MIN_SIZE,
+ webkit_settings, "minimum-logical-font-size",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_DEFAULT_ENCODING,
+ webkit_settings, "default-encoding",
+ G_SETTINGS_BIND_GET);
}
void
ephy_embed_prefs_shutdown (void)
{
- int i;
-
- for (i = 0; i < G_N_ELEMENTS (webkit_pref_entries); i++)
- eel_gconf_notification_remove (connections[i]);
-
- g_free (connections);
- g_object_unref (settings);
+ g_object_unref (webkit_settings);
}
void
ephy_embed_prefs_add_embed (EphyEmbed *embed)
{
- ephy_embed_prefs_apply (embed, settings);
+ ephy_embed_prefs_apply (embed, webkit_settings);
}
diff --git a/embed/ephy-embed-prefs.h b/embed/ephy-embed-prefs.h
index 4cb63a3ad..0afbef5d3 100644
--- a/embed/ephy-embed-prefs.h
+++ b/embed/ephy-embed-prefs.h
@@ -23,29 +23,6 @@
#include "ephy-embed.h"
-#define CONF_NETWORK_CACHE_SIZE "/apps/epiphany/web/cache_size"
-#define CONF_RENDERING_FONT "/apps/epiphany/web/font"
-#define CONF_RENDERING_FONT_MIN_SIZE "/apps/epiphany/web/minimum_font_size"
-#define CONF_RENDERING_LANGUAGE "/apps/epiphany/web/language"
-#define CONF_RENDERING_USE_OWN_COLORS "/apps/epiphany/web/use_own_colors"
-#define CONF_RENDERING_USE_OWN_FONTS "/apps/epiphany/web/use_own_fonts"
-#define CONF_USER_CSS_ENABLED "/apps/epiphany/web/user_css_enabled"
-#define CONF_SECURITY_ALLOW_POPUPS "/apps/epiphany/web/allow_popups"
-#define CONF_SECURITY_PLUGINS_ENABLED "/apps/epiphany/web/plugins_enabled"
-#define CONF_SECURITY_JAVASCRIPT_ENABLED "/apps/epiphany/web/javascript_enabled"
-#define CONF_SECURITY_COOKIES_ACCEPT "/apps/epiphany/web/cookie_accept"
-#define CONF_LANGUAGE_AUTODETECT_ENCODING "/apps/epiphany/web/autodetect_encoding"
-#define CONF_LANGUAGE_DEFAULT_ENCODING "/apps/epiphany/web/default_encoding"
-#define CONF_IMAGE_ANIMATION_MODE "/apps/epiphany/web/image_animation"
-#define CONF_IMAGE_LOADING_MODE "/apps/epiphany/web/image_loading"
-#define CONF_DISPLAY_SMOOTHSCROLL "/apps/epiphany/web/smooth_scroll"
-#define CONF_WEB_INSPECTOR_ENABLED "/apps/epiphany/web/inspector_enabled"
-#define CONF_CARET_BROWSING_ENABLED "/apps/epiphany/web/browse_with_caret"
-#define CONF_USER_AGENT "/apps/epiphany/general/user_agent"
-
-#define CONF_DESKTOP_FONT_VAR_NAME "/desktop/gnome/interface/font_name"
-#define CONF_DESKTOP_FONT_FIXED_NAME "/desktop/gnome/interface/monospace_font_name"
-
#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION)
#error "Only <epiphany/epiphany.h> can be included directly."
#endif
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index 04ead3f57..560eb3431 100644
--- a/embed/ephy-embed-single.c
+++ b/embed/ephy-embed-single.c
@@ -23,8 +23,8 @@
#define LIBSOUP_I_HAVE_READ_BUG_594377_AND_KNOW_SOUP_PASSWORD_MANAGER_MIGHT_GO_AWAY
#define NSPLUGINWRAPPER_SETUP "/usr/bin/mozilla-plugin-config"
-#include "eel-gconf-extensions.h"
#include "ephy-embed-single.h"
+#include "ephy-embed-shell.h"
#include "ephy-embed-prefs.h"
#include "ephy-embed-type-builtins.h"
#include "ephy-debug.h"
@@ -33,6 +33,8 @@
#include "ephy-signal-accumulator.h"
#include "ephy-permission-manager.h"
#include "ephy-profile-migration.h"
+#include "ephy-prefs.h"
+#include "ephy-settings.h"
#ifdef ENABLE_CERTIFICATE_MANAGER
#include "ephy-certificate-manager.h"
@@ -480,7 +482,8 @@ ephy_embed_single_initialize (EphyEmbedSingle *single)
filename = g_build_filename (ephy_dot_dir (), "cookies.sqlite", NULL);
jar = soup_cookie_jar_sqlite_new (filename, FALSE);
g_free (filename);
- cookie_policy = eel_gconf_get_string (CONF_SECURITY_COOKIES_ACCEPT);
+ cookie_policy = g_settings_get_string (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_COOKIES_POLICY);
ephy_embed_prefs_set_cookie_jar_policy (jar, cookie_policy);
g_free (cookie_policy);
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 0f6b01198..77066d393 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -26,7 +26,6 @@
#include "config.h"
#include "downloader-view.h"
-#include "eel-gconf-extensions.h"
#include "ephy-adblock-manager.h"
#include "ephy-debug.h"
#include "ephy-embed.h"
@@ -40,6 +39,7 @@
#include "ephy-file-helpers.h"
#include "ephy-history.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-stock-icons.h"
#include "ephy-string.h"
#include "ephy-web-view.h"
@@ -445,7 +445,7 @@ request_destination_uri (WebKitWebView *web_view,
dialog = ephy_file_chooser_new (_("Save"),
window,
GTK_FILE_CHOOSER_ACTION_SAVE,
- CONF_STATE_SAVE_DIR,
+ EPHY_PREFS_STATE_SAVE_DIR,
EPHY_FILE_FILTER_ALL_SUPPORTED);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), suggested_filename);
@@ -823,7 +823,8 @@ download_status_changed_cb (GObject *object,
*/
g_object_freeze_notify (G_OBJECT (download));
- if (eel_gconf_get_boolean (CONF_AUTO_DOWNLOADS)) {
+ if (g_settings_get_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_AUTO_DOWNLOADS)) {
perform_auto_download (download);
/* User won't select a destination, unfreeze. */
g_object_thaw_notify (G_OBJECT (download));
@@ -857,7 +858,8 @@ download_requested_cb (WebKitWebView *web_view,
EphyEmbed *embed)
{
/* Is download locked down? */
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK))
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK))
return FALSE;
/* Wait for the request to be sent in all cases, so that we have a
diff --git a/embed/ephy-encodings.c b/embed/ephy-encodings.c
index 15230ac64..597f53132 100644
--- a/embed/ephy-encodings.c
+++ b/embed/ephy-encodings.c
@@ -24,8 +24,9 @@
#include "ephy-encodings.h"
#include "ephy-node-db.h"
#include "ephy-file-helpers.h"
-#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
+#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include <glib/gi18n.h>
#include <string.h>
@@ -146,7 +147,6 @@ enum
DETECTORS_NODE_ID = 5
};
-#define RECENT_KEY "/apps/epiphany/general/recent_encodings"
#define RECENT_MAX 4
static void ephy_encodings_class_init (EphyEncodingsClass *klass);
@@ -326,7 +326,8 @@ void
ephy_encodings_add_recent (EphyEncodings *encodings,
const char *code)
{
- GSList *element;
+ GSList *element, *l;
+ GVariantBuilder builder;
g_return_if_fail (EPHY_IS_ENCODINGS (encodings));
g_return_if_fail (code != NULL);
@@ -358,8 +359,15 @@ ephy_encodings_add_recent (EphyEncodings *encodings,
g_slist_remove_link (encodings->priv->recent, tail);
}
- /* persist the list */
- eel_gconf_set_string_list (RECENT_KEY, encodings->priv->recent);
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY);
+ for (l = encodings->priv->recent; l; l = l->next)
+ {
+ g_variant_builder_add (&builder, "s", l->data);
+ }
+
+ g_settings_set (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_RECENT_ENCODINGS,
+ "as", &builder);
}
GList *
@@ -385,8 +393,8 @@ static void
ephy_encodings_init (EphyEncodings *encodings)
{
EphyNodeDb *db;
- GSList *list, *l;
- guint i;
+ char **list;
+ int i;
encodings->priv = EPHY_ENCODINGS_GET_PRIVATE (encodings);
@@ -412,29 +420,29 @@ ephy_encodings_init (EphyEncodings *encodings)
}
/* get the list of recently used encodings */
- list = eel_gconf_get_string_list (RECENT_KEY);
+ list = g_settings_get_strv (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_RECENT_ENCODINGS);
/* make sure the list has no duplicates (GtkUIManager goes
* crazy otherwise), and only valid entries
*/
encodings->priv->recent = NULL;
- for (l = list; l != NULL; l = l->next)
+ for (i = 0; list[i]; i++)
{
- if (g_slist_find (encodings->priv->recent, l->data) == NULL
+ char *item;
+ item = list[i];
+
+ if (g_slist_find (encodings->priv->recent, item) == NULL
&& g_slist_length (encodings->priv->recent) < RECENT_MAX
- && ephy_encodings_get_node (encodings, l->data, FALSE) != NULL)
+ && ephy_encodings_get_node (encodings, item, FALSE) != NULL)
{
encodings->priv->recent =
g_slist_prepend (encodings->priv->recent,
- l->data);
- }
- else
- {
- g_free (l->data);
+ g_strdup (item));
}
}
encodings->priv->recent = g_slist_reverse (encodings->priv->recent);
- g_slist_free (list);
+ g_strfreev (list);
}
EphyEncodings *
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index 117315c34..86a4aaaf0 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -26,8 +26,8 @@
#include "ephy-debug.h"
#include "ephy-node-db.h"
#include "ephy-node-common.h"
-#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-string.h"
#include <time.h>
@@ -59,7 +59,6 @@ struct _EphyHistoryPrivate
GHashTable *pages_hash;
guint autosave_timeout;
guint update_hosts_idle;
- guint disable_history_notifier_id;
gboolean dirty;
gboolean enabled;
};
@@ -469,16 +468,6 @@ connect_page_removed_from_host (char *url,
}
static void
-disable_history_notifier (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyHistory *history)
-{
- ephy_history_set_enabled
- (history, !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_HISTORY));
-}
-
-static void
ephy_history_init (EphyHistory *eb)
{
EphyNodeDb *db;
@@ -561,10 +550,10 @@ ephy_history_init (EphyHistory *eb)
(GSourceFunc)periodic_save_cb,
eb);
- disable_history_notifier (NULL, 0, NULL, eb);
- eb->priv->disable_history_notifier_id = eel_gconf_notification_add
- (CONF_LOCKDOWN_DISABLE_HISTORY,
- (GConfClientNotifyFunc) disable_history_notifier, eb);
+ g_settings_bind (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_HISTORY,
+ eb, "enabled",
+ G_SETTINGS_BIND_INVERT_BOOLEAN | G_SETTINGS_BIND_GET);
}
static void
@@ -589,8 +578,6 @@ ephy_history_finalize (GObject *object)
g_source_remove (eb->priv->autosave_timeout);
- eel_gconf_notification_remove (eb->priv->disable_history_notifier_id);
-
g_free (eb->priv->xml_file);
LOG ("Global history finalized");
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index ba2f48f78..ac68164d4 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -29,7 +29,6 @@
#include <webkit/webkit.h>
#include <gnome-keyring.h>
-#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
#include "ephy-embed.h"
#include "ephy-embed-container.h"
@@ -45,6 +44,7 @@
#include "ephy-profile-migration.h"
#include "ephy-favicon-cache.h"
#include "ephy-history.h"
+#include "ephy-settings.h"
#include "ephy-string.h"
#include "ephy-web-view.h"
#include "ephy-zoom.h"
@@ -345,8 +345,8 @@ ephy_web_view_get_popups_allowed (EphyWebView *view)
break;
case EPHY_PERMISSION_DEFAULT:
default:
- allow = eel_gconf_get_boolean
- (CONF_SECURITY_ALLOW_POPUPS);
+ allow = g_settings_get_boolean (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_ENABLE_POPUPS);
break;
}
@@ -1990,7 +1990,8 @@ load_status_cb (WebKitWebView *web_view,
g_object_notify (object, "embed-title");
if (ephy_has_private_profile () == FALSE &&
- eel_gconf_get_boolean (CONF_PRIVACY_REMEMBER_PASSWORDS))
+ g_settings_get_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_REMEMBER_PASSWORDS))
_ephy_web_view_hook_into_forms (view);
_ephy_web_view_hook_into_links (view);
@@ -2220,7 +2221,8 @@ normalize_or_autosearch_url (EphyWebView *view, const char *url)
!g_regex_match (priv->non_search_regex, url, 0, NULL)) {
char *query_param, *url_search;
- url_search = eel_gconf_get_string (CONF_URL_SEARCH);
+ url_search = g_settings_get_string (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_KEYWORD_SEARCH_URL);
if (url_search == NULL || url_search[0] == '\0') {
g_free (url_search);
@@ -3561,7 +3563,7 @@ ephy_web_view_load_homepage (EphyWebView *view)
g_signal_emit_by_name (view, "loading-homepage");
- home = eel_gconf_get_string (CONF_GENERAL_HOMEPAGE);
+ home = g_settings_get_string (EPHY_SETTINGS_MAIN, EPHY_PREFS_HOMEPAGE_URL);
if (home == NULL || home[0] == '\0')
{
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 08f19224e..b98c1b37b 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -8,7 +8,6 @@ header_DATA = \
$(INST_H_FILES)
NOINST_H_FILES = \
- eel-gconf-extensions.h \
ephy-debug.h \
ephy-dnd.h \
ephy-file-chooser.h \
@@ -38,10 +37,10 @@ INST_H_FILES = \
ephy-loader.h \
ephy-node.h \
ephy-node-db.h \
+ ephy-settings.h \
ephy-state.h
libephymisc_la_SOURCES = \
- eel-gconf-extensions.c \
ephy-debug.c \
ephy-dialog.c \
ephy-dnd.c \
@@ -60,6 +59,7 @@ libephymisc_la_SOURCES = \
ephy-prefs.h \
ephy-profile-migration.c \
ephy-print-utils.c \
+ ephy-settings.c \
ephy-shlib-loader.c \
ephy-signal-accumulator.c \
ephy-state.c \
diff --git a/lib/eel-gconf-extensions.c b/lib/eel-gconf-extensions.c
deleted file mode 100644
index 310ce1c17..000000000
--- a/lib/eel-gconf-extensions.c
+++ /dev/null
@@ -1,724 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* eel-gconf-extensions.c - Stuff to make GConf easier to use.
-
- Copyright © 2000, 2001 Eazel, Inc.
-
- The Gnome Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The Gnome Library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the Gnome Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- Authors: Ramiro Estrugo <ramiro@eazel.com>
-
-*/
-
-#include "config.h"
-
-#include "eel-gconf-extensions.h"
-
-#include <glib/gi18n.h>
-
-#include <gconf/gconf-client.h>
-#include <gconf/gconf.h>
-#include <string.h>
-
-static GConfClient *global_gconf_client = NULL;
-
-static void
-global_client_free (void)
-{
- if (global_gconf_client == NULL) {
- return;
- }
-
- g_object_unref (global_gconf_client);
- global_gconf_client = NULL;
-}
-
-/* Public */
-GConfClient *
-eel_gconf_client_get_global (void)
-{
- if (global_gconf_client == NULL) {
- global_gconf_client = gconf_client_get_default ();
- g_atexit (global_client_free);
- }
-
- return global_gconf_client;
-}
-
-gboolean
-eel_gconf_handle_error (GError **error)
-{
- g_return_val_if_fail (error != NULL, FALSE);
-
- if (*error != NULL) {
- g_warning (_("GConf error:\n %s"), (*error)->message);
- g_error_free (*error);
- *error = NULL;
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-void
-eel_gconf_set_boolean (const char *key,
- gboolean boolean_value)
-{
- GConfClient *client;
- GError *error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_set_bool (client, key, boolean_value, &error);
- eel_gconf_handle_error (&error);
-}
-
-gboolean
-eel_gconf_get_boolean (const char *key)
-{
- gboolean result;
- GConfClient *client;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, FALSE);
-
- client = eel_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, FALSE);
-
- result = gconf_client_get_bool (client, key, &error);
-
- if (eel_gconf_handle_error (&error)) {
- result = FALSE;
- }
-
- return result;
-}
-
-void
-eel_gconf_set_integer (const char *key,
- int int_value)
-{
- GConfClient *client;
- GError *error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_set_int (client, key, int_value, &error);
- eel_gconf_handle_error (&error);
-}
-
-int
-eel_gconf_get_integer (const char *key)
-{
- int result;
- GConfClient *client;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, 0);
-
- client = eel_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, 0);
-
- result = gconf_client_get_int (client, key, &error);
-
- if (eel_gconf_handle_error (&error)) {
- result = 0;
- }
-
- return result;
-}
-
-void
-eel_gconf_set_string (const char *key,
- const char *string_value)
-{
- GConfClient *client;
- GError *error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_set_string (client, key, string_value, &error);
- eel_gconf_handle_error (&error);
-}
-
-char *
-eel_gconf_get_string (const char *key)
-{
- char *result;
- GConfClient *client;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, NULL);
-
- result = gconf_client_get_string (client, key, &error);
-
- if (eel_gconf_handle_error (&error)) {
- result = g_strdup ("");
- }
-
- return result;
-}
-
-void
-eel_gconf_set_string_list (const char *key,
- const GSList *slist)
-{
- GConfClient *client;
- GError *error;
-
- g_return_if_fail (key != NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- error = NULL;
- gconf_client_set_list (client, key, GCONF_VALUE_STRING,
- /* Need cast cause of GConf api bug */
- (GSList *) slist,
- &error);
- eel_gconf_handle_error (&error);
-}
-
-GSList *
-eel_gconf_get_string_list (const char *key)
-{
- GSList *slist;
- GConfClient *client;
- GError *error;
-
- g_return_val_if_fail (key != NULL, NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, NULL);
-
- error = NULL;
- slist = gconf_client_get_list (client, key, GCONF_VALUE_STRING, &error);
- if (eel_gconf_handle_error (&error)) {
- slist = NULL;
- }
-
- return slist;
-}
-
-gboolean
-eel_gconf_is_default (const char *key)
-{
- gboolean result;
- GConfValue *value;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, FALSE);
-
- value = gconf_client_get_without_default (eel_gconf_client_get_global (), key, &error);
-
- if (eel_gconf_handle_error (&error)) {
- if (value != NULL) {
- gconf_value_free (value);
- }
- return FALSE;
- }
-
- result = (value == NULL);
- eel_gconf_value_free (value);
- return result;
-}
-
-gboolean
-eel_gconf_key_is_writable (const char *key)
-{
- gboolean result;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, FALSE);
-
- result = gconf_client_key_is_writable (eel_gconf_client_get_global (), key, &error);
-
- if (eel_gconf_handle_error (&error)) {
- return result;
- }
-
- return result;
-}
-
-gboolean
-eel_gconf_monitor_add (const char *directory)
-{
- GError *error = NULL;
- GConfClient *client;
-
- g_return_val_if_fail (directory != NULL, FALSE);
-
- client = gconf_client_get_default ();
- g_return_val_if_fail (client != NULL, FALSE);
-
- gconf_client_add_dir (client,
- directory,
- GCONF_CLIENT_PRELOAD_NONE,
- &error);
-
- if (eel_gconf_handle_error (&error)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-gboolean
-eel_gconf_monitor_remove (const char *directory)
-{
- GError *error = NULL;
- GConfClient *client;
-
- if (directory == NULL) {
- return FALSE;
- }
-
- client = gconf_client_get_default ();
- g_return_val_if_fail (client != NULL, FALSE);
-
- gconf_client_remove_dir (client,
- directory,
- &error);
-
- if (eel_gconf_handle_error (&error)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-void
-eel_gconf_preload_cache (const char *directory,
- GConfClientPreloadType preload_type)
-{
- GError *error = NULL;
- GConfClient *client;
-
- if (directory == NULL) {
- return;
- }
-
- client = gconf_client_get_default ();
- g_return_if_fail (client != NULL);
-
- gconf_client_preload (client,
- directory,
- preload_type,
- &error);
-
- eel_gconf_handle_error (&error);
-}
-
-void
-eel_gconf_suggest_sync (void)
-{
- GConfClient *client;
- GError *error = NULL;
-
- client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_suggest_sync (client, &error);
- eel_gconf_handle_error (&error);
-}
-
-GConfValue*
-eel_gconf_get_value (const char *key)
-{
- GConfValue *value = NULL;
- GConfClient *client;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, NULL);
-
- value = gconf_client_get (client, key, &error);
-
- if (eel_gconf_handle_error (&error)) {
- if (value != NULL) {
- gconf_value_free (value);
- value = NULL;
- }
- }
-
- return value;
-}
-
-GConfValue*
-eel_gconf_get_default_value (const char *key)
-{
- GConfValue *value = NULL;
- GConfClient *client;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, NULL);
-
- value = gconf_client_get_default_from_schema (client, key, &error);
-
- if (eel_gconf_handle_error (&error)) {
- if (value != NULL) {
- gconf_value_free (value);
- value = NULL;
- }
- }
-
- return value;
-}
-
-static int
-eel_strcmp (const char *string_a, const char *string_b)
-{
- /* FIXME bugzilla.eazel.com 5450: Maybe we need to make this
- * treat 'NULL < ""', or have a flavor that does that. If we
- * didn't have code that already relies on 'NULL == ""', I
- * would change it right now.
- */
- return strcmp (string_a == NULL ? "" : string_a,
- string_b == NULL ? "" : string_b);
-}
-
-static gboolean
-eel_str_is_equal (const char *string_a, const char *string_b)
-{
- /* FIXME bugzilla.eazel.com 5450: Maybe we need to make this
- * treat 'NULL != ""', or have a flavor that does that. If we
- * didn't have code that already relies on 'NULL == ""', I
- * would change it right now.
- */
- return eel_strcmp (string_a, string_b) == 0;
-}
-
-static gboolean
-simple_value_is_equal (const GConfValue *a,
- const GConfValue *b)
-{
- g_return_val_if_fail (a != NULL, FALSE);
- g_return_val_if_fail (b != NULL, FALSE);
-
- switch (a->type) {
- case GCONF_VALUE_STRING:
- return eel_str_is_equal (gconf_value_get_string (a),
- gconf_value_get_string (b));
- break;
-
- case GCONF_VALUE_INT:
- return gconf_value_get_int (a) ==
- gconf_value_get_int (b);
- break;
-
- case GCONF_VALUE_FLOAT:
- return gconf_value_get_float (a) ==
- gconf_value_get_float (b);
- break;
-
- case GCONF_VALUE_BOOL:
- return gconf_value_get_bool (a) ==
- gconf_value_get_bool (b);
- break;
- default:
- g_assert_not_reached ();
- }
-
- return FALSE;
-}
-
-gboolean
-eel_gconf_value_is_equal (const GConfValue *a,
- const GConfValue *b)
-{
- GSList *node_a;
- GSList *node_b;
-
- if (a == NULL && b == NULL) {
- return TRUE;
- }
-
- if (a == NULL || b == NULL) {
- return FALSE;
- }
-
- if (a->type != b->type) {
- return FALSE;
- }
-
- switch (a->type) {
- case GCONF_VALUE_STRING:
- case GCONF_VALUE_INT:
- case GCONF_VALUE_FLOAT:
- case GCONF_VALUE_BOOL:
- return simple_value_is_equal (a, b);
- break;
-
- case GCONF_VALUE_LIST:
- if (gconf_value_get_list_type (a) !=
- gconf_value_get_list_type (b)) {
- return FALSE;
- }
-
- node_a = gconf_value_get_list (a);
- node_b = gconf_value_get_list (b);
-
- if (node_a == NULL && node_b == NULL) {
- return TRUE;
- }
-
- if (g_slist_length (node_a) !=
- g_slist_length (node_b)) {
- return FALSE;
- }
-
- for (;
- node_a != NULL && node_b != NULL;
- node_a = node_a->next, node_b = node_b->next) {
- g_assert (node_a->data != NULL);
- g_assert (node_b->data != NULL);
- if (!simple_value_is_equal (node_a->data, node_b->data)) {
- return FALSE;
- }
- }
-
- return TRUE;
- default:
- /* FIXME: pair ? */
- g_assert (0);
- }
-
- g_assert_not_reached ();
- return FALSE;
-}
-
-void
-eel_gconf_value_free (GConfValue *value)
-{
- if (value == NULL) {
- return;
- }
-
- gconf_value_free (value);
-}
-
-guint
-eel_gconf_notification_add (const char *key,
- GConfClientNotifyFunc notification_callback,
- gpointer callback_data)
-{
- guint notification_id;
- GConfClient *client;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, EEL_GCONF_UNDEFINED_CONNECTION);
- g_return_val_if_fail (notification_callback != NULL, EEL_GCONF_UNDEFINED_CONNECTION);
-
- client = eel_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, EEL_GCONF_UNDEFINED_CONNECTION);
-
- notification_id = gconf_client_notify_add (client,
- key,
- notification_callback,
- callback_data,
- NULL,
- &error);
-
- if (eel_gconf_handle_error (&error)) {
- if (notification_id != EEL_GCONF_UNDEFINED_CONNECTION) {
- gconf_client_notify_remove (client, notification_id);
- notification_id = EEL_GCONF_UNDEFINED_CONNECTION;
- }
- }
-
- return notification_id;
-}
-
-void
-eel_gconf_notification_remove (guint notification_id)
-{
- GConfClient *client;
-
- if (notification_id == EEL_GCONF_UNDEFINED_CONNECTION) {
- return;
- }
-
- client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_notify_remove (client, notification_id);
-}
-
-GSList *
-eel_gconf_value_get_string_list (const GConfValue *value)
-{
- GSList *result;
- const GSList *slist;
- const GSList *node;
- const char *string;
- const GConfValue *next_value;
-
- if (value == NULL) {
- return NULL;
- }
-
- g_return_val_if_fail (value->type == GCONF_VALUE_LIST, NULL);
- g_return_val_if_fail (gconf_value_get_list_type (value) == GCONF_VALUE_STRING, NULL);
-
- slist = gconf_value_get_list (value);
- result = NULL;
- for (node = slist; node != NULL; node = node->next) {
- next_value = node->data;
- g_return_val_if_fail (next_value != NULL, NULL);
- g_return_val_if_fail (next_value->type == GCONF_VALUE_STRING, NULL);
- string = gconf_value_get_string (next_value);
- result = g_slist_append (result, g_strdup (string));
- }
- return result;
-}
-
-void
-eel_gconf_value_set_string_list (GConfValue *value,
- const GSList *string_list)
-{
- const GSList *node;
- GConfValue *next_value;
- GSList *value_list;
-
- g_return_if_fail (value->type == GCONF_VALUE_LIST);
- g_return_if_fail (gconf_value_get_list_type (value) == GCONF_VALUE_STRING);
-
- value_list = NULL;
- for (node = string_list; node != NULL; node = node->next) {
- next_value = gconf_value_new (GCONF_VALUE_STRING);
- gconf_value_set_string (next_value, node->data);
- value_list = g_slist_append (value_list, next_value);
- }
-
- gconf_value_set_list (value, value_list);
-
- for (node = value_list; node != NULL; node = node->next) {
- gconf_value_free (node->data);
- }
- g_slist_free (value_list);
-}
-
-void
-eel_gconf_set_float (const char *key,
- gfloat float_value)
-{
- GConfClient *client;
- GError *error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_set_float (client, key, float_value, &error);
- eel_gconf_handle_error (&error);
-}
-
-gfloat
-eel_gconf_get_float (const char *key)
-{
- gfloat result;
- GConfClient *client;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, 0);
-
- client = eel_gconf_client_get_global ();
- g_return_val_if_fail (client != NULL, 0);
-
- result = gconf_client_get_float (client, key, &error);
-
- if (eel_gconf_handle_error (&error)) {
- result = 0;
- }
-
- return result;
-}
-
-static char *
-tilde_compress (const char *path)
-{
- const char *home;
-
- if (path == NULL) return NULL;
-
- home = g_get_home_dir ();
- if (home == NULL) return g_strdup (path);
-
- if (g_str_has_prefix (path, home))
- {
- return g_strconcat ("~", path + strlen (home), NULL);
- }
-
- return g_strdup (path);
-}
-
-void
-eel_gconf_set_path (const char *key,
- const char *value)
-{
- char *tilde_path;
- char *converted;
-
- tilde_path = tilde_compress (value);
- converted = g_filename_to_utf8 (tilde_path, -1, NULL, NULL, NULL);
- eel_gconf_set_string (key, converted);
-
- g_free (tilde_path);
- g_free (converted);
-}
-
-void
-eel_gconf_unset_key (const char *key)
-{
- GConfClient *client;
- GError *error = NULL;
-
- client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_unset (client, key, &error);
- eel_gconf_handle_error (&error);
-}
-
-void
-eel_gconf_notify (const char *key)
-{
- GConfClient *client;
-
- client = eel_gconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- gconf_client_notify (client, key);
-}
diff --git a/lib/eel-gconf-extensions.h b/lib/eel-gconf-extensions.h
deleted file mode 100644
index 36ce01684..000000000
--- a/lib/eel-gconf-extensions.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* eel-gconf-extensions.h - Stuff to make GConf easier to use.
-
- Copyright © 2000, 2001 Eazel, Inc.
-
- The Gnome Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The Gnome Library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the Gnome Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- Authors: Ramiro Estrugo <ramiro@eazel.com>
-
-*/
-
-#ifndef EEL_GCONF_EXTENSIONS_H
-#define EEL_GCONF_EXTENSIONS_H
-
-#include <glib.h>
-#include <gconf/gconf.h>
-#include <gconf/gconf-client.h>
-
-G_BEGIN_DECLS
-
-#define EEL_GCONF_UNDEFINED_CONNECTION 0
-
-GConfClient *eel_gconf_client_get_global (void);
-gboolean eel_gconf_handle_error (GError **error);
-void eel_gconf_set_boolean (const char *key,
- gboolean boolean_value);
-gboolean eel_gconf_get_boolean (const char *key);
-int eel_gconf_get_integer (const char *key);
-void eel_gconf_set_integer (const char *key,
- int int_value);
-char * eel_gconf_get_string (const char *key);
-void eel_gconf_set_string (const char *key,
- const char *string_value);
-GSList * eel_gconf_get_string_list (const char *key);
-void eel_gconf_set_string_list (const char *key,
- const GSList *string_list_value);
-gboolean eel_gconf_key_is_writable (const char *key);
-gboolean eel_gconf_is_default (const char *key);
-gboolean eel_gconf_monitor_add (const char *directory);
-gboolean eel_gconf_monitor_remove (const char *directory);
-void eel_gconf_preload_cache (const char *directory,
- GConfClientPreloadType preload_type);
-void eel_gconf_suggest_sync (void);
-GConfValue* eel_gconf_get_value (const char *key);
-GConfValue* eel_gconf_get_default_value (const char *key);
-gboolean eel_gconf_value_is_equal (const GConfValue *a,
- const GConfValue *b);
-void eel_gconf_value_free (GConfValue *value);
-guint eel_gconf_notification_add (const char *key,
- GConfClientNotifyFunc notification_callback,
- gpointer callback_data);
-void eel_gconf_notification_remove (guint notification_id);
-GSList * eel_gconf_value_get_string_list (const GConfValue *value);
-void eel_gconf_value_set_string_list (GConfValue *value,
- const GSList *string_list);
-
-/* These are ephy additions, not part of the eel code */
-
-void eel_gconf_set_float (const char *key,
- gfloat float_value);
-gfloat eel_gconf_get_float (const char *key);
-void eel_gconf_set_path (const char *key,
- const char *value);
-void eel_gconf_unset_key (const char *key);
-void eel_gconf_notify (const char *key);
-
-G_END_DECLS
-
-#endif /* EEL_GCONF_EXTENSIONS_H */
diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c
index f39a9f7b5..1ca4d0daa 100644
--- a/lib/ephy-dialog.c
+++ b/lib/ephy-dialog.c
@@ -23,7 +23,6 @@
#include "ephy-dialog.h"
#include "ephy-state.h"
#include "ephy-gui.h"
-#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
#include <stdlib.h>
@@ -46,41 +45,17 @@ enum
PROP_DEFAULT_HEIGHT
};
-typedef enum
-{
- PT_TOGGLEBUTTON,
- PT_RADIOBUTTON,
- PT_SPINBUTTON,
- PT_COMBOBOX,
- PT_EDITABLE,
- PT_UNKNOWN
-} WidgetType;
-
-typedef struct
-{
- const char *id;
- EphyDialog *dialog;
- char *pref;
- EphyDialogApplyType apply_type;
- GtkWidget *widget;
- WidgetType widget_type;
- GType data_type;
- GList *string_enum;
- int data_col;
- gboolean loaded;
- gboolean sane_state;
-} PropertyInfo;
-
#define EPHY_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_DIALOG, EphyDialogPrivate))
struct _EphyDialogPrivate
{
char *name;
- GHashTable *props;
GtkWidget *parent;
GtkWidget *dialog;
+ GtkBuilder *builder;
+
guint has_default_size : 1;
guint disposing : 1;
guint initialized : 1;
@@ -89,8 +64,6 @@ struct _EphyDialogPrivate
int default_height;
};
-#define SPIN_DELAY 0.20
-
enum
{
CHANGED,
@@ -132,905 +105,6 @@ ephy_dialog_get_type (void)
return type;
}
-static PropertyInfo *
-lookup_info (EphyDialog *dialog, const char *id)
-{
- return g_hash_table_lookup (dialog->priv->props, id);
-}
-
-static void
-set_sensitivity (PropertyInfo *info, gboolean sensitive)
-{
- g_return_if_fail (info->widget != NULL);
-
- if (info->widget_type == PT_RADIOBUTTON)
- {
- GSList *list, *l;
-
- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (info->widget));
-
- for (l = list; l != NULL; l = l->next)
- {
- sensitive = gtk_widget_is_sensitive (GTK_WIDGET (l->data)) && sensitive;
- gtk_widget_set_sensitive (GTK_WIDGET (l->data), sensitive);
- }
- }
- else if (info->widget_type == PT_EDITABLE)
- {
- sensitive = gtk_widget_is_sensitive (info->widget) && sensitive;
- gtk_editable_set_editable (GTK_EDITABLE (info->widget), sensitive);
- }
- else
- {
- sensitive = gtk_widget_is_sensitive (info->widget) && sensitive;
- gtk_widget_set_sensitive (info->widget, sensitive);
- }
-}
-
-static void
-set_value_from_pref (PropertyInfo *info, GValue *value)
-{
- char *text;
-
- switch (info->data_type)
- {
- case G_TYPE_STRING:
- g_value_init (value, G_TYPE_STRING);
- text = eel_gconf_get_string (info->pref);
- g_value_take_string (value, text);
- break;
- case G_TYPE_INT:
- g_value_init (value, G_TYPE_INT);
- g_value_set_int (value, eel_gconf_get_integer (info->pref));
- break;
- case G_TYPE_FLOAT:
- g_value_init (value, G_TYPE_FLOAT);
- g_value_set_float (value, eel_gconf_get_float (info->pref));
- break;
- case G_TYPE_BOOLEAN:
- g_value_init (value, G_TYPE_BOOLEAN);
- g_value_set_boolean (value, eel_gconf_get_boolean (info->pref));
- break;
- default:
- g_warning ("Unsupported value read from pref %s\n", info->pref);
- break;
- }
-}
-
-static void
-set_pref_from_value (PropertyInfo *info, GValue *value)
-{
- const char *pref = info->pref;
-
- if (!G_VALUE_HOLDS (value, info->data_type))
- {
- g_warning ("Value type mismatch for id[%s], pref[%s]", info->id, info->pref);
- return;
- }
-
- switch (info->data_type)
- {
- case G_TYPE_STRING:
- {
- 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;
- case G_TYPE_FLOAT:
- eel_gconf_set_float (pref, g_value_get_float (value));
- break;
- case G_TYPE_BOOLEAN:
- eel_gconf_set_boolean (pref, g_value_get_boolean (value));
- break;
- default:
- break;
- }
-}
-
-static gboolean
-set_value_from_editable (PropertyInfo *info, GValue *value)
-{
- char *text;
- gboolean retval = TRUE;
- gboolean free_text = TRUE;
-
- g_return_val_if_fail (GTK_IS_EDITABLE (info->widget), FALSE);
-
- text = gtk_editable_get_chars (GTK_EDITABLE (info->widget), 0, -1);
-
- g_value_init (value, info->data_type);
- switch (info->data_type)
- {
- case G_TYPE_STRING:
- g_value_take_string (value, text);
- free_text = FALSE;
- break;
- /* FIXME : handle possible errors in the input for int and float */
- case G_TYPE_INT:
- g_value_set_int (value, atoi (text));
- break;
- case G_TYPE_FLOAT:
- g_value_set_float (value, strtod (text, NULL));
- break;
- default:
- retval = FALSE;
- g_value_unset (value);
- g_warning ("Unsupported value type for editable %s", info->id);
- break;
- }
-
- if (free_text)
- {
- g_free (text);
- }
-
- return retval;
-}
-
-static gboolean
-set_value_from_combobox (PropertyInfo *info, GValue *value)
-{
- g_return_val_if_fail (GTK_IS_COMBO_BOX (info->widget), FALSE);
-
- if (info->data_col != -1)
- {
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (info->widget), &iter))
- {
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (info->widget));
- gtk_tree_model_get_value (model, &iter, info->data_col, value);
-
- return TRUE;
- }
- }
- else if (info->data_type == G_TYPE_INT)
- {
- int index;
-
- index = gtk_combo_box_get_active (GTK_COMBO_BOX (info->widget));
-
- if (index >= 0)
- {
- g_value_init (value, G_TYPE_INT);
- g_value_set_int (value, index);
-
- return TRUE;
- }
- }
- else
- {
- g_warning ("Unsupported data type for combo %s\n", info->id);
- }
-
- return FALSE;
-}
-
-static int
-get_radio_button_active_index (GtkWidget *radiobutton)
-{
- GtkToggleButton *toggle_button;
- GSList *list;
- int index, i, length;
-
- /* get group list */
- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton));
- length = g_slist_length (list);
-
- /* iterate over list to find active button */
- for (i = 0; list != NULL; i++, list = list->next)
- {
- /* get button and text */
- toggle_button = GTK_TOGGLE_BUTTON (list->data);
- if (gtk_toggle_button_get_active (toggle_button))
- {
- break;
- }
- }
-
- /* check we didn't run off end */
- g_assert (list != NULL);
-
- /* return index (reverse order!) */
- return index = (length - 1) - i;
-}
-
-static gboolean
-set_value_from_radiobuttongroup (PropertyInfo *info, GValue *value)
-{
- gboolean retval = TRUE;
- int index;
-
- g_return_val_if_fail (GTK_IS_RADIO_BUTTON (info->widget), FALSE);
-
- index = get_radio_button_active_index (info->widget);
- g_return_val_if_fail (index >= 0, FALSE);
-
- if (info->data_type == G_TYPE_STRING)
- {
- g_return_val_if_fail (info->string_enum != NULL, FALSE);
- g_return_val_if_fail (g_list_nth_data (info->string_enum, index) != NULL, FALSE);
-
- g_value_init (value, G_TYPE_STRING);
- g_value_set_string (value, (char*) g_list_nth_data (info->string_enum, index));
- }
- else if (info->data_type == G_TYPE_INT)
- {
- g_value_init (value, G_TYPE_INT);
- g_value_set_int (value, index);
- }
- else
- {
- retval = FALSE;
- g_warning ("unsupported data type for radio button %s\n", info->id);
- }
-
- return retval;
-}
-
-static gboolean
-set_value_from_spin_button (PropertyInfo *info, GValue *value)
-{
- gboolean retval = TRUE;
- gdouble f;
- gboolean is_int;
-
- g_return_val_if_fail (GTK_IS_SPIN_BUTTON (info->widget), FALSE);
-
- f = gtk_spin_button_get_value (GTK_SPIN_BUTTON (info->widget));
-
- is_int = (gtk_spin_button_get_digits (GTK_SPIN_BUTTON(info->widget)) == 0);
-
- if (info->data_type == G_TYPE_INT && is_int)
- {
- g_value_init (value, G_TYPE_INT);
- g_value_set_int (value, (int) f);
- }
- else if (info->data_type == G_TYPE_FLOAT)
- {
- g_value_init (value, G_TYPE_FLOAT);
- g_value_set_float (value, f);
- }
- else
- {
- retval = FALSE;
- g_warning ("Unsupported data type for spin button %s\n", info->id);
- }
-
- return retval;
-}
-
-static gboolean
-set_value_from_togglebutton (PropertyInfo *info, GValue *value)
-{
- gboolean retval = TRUE;
- gboolean active;
-
- g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (info->widget), FALSE);
-
- 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);
- g_value_set_boolean (value, active);
- }
- else
- {
- retval = FALSE;
- g_warning ("Unsupported data type for toggle button %s\n", info->id);
- }
-
- return retval;
-}
-
-static gboolean
-set_value_from_info (PropertyInfo *info, GValue *value)
-{
- gboolean retval;
-
- if (info->sane_state == FALSE)
- {
- return FALSE;
- }
-
- switch (info->widget_type)
- {
- case PT_SPINBUTTON:
- retval = set_value_from_spin_button (info, value);
- break;
- case PT_RADIOBUTTON:
- retval = set_value_from_radiobuttongroup (info, value);
- break;
- case PT_TOGGLEBUTTON:
- retval = set_value_from_togglebutton (info, value);
- break;
- case PT_EDITABLE:
- retval = set_value_from_editable (info, value);
- break;
- case PT_COMBOBOX:
- retval = set_value_from_combobox (info, value);
- break;
- default:
- retval = FALSE;
- g_warning ("Unsupported widget type\n");
- break;
- }
-
- return retval;
-}
-
-static void
-set_editable_from_value (PropertyInfo *info, const GValue *value)
-{
- char *text = NULL;
- int pos = 0; /* insertion position */
-
- g_return_if_fail (GTK_IS_EDITABLE (info->widget));
-
- switch (info->data_type)
- {
- case G_TYPE_STRING:
- text = g_value_dup_string (value);
- break;
- case G_TYPE_INT:
- text = g_strdup_printf ("%d", g_value_get_int (value));
- break;
- case G_TYPE_FLOAT:
- text = g_strdup_printf ("%.2f", g_value_get_float (value));
- break;
- default:
- break;
- }
-
- if (text == NULL)
- {
- text = g_strdup ("");
- }
-
- info->sane_state = TRUE;
-
- gtk_editable_delete_text (GTK_EDITABLE (info->widget), 0, -1);
- gtk_editable_insert_text (GTK_EDITABLE (info->widget), text, strlen (text), &pos);
-
- g_free (text);
-}
-
-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;
- const char *val;
- GList *s = NULL;
-
- if (string_enum)
- {
- val = g_value_get_string (value);
-
- s = g_list_find_custom (string_enum, val, (GCompareFunc) strcmp_with_null);
-
- if (s)
- {
- index = g_list_position (string_enum, s);
- }
-
- }
- else
- {
- index = g_value_get_int (value);
- }
-
- return index;
-}
-
-static gboolean
-compare_values (const GValue *a, const GValue *b)
-{
- if (G_VALUE_HOLDS (a, G_TYPE_STRING))
- {
- const char *ta, *tb;
-
- ta = g_value_get_string (a);
- tb = g_value_get_string (b);
-
- return (strcmp_with_null (ta, tb) == 0);
- }
- else if (G_VALUE_HOLDS (a, G_TYPE_INT))
- {
- return g_value_get_int (a) == g_value_get_int (b);
- }
- else if (G_VALUE_HOLDS (a, G_TYPE_FLOAT))
- {
- return g_value_get_float (a) == g_value_get_float (b);
- }
- else if (G_VALUE_HOLDS (a, G_TYPE_BOOLEAN))
- {
- return g_value_get_boolean (a) == g_value_get_boolean (b);
- }
-
- return FALSE;
-}
-
-static void
-set_combo_box_from_value (PropertyInfo *info, const GValue *value)
-{
- g_return_if_fail (GTK_IS_COMBO_BOX (info->widget));
-
- if (info->data_col != -1)
- {
- GValue data = { 0, };
- GtkTreeModel *model;
- GtkTreeIter iter;
- gboolean valid, found = FALSE;
-
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (info->widget));
-
- valid = gtk_tree_model_get_iter_first (model, &iter);
- while (valid)
- {
- gtk_tree_model_get_value (model, &iter, info->data_col, &data);
- found = compare_values (&data, value);
- g_value_unset (&data);
-
- if (found) break;
-
- valid = gtk_tree_model_iter_next (model, &iter);
- }
-
- if (found)
- {
- gtk_combo_box_set_active_iter (GTK_COMBO_BOX (info->widget), &iter);
- }
- else
- {
- gtk_combo_box_set_active (GTK_COMBO_BOX (info->widget), 0);
- }
-
- info->sane_state = found;
- }
- else if (info->data_type == G_TYPE_INT)
- {
- int index;
-
- index = g_value_get_int (value);
-
- info->sane_state = index >= 0;
-
- g_return_if_fail (index >= -1);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (info->widget), index);
- }
- else
- {
- g_warning ("Unsupported data type for combo box %s\n", info->id);
- }
-}
-
-static void
-set_radiobuttongroup_from_value (PropertyInfo *info, const GValue *value)
-{
- GtkToggleButton *button;
- GSList *list;
- gint length;
- int index;
-
- g_return_if_fail (GTK_IS_RADIO_BUTTON (info->widget));
-
- list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (info->widget));
-
- length = g_slist_length (list);
-
- index = get_index_from_value (value, info->string_enum);
-
- /* new buttons are *prepended* to the list, so button added as first
- * has last position in the list */
- index = (length - 1) - index;
-
- if (index < 0 || index >= length)
- {
- info->sane_state = FALSE;
- g_return_if_fail (index >= 0 && index < length);
- return;
- }
-
- button = GTK_TOGGLE_BUTTON (g_slist_nth_data (list, index));
- g_return_if_fail (button != NULL);
-
- info->sane_state = TRUE;
-
- if (gtk_toggle_button_get_active (button) == FALSE)
- {
- gtk_toggle_button_set_active (button, TRUE);
- }
-}
-
-static void
-set_spin_button_from_value (PropertyInfo *info, const GValue *value)
-{
- gdouble f = 0.0;
- gboolean is_int;
-
- g_return_if_fail (GTK_IS_SPIN_BUTTON (info->widget));
-
- is_int = (gtk_spin_button_get_digits (GTK_SPIN_BUTTON (info->widget)) == 0);
-
- if (info->data_type == G_TYPE_INT && is_int)
- {
- f = (float) g_value_get_int (value);
- }
- else if (info->data_type == G_TYPE_FLOAT)
- {
- f = g_value_get_float (value);
- }
- else
- {
- info->sane_state = FALSE;
- g_warning ("Unsupported data type for spin button %s\n", info->id);
- return;
- }
-
- info->sane_state = TRUE;
-
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (info->widget), f);
-}
-
-static void
-set_togglebutton_from_value (PropertyInfo *info, const GValue *value)
-{
- gboolean active;
-
- g_return_if_fail (GTK_IS_TOGGLE_BUTTON (info->widget));
- g_return_if_fail (info->data_type == G_TYPE_BOOLEAN);
-
- 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);
-}
-
-static void
-set_info_from_value (PropertyInfo *info, const GValue *value)
-{
- if (!G_VALUE_HOLDS (value, info->data_type))
- {
- g_warning ("Incompatible value types for id %s\n", info->id);
- return;
- }
-
- switch (info->widget_type)
- {
- case PT_SPINBUTTON:
- set_spin_button_from_value (info, value);
- break;
- case PT_RADIOBUTTON:
- set_radiobuttongroup_from_value (info, value);
- break;
- case PT_TOGGLEBUTTON:
- set_togglebutton_from_value (info, value);
- break;
- case PT_EDITABLE:
- set_editable_from_value (info, value);
- break;
- case PT_COMBOBOX:
- set_combo_box_from_value (info, value);
- break;
- default:
- g_warning ("Unknown widget type\n");
- break;
- }
-}
-
-/* widget changed callbacks */
-
-static void
-set_pref_from_info_and_emit (PropertyInfo *info)
-{
- GValue value = { 0, };
-
- if (!set_value_from_info (info, &value))
- {
- return;
- }
-
- g_signal_emit (info->dialog, signals[CHANGED], g_quark_from_string (info->id), &value);
-
- if ((info->apply_type & PT_AUTOAPPLY) && info->pref != NULL)
- {
- set_pref_from_value (info, &value);
- }
-
- g_value_unset (&value);
-}
-
-static void
-togglebutton_clicked_cb (GtkWidget *widget, PropertyInfo *info)
-{
- info->sane_state = TRUE;
-
- set_pref_from_info_and_emit (info);
-}
-
-static void
-radiobutton_clicked_cb (GtkWidget *widget, PropertyInfo *info)
-{
- info->sane_state = TRUE;
-
- if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget)))
- {
- return;
- }
-
- set_pref_from_info_and_emit (info);
-}
-
-static gboolean
-spinbutton_timeout_cb (PropertyInfo *info)
-{
- GTimer *spin_timer;
-
- spin_timer = (GTimer *) g_object_get_data (G_OBJECT (info->widget), "timer");
-
- /* timer still valid? */
- if (spin_timer == NULL)
- {
- /* don't call me again */
- return FALSE;
- }
-
- /* okay, we're ready to set */
- if (g_timer_elapsed (spin_timer, NULL) >= SPIN_DELAY)
- {
- /* kill off the timer */
- g_timer_destroy (spin_timer);
- g_object_set_data (G_OBJECT (info->widget), "timer", NULL);
-
- /* HACK update the spinbutton here so that the
- * changes made directly in the entry are accepted
- * and set in the pref. Otherwise the old value is used */
- gtk_spin_button_update (GTK_SPIN_BUTTON (info->widget));
-
- info->sane_state = TRUE;
-
- set_pref_from_info_and_emit (info);
-
- /* done, don't run again */
- return FALSE;
- }
-
- /* not elapsed yet, call me again */
- return TRUE;
-}
-
-static void
-spinbutton_changed_cb (GtkWidget *widget, PropertyInfo *info)
-{
- GTimer *spin_timer;
-
- if ((info->apply_type & PT_AUTOAPPLY) == 0) return;
-
- spin_timer = g_object_get_data (G_OBJECT (info->widget), "timer");
-
- /* destroy an existing timer */
- if (spin_timer != NULL)
- {
- g_timer_destroy (spin_timer);
- }
-
- /* start tnew timer */
- spin_timer = g_timer_new();
- g_timer_start (spin_timer);
- g_object_set_data (G_OBJECT (info->widget), "timer", spin_timer);
-
- g_timeout_add (50, (GSourceFunc) spinbutton_timeout_cb, info);
-}
-
-static void
-changed_cb (GtkWidget *widget, PropertyInfo *info)
-{
- info->sane_state = TRUE;
-
- set_pref_from_info_and_emit (info);
-}
-
-static void
-connect_signals (gpointer key, PropertyInfo *info, EphyDialog *dialog)
-{
- GSList *list;
-
- g_return_if_fail (info->widget != NULL);
-
- switch (info->widget_type)
- {
- case PT_TOGGLEBUTTON:
- g_signal_connect (G_OBJECT (info->widget), "clicked",
- G_CALLBACK (togglebutton_clicked_cb),
- (gpointer)info);
- break;
- case PT_RADIOBUTTON:
- list = gtk_radio_button_get_group
- (GTK_RADIO_BUTTON (info->widget));
- for (; list != NULL; list = list->next)
- {
- g_signal_connect
- (G_OBJECT (list->data), "clicked",
- G_CALLBACK (radiobutton_clicked_cb),
- info);
- }
- break;
- case PT_SPINBUTTON:
- g_signal_connect (G_OBJECT (info->widget), "changed",
- G_CALLBACK (spinbutton_changed_cb),
- info);
- break;
- case PT_COMBOBOX:
- g_signal_connect (G_OBJECT (info->widget), "changed",
- G_CALLBACK (changed_cb), info);
- break;
- case PT_EDITABLE:
- g_signal_connect (G_OBJECT (info->widget), "changed",
- G_CALLBACK (changed_cb), info);
- break;
- case PT_UNKNOWN:
- break;
- }
-}
-
-static void
-disconnect_signals (gpointer key, PropertyInfo *info, EphyDialog *dialog)
-{
- g_return_if_fail (info->widget != NULL);
-
- g_signal_handlers_disconnect_matched (info->widget, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, info);
-}
-
-static void
-init_props (EphyDialog *dialog, const EphyDialogProperty *properties, GtkBuilder *builder)
-{
- int i;
-
- for (i = 0 ; properties[i].id != NULL; i++)
- {
- PropertyInfo *info = g_new0 (PropertyInfo, 1);
-
- info->id = properties[i].id;
- info->dialog = dialog;
- info->pref = g_strdup (properties[i].pref);
- info->apply_type = properties[i].apply_type;
- info->string_enum = NULL;
- info->data_col = -1;
-
- info->widget = (GtkWidget*)gtk_builder_get_object (builder, info->id);
-
- if (GTK_IS_COMBO_BOX (info->widget))
- {
- info->widget_type = PT_COMBOBOX;
- info->data_type = G_TYPE_INT;
- }
- else if (GTK_IS_SPIN_BUTTON (info->widget))
- {
- info->widget_type = PT_SPINBUTTON;
- info->data_type = G_TYPE_INT;
- }
- else if (GTK_IS_RADIO_BUTTON (info->widget))
- {
- info->widget_type = PT_RADIOBUTTON;
- info->data_type = G_TYPE_INT;
- }
- else if (GTK_IS_TOGGLE_BUTTON (info->widget))
- {
- info->widget_type = PT_TOGGLEBUTTON;
- info->data_type = G_TYPE_BOOLEAN;
- }
- else if (GTK_IS_EDITABLE (info->widget))
- {
- info->widget_type = PT_EDITABLE;
- info->data_type = G_TYPE_STRING;
- }
- else
- {
- info->widget_type = PT_UNKNOWN;
- info->data_type = G_TYPE_INVALID;
- }
-
- if (properties[i].data_type != 0)
- {
- info->data_type = properties[i].data_type;
- }
-
- info->loaded = FALSE;
- info->sane_state = FALSE;
-
- g_hash_table_insert (dialog->priv->props, (char *) info->id, info);
- }
-}
-
-static void
-load_info (gpointer key, PropertyInfo *info, EphyDialog *dialog)
-{
- GValue value = { 0, };
-
- g_return_if_fail (info->widget != NULL);
-
- if (info->pref != NULL)
- {
- set_value_from_pref (info, &value);
- set_info_from_value (info, &value);
-
- g_signal_emit (info->dialog, signals[CHANGED], g_quark_from_string (info->id), &value);
-
- g_value_unset (&value);
-
- set_sensitivity (info, eel_gconf_key_is_writable (info->pref));
- }
-
- info->loaded = TRUE;
-}
-
-static void
-save_info (gpointer key, PropertyInfo *info, EphyDialog *dialog)
-{
- GValue value = { 0, };
-
- if (info->pref == NULL || (info->apply_type & PT_NORMAL) == 0)
- {
- return;
- }
-
- if (!info->sane_state)
- {
- g_warning ("Not persisting insane state of id[%s]", info->id);
- return;
- }
-
- if (set_value_from_info (info, &value))
- {
- set_pref_from_value (info, &value);
- g_value_unset (&value);
- }
-}
-
static void
setup_default_size (EphyDialog *dialog)
{
@@ -1058,8 +132,6 @@ setup_default_size (EphyDialog *dialog)
static void
dialog_destroy_cb (GtkWidget *widget, EphyDialog *dialog)
{
- g_hash_table_foreach (dialog->priv->props, (GHFunc) save_info, dialog);
-
if (dialog->priv->disposing == FALSE)
{
g_object_unref (dialog);
@@ -1068,7 +140,6 @@ dialog_destroy_cb (GtkWidget *widget, EphyDialog *dialog)
static void
impl_construct (EphyDialog *dialog,
- const EphyDialogProperty *properties,
const char *file,
const char *name,
const char *domain)
@@ -1087,7 +158,9 @@ impl_construct (EphyDialog *dialog,
return;
}
- priv->dialog = (GtkWidget*)gtk_builder_get_object (builder, name);
+ priv->builder = g_object_ref (builder);
+ priv->dialog = GTK_WIDGET (gtk_builder_get_object (builder, name));
+
g_return_if_fail (priv->dialog != NULL);
if (priv->name == NULL)
@@ -1095,11 +168,6 @@ impl_construct (EphyDialog *dialog,
priv->name = g_strdup (name);
}
- if (properties)
- {
- init_props (dialog, properties, builder);
- }
-
g_signal_connect_object (dialog->priv->dialog, "destroy",
G_CALLBACK(dialog_destroy_cb), dialog, 0);
@@ -1109,14 +177,6 @@ impl_construct (EphyDialog *dialog,
static void
impl_show (EphyDialog *dialog)
{
- if (dialog->priv->initialized == FALSE)
- {
- dialog->priv->initialized = TRUE;
-
- g_hash_table_foreach (dialog->priv->props, (GHFunc) load_info, dialog);
- g_hash_table_foreach (dialog->priv->props, (GHFunc) connect_signals, dialog);
- }
-
setup_default_size (dialog);
if (dialog->priv->parent != NULL)
@@ -1132,100 +192,6 @@ impl_show (EphyDialog *dialog)
}
/**
- * ephy_dialog_add_enum:
- * @dialog: an #EphyDialog
- * @property_id: string identifier of the property to modify
- * @n_items: length of @items array
- * @items: array of items to add to @property_id
- *
- * Modifies the property identified by @property_id in @dialog to have its
- * string_enum member set to a #GList constructed with the elements given as
- * @items.
- **/
-void
-ephy_dialog_add_enum (EphyDialog *dialog,
- const char *property_id,
- guint n_items,
- const char *const *items)
-{
- PropertyInfo *info;
- int i = 0;
- GList *l = NULL;
-
- g_return_if_fail (EPHY_IS_DIALOG (dialog));
-
- info = lookup_info (dialog, property_id);
- g_return_if_fail (info != NULL);
-
- for (i = 0; i < n_items; i++)
- {
- l = g_list_prepend (l, g_strdup (items[i]));
- }
-
- info->string_enum = g_list_reverse (l);
-}
-
-/**
- * ephy_dialog_set_data_column:
- * @dialog: an #EphyDialog
- * @property_id: string identifier of the property to modify
- * @column: value for the data_col member of @property_id
- *
- * Sets the data_col member of the property identified by @property_id in @dialog
- * to @column.
- **/
-void
-ephy_dialog_set_data_column (EphyDialog *dialog,
- const char *property_id,
- int column)
-{
- PropertyInfo *info;
-
- g_return_if_fail (EPHY_IS_DIALOG (dialog));
-
- info = lookup_info (dialog, property_id);
- g_return_if_fail (info != NULL);
-
- info->data_col = column;
-}
-
-/**
- * ephy_dialog_set_pref:
- * @dialog: an #EphyDialog
- * @property_id: string identifier of the property to modify
- * @pref: preference value of the property identified by @property_id
- *
- * Sets the pref member of the property of @dialog identified by @property_id
- * to @pref.
- **/
-void
-ephy_dialog_set_pref (EphyDialog *dialog,
- const char *property_id,
- const char *pref)
-{
- PropertyInfo *info;
-
- g_return_if_fail (EPHY_IS_DIALOG (dialog));
-
- info = lookup_info (dialog, property_id);
- g_return_if_fail (info != NULL);
-
- disconnect_signals (NULL, info, dialog);
-
- info->loaded = FALSE;
- info->sane_state = FALSE;
- g_free (info->pref);
- info->pref = g_strdup (pref);
-
- if (dialog->priv->initialized)
- {
- /* dialog is already initialised, so initialise this here */
- load_info (NULL, info, dialog);
- connect_signals (NULL, info, dialog);
- }
-}
-
-/**
* ephy_dialog_set_size_group:
* @dialog: an #EphyDialog
* @first_id: id of a widget in @dialog
@@ -1250,14 +216,12 @@ ephy_dialog_set_size_group (EphyDialog *dialog,
while (first_id != NULL)
{
- PropertyInfo *info;
+ GtkWidget *widget;
- info = lookup_info (dialog, first_id);
- g_return_if_fail (info != NULL);
+ widget = ephy_dialog_get_control (dialog, first_id);
+ g_return_if_fail (widget != NULL);
- g_return_if_fail (info->widget != NULL);
-
- gtk_size_group_add_widget (size_group, info->widget);
+ gtk_size_group_add_widget (size_group, widget);
first_id = va_arg (vl, const char*);
}
@@ -1270,24 +234,21 @@ ephy_dialog_set_size_group (EphyDialog *dialog,
/**
* ephy_dialog_construct:
* @dialog: an #EphyDialog
- * @properties: an array of #EphyDialogProperty elements
* @file: the path to a #GtkBuilder file
* @name: name of the widget to use for @dialog, found in @file
* @domain: translation domain to set for @dialog
*
* Constructs the widget part of @dialog using the widget identified by @name
- * in the #GtkBuilder file found at @file. Fills the dialog properties with
- * @properties and sets translation domain to @domain.
+ * in the #GtkBuilder file found at @file.
**/
void
ephy_dialog_construct (EphyDialog *dialog,
- const EphyDialogProperty *properties,
const char *file,
const char *name,
const char *domain)
{
EphyDialogClass *klass = EPHY_DIALOG_GET_CLASS (dialog);
- klass->construct (dialog, properties, file, name, domain);
+ klass->construct (dialog, file, name, domain);
}
/**
@@ -1354,16 +315,16 @@ ephy_dialog_run (EphyDialog *dialog)
**/
GtkWidget *
ephy_dialog_get_control (EphyDialog *dialog,
- const char *property_id)
+ const char *object_id)
{
- PropertyInfo *info;
+ GtkWidget *widget;
g_return_val_if_fail (EPHY_IS_DIALOG (dialog), NULL);
- info = lookup_info (dialog, property_id);
- g_return_val_if_fail (info != NULL, NULL);
+ widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->builder,
+ object_id));
- return info->widget;
+ return widget;
}
/**
@@ -1383,7 +344,6 @@ ephy_dialog_get_controls (EphyDialog *dialog,
const char *first_id,
...)
{
- PropertyInfo *info;
GtkWidget **wptr;
va_list varargs;
@@ -1391,11 +351,8 @@ ephy_dialog_get_controls (EphyDialog *dialog,
while (first_id != NULL)
{
- info = lookup_info (dialog, first_id);
- g_return_if_fail (info != NULL);
-
wptr = va_arg (varargs, GtkWidget **);
- *wptr = info->widget;
+ *wptr = ephy_dialog_get_control (dialog, first_id);
first_id = va_arg (varargs, const char *);
}
@@ -1403,68 +360,6 @@ ephy_dialog_get_controls (EphyDialog *dialog,
va_end (varargs);
}
-/**
- * ephy_dialog_get_value:
- * @dialog: an #EphyDialog
- * @property_id: property name
- * @value: (out): location to store the value of @property_id
- *
- * Gets the value of @property_id and stores it in @value.
- *
- * Returns: %TRUE if the operation was successful
- */
-gboolean
-ephy_dialog_get_value (EphyDialog *dialog,
- const char *property_id,
- GValue *value)
-{
- PropertyInfo *info;
-
- g_return_val_if_fail (EPHY_IS_DIALOG (dialog), FALSE);
-
- info = lookup_info (dialog, property_id);
- g_return_val_if_fail (info != NULL, FALSE);
-
- return set_value_from_info (info, value);
-}
-
-/**
- * ephy_dialog_set_value:
- * @dialog: an #EphyDialog
- * @property_id: @dialog property to set
- * @value: value to set @property_id to
- *
- * Sets the property identified by @property_id to @value in @dialog.
- **/
-void
-ephy_dialog_set_value (EphyDialog *dialog,
- const char *property_id,
- const GValue *value)
-{
- PropertyInfo *info;
-
- g_return_if_fail (EPHY_IS_DIALOG (dialog));
-
- info = lookup_info (dialog, property_id);
- g_return_if_fail (info != NULL);
-
- set_info_from_value (info, value);
-}
-
-static void
-free_prop_info (PropertyInfo *info)
-{
- if (info->string_enum)
- {
- g_list_foreach (info->string_enum, (GFunc)g_free, NULL);
- g_list_free (info->string_enum);
- }
-
- g_free (info->pref);
-
- g_free (info);
-}
-
static void
ephy_dialog_init (EphyDialog *dialog)
{
@@ -1472,9 +367,6 @@ ephy_dialog_init (EphyDialog *dialog)
dialog->priv->default_width = -1;
dialog->priv->default_height = -1;
-
- dialog->priv->props = g_hash_table_new_full
- (g_str_hash, g_str_equal, NULL, (GDestroyNotify) free_prop_info);
}
static void
@@ -1497,8 +389,6 @@ ephy_dialog_finalize (GObject *object)
{
EphyDialog *dialog = EPHY_DIALOG (object);
- g_hash_table_destroy (dialog->priv->props);
-
g_free (dialog->priv->name);
G_OBJECT_CLASS (parent_class)->finalize (object);
diff --git a/lib/ephy-dialog.h b/lib/ephy-dialog.h
index 4e73ab897..0373ea834 100644
--- a/lib/ephy-dialog.h
+++ b/lib/ephy-dialog.h
@@ -43,21 +43,6 @@ typedef struct _EphyDialog EphyDialog;
typedef struct _EphyDialogPrivate EphyDialogPrivate;
typedef struct _EphyDialogProperty EphyDialogProperty;
-typedef enum
-{
- PT_NORMAL = 0,
- PT_AUTOAPPLY = 1 << 0,
- PT_INVERTED = 1 << 1
-} EphyDialogApplyType;
-
-struct _EphyDialogProperty
-{
- const char *id;
- const char *pref;
- EphyDialogApplyType apply_type;
- GType data_type;
-};
-
struct _EphyDialogClass
{
GObjectClass parent_class;
@@ -69,7 +54,6 @@ struct _EphyDialogClass
/* Methods */
void (* construct) (EphyDialog *dialog,
- const EphyDialogProperty *properties,
const char *file,
const char *name,
const char *domain);
@@ -91,20 +75,10 @@ EphyDialog *ephy_dialog_new (void);
EphyDialog *ephy_dialog_new_with_parent (GtkWidget *parent_window);
void ephy_dialog_construct (EphyDialog *dialog,
- const EphyDialogProperty *properties,
const char *file,
const char *name,
const char *domain);
-void ephy_dialog_add_enum (EphyDialog *dialog,
- const char *property_id,
- guint n_items,
- const char * const *items);
-
-void ephy_dialog_set_data_column (EphyDialog *dialog,
- const char *property_id,
- int column);
-
void ephy_dialog_set_size_group (EphyDialog *dialog,
const char *first_id,
...);
@@ -127,18 +101,6 @@ void ephy_dialog_get_controls (EphyDialog *dialog,
const char *first_id,
...);
-gboolean ephy_dialog_get_value (EphyDialog *dialog,
- const char *property_id,
- GValue *value);
-
-void ephy_dialog_set_value (EphyDialog *dialog,
- const char *property_id,
- const GValue *value);
-
-void ephy_dialog_set_pref (EphyDialog *dialog,
- const char *property_id,
- const char *pref);
-
G_END_DECLS
#endif
diff --git a/lib/ephy-file-chooser.c b/lib/ephy-file-chooser.c
index 2fd9a7d3e..fe85eee4f 100644
--- a/lib/ephy-file-chooser.c
+++ b/lib/ephy-file-chooser.c
@@ -22,10 +22,10 @@
#include "ephy-file-chooser.h"
#include "ephy-file-helpers.h"
-#include "eel-gconf-extensions.h"
#include "ephy-state.h"
#include "ephy-gui.h"
#include "ephy-debug.h"
+#include "ephy-settings.h"
#include "ephy-stock-icons.h"
#include "ephy-string.h"
@@ -64,7 +64,8 @@ current_folder_changed_cb (GtkFileChooser *chooser, EphyFileChooser *dialog)
dir = gtk_file_chooser_get_current_folder (chooser);
- eel_gconf_set_path (dialog->priv->persist_key, dir);
+ g_settings_set_string (EPHY_SETTINGS_STATE,
+ dialog->priv->persist_key, dir);
g_free (dir);
}
@@ -86,7 +87,10 @@ file_chooser_response_cb (GtkWidget *widget,
dir = g_path_get_dirname (filename);
if (dir != NULL)
- eel_gconf_set_path (dialog->priv->persist_key, dir);
+ g_settings_set_string
+ (EPHY_SETTINGS_STATE,
+ dialog->priv->persist_key,
+ dir);
g_free (dir);
g_free (filename);
@@ -143,7 +147,7 @@ ephy_file_chooser_set_persist_key (EphyFileChooser *dialog, const char *key)
dialog->priv->persist_key = g_strdup (key);
- dir = eel_gconf_get_string (key);
+ dir = g_settings_get_string (EPHY_SETTINGS_STATE, key);
if (dir != NULL)
{
/* FIXME: Maybe we will find a better way to do this when the
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index 495164d84..1a36cb457 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -25,8 +25,8 @@
#include "ephy-file-helpers.h"
#include "ephy-prefs.h"
-#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
+#include "ephy-settings.h"
#include "ephy-string.h"
#include <glib.h>
@@ -154,7 +154,8 @@ ephy_file_get_downloads_dir (void)
{
char *download_dir, *expanded;
- download_dir = eel_gconf_get_string (CONF_STATE_DOWNLOAD_DIR);
+ download_dir = g_settings_get_string (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_DOWNLOAD_DIR);
if (download_dir && strcmp (download_dir, _("Downloads")) == 0)
{
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 5f2fa16da..e61a49e94 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -1,5 +1,6 @@
/*
* Copyright © 2000-2003 Marco Pesenti Gritti
+ * Copyright © 2010 Igalia S.L.
*
* 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
@@ -26,54 +27,93 @@
G_BEGIN_DECLS
-#define EPIPHANY_SCHEMA_VERSION 1
-#define CONF_SCHEMA_VERSION "/apps/epiphany/schema_version"
+typedef enum
+{
+ EPHY_PREFS_UI_TOOLBAR_STYLE_BOTH,
+ EPHY_PREFS_UI_TOOLBAR_STYLE_BOTH_HORIZ,
+ EPHY_PREFS_UI_TOOLBAR_STYLE_BOTH_ICONS,
+ EPHY_PREFS_UI_TOOLBAR_STYLE_BOTH_TEXT
+} EphyPrefsUIToolbarStyle;
-/* General */
-#define CONF_GENERAL_HOMEPAGE "/apps/epiphany/general/homepage"
-#define CONF_URL_SEARCH "/apps/epiphany/general/url_search"
-#define CONF_ALWAYS_SHOW_TABS_BAR "/apps/epiphany/general/always_show_tabs_bar"
-#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"
-#define CONF_INTERFACE_TOOLBAR_STYLE "/apps/epiphany/general/toolbar_style"
-#define CONF_INTERFACE_OPEN_NEW_WINDOWS_IN_TAB "/apps/epiphany/general/open_new_windows_in_tab"
-#define CONF_AUTO_DOWNLOADS "/apps/epiphany/general/automatic_downloads"
-#define CONF_DESKTOP_IS_HOME_DIR "/apps/nautilus/preferences/desktop_is_home_dir"
-#define CONF_NETWORK_MANAGED "/apps/epiphany/general/managed_network"
-#define CONF_DOWNLOADS_HIDDEN "/apps/epiphany/dialogs/downloads_hidden"
-#define CONF_WARN_ON_CLOSE_UNSUBMITTED_DATA "/apps/epiphany/dialogs/warn_on_close_unsubmitted_data"
+typedef enum
+{
+ EPHY_PREFS_WEB_COOKIES_POLICY_ALWAYS,
+ EPHY_PREFS_WEB_COOKIES_POLICY_NO_THIRD_PARTY,
+ EPHY_PREFS_WEB_COOKIES_POLICY_NEVER
+} EphyPrefsWebCookiesPolicy;
-/* 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_DOWNLOAD_DIR "/apps/epiphany/directories/downloads_folder"
-#define CONF_STATE_UPLOAD_DIR "/apps/epiphany/directories/upload"
+typedef enum
+{
+ EPHY_PREFS_STATE_HISTORY_DATE_FILTER_LAST_HALF_HOUR,
+ EPHY_PREFS_STATE_HISTORY_DATE_FILTER_EVER,
+ EPHY_PREFS_STATE_HISTORY_DATE_FILTER_TODAY,
+ EPHY_PREFS_STATE_HISTORY_DATE_FILTER_LAST_TWO_DAYS,
+ EPHY_PREFS_STATE_HISTORY_DATE_FILTER_LAST_THREE_DAYS
+} EphyPrefsStateHistoryDateFilter;
-/* Lockdown */
-#define CONF_LOCKDOWN_FULLSCREEN "/apps/epiphany/lockdown/fullscreen"
-#define CONF_LOCKDOWN_DISABLE_ARBITRARY_URL "/apps/epiphany/lockdown/disable_arbitrary_url"
-#define CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING "/apps/epiphany/lockdown/disable_bookmark_editing"
-#define CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING "/apps/epiphany/lockdown/disable_toolbar_editing"
-#define CONF_LOCKDOWN_DISABLE_HISTORY "/apps/epiphany/lockdown/disable_history"
-#define CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK "/desktop/gnome/lockdown/disable_save_to_disk"
-#define CONF_LOCKDOWN_DISABLE_HISTORY "/apps/epiphany/lockdown/disable_history"
-#define CONF_LOCKDOWN_DISABLE_PRINTING "/desktop/gnome/lockdown/disable_printing"
-#define CONF_LOCKDOWN_DISABLE_PRINT_SETUP "/desktop/gnome/lockdown/disable_print_setup"
-#define CONF_LOCKDOWN_DISABLE_COMMAND_LINE "/desktop/gnome/lockdown/disable_command_line"
-#define CONF_LOCKDOWN_DISABLE_QUIT "/apps/epiphany/lockdown/disable_quit"
-#define CONF_LOCKDOWN_DISABLE_JAVASCRIPT_CHROME "/apps/epiphany/lockdown/disable_javascript_chrome"
+#define EPHY_PREFS_UI_SCHEMA "org.gnome.Epiphany.ui"
+#define EPHY_PREFS_UI_ALWAYS_SHOW_TABS_BAR "always-show-tabs-bar"
+#define EPHY_PREFS_UI_SHOW_TOOLBARS "show-toolbars"
+#define EPHY_PREFS_UI_SHOW_BOOKMARKS_BAR "show-bookmarks-bar"
+#define EPHY_PREFS_UI_TOOLBAR_STYLE "toolbar-style"
+#define EPHY_PREFS_UI_DOWNLOADS_HIDDEN "downloads-hidden"
-/* System prefs */
-#define CONF_DESKTOP_FTP_HANDLER "/desktop/gnome/url-handlers/ftp/command"
-#define CONF_DESKTOP_TOOLBAR_STYLE "/desktop/gnome/interface/toolbar_style"
-#define CONF_DESKTOP_BG_PICTURE "/desktop/gnome/background/picture_filename"
-#define CONF_DESKTOP_BG_TYPE "/desktop/gnome/background/picture_options"
+#define EPHY_PREFS_STATE_SCHEMA "org.gnome.Epiphany.state"
+#define EPHY_PREFS_STATE_SAVE_DIR "save-dir"
+#define EPHY_PREFS_STATE_SAVE_IMAGE_DIR "save-image-dir"
+#define EPHY_PREFS_STATE_OPEN_DIR "open-dir"
+#define EPHY_PREFS_STATE_DOWNLOAD_DIR "download-dir"
+#define EPHY_PREFS_STATE_UPLOAD_DIR "upload-dir"
+#define EPHY_PREFS_STATE_RECENT_ENCODINGS "recent-encodings"
+#define EPHY_PREFS_STATE_BOOKMARKS_VIEW_TITLE "bookmarks-view-title"
+#define EPHY_PREFS_STATE_BOOKMARKS_VIEW_ADDRESS "bookmarks-view-address"
+#define EPHY_PREFS_STATE_HISTORY_VIEW_TITLE "history-view-title"
+#define EPHY_PREFS_STATE_HISTORY_VIEW_ADDRESS "history-view-address"
+#define EPHY_PREFS_STATE_HISTORY_VIEW_DATE "history-view-date"
+#define EPHY_PREFS_STATE_HISTORY_DATE_FILTER "history-date-filter"
-/* Privacy */
-#define CONF_PRIVACY_REMEMBER_PASSWORDS "/apps/epiphany/general/remember_passwords"
+#define EPHY_PREFS_WEB_SCHEMA "org.gnome.Epiphany.web"
+#define EPHY_PREFS_WEB_FONT_MIN_SIZE "min-font-size"
+#define EPHY_PREFS_WEB_LANGUAGE "language"
+#define EPHY_PREFS_WEB_USE_OWN_FONTS "use-own-fonts"
+#define EPHY_PREFS_WEB_USE_OWN_COLORS "use-own-colors"
+#define EPHY_PREFS_WEB_ENABLE_USER_CSS "enable-user-css"
+#define EPHY_PREFS_WEB_ENABLE_POPUPS "enable-popups"
+#define EPHY_PREFS_WEB_ENABLE_PLUGINS "enable-plugins"
+#define EPHY_PREFS_WEB_ENABLE_JAVASCRIPT "enable-javascript"
+#define EPHY_PREFS_WEB_COOKIES_POLICY "cookies-policy"
+#define EPHY_PREFS_WEB_IMAGE_ANIMATION_MODE "image-animation-mode"
+#define EPHY_PREFS_WEB_DEFAULT_ENCODING "default-encoding"
+
+#define EPHY_PREFS_SCHEMA "org.gnome.Epiphany"
+#define EPHY_PREFS_HOMEPAGE_URL "homepage-url"
+#define EPHY_PREFS_USER_AGENT "user-agent"
+#define EPHY_PREFS_CACHE_SIZE "cache-size"
+#define EPHY_PREFS_NEW_WINDOWS_IN_TABS "new-windows-in-tabs"
+#define EPHY_PREFS_AUTO_DOWNLOADS "automatic-downloads"
+#define EPHY_PREFS_WARN_ON_CLOSE_UNSUBMITTED_DATA "warn-on-close-unsubmitted-data"
+#define EPHY_PREFS_MIDDLE_CLICK_OPENS_URL "middle-click-opens-url"
+#define EPHY_PREFS_REMEMBER_PASSWORDS "remember-passwords"
+#define EPHY_PREFS_KEYWORD_SEARCH_URL "keyword-search-url"
+#define EPHY_PREFS_MANAGED_NETWORK "managed-network"
+#define EPHY_PREFS_ENABLE_SMOOTH_SCROLLING "enable-smooth-scrolling"
+#define EPHY_PREFS_ENABLE_WEB_INSPECTOR "enable-web-inspector"
+#define EPHY_PREFS_ENABLE_CARET_BROWSING "enable-caret-browsing"
+#define EPHY_PREFS_ENABLED_EXTENSIONS "enabled-extensions"
+
+#define EPHY_PREFS_LOCKDOWN_SCHEMA "org.gnome.Epiphany.lockdown"
+#define EPHY_PREFS_LOCKDOWN_FULLSCREEN "disable-fullscreen"
+#define EPHY_PREFS_LOCKDOWN_ARBITRARY_URL "disable-arbitrary-url"
+#define EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING "disable-bookmark-editing"
+#define EPHY_PREFS_LOCKDOWN_TOOLBAR_EDITING "disable-toolbar-editing"
+#define EPHY_PREFS_LOCKDOWN_HISTORY "disable-history"
+#define EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK "disable-save-to-disk"
+#define EPHY_PREFS_LOCKDOWN_PRINTING "disable-printing"
+#define EPHY_PREFS_LOCKDOWN_PRINT_SETUP "disable-print-setup"
+#define EPHY_PREFS_LOCKDOWN_COMMAND_LINE "disable-command-line"
+#define EPHY_PREFS_LOCKDOWN_QUIT "disable-quit"
+#define EPHY_PREFS_LOCKDOWN_JAVASCRIPT_CHROME "disable-javascript-chrome"
+#define EPHY_PREFS_LOCKDOWN_MENUBAR "disable-menubar"
G_END_DECLS
diff --git a/lib/ephy-settings.c b/lib/ephy-settings.c
new file mode 100644
index 000000000..4c9810933
--- /dev/null
+++ b/lib/ephy-settings.c
@@ -0,0 +1,65 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set sw=2 ts=2 sts=2 et: */
+/*
+ * Copyright © 2010 Igalia S.L.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#include "ephy-settings.h"
+
+#include "ephy-debug.h"
+
+#include <glib.h>
+#include <gio/gio.h>
+
+static GHashTable *settings = NULL;
+
+void
+ephy_settings_shutdown (void)
+{
+ if (settings != NULL) {
+ g_hash_table_remove_all (settings);
+ g_hash_table_unref (settings);
+ }
+}
+
+GSettings *
+ephy_settings_get (const char *schema)
+{
+ GSettings *gsettings = NULL;
+
+ if (settings == NULL) {
+ settings = g_hash_table_new_full (g_str_hash,
+ g_str_equal, g_free,
+ g_object_unref);
+ }
+
+ gsettings = g_hash_table_lookup (settings, schema);
+
+ if (gsettings == NULL) {
+ gsettings = g_settings_new (schema);
+
+ if (gsettings == NULL)
+ g_warning ("Invalid schema requested");
+ else
+ g_hash_table_insert (settings, g_strdup (schema), gsettings);
+ }
+
+ return gsettings;
+}
diff --git a/lib/ephy-settings.h b/lib/ephy-settings.h
new file mode 100644
index 000000000..197941c66
--- /dev/null
+++ b/lib/ephy-settings.h
@@ -0,0 +1,44 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set sw=2 ts=2 sts=2 et: */
+/*
+ * Copyright © 2010 Igalia S.L.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#if !defined (__EPHY_EPIPHANY_H_INSIDE__) && !defined (EPIPHANY_COMPILATION)
+#error "Only <epiphany/epiphany.h> can be included directly."
+#endif
+
+#ifndef EPHY_SETTINGS_H
+#define EPHY_SETTINGS_H
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include "ephy-prefs.h"
+
+#define EPHY_SETTINGS_MAIN ephy_settings_get (EPHY_PREFS_SCHEMA)
+#define EPHY_SETTINGS_UI ephy_settings_get (EPHY_PREFS_UI_SCHEMA)
+#define EPHY_SETTINGS_WEB ephy_settings_get (EPHY_PREFS_WEB_SCHEMA)
+#define EPHY_SETTINGS_LOCKDOWN ephy_settings_get (EPHY_PREFS_LOCKDOWN_SCHEMA)
+#define EPHY_SETTINGS_STATE ephy_settings_get (EPHY_PREFS_STATE_SCHEMA)
+
+GSettings *ephy_settings_get (const char *schema);
+
+void ephy_settings_shutdown (void);
+
+#endif /* EPHY_SETTINGS_H */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 03d922af1..85ca44520 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,8 +4,7 @@
data/bme.desktop.in.in
[type: gettext/xml] data/default-bookmarks.rdf.in
data/epiphany.desktop.in.in
-data/epiphany-lockdown.schemas.in
-data/epiphany.schemas.in
+data/org.gnome.epiphany.gschema.xml.in
[type: gettext/glade] data/glade/certificate-dialogs.ui
[type: gettext/glade] data/glade/epiphany.ui
[type: gettext/glade] data/glade/form-signing-dialog.ui
@@ -20,7 +19,6 @@ embed/ephy-embed-utils.c
embed/ephy-encodings.c
embed/ephy-history.c
embed/ephy-web-view.c
-lib/eel-gconf-extensions.c
lib/egg/eggdesktopfile.c
lib/egg/eggsmclient.c
lib/egg/egg-editable-toolbar.c
diff --git a/src/bookmarks/ephy-bookmark-properties.c b/src/bookmarks/ephy-bookmark-properties.c
index b681f21e4..c566678a7 100644
--- a/src/bookmarks/ephy-bookmark-properties.c
+++ b/src/bookmarks/ephy-bookmark-properties.c
@@ -34,8 +34,7 @@
#include "ephy-gui.h"
#include "ephy-dnd.h"
#include "ephy-prefs.h"
-
-#include "eel-gconf-extensions.h"
+#include "ephy-settings.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@@ -523,7 +522,8 @@ ephy_bookmark_properties_constructor (GType type,
EPHY_STATE_WINDOW_SAVE_SIZE);
}
/* Lockdown */
- lockdown = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING);
+ lockdown = g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING);
update_window_title (properties);
content_area = gtk_dialog_get_content_area (dialog);
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 2f81b8c6a..32a25caa1 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -34,6 +34,7 @@
#include "ephy-node-view.h"
#include "ephy-window.h"
#include "ephy-dnd.h"
+#include "ephy-settings.h"
#include "ephy-shell.h"
#include "ephy-session.h"
#include "ephy-file-helpers.h"
@@ -45,7 +46,6 @@
#include "ephy-stock-icons.h"
#include "ephy-search-entry.h"
#include "ephy-favicon-cache.h"
-#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
#include "egg-toolbars-model.h"
#include "ephy-prefs.h"
@@ -126,8 +126,6 @@ static void cmd_help_contents (GtkAction *action,
#define EPHY_BOOKMARKS_EDITOR_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_BOOKMARKS_EDITOR, EphyBookmarksEditorPrivate))
-#define CONF_BOOKMARKS_VIEW_DETAILS "/apps/epiphany/dialogs/bookmarks_view_details"
-
#define RESERVED_STRING N_("Remove from this topic")
struct _EphyBookmarksEditorPrivate
@@ -216,22 +214,11 @@ static const GtkToggleActionEntry ephy_bookmark_toggle_entries [] = {
{ "ShowOnToolbar", NULL, N_("_Show on Toolbar"), NULL,
N_("Show the selected bookmark on a toolbar"),
G_CALLBACK (cmd_toolbar), FALSE },
-};
-
-enum
-{
- VIEW_TITLE,
- VIEW_TITLE_AND_ADDRESS
-};
-
-static const GtkRadioActionEntry ephy_bookmark_radio_entries [] =
-{
/* View Menu */
{ "ViewTitle", NULL, N_("_Title"), NULL,
- N_("Show only the title column"), VIEW_TITLE },
- { "ViewTitleAddress", NULL, N_("T_itle and Address"), NULL,
- N_("Show both the title and address columns"),
- VIEW_TITLE_AND_ADDRESS }
+ N_("Show the title column"), NULL, TRUE },
+ { "ViewAddress", NULL, N_("Address"), NULL,
+ N_("Show the address column"), NULL, FALSE }
};
G_DEFINE_TYPE (EphyBookmarksEditor, ephy_bookmarks_editor, GTK_TYPE_WINDOW)
@@ -1117,50 +1104,6 @@ cmd_help_contents (GtkAction *action,
}
static void
-set_columns_visibility (EphyBookmarksEditor *editor, int value)
-{
- switch (value)
- {
- case VIEW_TITLE:
- gtk_tree_view_column_set_visible (editor->priv->title_col, TRUE);
- gtk_tree_view_column_set_visible (editor->priv->address_col, FALSE);
- break;
- case VIEW_TITLE_AND_ADDRESS:
- gtk_tree_view_column_set_visible (editor->priv->title_col, TRUE);
- gtk_tree_view_column_set_visible (editor->priv->address_col, TRUE);
- break;
- }
-}
-
-static void
-cmd_view_columns (GtkAction *action,
- GtkRadioAction *current,
- EphyBookmarksEditor *editor)
-{
- int value;
- GSList *svalues = NULL;
-
- g_return_if_fail (EPHY_IS_BOOKMARKS_EDITOR (editor));
-
- value = gtk_radio_action_get_current_value (current);
- set_columns_visibility (editor, value);
-
- switch (value)
- {
- case VIEW_TITLE:
- svalues = g_slist_append (svalues, (gpointer)"title");
- break;
- case VIEW_TITLE_AND_ADDRESS:
- svalues = g_slist_append (svalues, (gpointer)"title");
- svalues = g_slist_append (svalues, (gpointer)"address");
- break;
- }
-
- eel_gconf_set_string_list (CONF_BOOKMARKS_VIEW_DETAILS, svalues);
- g_slist_free (svalues);
-}
-
-static void
ephy_bookmarks_editor_show (GtkWidget *widget)
{
EphyBookmarksEditor *editor = EPHY_BOOKMARKS_EDITOR (widget);
@@ -1699,31 +1642,6 @@ provide_keyword_uri (EphyNode *node, GValue *value, gpointer data)
g_free (uri);
}
-static int
-get_details_value (EphyBookmarksEditor *editor)
-{
- int value;
- GSList *svalues;
-
- svalues = eel_gconf_get_string_list (CONF_BOOKMARKS_VIEW_DETAILS);
-
- if (svalues &&
- g_slist_find_custom (svalues, "title", (GCompareFunc)strcmp) &&
- g_slist_find_custom (svalues, "address", (GCompareFunc)strcmp))
- {
- value = VIEW_TITLE_AND_ADDRESS;
- }
- else
- {
- value = VIEW_TITLE;
- }
-
- g_slist_foreach (svalues, (GFunc) g_free, NULL);
- g_slist_free (svalues);
-
- return value;
-}
-
static void
ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
{
@@ -1735,7 +1653,7 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
GtkUIManager *ui_merge;
GtkActionGroup *action_group;
GtkAction *action;
- int col_id, url_col_id, title_col_id, details_value;
+ int col_id, url_col_id, title_col_id;
ephy_gui_ensure_window_group (GTK_WINDOW (editor));
@@ -1758,13 +1676,6 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
gtk_action_group_add_toggle_actions (action_group, ephy_bookmark_toggle_entries,
G_N_ELEMENTS (ephy_bookmark_toggle_entries), editor);
- details_value = get_details_value (editor);
- gtk_action_group_add_radio_actions (action_group,
- ephy_bookmark_radio_entries,
- G_N_ELEMENTS (ephy_bookmark_radio_entries),
- details_value,
- G_CALLBACK (cmd_view_columns),
- editor);
gtk_ui_manager_insert_action_group (ui_merge,
action_group, 0);
gtk_ui_manager_add_ui_from_file (ui_merge,
@@ -1901,6 +1812,27 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
gtk_container_add (GTK_CONTAINER (scrolled_window), bm_view);
gtk_widget_show (bm_view);
editor->priv->bm_view = bm_view;
+
+ action = gtk_action_group_get_action (action_group, "ViewTitle");
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_BOOKMARKS_VIEW_TITLE,
+ action, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_BOOKMARKS_VIEW_TITLE,
+ editor->priv->title_col, "visible",
+ G_SETTINGS_BIND_DEFAULT);
+
+ action = gtk_action_group_get_action (action_group, "ViewAddress");
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_BOOKMARKS_VIEW_ADDRESS,
+ action, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_BOOKMARKS_VIEW_ADDRESS,
+ editor->priv->address_col, "visible",
+ G_SETTINGS_BIND_DEFAULT);
+
g_signal_connect (G_OBJECT (bm_view),
"key_press_event",
G_CALLBACK (key_pressed_cb),
@@ -1931,12 +1863,12 @@ ephy_bookmarks_editor_construct (EphyBookmarksEditor *editor)
"bookmarks_paned",
130);
- set_columns_visibility (editor, details_value);
-
/* Lockdown settings */
action = gtk_action_group_get_action (action_group, "Export");
gtk_action_set_sensitive (action,
- eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK) == FALSE);
+ g_settings_get_boolean
+ (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK) == FALSE);
}
void
diff --git a/src/bookmarks/ephy-bookmarks-import.c b/src/bookmarks/ephy-bookmarks-import.c
index 1efdb71de..f6ed781cb 100644
--- a/src/bookmarks/ephy-bookmarks-import.c
+++ b/src/bookmarks/ephy-bookmarks-import.c
@@ -32,8 +32,7 @@
#include "ephy-bookmarks-import.h"
#include "ephy-debug.h"
#include "ephy-prefs.h"
-
-#include "eel-gconf-extensions.h"
+#include "ephy-settings.h"
/**
* NSItemType: netscape bookmark item type
@@ -73,7 +72,9 @@ ephy_bookmarks_import (EphyBookmarks *bookmarks,
GFile *file;
GFileInfo *file_info;
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
+ return FALSE;
g_return_val_if_fail (filename != NULL, FALSE);
@@ -712,7 +713,9 @@ ephy_bookmarks_import_mozilla (EphyBookmarks *bookmarks,
char *parsedname;
GList *folders = NULL;
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
+ return FALSE;
name = g_string_new (NULL);
url = g_string_new (NULL);
@@ -792,7 +795,9 @@ ephy_bookmarks_import_xbel (EphyBookmarks *bookmarks,
xmlTextReaderPtr reader;
int ret;
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
+ return FALSE;
if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE)
{
@@ -969,7 +974,8 @@ ephy_bookmarks_import_rdf (EphyBookmarks *bookmarks,
xmlNodePtr child;
xmlNodePtr root;
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return FALSE;
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
if (g_file_test (filename, G_FILE_TEST_EXISTS) == FALSE)
return FALSE;
diff --git a/src/bookmarks/ephy-bookmarks-ui.c b/src/bookmarks/ephy-bookmarks-ui.c
index 91479db85..1f97eddb3 100644
--- a/src/bookmarks/ephy-bookmarks-ui.c
+++ b/src/bookmarks/ephy-bookmarks-ui.c
@@ -20,7 +20,6 @@
#include "config.h"
-#include "eel-gconf-extensions.h"
#include "ephy-bookmarks.h"
#include "ephy-bookmarks-ui.h"
#include "ephy-bookmarks-menu.h"
@@ -36,6 +35,7 @@
#include "ephy-node-common.h"
#include "ephy-link.h"
#include "ephy-dnd.h"
+#include "ephy-embed-shell.h"
#include "ephy-history.h"
#include "ephy-shell.h"
#include "ephy-string.h"
@@ -44,6 +44,7 @@
#include "ephy-gui.h"
#include "ephy-stock-icons.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "egg-editable-toolbar.h"
#include <string.h>
@@ -434,7 +435,9 @@ ephy_bookmarks_ui_add_bookmark (GtkWindow *parent,
EphyNode *bookmark;
GtkWidget *dialog;
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING)) return;
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
+ return;
bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ());
bookmark = ephy_bookmarks_add (bookmarks, title, location);
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 507426978..43c1ad9d9 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -34,12 +34,11 @@
#include "ephy-bookmarks-import.h"
#include "ephy-bookmark-properties.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-marshal.h"
#include "ephy-signal-accumulator.h"
#include "ephy-stock-icons.h"
-#include "eel-gconf-extensions.h"
-
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@@ -82,7 +81,6 @@ struct _EphyBookmarksPrivate
EphyNode *smartbookmarks;
EphyNode *lower_fav;
double lower_score;
- guint disable_bookmark_editing_notifier_id;
#ifdef ENABLE_ZEROCONF
/* Local sites */
@@ -630,14 +628,6 @@ topics_removed_cb (EphyNode *node,
}
static void
-update_bookmark_editing (EphyBookmarks *eb)
-{
- g_object_set (G_OBJECT (eb->priv->db),
- "immutable", eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING),
- NULL);
-}
-
-static void
fix_hierarchy_topic (EphyBookmarks *eb,
EphyNode *topic)
{
@@ -693,15 +683,6 @@ fix_hierarchy (EphyBookmarks *eb)
}
static void
-disable_bookmark_editing_notifier (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyBookmarks *eb)
-{
- update_bookmark_editing (eb);
-}
-
-static void
backup_file (const char *original_filename, const char *extension)
{
char *template, *backup_filename;
@@ -1339,10 +1320,10 @@ ephy_bookmarks_init (EphyBookmarks *eb)
fix_hierarchy (eb);
- eb->priv->disable_bookmark_editing_notifier_id = eel_gconf_notification_add
- (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING,
- (GConfClientNotifyFunc)disable_bookmark_editing_notifier, eb);
- update_bookmark_editing (eb);
+ g_settings_bind (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING,
+ eb->priv->db, "immutable",
+ G_SETTINGS_BIND_GET);
ephy_setup_history_notifiers (eb);
ephy_bookmarks_update_favorites (eb);
@@ -1354,8 +1335,6 @@ ephy_bookmarks_finalize (GObject *object)
EphyBookmarks *eb = EPHY_BOOKMARKS (object);
EphyBookmarksPrivate *priv = eb->priv;
- eel_gconf_notification_remove (priv->disable_bookmark_editing_notifier_id);
-
if (priv->save_timeout_id != 0)
{
g_source_remove (priv->save_timeout_id);
diff --git a/src/ephy-activation.c b/src/ephy-activation.c
index 85e2cf91c..802ca4bd6 100644
--- a/src/ephy-activation.c
+++ b/src/ephy-activation.c
@@ -21,10 +21,10 @@
#include "ephy-activation.h"
+#include "ephy-settings.h"
#include "ephy-shell.h"
#include "ephy-session.h"
#include "ephy-prefs.h"
-#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
static gboolean
@@ -86,7 +86,8 @@ ephy_activation_open_bookmarks_editor (EphyDbus *ephy_dbus,
guint startup_id,
GError **error)
{
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING))
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
{
g_set_error (error,
g_quark_from_static_string ("ephy-activation-error"),
diff --git a/src/ephy-encoding-dialog.c b/src/ephy-encoding-dialog.c
index 7bb055c73..009a3dd64 100644
--- a/src/ephy-encoding-dialog.c
+++ b/src/ephy-encoding-dialog.c
@@ -39,25 +39,6 @@
#include <string.h>
#include <webkit/webkit.h>
-enum
-{
- WINDOW_PROP,
- SCROLLED_WINDOW_PROP,
- AUTOMATIC_PROP,
- MANUAL_PROP
-};
-
-static const
-EphyDialogProperty properties [] =
-{
- { "encoding_dialog", NULL, PT_NORMAL, 0 },
- { "scrolled_window", NULL, PT_NORMAL, 0 },
- { "automatic_button", NULL, PT_NORMAL, 0 },
- { "manual_button", NULL, PT_NORMAL, 0 },
-
- { NULL }
-};
-
#define EPHY_ENCODING_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_ENCODING_DIALOG, EphyEncodingDialogPrivate))
struct _EphyEncodingDialogPrivate
@@ -127,7 +108,8 @@ sync_encoding_against_embed (EphyEncodingDialog *dialog)
g_list_free (rows);
}
- button = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[AUTOMATIC_PROP].id);
+ button = ephy_dialog_get_control (EPHY_DIALOG (dialog),
+ "automatic_button");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), is_automatic);
dialog->priv->update_tag = FALSE;
@@ -206,7 +188,8 @@ activate_choice (EphyEncodingDialog *dialog)
embed = ephy_embed_dialog_get_embed (EPHY_EMBED_DIALOG (dialog));
g_return_if_fail (EPHY_IS_EMBED (embed));
- button = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[AUTOMATIC_PROP].id);
+ button = ephy_dialog_get_control (EPHY_DIALOG (dialog),
+ "automatic_button");
is_automatic = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
@@ -253,7 +236,7 @@ view_node_selected_cb (EphyNodeView *view,
if (dialog->priv->update_tag) return;
- button = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[MANUAL_PROP].id);
+ button = ephy_dialog_get_control (EPHY_DIALOG (dialog), "manual_button");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
activate_choice (dialog);
@@ -270,7 +253,7 @@ view_node_activated_cb (GtkWidget *view,
if (dialog->priv->update_tag) return;
- button = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[MANUAL_PROP].id);
+ button = ephy_dialog_get_control (EPHY_DIALOG (dialog), "manual_button");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
activate_choice (dialog);
@@ -302,12 +285,12 @@ ephy_encoding_dialog_init (EphyEncodingDialog *dialog)
(EPHY_EMBED_SHELL (ephy_shell)));
ephy_dialog_construct (EPHY_DIALOG (dialog),
- properties,
ephy_file ("epiphany.ui"),
"encoding_dialog",
NULL);
- window = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[WINDOW_PROP].id);
+ window = ephy_dialog_get_control (EPHY_DIALOG (dialog),
+ "encoding_dialog");
g_signal_connect (window, "response",
G_CALLBACK (ephy_encoding_dialog_response_cb), dialog);
@@ -341,17 +324,18 @@ ephy_encoding_dialog_init (EphyEncodingDialog *dialog)
gtk_widget_show (treeview);
- scroller = ephy_dialog_get_control
- (EPHY_DIALOG (dialog), properties[SCROLLED_WINDOW_PROP].id);
+ scroller = ephy_dialog_get_control (EPHY_DIALOG (dialog),
+ "scrolled_window");
gtk_container_add (GTK_CONTAINER (scroller), treeview);
- button = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[AUTOMATIC_PROP].id);
+ button = ephy_dialog_get_control (EPHY_DIALOG (dialog),
+ "automatic_button");
child = gtk_bin_get_child (GTK_BIN (button));
gtk_label_set_use_markup (GTK_LABEL (child), TRUE);
g_signal_connect (button, "toggled",
G_CALLBACK (automatic_toggled_cb), dialog);
- button = ephy_dialog_get_control (EPHY_DIALOG (dialog), properties[MANUAL_PROP].id);
+ button = ephy_dialog_get_control (EPHY_DIALOG (dialog), "manual_button");
gtk_label_set_use_markup (GTK_LABEL (child), TRUE);
dialog->priv->enc_view = treeview;
diff --git a/src/ephy-extensions-manager.c b/src/ephy-extensions-manager.c
index e3e57ffe2..35122c87d 100644
--- a/src/ephy-extensions-manager.c
+++ b/src/ephy-extensions-manager.c
@@ -32,12 +32,11 @@
#include "ephy-node-db.h"
#include "ephy-shell.h"
-#include "eel-gconf-extensions.h"
#include "ephy-file-helpers.h"
#include "ephy-object-helpers.h"
#include "ephy-debug.h"
-
-#include <gconf/gconf-client.h>
+#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include <gio/gio.h>
#include <gmodule.h>
@@ -47,7 +46,6 @@
#include "ephy-seed-loader.h"
#endif
-#define CONF_LOADED_EXTENSIONS "/apps/epiphany/general/active_extensions"
#define EE_GROUP "Epiphany Extension"
#define DOT_INI ".ephy-extension"
#define RELOAD_DELAY 333 /* ms */
@@ -64,7 +62,6 @@ struct _EphyExtensionsManagerPrivate
GList *extensions;
GList *dir_monitors;
GList *windows;
- guint active_extensions_notifier_id;
guint sync_timeout_id;
GHashTable *reload_hash;
};
@@ -110,35 +107,60 @@ G_DEFINE_TYPE_WITH_CODE (EphyExtensionsManager, ephy_extensions_manager, G_TYPE_
G_IMPLEMENT_INTERFACE (EPHY_TYPE_EXTENSION,
ephy_extensions_manager_iface_init))
-/**
- * ephy_extensions_manager_load:
- * @manager: an #EphyExtensionsManager
- * @identifier: identifier of the extension to load
- *
- * Loads the extension corresponding to @identifier.
- **/
-void
-ephy_extensions_manager_load (EphyExtensionsManager *manager,
- const char *identifier)
+static void
+ephy_extensions_manager_toggle_load (EphyExtensionsManager *manager,
+ const char *identifier,
+ gboolean status)
{
- GSList *gconf_exts;
+ char **exts;
+ GVariantBuilder builder;
+ gboolean dirty = FALSE;
+ int i;
g_return_if_fail (EPHY_IS_EXTENSIONS_MANAGER (manager));
g_return_if_fail (identifier != NULL);
- LOG ("Adding '%s' to extensions", identifier);
+ if (status)
+ LOG ("Adding '%s' to extensions", identifier);
+ else
+ LOG ("Removing '%s' from extensions", identifier);
- gconf_exts = eel_gconf_get_string_list (CONF_LOADED_EXTENSIONS);
+ exts = g_settings_get_strv (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLED_EXTENSIONS);
- if (!g_slist_find_custom (gconf_exts, identifier, (GCompareFunc) strcmp))
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY);
+ for (i = 0; exts[i]; i++)
{
- gconf_exts = g_slist_prepend (gconf_exts, g_strdup (identifier));
+ if (g_strcmp0 (exts[i], identifier) == 0)
+ {
+ dirty = TRUE;
+ if (status)
+ break;
+ else
+ continue;
+ }
- eel_gconf_set_string_list (CONF_LOADED_EXTENSIONS, gconf_exts);
+ g_variant_builder_add (&builder, "s", exts[i]);
}
- g_slist_foreach (gconf_exts, (GFunc) g_free, NULL);
- g_slist_free (gconf_exts);
+ if (!dirty)
+ g_settings_set (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLED_EXTENSIONS,
+ "as", &builder);
+}
+
+/**
+ * ephy_extensions_manager_load:
+ * @manager: an #EphyExtensionsManager
+ * @identifier: identifier of the extension to load
+ *
+ * Loads the extension corresponding to @identifier.
+ **/
+void
+ephy_extensions_manager_load (EphyExtensionsManager *manager,
+ const char *identifier)
+{
+ ephy_extensions_manager_toggle_load (manager, identifier, TRUE);
}
/**
@@ -156,29 +178,7 @@ void
ephy_extensions_manager_unload (EphyExtensionsManager *manager,
const char *identifier)
{
- GSList *gconf_exts;
- GSList *l;
-
- g_return_if_fail (EPHY_IS_EXTENSIONS_MANAGER (manager));
- g_return_if_fail (identifier != NULL);
-
- LOG ("Removing '%s' from extensions", identifier);
-
- gconf_exts = eel_gconf_get_string_list (CONF_LOADED_EXTENSIONS);
-
- l = g_slist_find_custom (gconf_exts, identifier, (GCompareFunc) strcmp);
-
- if (l != NULL)
- {
- gconf_exts = g_slist_remove_link (gconf_exts, l);
- g_free (l->data);
- g_slist_free_1 (l);
-
- eel_gconf_set_string_list (CONF_LOADED_EXTENSIONS, gconf_exts);
- }
-
- g_slist_foreach (gconf_exts, (GFunc) g_free, NULL);
- g_slist_free (gconf_exts);
+ ephy_extensions_manager_toggle_load (manager, identifier, FALSE);
}
/**
@@ -629,50 +629,65 @@ unload_extension (EphyExtensionsManager *manager,
static void
sync_loaded_extensions (EphyExtensionsManager *manager)
{
- GConfClient *client;
- GConfValue *value;
- GSList *active_extensions = NULL;
+ char **extensions;
+ GVariantBuilder builder;
+ int i;
+ gboolean has_ui = FALSE;
GList *l;
- gboolean active;
ExtensionInfo *info;
LOG ("Synching changed list of active extensions");
- client = gconf_client_get_default ();
- g_return_if_fail (client != NULL);
+ extensions = g_settings_get_strv (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLED_EXTENSIONS);
- value = gconf_client_get (client, CONF_LOADED_EXTENSIONS, NULL);
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY);
- /* make sure the extensions-manager-ui is loaded */
- if (value == NULL ||
- value->type != GCONF_VALUE_LIST ||
- gconf_value_get_list_type (value) != GCONF_VALUE_STRING)
+ /* Make sure the extensions-manager-ui is always loaded. */
+ for (i = 0; extensions[i]; i++)
{
- active_extensions = g_slist_prepend (active_extensions,
- g_strdup ("extensions-manager-ui"));
- eel_gconf_set_string_list (CONF_LOADED_EXTENSIONS, active_extensions);
+ if (!has_ui && g_strcmp0 (extensions[i],
+ "extensions-manager-ui") == 0)
+ has_ui = TRUE;
+
+ g_variant_builder_add (&builder, "s", extensions[i]);
}
- else
+
+ if (!has_ui)
{
- active_extensions = eel_gconf_get_string_list (CONF_LOADED_EXTENSIONS);
+ g_variant_builder_add (&builder, "s", "extensions-manager-ui");
+ g_settings_set (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLED_EXTENSIONS,
+ "as", &builder);
+
+ g_strfreev (extensions);
+ extensions = g_settings_get_strv
+ (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLED_EXTENSIONS);
}
+
for (l = manager->priv->data; l != NULL; l = l->next)
{
gboolean changed;
+ gboolean active = FALSE;
+ int j;
info = (ExtensionInfo *) l->data;
- active = (g_slist_find_custom (active_extensions,
- info->info.identifier,
- (GCompareFunc) strcmp) != NULL);
+ for (j = 0; extensions[j]; j++)
+ {
+ if (!active && g_strcmp0 (extensions[j],
+ info->info.identifier) == 0)
+ active = TRUE;
+ }
LOG ("Extension '%s' is %sactive and %sloaded",
info->info.identifier,
active ? "" : "not ",
info->info.active ? "" : "not ");
- changed = ( info->info.enabled != active );
+ changed = (info->info.enabled != active);
info->info.enabled = active;
@@ -699,14 +714,7 @@ sync_loaded_extensions (EphyExtensionsManager *manager)
}
}
- g_slist_foreach (active_extensions, (GFunc) g_free, NULL);
- g_slist_free (active_extensions);
-
- if (value != NULL)
- {
- gconf_value_free (value);
- }
- g_object_unref (client);
+ g_strfreev (extensions);
}
static void
@@ -920,10 +928,9 @@ ephy_extensions_manager_load_dir (EphyExtensionsManager *manager,
}
static void
-active_extensions_notifier (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyExtensionsManager *manager)
+active_extensions_cb (GSettings *settings,
+ char *key,
+ EphyExtensionsManager *manager)
{
sync_loaded_extensions (manager);
}
@@ -964,12 +971,12 @@ ephy_extensions_manager_startup (EphyExtensionsManager *manager)
ephy_extensions_manager_load_dir (manager, EXTENSIONS_DIR);
- active_extensions_notifier (NULL, 0, NULL, manager);
- manager->priv->active_extensions_notifier_id =
- eel_gconf_notification_add
- (CONF_LOADED_EXTENSIONS,
- (GConfClientNotifyFunc) active_extensions_notifier,
- manager);
+ sync_loaded_extensions (manager);
+
+ g_signal_connect (EPHY_SETTINGS_MAIN,
+ "changed::" EPHY_PREFS_ENABLED_EXTENSIONS,
+ G_CALLBACK (active_extensions_cb),
+ manager);
}
static void
@@ -978,12 +985,6 @@ ephy_extensions_manager_dispose (GObject *object)
EphyExtensionsManager *manager = EPHY_EXTENSIONS_MANAGER (object);
EphyExtensionsManagerPrivate *priv = manager->priv;
- if (priv->active_extensions_notifier_id != 0)
- {
- eel_gconf_notification_remove (priv->active_extensions_notifier_id);
- priv->active_extensions_notifier_id = 0;
- }
-
if (priv->reload_hash != NULL)
{
g_hash_table_destroy (priv->reload_hash);
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 6fabfbda1..ba81c6e0d 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -39,12 +39,12 @@
#include "ephy-search-entry.h"
#include "ephy-session.h"
#include "ephy-favicon-cache.h"
-#include "eel-gconf-extensions.h"
#include "ephy-node.h"
#include "ephy-node-common.h"
#include "ephy-node-view.h"
#include "ephy-bookmarks-ui.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-gui.h"
#include "ephy-time-helpers.h"
@@ -90,17 +90,12 @@ static void cmd_select_all (GtkAction *action,
EphyHistoryWindow *editor);
static void cmd_help_contents (GtkAction *action,
EphyHistoryWindow *editor);
-static void cmd_view_columns (GtkAction *action,
- EphyHistoryWindow *view);
static void search_entry_search_cb (GtkWidget *entry,
char *search_text,
EphyHistoryWindow *editor);
#define EPHY_HISTORY_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_HISTORY_WINDOW, EphyHistoryWindowPrivate))
-#define CONF_HISTORY_DATE_FILTER "/apps/epiphany/dialogs/history_date_filter"
-#define CONF_HISTORY_VIEW_DETAILS "/apps/epiphany/dialogs/history_view_details"
-
struct _EphyHistoryWindowPrivate
{
EphyHistory *history;
@@ -127,21 +122,6 @@ enum
PROP_HISTORY
};
-enum
-{
- TIME_LAST_HALF_HOUR,
- TIME_TODAY,
- TIME_LAST_TWO_DAYS,
- TIME_LAST_THREE_DAYS,
- TIME_EVER
-};
-
-#define TIME_LAST_HALF_HOUR_STRING "last_half_hour"
-#define TIME_EVER_STRING "ever"
-#define TIME_TODAY_STRING "today"
-#define TIME_LAST_TWO_DAYS_STRING "last_two_days"
-#define TIME_LAST_THREE_DAYS_STRING "last_three_days"
-
static const GtkActionEntry ephy_history_ui_entries [] = {
/* Toplevel */
{ "File", NULL, N_("_File") },
@@ -204,11 +184,11 @@ static const GtkToggleActionEntry ephy_history_toggle_entries [] =
{
/* View Menu */
{ "ViewTitle", NULL, N_("_Title"), NULL,
- N_("Show the title column"), G_CALLBACK (cmd_view_columns), TRUE },
+ N_("Show the title column"), NULL, TRUE },
{ "ViewAddress", NULL, N_("_Address"), NULL,
- N_("Show the address column"), G_CALLBACK (cmd_view_columns), TRUE },
+ N_("Show the address column"), NULL, TRUE },
{ "ViewDateTime", NULL, N_("_Date and Time"), NULL,
- N_("Show the date and time column"), G_CALLBACK (cmd_view_columns), TRUE }
+ N_("Show the date and time column"), NULL, TRUE }
};
static void
@@ -493,77 +473,6 @@ cmd_help_contents (GtkAction *action,
ephy_gui_help (GTK_WIDGET (editor), "ephy-managing-history");
}
-static void
-set_column_visibility (EphyHistoryWindow *view,
- const char *action_name,
- gboolean active)
-{
- if (strcmp (action_name, "ViewTitle") == 0)
- {
- gtk_tree_view_column_set_visible (view->priv->title_col, active);
- }
- if (strcmp (action_name, "ViewAddress") == 0)
- {
- gtk_tree_view_column_set_visible (view->priv->address_col, active);
- }
- if (strcmp (action_name, "ViewDateTime") == 0)
- {
- gtk_tree_view_column_set_visible (view->priv->datetime_col, active);
- }
-}
-
-static void
-set_all_columns_visibility (EphyHistoryWindow *view,
- EphyHistoryWindowColumns details_value)
-{
- GtkActionGroup *action_group;
- GtkAction *action_title, *action_address, *action_datetime;
-
- action_group = view->priv->action_group;
- action_title = gtk_action_group_get_action (action_group, "ViewTitle");
- action_address = gtk_action_group_get_action (action_group, "ViewAddress");
- action_datetime = gtk_action_group_get_action (action_group, "ViewDateTime");
-
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action_title), (details_value & VIEW_TITLE));
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action_address), (details_value & VIEW_ADDRESS));
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action_datetime), (details_value & VIEW_DATETIME));
-}
-
-static void
-cmd_view_columns (GtkAction *action,
- EphyHistoryWindow *view)
-{
- gboolean active;
- const char *action_name;
- GSList *svalues = NULL;
-
- active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- action_name = gtk_action_get_name (action);
- set_column_visibility (view, action_name, active);
-
- svalues = eel_gconf_get_string_list (CONF_HISTORY_VIEW_DETAILS);
-
- if (active)
- {
- if (!g_slist_find_custom (svalues, (gpointer) action_name, (GCompareFunc) strcmp))
- {
- svalues = g_slist_append (svalues, (gpointer) action_name);
- }
- }
- else
- {
- GSList *delete;
- delete = g_slist_find_custom (svalues, (gpointer) action_name, (GCompareFunc) strcmp);
- if (delete)
- {
- svalues = g_slist_delete_link (svalues, delete);
- }
- }
-
- eel_gconf_set_string_list (CONF_HISTORY_VIEW_DETAILS, svalues);
- g_slist_free (svalues);
-}
-
G_DEFINE_TYPE (EphyHistoryWindow, ephy_history_window, GTK_TYPE_WINDOW)
static void
@@ -719,7 +628,9 @@ ephy_history_window_update_menu (EphyHistoryWindow *editor)
open_in_window = (pages_focus && pages_selection);
open_in_tab = (pages_focus && pages_selection);
delete = (pages_focus && pages_selection);
- bookmarks_locked = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING);
+ bookmarks_locked = g_settings_get_boolean
+ (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING);
bookmark_page = (pages_focus && single_page_selected) && !bookmarks_locked;
action_group = editor->priv->action_group;
@@ -853,7 +764,7 @@ add_by_date_filter (EphyHistoryWindow *editor,
(GTK_COMBO_BOX (editor->priv->time_combo));
/* no need to setup a new filter */
- if (time_range == TIME_EVER) return;
+ if (time_range == EPHY_PREFS_STATE_HISTORY_DATE_FILTER_EVER) return;
now = time (NULL);
if (localtime_r (&now, &btime) == NULL) return;
@@ -866,16 +777,18 @@ add_by_date_filter (EphyHistoryWindow *editor,
switch (time_range)
{
- case TIME_LAST_HALF_HOUR:
+ case EPHY_PREFS_STATE_HISTORY_DATE_FILTER_LAST_HALF_HOUR:
cmp_time = now - 30 * 60;
break;
- case TIME_LAST_THREE_DAYS:
+ case EPHY_PREFS_STATE_HISTORY_DATE_FILTER_TODAY:
+ cmp_time = midnight;
+ break;
+ case EPHY_PREFS_STATE_HISTORY_DATE_FILTER_LAST_TWO_DAYS:
days++;
- /* fall-through */
- case TIME_LAST_TWO_DAYS:
+ cmp_time = midnight;
+ break;
+ case EPHY_PREFS_STATE_HISTORY_DATE_FILTER_LAST_THREE_DAYS:
days++;
- /* fall-through */
- case TIME_TODAY:
cmp_time = midnight;
break;
default:
@@ -1019,7 +932,6 @@ build_search_box (EphyHistoryWindow *editor)
GtkWidget *box, *label, *entry;
GtkWidget *combo;
char *str;
- int time_range;
box = gtk_hbox_new (FALSE, 6);
gtk_container_set_border_width (GTK_CONTAINER (box), 6);
@@ -1045,42 +957,25 @@ build_search_box (EphyHistoryWindow *editor)
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Last 30 minutes"));
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Today"));
+
str = g_strdup_printf (ngettext ("Last %d day", "Last %d days", 2), 2);
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), str);
g_free (str);
+
str = g_strdup_printf (ngettext ("Last %d day", "Last %d days", 3), 3);
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), str);
g_free (str);
- /* keep this in sync with embed/ephy-history.c's HISTORY_PAGE_OBSOLETE_DAYS */
+
+ /* keep this in sync with embed/ephy-history.c's
+ * HISTORY_PAGE_OBSOLETE_DAYS */
str = g_strdup_printf (ngettext ("Last %d day", "Last %d days", 10), 10);
gtk_combo_box_append_text (GTK_COMBO_BOX (combo), str);
g_free (str);
- str = eel_gconf_get_string (CONF_HISTORY_DATE_FILTER);
- if (str && strcmp (TIME_LAST_HALF_HOUR_STRING, str) == 0)
- {
- time_range = TIME_LAST_HALF_HOUR;
- }
- if (str && strcmp (TIME_TODAY_STRING, str) == 0)
- {
- time_range = TIME_TODAY;
- }
- else if (str && strcmp (TIME_LAST_TWO_DAYS_STRING, str) == 0)
- {
- time_range = TIME_LAST_TWO_DAYS;
- }
- else if (str && strcmp (TIME_LAST_THREE_DAYS_STRING, str) == 0)
- {
- time_range = TIME_LAST_THREE_DAYS;
- }
- else
- {
- time_range = TIME_EVER;
- }
- g_free (str);
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo),
- time_range);
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_HISTORY_DATE_FILTER,
+ combo, "active",
+ G_SETTINGS_BIND_DEFAULT);
editor->priv->time_combo = combo;
@@ -1184,40 +1079,6 @@ view_selection_changed_cb (GtkWidget *view, EphyHistoryWindow *editor)
ephy_history_window_update_menu (editor);
}
-static EphyHistoryWindowColumns
-get_details_value (void)
-{
- guint value = 0;
- GSList *svalues;
-
- svalues = eel_gconf_get_string_list (CONF_HISTORY_VIEW_DETAILS);
- if (svalues == NULL)
- {
- svalues = g_slist_append (svalues, (gpointer) "ViewAddress");
- svalues = g_slist_append (svalues, (gpointer) "ViewTitle");
- eel_gconf_set_string_list (CONF_HISTORY_VIEW_DETAILS, svalues);
- return (VIEW_ADDRESS | VIEW_TITLE);
- }
-
- if (g_slist_find_custom (svalues, "ViewTitle", (GCompareFunc)strcmp))
- {
- value |= VIEW_TITLE;
- }
- if (g_slist_find_custom (svalues, "ViewAddress", (GCompareFunc)strcmp))
- {
- value |= VIEW_ADDRESS;
- }
- if (g_slist_find_custom (svalues, "ViewDateTime", (GCompareFunc)strcmp))
- {
- value |= VIEW_DATETIME;
- }
-
- g_slist_foreach (svalues, (GFunc) g_free, NULL);
- g_slist_free (svalues);
-
- return value;
-}
-
static void
ephy_history_window_construct (EphyHistoryWindow *editor)
{
@@ -1229,8 +1090,8 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
EphyNode *node;
GtkUIManager *ui_merge;
GtkActionGroup *action_group;
+ GtkAction *action;
int url_col_id, title_col_id, datetime_col_id;
- EphyHistoryWindowColumns details_value;
ephy_gui_ensure_window_group (GTK_WINDOW (editor));
@@ -1253,7 +1114,6 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
gtk_action_group_add_actions (action_group, ephy_history_ui_entries,
G_N_ELEMENTS (ephy_history_ui_entries), editor);
- details_value = get_details_value ();
gtk_action_group_add_toggle_actions (action_group,
ephy_history_toggle_entries,
G_N_ELEMENTS (ephy_history_toggle_entries),
@@ -1391,6 +1251,36 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
gtk_widget_show (pages_view);
editor->priv->pages_view = pages_view;
+ action = gtk_action_group_get_action (action_group, "ViewTitle");
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_HISTORY_VIEW_TITLE,
+ action, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_HISTORY_VIEW_TITLE,
+ editor->priv->title_col, "visible",
+ G_SETTINGS_BIND_DEFAULT);
+
+ action = gtk_action_group_get_action (action_group, "ViewAddress");
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_HISTORY_VIEW_ADDRESS,
+ action, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_HISTORY_VIEW_ADDRESS,
+ editor->priv->address_col, "visible",
+ G_SETTINGS_BIND_DEFAULT);
+
+ action = gtk_action_group_get_action (action_group, "ViewDateTime");
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_HISTORY_VIEW_DATE,
+ action, "active",
+ G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_HISTORY_VIEW_DATE,
+ editor->priv->datetime_col, "visible",
+ G_SETTINGS_BIND_DEFAULT);
+
g_signal_connect (G_OBJECT (pages_view),
"node_activated",
G_CALLBACK (ephy_history_window_node_activated_cb),
@@ -1420,7 +1310,6 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
"history_paned",
130);
- set_all_columns_visibility (editor, details_value);
setup_filters (editor, TRUE, TRUE);
}
@@ -1508,37 +1397,6 @@ ephy_history_window_init (EphyHistoryWindow *editor)
}
static void
-save_date_filter (EphyHistoryWindow *editor)
-{
- const char *time_string = NULL;
- int time_range;
-
- time_range = gtk_combo_box_get_active
- (GTK_COMBO_BOX (editor->priv->time_combo));
-
- switch (time_range)
- {
- case TIME_LAST_HALF_HOUR:
- time_string = TIME_LAST_HALF_HOUR_STRING;
- break;
- case TIME_EVER:
- time_string = TIME_EVER_STRING;
- break;
- case TIME_TODAY:
- time_string = TIME_TODAY_STRING;
- break;
- case TIME_LAST_TWO_DAYS:
- time_string = TIME_LAST_TWO_DAYS_STRING;
- break;
- case TIME_LAST_THREE_DAYS:
- time_string = TIME_LAST_THREE_DAYS_STRING;
- break;
- }
-
- eel_gconf_set_string (CONF_HISTORY_DATE_FILTER, time_string);
-}
-
-static void
ephy_history_window_dispose (GObject *object)
{
EphyHistoryWindow *editor;
@@ -1555,8 +1413,6 @@ ephy_history_window_dispose (GObject *object)
remove_focus_monitor (editor, editor->priv->search_entry);
editor->priv->sites_view = NULL;
-
- save_date_filter (editor);
}
G_OBJECT_CLASS (ephy_history_window_parent_class)->dispose (object);
diff --git a/src/ephy-home-action.c b/src/ephy-home-action.c
index c2826a3bf..05290a0ec 100644
--- a/src/ephy-home-action.c
+++ b/src/ephy-home-action.c
@@ -22,9 +22,9 @@
#include "ephy-home-action.h"
#include "ephy-link.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-gui.h"
#include "ephy-dnd.h"
-#include "eel-gconf-extensions.h"
#include <string.h>
@@ -162,7 +162,8 @@ ephy_home_action_activate (GtkAction *action)
g_object_get (G_OBJECT (action), "name", &action_name, NULL);
- address = eel_gconf_get_string (CONF_GENERAL_HOMEPAGE);
+ address = g_settings_get_string (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_HOMEPAGE_URL);
action_name_association (action, action_name, address, FALSE);
diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c
index 1910aca2c..61aec8d86 100644
--- a/src/ephy-lockdown.c
+++ b/src/ephy-lockdown.c
@@ -2,6 +2,7 @@
/*
* Copyright © 2000, 2001, 2002, 2003, 2004 Marco Pesenti Gritti
* Copyright © 2003, 2004, 2005 Christian Persch
+ * Copyright © 2010 Igalia S.L.
*
* 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
@@ -21,49 +22,25 @@
#include "config.h"
+#include "ephy-action-helper.h"
#include "ephy-embed-container.h"
+#include "ephy-embed-shell.h"
#include "ephy-embed-utils.h"
#include "ephy-web-view.h"
#include "ephy-lockdown.h"
#include "ephy-extension.h"
-#include "ephy-action-helper.h"
+#include "ephy-settings.h"
#include "ephy-toolbar.h"
#include "ephy-prefs.h"
-#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
#include <gtk/gtk.h>
#include <string.h>
-static void ephy_lockdown_iface_init (EphyExtensionIface *iface);
-
-/* Make sure these don't overlap with those in ephy-window.c and ephy-toolbar.c */
-enum
-{
- LOCKDOWN_FLAG = 1 << 31
-};
+#define LOCKDOWN_FLAG 1 << 8
-static const char * const keys [] =
-{
- CONF_LOCKDOWN_DISABLE_ARBITRARY_URL,
- CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING,
- CONF_LOCKDOWN_DISABLE_COMMAND_LINE,
- CONF_LOCKDOWN_DISABLE_HISTORY,
- CONF_LOCKDOWN_DISABLE_PRINTING,
- CONF_LOCKDOWN_DISABLE_PRINT_SETUP,
- CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK,
- CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING,
- CONF_LOCKDOWN_FULLSCREEN
-};
-
-#define EPHY_LOCKDOWN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_LOCKDOWN, EphyLockdownPrivate))
-
-struct _EphyLockdownPrivate
-{
- guint notifier_id[G_N_ELEMENTS (keys)];
- GList *windows;
-};
+static void ephy_lockdown_iface_init (EphyExtensionIface *iface);
static int
find_name (GtkActionGroup *action_group,
@@ -86,237 +63,226 @@ find_action_group (GtkUIManager *manager,
}
static void
-update_location_editable (EphyWindow *window,
- GtkAction *action,
- gboolean editable)
+arbitrary_url_cb (GSettings *settings,
+ char *key,
+ EphyWindow *window)
{
EphyEmbed *embed;
GtkWidget *toolbar;
char *address;
- g_object_set (action, "editable", editable, NULL);
-
/* Restore the real web page address when disabling entry */
- if (editable == FALSE)
+ if (g_settings_get_boolean (settings, key))
{
- toolbar = ephy_window_get_toolbar (window);
embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
/* embed is NULL on startup */
- if (embed != NULL)
- {
- address = ephy_web_view_get_location (ephy_embed_get_web_view (embed), TRUE);
- ephy_toolbar_set_location (EPHY_TOOLBAR (toolbar), address);
- ephy_web_view_set_typed_address (ephy_embed_get_web_view (embed), NULL);
- g_free (address);
- }
+ if (embed == NULL)
+ return;
+
+ toolbar = ephy_window_get_toolbar (window);
+ address = ephy_web_view_get_location (ephy_embed_get_web_view (embed), TRUE);
+ ephy_toolbar_set_location (EPHY_TOOLBAR (toolbar), address);
+ ephy_web_view_set_typed_address (ephy_embed_get_web_view (embed), NULL);
+ g_free (address);
}
}
-/* NOTE: If you bring more actions under lockdown control, make sure
- * that all sensitivity updates on them are done using the helpers!
- */
static void
-update_window (EphyWindow *window,
- EphyLockdown *lockdown)
+fullscreen_cb (GSettings *settings,
+ char *key,
+ EphyWindow *window)
{
- GtkUIManager *manager;
- GtkActionGroup *action_group, *popups_action_group;
- GtkActionGroup *toolbar_action_group, *special_toolbar_action_group;
- GtkAction *action;
- gboolean disabled, fullscreen, print_setup_disabled, writable;
-
- LOG ("Updating window %p", window);
-
- manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window));
- action_group = find_action_group (manager, "WindowActions");
- popups_action_group = find_action_group (manager, "PopupsActions");
- toolbar_action_group = find_action_group (manager, "ToolbarActions");
- special_toolbar_action_group = find_action_group (manager, "SpecialToolbarActions");
- g_return_if_fail (action_group != NULL
- && popups_action_group != NULL
- && toolbar_action_group != NULL
- && special_toolbar_action_group != NULL);
-
- disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINTING);
- print_setup_disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_PRINT_SETUP) ||
- eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_COMMAND_LINE);
- action = gtk_action_group_get_action (action_group, "FilePrintSetup");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled || print_setup_disabled);
- action = gtk_action_group_get_action (action_group, "FilePrintPreview");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (action_group, "FilePrint");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
-
- writable = eel_gconf_key_is_writable (CONF_WINDOWS_SHOW_TOOLBARS);
- action = gtk_action_group_get_action (action_group, "ViewToolbar");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, !writable);
-
- disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL);
- action = gtk_action_group_get_action (action_group, "GoLocation");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (special_toolbar_action_group, "Location");
- update_location_editable (window, action, !disabled);
- action = gtk_action_group_get_action (special_toolbar_action_group, "NavigationUp");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
-
- disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_HISTORY);
- action = gtk_action_group_get_action (action_group, "GoHistory");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (special_toolbar_action_group, "NavigationBack");
- gtk_action_set_visible (action, !disabled);
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (special_toolbar_action_group, "NavigationForward");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- gtk_action_set_visible (action, !disabled);
-
- disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING);
- action = gtk_action_group_get_action (action_group, "GoBookmarks");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (action_group, "FileBookmarkPage");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (popups_action_group, "BookmarkLink");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
-
- disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_SAVE_TO_DISK);
- action = gtk_action_group_get_action (action_group, "FileSaveAs");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (popups_action_group, "DownloadLink");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (popups_action_group, "DownloadLinkAs");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (popups_action_group, "SaveImageAs");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (popups_action_group, "OpenImage");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- writable = eel_gconf_key_is_writable (CONF_DESKTOP_BG_PICTURE);
- action = gtk_action_group_get_action (popups_action_group, "SetImageAsBackground");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled || !writable);
-
- disabled = eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_TOOLBAR_EDITING);
- action = gtk_action_group_get_action (action_group, "ViewToolbarEditor");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (toolbar_action_group, "MoveToolItem");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (toolbar_action_group, "RemoveToolItem");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
- action = gtk_action_group_get_action (toolbar_action_group, "RemoveToolbar");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, disabled);
-
- fullscreen = eel_gconf_get_boolean (CONF_LOCKDOWN_FULLSCREEN);
- action = gtk_action_group_get_action (special_toolbar_action_group, "FileNewWindow");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, fullscreen);
- action = gtk_action_group_get_action (action_group, "ViewFullscreen");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, fullscreen);
-
- action = gtk_action_group_get_action (action_group, "TabsDetach");
- ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, fullscreen);
-
- if (fullscreen)
- {
+ if (g_settings_get_boolean (settings, key))
gtk_window_fullscreen (GTK_WINDOW (window));
- }
+ else
+ gtk_window_unfullscreen (GTK_WINDOW (window));
}
-static void
-notifier (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyLockdown *lockdown)
-{
- EphyLockdownPrivate *priv = lockdown->priv;
+typedef struct {
+ char *key;
+ char *action;
+ char *prop;
+} BindAction;
- LOG ("Key %s changed", entry->key);
+static const BindAction window_actions[] = {
+ { EPHY_PREFS_LOCKDOWN_PRINTING, "FilePrint", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_PRINTING, "FilePrintPreview", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_PRINTING, "FilePrintSetup", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_PRINT_SETUP, "FilePrintSetup", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_COMMAND_LINE, "FilePrintSetup", "sensitive" },
- g_list_foreach (priv->windows, (GFunc) update_window, lockdown);
-}
+ { EPHY_PREFS_LOCKDOWN_TOOLBAR_EDITING, "ViewToolbarEditor", "sensitive" },
-static void
-ephy_lockdown_init (EphyLockdown *lockdown)
+ { EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING, "GoBookmarks", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING, "FileBookmarkPage", "sensitive" },
+
+ { EPHY_PREFS_LOCKDOWN_ARBITRARY_URL, "GoLocation", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK, "FileSaveAs", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_HISTORY, "GoHistory", "sensitive" },
+
+ { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "ViewFullscreen", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "TabsDetach", "sensitive" }
+};
+
+static const BindAction popup_actions[] = {
+ { EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK, "DownloadLink", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK, "DownloadLinkAs", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK, "SaveImageAs", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK, "OpenImage", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING, "BookmarkLink", "sensitive" }
+};
+
+static const BindAction special_toolbar_actions[] = {
+ { EPHY_PREFS_LOCKDOWN_ARBITRARY_URL, "Location", "editable" },
+ { EPHY_PREFS_LOCKDOWN_ARBITRARY_URL, "NavigationUp", "sensitive" },
+
+ { EPHY_PREFS_LOCKDOWN_HISTORY, "NavigationBack", "visible" },
+ { EPHY_PREFS_LOCKDOWN_HISTORY, "NavigationBack", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_HISTORY, "NavigationForward", "visible" },
+ { EPHY_PREFS_LOCKDOWN_HISTORY, "NavigationForward", "sensitive" },
+
+ { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "FileNewWindow", "sensitive" }
+};
+
+static const BindAction toolbar_actions[] = {
+ { EPHY_PREFS_LOCKDOWN_TOOLBAR_EDITING, "MoveToolItem", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_TOOLBAR_EDITING, "RemoveToolItem", "sensitive" },
+ { EPHY_PREFS_LOCKDOWN_TOOLBAR_EDITING, "RemoveToolbar", "sensitive" }
+};
+
+static gboolean
+sensitive_get_mapping (GValue *value,
+ GVariant *variant,
+ gpointer data)
{
- EphyLockdownPrivate *priv;
- guint i;
+ GtkAction *action;
+ gboolean active, before, after;
- lockdown->priv = priv = EPHY_LOCKDOWN_GET_PRIVATE (lockdown);
+ action = GTK_ACTION (data);
+ active = g_variant_get_boolean (variant);
- LOG ("EphyLockdown initialising");
+ before = gtk_action_get_sensitive (action);
+ ephy_action_change_sensitivity_flags (action, LOCKDOWN_FLAG, active);
+ after = gtk_action_get_sensitive (action);
- for (i = 0; i < G_N_ELEMENTS (keys); i++)
- {
- priv->notifier_id[i] =eel_gconf_notification_add
- (keys[i], (GConfClientNotifyFunc) notifier, lockdown);
- }
- /* We know that no windows are open yet,
- * so we don't need to do notify here.
- */
+ /* Set (GtkAction::sensitive) to the value in GSettings _only if_
+ * the LOCKDOWN_FLAG had some real effect in the GtkAction */
+ g_value_set_boolean (value, (before != after) ? after : before);
- eel_gconf_monitor_add ("/apps/epiphany/lockdown");
- eel_gconf_monitor_add ("/desktop/gnome/lockdown");
+ return TRUE;
}
-G_DEFINE_TYPE_WITH_CODE (EphyLockdown, ephy_lockdown, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (EPHY_TYPE_EXTENSION,
- ephy_lockdown_iface_init))
-
static void
-ephy_lockdown_finalize (GObject *object)
+bind_settings_and_actions (GSettings *settings,
+ GtkActionGroup *action_group,
+ const BindAction *actions,
+ int actions_n)
{
- EphyLockdown *lockdown = EPHY_LOCKDOWN (object);
- EphyLockdownPrivate *priv = lockdown->priv;
- guint i;
+ int i;
- LOG ("EphyLockdown finalising");
+ for (i = 0; i < actions_n; i++)
+ {
+ GtkAction *action;
- eel_gconf_monitor_remove ("/apps/epiphany/lockdown");
- eel_gconf_monitor_remove ("/desktop/gnome/lockdown");
+ action = gtk_action_group_get_action (action_group,
+ actions[i].action);
- for (i = 0; i < G_N_ELEMENTS (keys); i++)
- {
- eel_gconf_notification_remove (priv->notifier_id[i]);
+ if (g_strcmp0 (actions[i].prop, "visible") == 0)
+ {
+ g_settings_bind (settings, actions[i].key,
+ action, actions[i].prop,
+ G_SETTINGS_BIND_GET |
+ G_SETTINGS_BIND_INVERT_BOOLEAN);
+ }
+ else
+ {
+ /* We need a custom get_mapping for 'sensitive'
+ * properties, see usage of
+ * ephy_action_change_sensitivity_flags in
+ * ephy-window.c. */
+ g_settings_bind_with_mapping (settings, actions[i].key,
+ action, actions[i].prop,
+ G_SETTINGS_BIND_GET,
+ sensitive_get_mapping,
+ NULL,
+ action, NULL);
+ }
}
-
- G_OBJECT_CLASS (ephy_lockdown_parent_class)->finalize (object);
}
static void
impl_attach_window (EphyExtension *extension,
EphyWindow *window)
{
- EphyLockdown *lockdown = EPHY_LOCKDOWN (extension);
- EphyLockdownPrivate *priv = lockdown->priv;
+ GtkUIManager *manager;
+ GtkActionGroup *action_group;
+ GtkAction *action;
+ GSettings *settings;
+
+ g_signal_connect (EPHY_SETTINGS_LOCKDOWN,
+ "changed::" EPHY_PREFS_LOCKDOWN_FULLSCREEN,
+ G_CALLBACK (fullscreen_cb), window);
+ g_signal_connect (EPHY_SETTINGS_LOCKDOWN,
+ "changed::" EPHY_PREFS_LOCKDOWN_ARBITRARY_URL,
+ G_CALLBACK (arbitrary_url_cb), window);
+
+ /* Trigger an initial state on these elements. */
+ fullscreen_cb (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_FULLSCREEN, window);
+ arbitrary_url_cb (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_ARBITRARY_URL, window);
+
+ manager = GTK_UI_MANAGER (ephy_window_get_ui_manager (window));
- priv->windows = g_list_prepend (priv->windows, window);
+ action_group = find_action_group (manager, "WindowActions");
+ bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
+ action_group, window_actions,
+ G_N_ELEMENTS (window_actions));
- update_window (window, lockdown);
+ action = gtk_action_group_get_action (action_group, "ViewToolbar");
+ g_settings_bind_writable (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_SHOW_TOOLBARS,
+ action, "sensitive", FALSE);
+
+ action_group = find_action_group (manager, "PopupsActions");
+ bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
+ action_group, popup_actions,
+ G_N_ELEMENTS (popup_actions));
+
+ action = gtk_action_group_get_action (action_group,
+ "SetImageAsBackground");
+ settings = ephy_settings_get ("org.gnome.desktop.background");
+ g_settings_bind_writable (settings, "picture-filename",
+ action, "sensitive", FALSE);
+
+ action_group = find_action_group (manager, "SpecialToolbarActions");
+ bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
+ action_group, special_toolbar_actions,
+ G_N_ELEMENTS (special_toolbar_actions));
+
+ action_group = find_action_group (manager, "ToolbarActions");
+ bind_settings_and_actions (EPHY_SETTINGS_LOCKDOWN,
+ action_group, toolbar_actions,
+ G_N_ELEMENTS (toolbar_actions));
}
static void
-impl_detach_window (EphyExtension *extension,
- EphyWindow *window)
+ephy_lockdown_init (EphyLockdown *lockdown)
{
- EphyLockdown *lockdown = EPHY_LOCKDOWN (extension);
- EphyLockdownPrivate *priv = lockdown->priv;
-
- priv->windows = g_list_remove (priv->windows, window);
-
- /* Since we know that the window closes now, we don't have to
- * undo anything.
- */
+ LOG ("EphyLockdown initialising");
}
+G_DEFINE_TYPE_WITH_CODE (EphyLockdown, ephy_lockdown, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (EPHY_TYPE_EXTENSION,
+ ephy_lockdown_iface_init))
+
static void
ephy_lockdown_iface_init (EphyExtensionIface *iface)
{
iface->attach_window = impl_attach_window;
- iface->detach_window = impl_detach_window;
}
static void
ephy_lockdown_class_init (EphyLockdownClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = ephy_lockdown_finalize;
-
- g_type_class_add_private (object_class, sizeof (EphyLockdownPrivate));
}
-
diff --git a/src/ephy-main.c b/src/ephy-main.c
index dd7b69f55..1f0692884 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -20,13 +20,13 @@
#include "config.h"
+#include "ephy-settings.h"
#include "ephy-shell.h"
#include "ephy-file-helpers.h"
#include "ephy-object-helpers.h"
#include "ephy-state.h"
#include "ephy-debug.h"
#include "ephy-stock-icons.h"
-#include "eel-gconf-extensions.h"
#include "ephy-dbus-client-bindings.h"
#include "ephy-activation.h"
#include "ephy-session.h"
@@ -438,6 +438,7 @@ main (int argc,
DBusGProxy *proxy;
GError *error = NULL;
guint32 user_time;
+ gboolean arbitrary_url;
#ifdef ENABLE_NLS
/* Initialize the i18n stuff */
@@ -572,8 +573,10 @@ main (int argc,
exit (1);
}
- if (arguments != NULL &&
- eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL))
+ arbitrary_url = g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_ARBITRARY_URL);
+
+ if (arguments != NULL && arbitrary_url)
{
g_print ("URL loading is locked down\n");
exit (1);
@@ -718,7 +721,6 @@ main (int argc,
if (ephy_has_private_profile () == FALSE)
_ephy_profile_migrate ();
- eel_gconf_monitor_add ("/apps/epiphany/general");
ephy_stock_icons_init ();
load_accels ();
@@ -745,9 +747,9 @@ main (int argc,
if (notify_is_initted ())
notify_uninit ();
#endif
- eel_gconf_monitor_remove ("/apps/epiphany/general");
save_accels ();
ephy_state_save ();
+ ephy_settings_shutdown ();
ephy_file_helpers_shutdown ();
xmlCleanupParser ();
diff --git a/src/ephy-net-monitor.c b/src/ephy-net-monitor.c
index a6fb56fd9..3c970c1bf 100644
--- a/src/ephy-net-monitor.c
+++ b/src/ephy-net-monitor.c
@@ -21,9 +21,9 @@
#include "ephy-net-monitor.h"
-#include "eel-gconf-extensions.h"
#include "ephy-dbus.h"
#include "ephy-debug.h"
+#include "ephy-settings.h"
#include "ephy-prefs.h"
#include <NetworkManager.h>
@@ -41,7 +41,6 @@ typedef enum
struct _EphyNetMonitorPrivate
{
DBusConnection *bus;
- guint notify_id;
guint active : 1;
NetworkStatus status;
};
@@ -285,31 +284,6 @@ ephy_net_monitor_shutdown (EphyNetMonitor *monitor)
}
static void
-notify_network_managed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyNetMonitor *monitor)
-{
- EphyNetMonitorPrivate *priv = monitor->priv;
- GConfValue *value;
- gboolean active = TRUE;
-
- LOG (CONF_NETWORK_MANAGED " key changed");
-
- g_assert (entry != NULL);
-
- value = gconf_entry_get_value (entry);
- if (value != NULL && value->type == GCONF_VALUE_BOOL)
- {
- active = gconf_value_get_bool (value);
- }
-
- priv->active = active;
-
- g_object_notify (G_OBJECT (monitor), "network-status");
-}
-
-static void
ephy_net_monitor_init (EphyNetMonitor *monitor)
{
EphyNetMonitorPrivate *priv;
@@ -320,12 +294,6 @@ ephy_net_monitor_init (EphyNetMonitor *monitor)
priv->status = NETWORK_UP;
- priv->notify_id = eel_gconf_notification_add
- (CONF_NETWORK_MANAGED,
- (GConfClientNotifyFunc) notify_network_managed_cb,
- monitor);
- eel_gconf_notify (CONF_NETWORK_MANAGED);
-
ephy_net_monitor_startup (monitor);
}
@@ -333,18 +301,11 @@ static void
ephy_net_monitor_dispose (GObject *object)
{
EphyNetMonitor *monitor = EPHY_NET_MONITOR (object);
- EphyNetMonitorPrivate *priv = monitor->priv;
LOG ("EphyNetMonitor finalising");
ephy_net_monitor_shutdown (monitor);
- if (priv->notify_id != 0)
- {
- eel_gconf_notification_remove (priv->notify_id);
- priv->notify_id = 0;
- }
-
G_OBJECT_CLASS (ephy_net_monitor_parent_class)->dispose (object);
}
@@ -401,10 +362,13 @@ gboolean
ephy_net_monitor_get_net_status (EphyNetMonitor *monitor)
{
EphyNetMonitorPrivate *priv;
+ gboolean managed;
g_return_val_if_fail (EPHY_IS_NET_MONITOR (monitor), FALSE);
priv = monitor->priv;
+ managed = g_settings_get_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_MANAGED_NETWORK);
- return !priv->active || priv->status != NETWORK_DOWN;
+ return !managed || priv->status != NETWORK_DOWN;
}
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 73fad2b63..23805d267 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -23,8 +23,8 @@
#include "config.h"
#include "ephy-notebook.h"
-#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-marshal.h"
#include "ephy-file-helpers.h"
#include "ephy-dnd.h"
@@ -371,7 +371,8 @@ notebook_drag_data_received_cb (GtkWidget* widget,
g_signal_stop_emission_by_name (widget, "drag_data_received");
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL)) return;
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_ARBITRARY_URL)) return;
data = gtk_selection_data_get_data (selection_data);
if (gtk_selection_data_get_length (selection_data) <= 0 || data == NULL) return;
@@ -437,17 +438,18 @@ update_tabs_visibility (EphyNotebook *nb,
if (before_inserting) num++;
- show_tabs = (eel_gconf_get_boolean (CONF_ALWAYS_SHOW_TABS_BAR) || num > 1) &&
+ show_tabs = (g_settings_get_boolean (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_ALWAYS_SHOW_TABS_BAR)
+ || num > 1) &&
priv->show_tabs == TRUE;
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (nb), show_tabs);
}
static void
-tabs_visibility_notifier (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyNotebook *nb)
+show_tabs_changed_cb (GSettings *settings,
+ char *key,
+ EphyNotebook *nb)
{
update_tabs_visibility (nb, FALSE);
}
@@ -484,9 +486,9 @@ ephy_notebook_init (EphyNotebook *notebook)
GDK_ACTION_MOVE | GDK_ACTION_COPY);
gtk_drag_dest_add_text_targets (widget);
- priv->tabs_vis_notifier_id = eel_gconf_notification_add
- (CONF_ALWAYS_SHOW_TABS_BAR,
- (GConfClientNotifyFunc)tabs_visibility_notifier, notebook);
+ g_signal_connect (EPHY_SETTINGS_UI,
+ "changed::" EPHY_PREFS_UI_ALWAYS_SHOW_TABS_BAR,
+ G_CALLBACK (show_tabs_changed_cb), notebook);
}
static void
@@ -495,8 +497,6 @@ ephy_notebook_finalize (GObject *object)
EphyNotebook *notebook = EPHY_NOTEBOOK (object);
EphyNotebookPrivate *priv = notebook->priv;
- eel_gconf_notification_remove (priv->tabs_vis_notifier_id);
-
g_list_free (priv->focused_pages);
G_OBJECT_CLASS (ephy_notebook_parent_class)->finalize (object);
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 9adf2dcfd..558793c6f 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -32,11 +32,11 @@
#include "ephy-embed-container.h"
#include "ephy-extension.h"
#include "ephy-file-helpers.h"
-#include "eel-gconf-extensions.h"
#include "ephy-gui.h"
#include "ephy-history-window.h"
#include "ephy-notebook.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-shell.h"
#include "ephy-stock-icons.h"
#include "ephy-window.h"
@@ -1667,14 +1667,18 @@ ephy_session_load (EphySession *session,
if (id && xmlStrEqual ((const xmlChar *) BOOKMARKS_EDITOR_ID, id))
{
- if (!eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING))
+ if (!g_settings_get_boolean
+ (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING))
{
widget = ephy_shell_get_bookmarks_editor (ephy_shell);
}
}
else if (id && xmlStrEqual ((const xmlChar *) HISTORY_WINDOW_ID, id))
{
- if (!eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_HISTORY))
+ if (!g_settings_get_boolean
+ (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_HISTORY))
{
widget = ephy_shell_get_history_window (ephy_shell);
}
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 2d575d092..f15ceda6a 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -30,10 +30,8 @@
#include "ephy-shell.h"
#include "ephy-type-builtins.h"
#include "ephy-embed-container.h"
-#include "ephy-embed-shell.h"
#include "ephy-embed-single.h"
#include "ephy-embed-utils.h"
-#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
#include "ephy-file-helpers.h"
#include "ephy-favicon-cache.h"
@@ -54,6 +52,7 @@
#include "egg-toolbars-model.h"
#include "ephy-toolbars-model.h"
#include "ephy-toolbar.h"
+#include "ephy-settings.h"
#include "ephy-prefs.h"
#include "ephy-gui.h"
#include "ephy-stock-icons.h"
@@ -124,7 +123,8 @@ ephy_shell_new_window_cb (EphyEmbedSingle *single,
LOG ("ephy_shell_new_window_cb tab chrome %d", chromemask);
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_JAVASCRIPT_CHROME))
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_JAVASCRIPT_CHROME))
{
chromemask = EPHY_WEB_VIEW_CHROME_ALL;
}
@@ -368,7 +368,10 @@ ephy_shell_new_tab_full (EphyShell *shell,
if (flags & EPHY_NEW_TAB_IN_EXISTING_WINDOW) in_new_window = FALSE;
if (flags & EPHY_NEW_TAB_DONT_COPY_HISTORY) copy_history = FALSE;
- in_new_window = in_new_window && !eel_gconf_get_boolean (CONF_LOCKDOWN_FULLSCREEN);
+ in_new_window = in_new_window &&
+ !g_settings_get_boolean
+ (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_FULLSCREEN);
g_return_val_if_fail (open_page == (gboolean)(request != NULL), NULL);
jump_to = (flags & EPHY_NEW_TAB_JUMP) != 0;
diff --git a/src/ephy-toolbar-editor.c b/src/ephy-toolbar-editor.c
index 4476e1fbe..2fd49250f 100644
--- a/src/ephy-toolbar-editor.c
+++ b/src/ephy-toolbar-editor.c
@@ -20,19 +20,19 @@
#include "config.h"
-#include "ephy-toolbar-editor.h"
+#include "ephy-debug.h"
#include "ephy-gui.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-state.h"
#include "ephy-file-helpers.h"
#include "ephy-shell.h"
+#include "ephy-stock-icons.h"
+#include "ephy-toolbar-editor.h"
#include "eggtypebuiltins.h"
#include "egg-toolbars-model.h"
#include "egg-editable-toolbar.h"
#include "egg-toolbar-editor.h"
-#include "eel-gconf-extensions.h"
-#include "ephy-stock-icons.h"
-#include "ephy-debug.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@@ -115,7 +115,8 @@ combo_changed_cb (GtkComboBox *combo,
pref = value->value_nick;
}
- eel_gconf_set_string (CONF_INTERFACE_TOOLBAR_STYLE, pref);
+ g_settings_set_string (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_TOOLBAR_STYLE, pref);
g_type_class_unref (flags_class);
}
@@ -240,7 +241,8 @@ ephy_toolbar_editor_constructor (GType type,
gtk_widget_show_all (hbox);
/* get active from pref */
- pref = eel_gconf_get_string (CONF_INTERFACE_TOOLBAR_STYLE);
+ pref = g_settings_get_string (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_TOOLBAR_STYLE);
if (pref != NULL)
{
flags_class = g_type_class_ref (EGG_TYPE_TB_MODEL_FLAGS);
diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c
index a10fc3ada..5dc6cf4b1 100644
--- a/src/ephy-toolbars-model.c
+++ b/src/ephy-toolbars-model.c
@@ -23,7 +23,7 @@
#include "ephy-toolbars-model.h"
#include "ephy-file-helpers.h"
#include "ephy-prefs.h"
-#include "eel-gconf-extensions.h"
+#include "ephy-settings.h"
#include "eggtypebuiltins.h"
#include "ephy-debug.h"
@@ -39,7 +39,6 @@ struct _EphyToolbarsModelPrivate
char *xml_file;
EggTbModelFlags style;
guint timeout;
- guint style_notifier_id;
};
static void ephy_toolbars_model_class_init (EphyToolbarsModelClass *klass);
@@ -118,7 +117,8 @@ get_toolbar_style (void)
EggTbModelFlags flags = 0;
char *pref;
- pref = eel_gconf_get_string (CONF_INTERFACE_TOOLBAR_STYLE);
+ pref = g_settings_get_string (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_TOOLBAR_STYLE);
if (pref != NULL)
{
flags_class = g_type_class_ref (EGG_TYPE_TB_MODEL_FLAGS);
@@ -137,10 +137,9 @@ get_toolbar_style (void)
}
static void
-toolbar_style_notifier (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyToolbarsModel *model)
+toolbar_style_changed_cb (GSettings *settings,
+ char *key,
+ EphyToolbarsModel *model)
{
model->priv->style = get_toolbar_style ();
@@ -233,9 +232,9 @@ ephy_toolbars_model_init (EphyToolbarsModel *model)
NULL);
priv->style = get_toolbar_style ();
- priv->style_notifier_id = eel_gconf_notification_add
- (CONF_INTERFACE_TOOLBAR_STYLE,
- (GConfClientNotifyFunc) toolbar_style_notifier, model);
+ g_signal_connect (EPHY_SETTINGS_UI,
+ "changed::" EPHY_PREFS_UI_TOOLBAR_STYLE,
+ G_CALLBACK (toolbar_style_changed_cb), model);
g_signal_connect_after (model, "item_added",
G_CALLBACK (save_changes), NULL);
@@ -263,11 +262,6 @@ ephy_toolbars_model_finalize (GObject *object)
EphyToolbarsModel *model = EPHY_TOOLBARS_MODEL (object);
EphyToolbarsModelPrivate *priv = model->priv;
- if (priv->style_notifier_id != 0)
- {
- eel_gconf_notification_remove (priv->style_notifier_id);
- }
-
if (priv->timeout != 0)
{
g_source_remove (priv->timeout);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 0f8a666bd..7cd5253e1 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -31,8 +31,8 @@
#include "ephy-embed-single.h"
#include "ephy-embed-utils.h"
#include "ephy-shell.h"
-#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-embed-prefs.h"
#include "ephy-embed-utils.h"
#include "ephy-zoom.h"
@@ -412,8 +412,6 @@ static const struct
#endif /* HAVE_X11_XF86KEYSYM_H */
};
-#define CONF_LOCKDOWN_HIDE_MENUBAR "/apps/epiphany/lockdown/hide_menubar"
-
#define BOOKMARKS_MENU_PATH "/menubar/BookmarksMenu"
#define SETTINGS_CONNECTION_DATA_KEY "EphyWindowSettings"
@@ -446,8 +444,6 @@ struct _EphyWindowPrivate
guint idle_worker;
GtkWidget *entry;
- guint browse_with_caret_notifier_id;
- guint allow_popups_notifier_id;
guint clear_progress_timeout_id;
guint menubar_accel_keyval;
@@ -552,7 +548,8 @@ construct_confirm_close_dialog (EphyWindow *window)
static gboolean
confirm_close_with_modified_forms (EphyWindow *window)
{
- if (eel_gconf_get_boolean (CONF_WARN_ON_CLOSE_UNSUBMITTED_DATA))
+ if (g_settings_get_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_WARN_ON_CLOSE_UNSUBMITTED_DATA))
{
GtkWidget *dialog;
int response;
@@ -817,7 +814,9 @@ ephy_window_fullscreen (EphyWindow *window)
priv->fullscreen_mode = TRUE;
- lockdown_fs = eel_gconf_get_boolean (CONF_LOCKDOWN_FULLSCREEN);
+ lockdown_fs = g_settings_get_boolean
+ (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_FULLSCREEN);
popup = ephy_fullscreen_popup_new (window);
ephy_fullscreen_popup_set_show_leave
@@ -975,7 +974,8 @@ ephy_window_key_press_event (GtkWidget *widget,
}
/* Don't activate menubar in lockdown mode */
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_HIDE_MENUBAR))
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_MENUBAR))
{
return GTK_WIDGET_CLASS (ephy_window_parent_class)->key_press_event (widget, event);
}
@@ -1014,7 +1014,8 @@ ephy_window_delete_event (GtkWidget *widget,
/* We ignore the delete_event if the disable_quit lockdown has been set
*/
- if (eel_gconf_get_boolean("/apps/epiphany/lockdown/disable_quit")) return TRUE;
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_QUIT)) return TRUE;
tabs = impl_get_children (EPHY_EMBED_CONTAINER (window));
for (l = tabs; l != NULL; l = l->next)
@@ -1080,7 +1081,9 @@ update_popup_actions_visibility (EphyWindow *window,
action = gtk_action_group_get_action (action_group, "OpenFrame");
gtk_action_set_visible (action, is_frame);
- inspector_enabled = eel_gconf_get_boolean (CONF_WEB_INSPECTOR_ENABLED);
+ inspector_enabled = g_settings_get_boolean
+ (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLE_WEB_INSPECTOR);
action = gtk_action_group_get_action (action_group, "InspectElement");
gtk_action_set_visible (action, inspector_enabled);
}
@@ -2251,8 +2254,11 @@ ephy_window_dom_mouse_click_cb (WebKitWebView *view,
is_middle_click = (button == 2);
middle_click_opens =
- eel_gconf_get_boolean (CONF_INTERFACE_MIDDLE_CLICK_OPEN_URL) &&
- !eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_ARBITRARY_URL);
+ g_settings_get_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_MIDDLE_CLICK_OPENS_URL) &&
+ !g_settings_get_boolean
+ (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_ARBITRARY_URL);
is_link = (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK) != 0;
is_image = (context & WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE) != 0;
@@ -2400,7 +2406,8 @@ create_web_view_cb (WebKitWebView *web_view,
EphyNewTabFlags flags;
EphyWindow *parent_window;
- if (eel_gconf_get_boolean (CONF_INTERFACE_OPEN_NEW_WINDOWS_IN_TAB))
+ if (g_settings_get_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_NEW_WINDOWS_IN_TABS))
{
parent_window = window;
flags = EPHY_NEW_TAB_IN_EXISTING_WINDOW |
@@ -2973,7 +2980,8 @@ notebook_page_close_request_cb (EphyNotebook *notebook,
{
EphyWindowPrivate *priv = window->priv;
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_QUIT) &&
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_QUIT) &&
gtk_notebook_get_n_pages (priv->notebook) == 1)
{
return;
@@ -3045,12 +3053,14 @@ ephy_window_set_chrome (EphyWindow *window, EphyWebViewChrome mask)
window->priv->should_save_chrome = TRUE;
}
- if (!eel_gconf_get_boolean (CONF_WINDOWS_SHOW_TOOLBARS))
+ if (!g_settings_get_boolean (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_SHOW_TOOLBARS))
{
chrome_mask &= ~EPHY_WEB_VIEW_CHROME_TOOLBAR;
}
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_HIDE_MENUBAR))
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_MENUBAR))
{
chrome_mask &= ~EPHY_WEB_VIEW_CHROME_MENUBAR;
}
@@ -3089,11 +3099,6 @@ ephy_window_dispose (GObject *object)
g_signal_handlers_disconnect_by_func
(single, G_CALLBACK (sync_network_status), window);
- eel_gconf_notification_remove (priv->browse_with_caret_notifier_id);
- eel_gconf_notification_remove (priv->allow_popups_notifier_id);
- priv->browse_with_caret_notifier_id = 0;
- priv->allow_popups_notifier_id = 0;
-
if (priv->idle_resize_handler != 0)
{
g_source_remove (priv->idle_resize_handler);
@@ -3282,24 +3287,8 @@ ephy_window_class_init (EphyWindowClass *klass)
}
static void
-browse_with_caret_notifier (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- EphyWindow *window)
-{
- GtkAction *action;
- gboolean enabled;
-
- enabled = eel_gconf_get_boolean (CONF_CARET_BROWSING_ENABLED);
- action = gtk_action_group_get_action (window->priv->action_group,
- "BrowseWithCaret");
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), enabled);
-}
-
-static void
-allow_popups_notifier (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
+allow_popups_notifier (GSettings *settings,
+ char *key,
EphyWindow *window)
{
GList *tabs;
@@ -3539,14 +3528,17 @@ ephy_window_constructor (GType type,
(EGG_EDITABLE_TOOLBAR (priv->toolbar), model);
/* other notifiers */
- browse_with_caret_notifier (NULL, 0, NULL, window);
- priv->browse_with_caret_notifier_id = eel_gconf_notification_add
- (CONF_CARET_BROWSING_ENABLED,
- (GConfClientNotifyFunc)browse_with_caret_notifier, window);
+ action = gtk_action_group_get_action (window->priv->action_group,
+ "BrowseWithCaret");
+
+ g_settings_bind (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLE_CARET_BROWSING,
+ action, "active",
+ G_SETTINGS_BIND_GET);
- priv->allow_popups_notifier_id = eel_gconf_notification_add
- (CONF_SECURITY_ALLOW_POPUPS,
- (GConfClientNotifyFunc)allow_popups_notifier, window);
+ g_signal_connect (EPHY_SETTINGS_WEB,
+ "changed::" EPHY_PREFS_WEB_ENABLE_POPUPS,
+ G_CALLBACK (allow_popups_notifier), window);
/* network status */
single = EPHY_EMBED_SINGLE (ephy_embed_shell_get_embed_single (embed_shell));
@@ -3850,8 +3842,9 @@ sync_prefs_with_chrome (EphyWindow *window)
if (window->priv->should_save_chrome)
{
- eel_gconf_set_boolean (CONF_WINDOWS_SHOW_TOOLBARS,
- flags & EPHY_WEB_VIEW_CHROME_TOOLBAR);
+ g_settings_set_boolean (EPHY_SETTINGS_UI,
+ EPHY_PREFS_UI_SHOW_TOOLBARS,
+ flags & EPHY_WEB_VIEW_CHROME_TOOLBAR);
}
}
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index aae26c0a6..1b3e94ca1 100644
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -67,7 +67,7 @@ struct PdmActionInfo
GtkTreeView *treeview;
GtkTreeSelection *selection;
GtkTreeModel *model;
- int remove_id;
+ const char *remove_id;
int data_col;
char *scroll_to_host;
gboolean filled;
@@ -115,37 +115,9 @@ enum
enum
{
- PROP_WINDOW,
- PROP_NOTEBOOK,
- PROP_COOKIES_TREEVIEW,
- PROP_COOKIES_REMOVE,
- PROP_COOKIES_PROPERTIES,
- PROP_PASSWORDS_TREEVIEW,
- PROP_PASSWORDS_REMOVE,
- PROP_PASSWORDS_SHOW
-};
-
-enum
-{
PDM_DIALOG_RESPONSE_CLEAR = 1
};
-static const
-EphyDialogProperty properties [] =
-{
- { "pdm_dialog", NULL, PT_NORMAL, 0 },
- { "pdm_notebook", NULL, PT_NORMAL, 0 },
-
- { "cookies_treeview", NULL, PT_NORMAL, 0 },
- { "cookies_remove_button", NULL, PT_NORMAL, 0 },
- { "cookies_properties_button", NULL, PT_NORMAL, 0 },
- { "passwords_treeview", NULL, PT_NORMAL, 0 },
- { "passwords_remove_button", NULL, PT_NORMAL, 0 },
- { "passwords_show_button", NULL, PT_NORMAL, 0 },
-
- { NULL }
-};
-
static void pdm_dialog_class_init (PdmDialogClass *klass);
static void pdm_dialog_init (PdmDialog *dialog);
static void pdm_dialog_finalize (GObject *object);
@@ -174,11 +146,10 @@ pdm_dialog_show_help (PdmDialog *pd)
"managing-passwords"
};
- ephy_dialog_get_controls
- (EPHY_DIALOG (pd),
- properties[PROP_WINDOW].id, &window,
- properties[PROP_NOTEBOOK].id, &notebook,
- NULL);
+ ephy_dialog_get_controls (EPHY_DIALOG (pd),
+ "pdm_dialog", &window,
+ "pdm_notebook", &notebook,
+ NULL);
id = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
g_return_if_fail (id == 0 || id == 1);
@@ -488,7 +459,7 @@ action_treeview_selection_changed_cb (GtkTreeSelection *selection,
has_selection = gtk_tree_selection_count_selected_rows (selection) > 0;
- widget = ephy_dialog_get_control (d, properties[action->remove_id].id);
+ widget = ephy_dialog_get_control (d, action->remove_id);
gtk_widget_set_sensitive (widget, has_selection);
}
@@ -616,7 +587,7 @@ setup_action (PdmActionInfo *action)
GtkTreeSelection *selection;
widget = ephy_dialog_get_control (EPHY_DIALOG(action->dialog),
- properties[action->remove_id].id);
+ action->remove_id);
g_signal_connect (widget, "clicked",
G_CALLBACK (pdm_dialog_remove_button_clicked_cb),
action);
@@ -645,8 +616,7 @@ show_cookies_properties (PdmDialog *dialog,
GtkWidget *content_area;
char *str;
- parent = ephy_dialog_get_control (EPHY_DIALOG(dialog),
- properties[PROP_WINDOW].id);
+ parent = ephy_dialog_get_control (EPHY_DIALOG(dialog), "pdm_dialog");
gdialog = gtk_dialog_new_with_buttons
(_("Cookie Properties"),
@@ -791,7 +761,7 @@ cookies_treeview_selection_changed_cb (GtkTreeSelection *selection,
has_selection = gtk_tree_selection_count_selected_rows (selection) == 1;
- widget = ephy_dialog_get_control (d, properties[PROP_COOKIES_PROPERTIES].id);
+ widget = ephy_dialog_get_control (d, "cookies_properties_button");
gtk_widget_set_sensitive (widget, has_selection);
}
@@ -828,8 +798,8 @@ pdm_dialog_cookies_construct (PdmActionInfo *info)
LOG ("pdm_dialog_cookies_construct");
ephy_dialog_get_controls (EPHY_DIALOG (dialog),
- properties[PROP_COOKIES_TREEVIEW].id, &treeview,
- properties[PROP_COOKIES_PROPERTIES].id, &button,
+ "cookies_treeview", &treeview,
+ "cookies_properties_button", &button,
NULL);
g_signal_connect (button, "clicked",
@@ -1234,8 +1204,8 @@ passwords_show_toggled_cb (GtkWidget *button,
GtkTreeViewColumn *column;
gboolean active;
- treeview = GTK_TREE_VIEW (ephy_dialog_get_control
- (EPHY_DIALOG(dialog), properties[PROP_PASSWORDS_TREEVIEW].id));
+ treeview = GTK_TREE_VIEW (ephy_dialog_get_control (EPHY_DIALOG(dialog),
+ "passwords_treeview"));
column = gtk_tree_view_get_column (treeview, COL_PASSWORDS_PASSWORD);
active = gtk_toggle_button_get_active ((GTK_TOGGLE_BUTTON (button)));
@@ -1257,8 +1227,8 @@ pdm_dialog_passwords_construct (PdmActionInfo *info)
LOG ("pdm_dialog_passwords_construct");
ephy_dialog_get_controls (EPHY_DIALOG (dialog),
- properties[PROP_PASSWORDS_TREEVIEW].id, &treeview,
- properties[PROP_PASSWORDS_SHOW].id, &button,
+ "passwords_treeview", &treeview,
+ "passwords_show_button", &button,
NULL);
g_signal_connect (button, "toggled",
@@ -1521,7 +1491,7 @@ pdm_dialog_response_cb (GtkDialog *widget,
GtkWidget *parent;
parent = ephy_dialog_get_control (EPHY_DIALOG (dialog),
- properties[PROP_WINDOW].id);
+ "pdm_dialog");
page = gtk_notebook_get_current_page (GTK_NOTEBOOK (dialog->priv->notebook));
if (page == 0)
@@ -1554,14 +1524,13 @@ pdm_dialog_init (PdmDialog *dialog)
priv = dialog->priv = EPHY_PDM_DIALOG_GET_PRIVATE (dialog);
ephy_dialog_construct (EPHY_DIALOG(dialog),
- properties,
ephy_file ("epiphany.ui"),
"pdm_dialog",
NULL);
ephy_dialog_get_controls (EPHY_DIALOG (dialog),
- properties[PROP_WINDOW].id, &window,
- properties[PROP_NOTEBOOK].id, &priv->notebook,
+ "pdm_dialog", &window,
+ "pdm_notebook", &priv->notebook,
NULL);
ephy_gui_ensure_window_group (GTK_WINDOW (window));
@@ -1576,9 +1545,9 @@ pdm_dialog_init (PdmDialog *dialog)
* one set of buttons is wider than another.
*/
ephy_dialog_set_size_group (EPHY_DIALOG (dialog),
- properties[PROP_COOKIES_REMOVE].id,
- properties[PROP_COOKIES_PROPERTIES].id,
- properties[PROP_PASSWORDS_REMOVE].id,
+ "cookies_remove_button",
+ "cookies_properties_button",
+ "passwords_remove_button",
NULL);
cookies = g_new0 (PdmActionInfo, 1);
@@ -1589,7 +1558,7 @@ pdm_dialog_init (PdmDialog *dialog)
cookies->remove = pdm_dialog_cookie_remove;
cookies->scroll_to = pdm_dialog_cookie_scroll_to;
cookies->dialog = dialog;
- cookies->remove_id = PROP_COOKIES_REMOVE;
+ cookies->remove_id = "cookies_remove_button";
cookies->data_col = COL_COOKIES_DATA;
cookies->scroll_to_host = NULL;
cookies->filled = FALSE;
@@ -1603,7 +1572,7 @@ pdm_dialog_init (PdmDialog *dialog)
passwords->add = pdm_dialog_password_add;
passwords->remove = pdm_dialog_password_remove;
passwords->dialog = dialog;
- passwords->remove_id = PROP_PASSWORDS_REMOVE;
+ passwords->remove_id = "passwords_remove_button";
passwords->data_col = COL_PASSWORDS_DATA;
passwords->scroll_to_host = NULL;
passwords->filled = FALSE;
diff --git a/src/popup-commands.c b/src/popup-commands.c
index c90dcf0fc..4db684ea7 100644
--- a/src/popup-commands.c
+++ b/src/popup-commands.c
@@ -234,7 +234,7 @@ save_property_url (GtkAction *action,
(persist, EPHY_EMBED_PERSIST_FROM_CACHE |
(ask_dest ? EPHY_EMBED_PERSIST_ASK_DESTINATION : 0));
ephy_embed_persist_set_persist_key
- (persist, CONF_STATE_SAVE_DIR);
+ (persist, EPHY_PREFS_STATE_SAVE_DIR);
ephy_embed_persist_set_source (persist, location);
ephy_embed_persist_set_embed (persist, embed);
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 437a88b10..b1dcc7165 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -2,6 +2,7 @@
/*
* Copyright © 200-2003 Marco Pesenti Gritti
* Copyright © 2003, 2004, 2005 Christian Persch
+ * Copyright © 2010 Igalia S.L.
*
* 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
@@ -24,6 +25,7 @@
#include "prefs-dialog.h"
#include "ephy-dialog.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-embed-container.h"
#include "ephy-embed-shell.h"
#include "ephy-embed-utils.h"
@@ -33,7 +35,6 @@
#include "ephy-embed-single.h"
#include "ephy-shell.h"
#include "ephy-gui.h"
-#include "eel-gconf-extensions.h"
#include "ephy-langs.h"
#include "ephy-encodings.h"
#include "ephy-debug.h"
@@ -54,115 +55,6 @@ static void prefs_dialog_init (PrefsDialog *pd);
#include "languages.h"
-static const char * const cookies_accept_enum [] =
-{
- "anywhere", "current site", "nowhere"
-};
-
-enum
-{
- WINDOW_PROP,
- NOTEBOOK_PROP,
-
- /* General */
- HOMEPAGE_ENTRY_PROP,
- HOMEPAGE_CURRENT_PROP,
- HOMEPAGE_BLANK_PROP,
- AUTO_OPEN_PROP,
- DOWNLOAD_PATH_HBOX_PROP,
- DOWNLOAD_PATH_LABEL_PROP,
- WEB_INSPECTOR_BUTTON_PROP,
-
- /* Fonts and Colors */
- USE_FONTS_PROP,
- MIN_SIZE_PROP,
- USE_COLORS_PROP,
- CSS_CONTAINER_PROP,
- CSS_CHECKBOX_PROP,
- CSS_EDIT_BOX_PROP,
- CSS_EDIT_BUTTON_PROP,
-
- /* Privacy */
- ALLOW_POPUPS_PROP,
- ALLOW_JAVA_PROP,
- ALLOW_JS_PROP,
- ACCEPT_COOKIES_PROP,
- REMEMBER_PASSWORDS_PROP,
- DISK_CACHE_PROP,
- CLEAR_CACHE_BUTTON_PROP,
-
- /* Language */
- DEFAULT_ENCODING_PROP,
- DEFAULT_ENCODING_LABEL_PROP,
- LANGUAGE_ADD_BUTTON_PROP,
- LANGUAGE_REMOVE_BUTTON_PROP,
- LANGUAGE_UP_BUTTON_PROP,
- LANGUAGE_DOWN_BUTTON_PROP,
- LANGUAGE_TREEVIEW_PROP
-};
-
-static const
-EphyDialogProperty properties [] =
-{
- { "prefs_dialog", NULL, PT_NORMAL, 0},
- { "prefs_notebook", NULL, PT_NORMAL, 0},
-
- /* General */
- { "homepage_entry", CONF_GENERAL_HOMEPAGE, PT_AUTOAPPLY, G_TYPE_STRING },
- { "homepage_current_button", NULL, PT_NORMAL, 0 },
- { "homepage_blank_button", NULL, PT_NORMAL, 0 },
- { "automatic_downloads_checkbutton", CONF_AUTO_DOWNLOADS, PT_AUTOAPPLY, 0 },
- { "download_button_hbox", NULL, PT_NORMAL, 0 },
- { "download_button_label", NULL, PT_NORMAL, 0 },
- { "web_inspector_checkbutton", CONF_WEB_INSPECTOR_ENABLED, PT_AUTOAPPLY, 0 },
-
- /* Fonts and Colors */
- { "use_fonts_checkbutton", CONF_RENDERING_USE_OWN_FONTS, PT_AUTOAPPLY | PT_INVERTED, 0 },
- { "min_size_spinbutton", CONF_RENDERING_FONT_MIN_SIZE, PT_AUTOAPPLY, 0 },
- { "use_colors_checkbutton", CONF_RENDERING_USE_OWN_COLORS, PT_AUTOAPPLY | PT_INVERTED, 0 },
- { "css_container", NULL, PT_NORMAL, 0 },
- { "css_checkbox", CONF_USER_CSS_ENABLED, PT_AUTOAPPLY, 0 },
- { "css_edit_box", NULL, PT_NORMAL, 0 },
- { "css_edit_button", NULL, PT_NORMAL, 0 },
-
- /* Privacy */
- { "popups_allow_checkbutton", CONF_SECURITY_ALLOW_POPUPS, PT_AUTOAPPLY, 0 },
- { "enable_plugins_checkbutton", CONF_SECURITY_PLUGINS_ENABLED, PT_AUTOAPPLY, 0 },
- { "enable_javascript_checkbutton", CONF_SECURITY_JAVASCRIPT_ENABLED, PT_AUTOAPPLY, 0 },
- { "cookies_radiobutton", CONF_SECURITY_COOKIES_ACCEPT, PT_AUTOAPPLY, G_TYPE_STRING },
- { "remember_passwords_checkbutton", CONF_PRIVACY_REMEMBER_PASSWORDS, PT_AUTOAPPLY, 0 },
- { "disk_cache_spin", CONF_NETWORK_CACHE_SIZE, PT_AUTOAPPLY, 0 },
- { "clear_cache_button", NULL, PT_NORMAL, 0 },
-
- /* Languages */
- { "default_encoding_combo", CONF_LANGUAGE_DEFAULT_ENCODING, PT_AUTOAPPLY, G_TYPE_STRING },
- { "default_encoding_label", NULL, PT_NORMAL, 0 },
- { "lang_add_button", NULL, PT_NORMAL, 0 },
- { "lang_remove_button", NULL, PT_NORMAL, 0 },
- { "lang_up_button", NULL, PT_NORMAL, 0 },
- { "lang_down_button", NULL, PT_NORMAL, 0 },
- { "lang_treeview", NULL, PT_NORMAL, 0 },
-
- { NULL }
-};
-
-enum
-{
- LANGUAGE_DIALOG,
- LANGUAGE_PROP,
- LANGUAGE_ACCEPT_BUTTON_PROP
-};
-
-static const
-EphyDialogProperty add_lang_props [] =
-{
- { "add_language_dialog", NULL, PT_NORMAL, 0 },
- { "languages_treeview", NULL, PT_NORMAL, G_TYPE_STRING },
- { "add_button", NULL, PT_NORMAL, 0 },
-
- { NULL }
-};
-
enum
{
COL_LANG_NAME,
@@ -232,8 +124,8 @@ prefs_dialog_show_help (EphyDialog *dialog)
};
ephy_dialog_get_controls (dialog,
- properties[WINDOW_PROP].id, &window,
- properties[NOTEBOOK_PROP].id, &notebook,
+ "prefs_dialog", &window,
+ "prefs_notebook", &notebook,
NULL);
id = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
@@ -243,13 +135,6 @@ prefs_dialog_show_help (EphyDialog *dialog)
}
static void
-css_checkbox_toggled (GtkToggleButton *button,
- GtkWidget *widget)
-{
- g_object_set (widget, "sensitive", gtk_toggle_button_get_active (button), NULL);
-}
-
-static void
css_edit_button_clicked_cb (GtkWidget *button,
PrefsDialog *pd)
{
@@ -264,12 +149,73 @@ css_edit_button_clicked_cb (GtkWidget *button,
g_object_unref (css_file);
}
+static gboolean
+combo_get_mapping (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean valid = FALSE;
+ const char *settings_name;
+ int i;
+
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (user_data));
+ valid = gtk_tree_model_get_iter_first (model, &iter);
+ settings_name = g_variant_get_string (variant, NULL);
+ i = 0;
+
+ while (valid)
+ {
+ char *item_name;
+ gtk_tree_model_get (model, &iter, 1, &item_name, -1);
+
+ if (g_strcmp0 (item_name, settings_name) == 0)
+ {
+ g_value_set_int (value, i);
+ break;
+ }
+
+ i++;
+ valid = gtk_tree_model_iter_next (model, &iter);
+ g_free (item_name);
+ }
+
+ return TRUE;
+}
+
+static GVariant *
+combo_set_mapping (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GVariant *variant = NULL;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gboolean valid = FALSE;
+ int n;
+
+ n = g_value_get_int (value);
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (user_data));
+ valid = gtk_tree_model_iter_nth_child (model, &iter, NULL, n);
+
+ if (valid)
+ {
+ char *item_name;
+ gtk_tree_model_get (model, &iter, 1, &item_name, -1);
+
+ variant = g_variant_new_string (item_name);
+
+ g_free (item_name);
+ }
+
+ return variant;
+}
+
static void
create_node_combo (EphyDialog *dialog,
- int prop,
EphyEncodings *encodings,
EphyNode *node,
- const char *key,
const char *default_value)
{
EphyTreeModelNode *nodemodel;
@@ -279,15 +225,19 @@ create_node_combo (EphyDialog *dialog,
char *code;
int title_col, data_col;
- code = eel_gconf_get_string (key);
+ code = g_settings_get_string (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_DEFAULT_ENCODING);
if (code == NULL || ephy_encodings_get_node (encodings, code, FALSE) == NULL)
{
/* safe default */
- eel_gconf_set_string (key, default_value);
+ g_settings_set_string (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_DEFAULT_ENCODING,
+ default_value);
}
g_free (code);
- combo = GTK_COMBO_BOX (ephy_dialog_get_control (dialog, properties[prop].id));
+ combo = GTK_COMBO_BOX (ephy_dialog_get_control (dialog,
+ "default_encoding_combo"));
nodemodel = ephy_tree_model_node_new (node);
@@ -309,7 +259,14 @@ create_node_combo (EphyDialog *dialog,
"text", title_col,
NULL);
- ephy_dialog_set_data_column (dialog, properties[prop].id, data_col);
+ g_settings_bind_with_mapping (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_DEFAULT_ENCODING,
+ combo, "active",
+ G_SETTINGS_BIND_DEFAULT,
+ combo_get_mapping,
+ combo_set_mapping,
+ combo,
+ NULL);
g_object_unref (nodemodel);
g_object_unref (sortmodel);
@@ -358,10 +315,12 @@ static void
language_editor_update_pref (PrefsDialog *pd)
{
GtkTreeIter iter;
- GSList *codes = NULL;
+ GVariantBuilder builder;
if (gtk_tree_model_get_iter_first (pd->priv->lang_model, &iter))
{
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY);
+
do
{
char *code;
@@ -369,17 +328,15 @@ language_editor_update_pref (PrefsDialog *pd)
gtk_tree_model_get (pd->priv->lang_model, &iter,
COL_LANG_CODE, &code,
-1);
-
- codes = g_slist_prepend (codes, code);
+ g_variant_builder_add (&builder, "s", code);
+ g_free (code);
}
while (gtk_tree_model_iter_next (pd->priv->lang_model, &iter));
- }
- codes = g_slist_reverse (codes);
- eel_gconf_set_string_list (CONF_RENDERING_LANGUAGE, codes);
-
- g_slist_foreach (codes, (GFunc) g_free, NULL);
- g_slist_free (codes);
+ g_settings_set (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_LANGUAGE,
+ "as", &builder);
+ }
}
static void
@@ -420,7 +377,7 @@ add_lang_dialog_selection_changed (GtkTreeSelection *selection,
GtkWidget *button;
int n_selected;
- button = ephy_dialog_get_control (dialog, add_lang_props[LANGUAGE_ACCEPT_BUTTON_PROP].id);
+ button = ephy_dialog_get_control (dialog, "add_button");
n_selected = gtk_tree_selection_count_selected_rows (selection);
gtk_widget_set_sensitive (button, n_selected > 0);
@@ -443,7 +400,7 @@ add_lang_dialog_response_cb (GtkWidget *widget,
if (response == GTK_RESPONSE_ACCEPT)
{
treeview = GTK_TREE_VIEW (ephy_dialog_get_control
- (dialog, add_lang_props[LANGUAGE_PROP].id));
+ (dialog, "languages_treeview"));
selection = gtk_tree_view_get_selection (treeview);
rows = gtk_tree_selection_get_selected_rows (selection, &model);
@@ -572,7 +529,7 @@ setup_add_language_dialog (PrefsDialog *pd)
GtkTreeIter iter;
int i;
- parent = ephy_dialog_get_control (EPHY_DIALOG (pd), properties[WINDOW_PROP].id);
+ parent = ephy_dialog_get_control (EPHY_DIALOG (pd), "prefs_dialog");
dialog = EPHY_DIALOG (g_object_new (EPHY_TYPE_DIALOG,
"parent-window", parent,
@@ -581,7 +538,6 @@ setup_add_language_dialog (PrefsDialog *pd)
NULL));
ephy_dialog_construct (dialog,
- add_lang_props,
ephy_file ("prefs-dialog.ui"),
"add_language_dialog",
NULL);
@@ -610,8 +566,8 @@ setup_add_language_dialog (PrefsDialog *pd)
(GTK_TREE_SORTABLE (sortmodel), COL_LANG_NAME, GTK_SORT_ASCENDING);
ephy_dialog_get_controls (dialog,
- add_lang_props[LANGUAGE_PROP].id, &treeview,
- add_lang_props[LANGUAGE_DIALOG].id, &window,
+ "languages_treeview", &treeview,
+ "add_language_dialog", &window,
NULL);
gtk_window_group_add_window (gtk_window_get_group (GTK_WINDOW (parent)),
@@ -776,18 +732,19 @@ create_language_section (EphyDialog *dialog)
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
- GSList *list, *l, *ulist = NULL;
+ char **list = NULL;
+ int i;
pd->priv->iso_639_table = ephy_langs_iso_639_table ();
pd->priv->iso_3166_table = ephy_langs_iso_3166_table ();
ephy_dialog_get_controls
(dialog,
- properties[LANGUAGE_TREEVIEW_PROP].id, &treeview,
- properties[LANGUAGE_ADD_BUTTON_PROP].id, &pd->priv->lang_add_button,
- properties[LANGUAGE_REMOVE_BUTTON_PROP].id, &pd->priv->lang_remove_button,
- properties[LANGUAGE_UP_BUTTON_PROP].id, &pd->priv->lang_up_button,
- properties[LANGUAGE_DOWN_BUTTON_PROP].id, &pd->priv->lang_down_button,
+ "lang_treeview", &treeview,
+ "lang_add_button", &pd->priv->lang_add_button,
+ "lang_remove_button", &pd->priv->lang_remove_button,
+ "lang_up_button", &pd->priv->lang_up_button,
+ "lang_down_button", &pd->priv->lang_down_button,
NULL);
g_signal_connect (pd->priv->lang_add_button, "clicked",
@@ -802,16 +759,13 @@ create_language_section (EphyDialog *dialog)
/* setup the languages treeview */
pd->priv->lang_treeview = treeview;
- gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview), TRUE);
+ gtk_tree_view_set_reorderable (treeview, TRUE);
+ gtk_tree_view_set_headers_visible (treeview, FALSE);
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
pd->priv->lang_model = GTK_TREE_MODEL (store);
-
gtk_tree_view_set_model (treeview, pd->priv->lang_model);
- g_object_unref (store);
-
- gtk_tree_view_set_headers_visible (treeview, FALSE);
renderer = gtk_cell_renderer_text_new ();
@@ -833,28 +787,13 @@ create_language_section (EphyDialog *dialog)
g_signal_connect (G_OBJECT (selection), "changed",
G_CALLBACK (language_editor_selection_changed_cb), pd);
- list = eel_gconf_get_string_list (CONF_RENDERING_LANGUAGE);
-
- /* uniquify list */
- for (l = list; l != NULL; l = l->next)
- {
- if (g_slist_find_custom (ulist, l->data, (GCompareFunc) strcmp) == NULL)
- {
- ulist = g_slist_prepend (ulist, g_strdup (l->data));
- }
- }
- ulist = g_slist_reverse (ulist);
-
- /* if modified, write back */
- if (g_slist_length (ulist) != g_slist_length (list))
- {
- eel_gconf_set_string_list (CONF_RENDERING_LANGUAGE, ulist);
- }
+ list = g_settings_get_strv (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_LANGUAGE);
/* Fill languages editor */
- for (l = ulist; l != NULL; l = l->next)
+ for (i = 0; list[i]; i++)
{
- const char *code = (const char *) l->data;
+ const char *code = (const char *) list[i];
if (strcmp (code, "system") == 0)
{
@@ -869,24 +808,27 @@ create_language_section (EphyDialog *dialog)
g_free (text);
}
}
+ g_object_unref (store);
language_editor_update_buttons (pd);
+ g_strfreev (list);
/* Lockdown if key is not writable */
- if (eel_gconf_key_is_writable (CONF_RENDERING_LANGUAGE) == FALSE)
- {
- gtk_widget_set_sensitive (pd->priv->lang_add_button, FALSE);
- gtk_widget_set_sensitive (pd->priv->lang_remove_button, FALSE);
- gtk_widget_set_sensitive (pd->priv->lang_up_button, FALSE);
- gtk_widget_set_sensitive (pd->priv->lang_down_button, FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (pd->priv->lang_treeview), FALSE);
- }
-
- g_slist_foreach (list, (GFunc) g_free, NULL);
- g_slist_free (list);
-
- g_slist_foreach (ulist, (GFunc) g_free, NULL);
- g_slist_free (ulist);
+ g_settings_bind_writable (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_LANGUAGE,
+ pd->priv->lang_add_button, "sensitive", FALSE);
+ g_settings_bind_writable (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_LANGUAGE,
+ pd->priv->lang_remove_button, "sensitive", FALSE);
+ g_settings_bind_writable (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_LANGUAGE,
+ pd->priv->lang_up_button, "sensitive", FALSE);
+ g_settings_bind_writable (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_LANGUAGE,
+ pd->priv->lang_down_button, "sensitive", FALSE);
+ g_settings_bind_writable (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_LANGUAGE,
+ pd->priv->lang_treeview, "sensitive", FALSE);
}
static void
@@ -909,15 +851,20 @@ download_path_changed_cb (GtkFileChooser *button)
* two ephy_file_ functions. */
if (strcmp (dir, downloads_dir) == 0)
{
- eel_gconf_set_string (CONF_STATE_DOWNLOAD_DIR, _("Downloads"));
+ g_settings_set_string (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_DOWNLOAD_DIR,
+ _("Downloads"));
}
else if (strcmp (dir, desktop_dir) == 0)
{
- eel_gconf_set_string (CONF_STATE_DOWNLOAD_DIR, _("Desktop"));
+ g_settings_set_string (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_DOWNLOAD_DIR,
+ _("Desktop"));
}
else
{
- eel_gconf_set_path (CONF_STATE_DOWNLOAD_DIR, dir);
+ g_settings_set_string (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_DOWNLOAD_DIR, dir);
}
g_free (dir);
@@ -935,9 +882,9 @@ create_download_path_button (EphyDialog *dialog)
dir = ephy_file_get_downloads_dir ();
ephy_dialog_get_controls (dialog,
- properties[DOWNLOAD_PATH_HBOX_PROP].id, &hbox,
- properties[DOWNLOAD_PATH_LABEL_PROP].id, &label,
- properties[WINDOW_PROP].id, &parent,
+ "download_button_hbox", &hbox,
+ "download_button_label", &label,
+ "prefs_dialog", &parent,
NULL);
fc = ephy_file_chooser_new (_("Select a Directory"),
@@ -945,7 +892,8 @@ create_download_path_button (EphyDialog *dialog)
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
NULL, EPHY_FILE_FILTER_NONE);
- /* Unset the destroy-with-parent, since gtkfilechooserbutton doesn't expect this */
+ /* Unset the destroy-with-parent, since gtkfilechooserbutton doesn't
+ * expect this */
gtk_window_set_destroy_with_parent (GTK_WINDOW (fc), FALSE);
button = gtk_file_chooser_button_new_with_dialog (GTK_WIDGET (fc));
@@ -958,7 +906,9 @@ create_download_path_button (EphyDialog *dialog)
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_widget_show (button);
- gtk_widget_set_sensitive (button, eel_gconf_key_is_writable (CONF_STATE_DOWNLOAD_DIR));
+ g_settings_bind_writable (EPHY_SETTINGS_STATE,
+ EPHY_PREFS_STATE_DOWNLOAD_DIR,
+ button, "sensitive", FALSE);
g_free (dir);
}
@@ -977,37 +927,25 @@ prefs_dialog_response_cb (GtkDialog *widget,
}
static void
-prefs_clear_cache_button_clicked_cb (GtkWidget *button,
- PrefsDialog *dialog)
+clear_cache_button_clicked_cb (GtkWidget *button,
+ PrefsDialog *dialog)
{
GtkWidget *parent;
parent = ephy_dialog_get_control (EPHY_DIALOG (dialog),
- properties[WINDOW_PROP].id);
- pdm_dialog_show_clear_all_dialog (EPHY_DIALOG (dialog),
- parent,
+ "prefs_dialog");
+ pdm_dialog_show_clear_all_dialog (EPHY_DIALOG (dialog), parent,
CLEAR_ALL_CACHE);
}
static void
-set_homepage_entry (EphyDialog *dialog,
- const char *new_location)
-{
- GValue value = { 0, };
-
- g_value_init (&value, G_TYPE_STRING);
- g_value_set_string (&value, new_location);
- ephy_dialog_set_value (dialog, properties[HOMEPAGE_ENTRY_PROP].id, &value);
- g_value_unset (&value);
-}
-
-static void
-prefs_homepage_current_button_clicked_cb (GtkWidget *button,
- EphyDialog *dialog)
+homepage_current_button_clicked_cb (GtkWidget *button,
+ EphyDialog *dialog)
{
EphySession *session;
EphyWindow *window;
EphyEmbed *embed;
+ EphyWebView *view;
session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default ()));
window = ephy_session_get_active_window (session);
@@ -1019,16 +957,127 @@ prefs_homepage_current_button_clicked_cb (GtkWidget *button,
(EPHY_EMBED_CONTAINER (window));
g_return_if_fail (embed != NULL);
- set_homepage_entry (dialog, ephy_web_view_get_address (ephy_embed_get_web_view (embed)));
+ view = ephy_embed_get_web_view (embed);
+
+ g_settings_set_string (EPHY_SETTINGS_MAIN, EPHY_PREFS_HOMEPAGE_URL,
+ ephy_web_view_get_address (view));
}
static void
-prefs_homepage_blank_button_clicked_cb (GtkWidget *button,
- EphyDialog *dialog)
+homepage_blank_button_clicked_cb (GtkWidget *button,
+ EphyDialog *dialog)
+{
+ g_settings_set_string (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_HOMEPAGE_URL, "");
+}
+
+static gboolean
+cookies_get_mapping (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
{
- set_homepage_entry (dialog, NULL);
+ const char *setting;
+ char *name;
+
+ setting = g_variant_get_string (variant, NULL);
+
+ g_object_get (user_data, "name", &name, NULL);
+
+ /* If the button name matches the setting, it should be active. */
+ if (g_strcmp0 (name, setting) == 0)
+ g_value_set_boolean (value, TRUE);
+
+ g_free (name);
+
+ return TRUE;
+}
+
+static GVariant *
+cookies_set_mapping (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GVariant *variant = NULL;
+ char *name;
+
+ /* Don't act unless the button has been activated (turned ON). */
+ if (!g_value_get_boolean (value))
+ return NULL;
+
+ g_object_get (user_data, "name", &name, NULL);
+ variant = g_variant_new_string (name);
+
+ g_free (name);
+
+ return variant;
}
+typedef struct
+{
+ char *obj;
+ char *prop;
+ char *schema;
+ char *key;
+ GSettingsBindFlags flags;
+ GSettingsBindGetMapping get_mapping;
+ GSettingsBindSetMapping set_mapping;
+} PrefsDialogPreference;
+
+static const PrefsDialogPreference preferences[] =
+{
+ { "homepage_entry", "text",
+ EPHY_PREFS_SCHEMA, EPHY_PREFS_HOMEPAGE_URL,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+ { "automatic_downloads_checkbutton", "active",
+ EPHY_PREFS_SCHEMA, EPHY_PREFS_AUTO_DOWNLOADS,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+ { "web_inspector_checkbutton", "active",
+ EPHY_PREFS_SCHEMA, EPHY_PREFS_ENABLE_WEB_INSPECTOR,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+ { "remember_passwords_checkbutton", "active",
+ EPHY_PREFS_SCHEMA, EPHY_PREFS_REMEMBER_PASSWORDS,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+
+ { "disk_cache_spinbutton", "value",
+ EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_CACHE_SIZE,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+ { "use_fonts_checkbutton", "active",
+ EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_USE_OWN_FONTS,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+ { "min_size_spinbutton", "value",
+ EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_FONT_MIN_SIZE,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+ { "use_colors_checkbutton", "active",
+ EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_USE_OWN_COLORS,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+ { "popups_allow_checkbutton", "active",
+ EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_ENABLE_POPUPS,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+ { "enable_plugins_checkbutton", "active",
+ EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_ENABLE_PLUGINS,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+ { "enable_javascript_checkbutton", "active",
+ EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_ENABLE_JAVASCRIPT,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+ { "css_checkbox", "active",
+ EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_ENABLE_USER_CSS,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+ { "css_edit_button", "sensitive",
+ EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_ENABLE_USER_CSS,
+ G_SETTINGS_BIND_DEFAULT, NULL, NULL },
+
+ /* Has mapping */
+ { "cookies_always_radiobutton", "active",
+ EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_COOKIES_POLICY,
+ G_SETTINGS_BIND_DEFAULT, cookies_get_mapping, cookies_set_mapping },
+ { "cookies_no_third_party_radiobutton", "active",
+ EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_COOKIES_POLICY,
+ G_SETTINGS_BIND_DEFAULT, cookies_get_mapping, cookies_set_mapping },
+ { "cookies_never_radiobutton", "active",
+ EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_COOKIES_POLICY,
+ G_SETTINGS_BIND_DEFAULT, cookies_get_mapping, cookies_set_mapping },
+};
+
static void
prefs_dialog_init (PrefsDialog *pd)
{
@@ -1036,31 +1085,42 @@ prefs_dialog_init (PrefsDialog *pd)
EphyEncodings *encodings;
GtkWidget *window, *curr_button, *blank_button;
GtkWidget *clear_cache_button;
- GtkWidget *css_checkbox, *css_edit_box, *css_edit_button, *css_container;
- gboolean sensitive;
+ GtkWidget *css_checkbox, *css_edit_button;
+ int i;
pd->priv = EPHY_PREFS_DIALOG_GET_PRIVATE (pd);
ephy_dialog_construct (dialog,
- properties,
ephy_file ("prefs-dialog.ui"),
"prefs_dialog",
NULL);
- ephy_dialog_add_enum (dialog, properties[ACCEPT_COOKIES_PROP].id,
- G_N_ELEMENTS (cookies_accept_enum), cookies_accept_enum);
+ for (i = 0; i < G_N_ELEMENTS (preferences); i++)
+ {
+ PrefsDialogPreference pref;
+ GtkWidget *widget;
+ GSettings *settings;
+
+ pref = preferences[i];
+ settings = ephy_settings_get (pref.schema);
+ widget = ephy_dialog_get_control (dialog, pref.obj);
+
+ g_settings_bind_with_mapping (settings, pref.key,
+ widget, pref.prop,
+ pref.flags,
+ pref.get_mapping,
+ pref.set_mapping,
+ widget, NULL);
+ }
- ephy_dialog_get_controls
- (dialog,
- properties[WINDOW_PROP].id, &window,
- properties[HOMEPAGE_CURRENT_PROP].id, &curr_button,
- properties[HOMEPAGE_BLANK_PROP].id, &blank_button,
- properties[CSS_CHECKBOX_PROP].id, &css_checkbox,
- properties[CSS_EDIT_BOX_PROP].id, &css_edit_box,
- properties[CSS_EDIT_BUTTON_PROP].id, &css_edit_button,
- properties[CSS_CONTAINER_PROP].id, &css_container,
- properties[CLEAR_CACHE_BUTTON_PROP].id, &clear_cache_button,
- NULL);
+ ephy_dialog_get_controls (dialog,
+ "prefs_dialog", &window,
+ "homepage_current_button", &curr_button,
+ "homepage_blank_button", &blank_button,
+ "css_checkbox", &css_checkbox,
+ "css_edit_button", &css_edit_button,
+ "clear_cache_button", &clear_cache_button,
+ NULL);
ephy_gui_ensure_window_group (GTK_WINDOW (window));
@@ -1068,31 +1128,31 @@ prefs_dialog_init (PrefsDialog *pd)
G_CALLBACK (prefs_dialog_response_cb), dialog);
g_signal_connect (curr_button, "clicked",
- G_CALLBACK (prefs_homepage_current_button_clicked_cb), dialog);
+ G_CALLBACK (homepage_current_button_clicked_cb),
+ dialog);
g_signal_connect (blank_button, "clicked",
- G_CALLBACK (prefs_homepage_blank_button_clicked_cb), dialog);
+ G_CALLBACK (homepage_blank_button_clicked_cb),
+ dialog);
/* set homepage button sensitivity */
- sensitive = eel_gconf_key_is_writable (CONF_GENERAL_HOMEPAGE);
- gtk_widget_set_sensitive (curr_button, sensitive);
- gtk_widget_set_sensitive (blank_button, sensitive);
-
- css_checkbox_toggled (GTK_TOGGLE_BUTTON (css_checkbox), css_edit_box);
- g_signal_connect (css_checkbox, "toggled",
- G_CALLBACK (css_checkbox_toggled), css_edit_box);
+ g_settings_bind_writable (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_HOMEPAGE_URL,
+ curr_button, "sensitive", FALSE);
+ g_settings_bind_writable (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_HOMEPAGE_URL,
+ blank_button, "sensitive", FALSE);
g_signal_connect (css_edit_button, "clicked",
G_CALLBACK (css_edit_button_clicked_cb), dialog);
g_signal_connect (clear_cache_button, "clicked",
- G_CALLBACK (prefs_clear_cache_button_clicked_cb), dialog);
+ G_CALLBACK (clear_cache_button_clicked_cb), dialog);
encodings = EPHY_ENCODINGS (ephy_embed_shell_get_encodings
(EPHY_EMBED_SHELL (ephy_shell)));
- create_node_combo (dialog, DEFAULT_ENCODING_PROP, encodings,
- ephy_encodings_get_all (encodings),
- CONF_LANGUAGE_DEFAULT_ENCODING, "ISO-8859-1");
+ create_node_combo (dialog, encodings,
+ ephy_encodings_get_all (encodings), "ISO-8859-1");
create_language_section (dialog);
diff --git a/src/window-commands.c b/src/window-commands.c
index 785990787..163f35a17 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -30,8 +30,8 @@
#include "ephy-embed-persist.h"
#include "ephy-debug.h"
#include "window-commands.h"
-#include "eel-gconf-extensions.h"
#include "ephy-prefs.h"
+#include "ephy-settings.h"
#include "ephy-embed-prefs.h"
#include "ephy-dialog.h"
#include "ephy-bookmarks-editor.h"
@@ -313,7 +313,7 @@ window_cmd_file_open (GtkAction *action,
dialog = ephy_file_chooser_new (_("Open"),
GTK_WIDGET (window),
GTK_FILE_CHOOSER_ACTION_OPEN,
- CONF_STATE_OPEN_DIR,
+ EPHY_PREFS_STATE_OPEN_DIR,
EPHY_FILE_FILTER_ALL_SUPPORTED);
g_signal_connect (dialog, "response",
@@ -343,7 +343,7 @@ window_cmd_file_save_as (GtkAction *action,
dialog = ephy_file_chooser_new (_("Save"),
GTK_WIDGET (window),
GTK_FILE_CHOOSER_ACTION_SAVE,
- CONF_STATE_SAVE_DIR,
+ EPHY_PREFS_STATE_SAVE_DIR,
EPHY_FILE_FILTER_ALL);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
@@ -396,7 +396,8 @@ window_cmd_file_close_window (GtkAction *action,
notebook = ephy_window_get_notebook (window);
- if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_QUIT) &&
+ if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+ EPHY_PREFS_LOCKDOWN_QUIT) &&
gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) == 1)
{
return;
@@ -1232,5 +1233,6 @@ window_cmd_browse_with_caret (GtkAction *action,
}
}
- eel_gconf_set_boolean (CONF_CARET_BROWSING_ENABLED, active);
+ g_settings_set_boolean (EPHY_SETTINGS_MAIN,
+ EPHY_PREFS_ENABLE_CARET_BROWSING, active);
}