[file-roller] Revert "Ported to GSettings"
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] Revert "Ported to GSettings"
- Date: Sat, 14 Aug 2010 08:23:16 +0000 (UTC)
commit 2d97cd696f46c79b3fdded70985cbe8e649f0b6a
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Aug 14 09:54:32 2010 +0200
Revert "Ported to GSettings"
Use GConf for version 2.32.
configure.ac | 14 +-
data/Makefile.am | 25 +-
data/file-roller.schemas | 184 +++++---
data/org.gnome.file-roller.gschema.xml | 208 --------
src/Makefile.am | 2 +
src/actions.c | 26 +-
src/dlg-add-files.c | 12 +-
src/dlg-add-folder.c | 38 +-
src/dlg-batch-add.c | 25 +-
src/dlg-extract.c | 19 +-
src/dlg-new.c | 26 +-
src/dlg-open-with.c | 86 ++--
src/dlg-password.c | 9 +-
src/dlg-update.c | 1 +
src/file-utils.c | 2 +
src/fr-archive.c | 3 +-
src/fr-window.c | 342 +++++++------
src/fr-window.h | 1 +
src/gconf-utils.c | 862 ++++++++++++++++++++++++++++++++
src/gconf-utils.h | 137 +++++
src/glib-utils.c | 68 ---
src/glib-utils.h | 11 -
src/main.c | 84 +++-
src/preferences.c | 244 ++++++++-
src/preferences.h | 102 ++--
src/typedefs.h | 3 -
26 files changed, 1796 insertions(+), 738 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a35fb11..02cccfa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,10 +10,10 @@ AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADER([config.h])
GNOME_COMMON_INIT
+
AC_PROG_CC
AM_DISABLE_STATIC
AC_PROG_LIBTOOL
-GLIB_GSETTINGS
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
@@ -27,6 +27,7 @@ dnl ==========================================================================
GLIB_REQUIRED=2.25.5
GIO_REQUIRED=2.25.5
+GCONF_REQUIRED=2.6.0
NAUTILUS_REQUIRED=2.22.2
AC_MSG_CHECKING([which gtk+ version to compile against])
@@ -77,7 +78,8 @@ PKG_CHECK_MODULES(FR, \
glib-2.0 >= $GLIB_REQUIRED \
gthread-2.0 \
gio-unix-2.0 >= $GIO_REQUIRED \
- gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
+ gtk+-$GTK_API_VERSION >= $GTK_REQUIRED \
+ gconf-2.0 >= $GCONF_REQUIRED)
AC_SUBST(FR_CFLAGS)
AC_SUBST(FR_LIBS)
@@ -148,6 +150,14 @@ AC_SUBST(DISABLE_DEPRECATED)
dnl ******************************
+AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
+if test x"$GCONFTOOL" = xno; then
+ AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
+fi
+AM_GCONF_SOURCE_2
+
+dnl ******************************
+
NAUTILUS_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extension`
AC_SUBST(NAUTILUS_EXTENSION_DIR)
diff --git a/data/Makefile.am b/data/Makefile.am
index 26bf6af..289c22f 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,22 +1,29 @@
+ INTLTOOL_DESKTOP_RULE@
+
SUBDIRS = ui icons
-desktopdir = $(datadir)/applications
desktop_in_in_files = file-roller.desktop.in.in
desktop_in_files = $(desktop_in_in_files:.desktop.in.in=.desktop.in)
+
+desktopdir = $(datadir)/applications
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
- INTLTOOL_DESKTOP_RULE@
matchdir = $(datadir)/file-roller
match_DATA = packages.match
-gsettings_SCHEMAS = org.gnome.file-roller.gschema.xml
- GSETTINGS_RULES@
+schemadir = @GCONF_SCHEMA_FILE_DIR@
+schema_DATA = file-roller.schemas
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
-install-data-hook: update-cache
-uninstall-hook: update-cache
-update-cache:
+install-data-local:
+if GCONF_SCHEMAS_INSTALL
+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$(schema_DATA)
+endif
+
+install-data-hook: update-icon-cache
+uninstall-hook: update-icon-cache
+update-icon-cache:
if test -z "$(DESTDIR)"; then \
echo "Updating Gtk icon cache."; \
$(gtk_update_icon_cache); \
@@ -25,13 +32,15 @@ update-cache:
echo "*** $(gtk_update_icon_cache)"; \
fi
+
EXTRA_DIST = \
$(desktop_in_in_files) \
$(desktop_in_files) \
$(desktop_DATA) \
packages.match.in \
packages.match \
- $(gsettings_SCHEMAS)
+ $(schema_DATA)
+
DISTCLEANFILES = \
$(desktop_in_files) \
diff --git a/data/file-roller.schemas b/data/file-roller.schemas
index 5c323e7..85265d1 100644
--- a/data/file-roller.schemas
+++ b/data/file-roller.schemas
@@ -1,42 +1,49 @@
-<?xml version="1.0"?>
<gconfschemafile>
<schemalist>
+
<schema>
- <key>/schemas/apps/file-roller/listing/sort-method</key>
- <applyto>/apps/file-roller/listing/sort-method</applyto>
+ <key>/schemas/apps/file-roller/listing/sort_method</key>
+ <applyto>/apps/file-roller/listing/sort_method</applyto>
<owner>file-roller</owner>
<type>string</type>
<default>name</default>
<locale name="C">
<short>How to sort files</short>
- <long>What criteria must be used to arrange files. Possible values: name, size, type, time, path.</long>
+ <long>What criteria must be used to arrange files. Possible values:
+ name, size, type, time, path.
+ </long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/listing/sort-type</key>
- <applyto>/apps/file-roller/listing/sort-type</applyto>
+ <key>/schemas/apps/file-roller/listing/sort_type</key>
+ <applyto>/apps/file-roller/listing/sort_type</applyto>
<owner>file-roller</owner>
<type>string</type>
<default>ascending</default>
<locale name="C">
<short>Sort type</short>
- <long>Whether to sort in ascending or descending direction. Possible values: ascending, descending.</long>
+ <long>Whether to sort in ascending or descending direction. Possible
+ values: ascending, descending.</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/listing/list-mode</key>
- <applyto>/apps/file-roller/listing/list-mode</applyto>
+ <key>/schemas/apps/file-roller/listing/list_mode</key>
+ <applyto>/apps/file-roller/listing/list_mode</applyto>
<owner>file-roller</owner>
<type>string</type>
<default>as_folder</default>
<locale name="C">
<short>List Mode</short>
- <long>Whether to view all files in the archive (all_files), or view the archive as a folder (as_folder).</long>
+ <long>Whether to view all files in the archive (all_files), or
+ view the archive as a folder (as_folder).</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/listing/show-type</key>
- <applyto>/apps/file-roller/listing/show-type</applyto>
+ <key>/schemas/apps/file-roller/listing/show_type</key>
+ <applyto>/apps/file-roller/listing/show_type</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>true</default>
@@ -45,9 +52,10 @@
<long>Display the Type column in the main window.</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/listing/show-size</key>
- <applyto>/apps/file-roller/listing/show-size</applyto>
+ <key>/schemas/apps/file-roller/listing/show_size</key>
+ <applyto>/apps/file-roller/listing/show_size</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>true</default>
@@ -56,9 +64,10 @@
<long>Display the Size column in the main window.</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/listing/show-time</key>
- <applyto>/apps/file-roller/listing/show-time</applyto>
+ <key>/schemas/apps/file-roller/listing/show_time</key>
+ <applyto>/apps/file-roller/listing/show_time</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>true</default>
@@ -67,9 +76,10 @@
<long>Display the Time column in the main window.</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/listing/show-path</key>
- <applyto>/apps/file-roller/listing/show-path</applyto>
+ <key>/schemas/apps/file-roller/listing/show_path</key>
+ <applyto>/apps/file-roller/listing/show_path</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>true</default>
@@ -78,20 +88,24 @@
<long>Display the Path column in the main window.</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/listing/use-mime-icons</key>
- <applyto>/apps/file-roller/listing/use-mime-icons</applyto>
+ <key>/schemas/apps/file-roller/listing/use_mime_icons</key>
+ <applyto>/apps/file-roller/listing/use_mime_icons</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short>Use mime icons</short>
- <long>if TRUE will display icons depending on the file type (slower), otherwise will use always the same icon for all files (faster).</long>
+ <long>if TRUE will display icons depending on the file type (slower),
+ otherwise will use always the same icon for all files (faster).
+ </long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/listing/name-column-width</key>
- <applyto>/apps/file-roller/listing/name-column-width</applyto>
+ <key>/schemas/apps/file-roller/listing/name_column_width</key>
+ <applyto>/apps/file-roller/listing/name_column_width</applyto>
<owner>file-roller</owner>
<type>int</type>
<default>250</default>
@@ -100,9 +114,10 @@
<long>The default width ofthe name column the file list.</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/ui/history-len</key>
- <applyto>/apps/file-roller/ui/history-len</applyto>
+ <key>/schemas/apps/file-roller/ui/history_len</key>
+ <applyto>/apps/file-roller/ui/history_len</applyto>
<owner>file-roller</owner>
<type>int</type>
<default>5</default>
@@ -111,42 +126,49 @@
<long>Max number of items in the Open Recents menu.</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/ui/window-width</key>
- <applyto>/apps/file-roller/ui/window-width</applyto>
+ <key>/schemas/apps/file-roller/ui/window_width</key>
+ <applyto>/apps/file-roller/ui/window_width</applyto>
<owner>file-roller</owner>
<type>int</type>
<default>600</default>
<locale name="C">
<short></short>
- <long></long>
+ <long>
+ </long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/ui/window-height</key>
- <applyto>/apps/file-roller/ui/window-height</applyto>
+ <key>/schemas/apps/file-roller/ui/window_height</key>
+ <applyto>/apps/file-roller/ui/window_height</applyto>
<owner>file-roller</owner>
<type>int</type>
<default>480</default>
<locale name="C">
<short></short>
- <long></long>
+ <long>
+ </long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/ui/sidebar-width</key>
- <applyto>/apps/file-roller/ui/sidebar-width</applyto>
+ <key>/schemas/apps/file-roller/ui/sidebar_width</key>
+ <applyto>/apps/file-roller/ui/sidebar_width</applyto>
<owner>file-roller</owner>
<type>int</type>
<default>200</default>
<locale name="C">
<short></short>
- <long></long>
+ <long>
+ </long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/ui/view-toolbar</key>
- <applyto>/apps/file-roller/ui/view-toolbar</applyto>
+ <key>/schemas/apps/file-roller/ui/view_toolbar</key>
+ <applyto>/apps/file-roller/ui/view_toolbar</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>true</default>
@@ -155,9 +177,10 @@
<long>Whether to display the toolbar.</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/ui/view-statusbar</key>
- <applyto>/apps/file-roller/ui/view-statusbar</applyto>
+ <key>/schemas/apps/file-roller/ui/view_statusbar</key>
+ <applyto>/apps/file-roller/ui/view_statusbar</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>true</default>
@@ -166,9 +189,10 @@
<long>Whether to display the statusbar.</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/ui/view-folders</key>
- <applyto>/apps/file-roller/ui/view-folders</applyto>
+ <key>/schemas/apps/file-roller/ui/view_folders</key>
+ <applyto>/apps/file-roller/ui/view_folders</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>false</default>
@@ -177,6 +201,7 @@
<long>Whether to display the folders pane.</long>
</locale>
</schema>
+
<schema>
<key>/schemas/apps/file-roller/general/editors</key>
<applyto>/apps/file-roller/general/editors</applyto>
@@ -186,23 +211,27 @@
<default>[]</default>
<locale name="C">
<short>Editors</short>
- <long>List of applications entered in the Open file dialog and not associated with the file type.</long>
+ <long>List of applications entered in the Open file dialog and not
+ associated with the file type.</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/general/compression-level</key>
- <applyto>/apps/file-roller/general/compression-level</applyto>
+ <key>/schemas/apps/file-roller/general/compression_level</key>
+ <applyto>/apps/file-roller/general/compression_level</applyto>
<owner>file-roller</owner>
<type>string</type>
<default>normal</default>
<locale name="C">
<short>Compression level</short>
- <long>Compression level used when adding files to an archive. Possible values : very_fast, fast, normal, maximum.</long>
+ <long>Compression level used when adding files to an archive.
+ Possible values : very_fast, fast, normal, maximum.</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/general/encrypt-header</key>
- <applyto>/apps/file-roller/general/encrypt-header</applyto>
+ <key>/schemas/apps/file-roller/general/encrypt_header</key>
+ <applyto>/apps/file-roller/general/encrypt_header</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>false</default>
@@ -211,17 +240,20 @@
<long>Whether to encrypt the archive header. If the header is encrypted the password will be required to list the archive content as well.</long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/general/migrate-directories</key>
- <applyto>/apps/file-roller/general/migrate-directories</applyto>
+ <key>/schemas/apps/file-roller/general/migrate_directories</key>
+ <applyto>/apps/file-roller/general/migrate_directories</applyto>
<owner>gthumb</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short></short>
- <long></long>
+ <long>
+ </long>
</locale>
</schema>
+
<schema>
<key>/schemas/apps/file-roller/dialogs/extract/overwrite</key>
<applyto>/apps/file-roller/dialogs/extract/overwrite</applyto>
@@ -233,9 +265,10 @@
<long></long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/dialogs/extract/skip-newer</key>
- <applyto>/apps/file-roller/dialogs/extract/skip-newer</applyto>
+ <key>/schemas/apps/file-roller/dialogs/extract/skip_newer</key>
+ <applyto>/apps/file-roller/dialogs/extract/skip_newer</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>false</default>
@@ -244,9 +277,10 @@
<long></long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/dialogs/extract/recreate-folders</key>
- <applyto>/apps/file-roller/dialogs/extract/recreate-folders</applyto>
+ <key>/schemas/apps/file-roller/dialogs/extract/recreate_folders</key>
+ <applyto>/apps/file-roller/dialogs/extract/recreate_folders</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>true</default>
@@ -255,9 +289,10 @@
<long></long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/dialogs/add/current-folder</key>
- <applyto>/apps/file-roller/dialogs/add/current-folder</applyto>
+ <key>/schemas/apps/file-roller/dialogs/add/current_folder</key>
+ <applyto>/apps/file-roller/dialogs/add/current_folder</applyto>
<owner>file-roller</owner>
<type>string</type>
<default></default>
@@ -266,6 +301,7 @@
<long></long>
</locale>
</schema>
+
<schema>
<key>/schemas/apps/file-roller/dialogs/add/filename</key>
<applyto>/apps/file-roller/dialogs/add/filename</applyto>
@@ -277,9 +313,10 @@
<long></long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/dialogs/add/include-files</key>
- <applyto>/apps/file-roller/dialogs/add/include-files</applyto>
+ <key>/schemas/apps/file-roller/dialogs/add/include_files</key>
+ <applyto>/apps/file-roller/dialogs/add/include_files</applyto>
<owner>file-roller</owner>
<type>string</type>
<default></default>
@@ -288,9 +325,10 @@
<long></long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/dialogs/add/exclude-files</key>
- <applyto>/apps/file-roller/dialogs/add/exclude-files</applyto>
+ <key>/schemas/apps/file-roller/dialogs/add/exclude_files</key>
+ <applyto>/apps/file-roller/dialogs/add/exclude_files</applyto>
<owner>file-roller</owner>
<type>string</type>
<default></default>
@@ -299,9 +337,10 @@
<long></long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/dialogs/add/exclude-folders</key>
- <applyto>/apps/file-roller/dialogs/add/exclude-folders</applyto>
+ <key>/schemas/apps/file-roller/dialogs/add/exclude_folders</key>
+ <applyto>/apps/file-roller/dialogs/add/exclude_folders</applyto>
<owner>file-roller</owner>
<type>string</type>
<default></default>
@@ -310,6 +349,7 @@
<long></long>
</locale>
</schema>
+
<schema>
<key>/schemas/apps/file-roller/dialogs/extract/update</key>
<applyto>/apps/file-roller/dialogs/extract/update</applyto>
@@ -321,6 +361,7 @@
<long></long>
</locale>
</schema>
+
<schema>
<key>/schemas/apps/file-roller/dialogs/extract/recursive</key>
<applyto>/apps/file-roller/dialogs/extract/recursive</applyto>
@@ -332,9 +373,10 @@
<long></long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/dialogs/extract/no-symlinks</key>
- <applyto>/apps/file-roller/dialogs/extract/no-symlinks</applyto>
+ <key>/schemas/apps/file-roller/dialogs/extract/no_symlinks</key>
+ <applyto>/apps/file-roller/dialogs/extract/no_symlinks</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>false</default>
@@ -343,9 +385,10 @@
<long></long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/dialogs/batch-add/default-extension</key>
- <applyto>/apps/file-roller/dialogs/batch-add/default-extension</applyto>
+ <key>/schemas/apps/file-roller/dialogs/batch-add/default_extension</key>
+ <applyto>/apps/file-roller/dialogs/batch-add/default_extension</applyto>
<owner>file-roller</owner>
<type>string</type>
<default>.tar.gz</default>
@@ -354,9 +397,10 @@
<long></long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/dialogs/batch-add/other-options</key>
- <applyto>/apps/file-roller/dialogs/batch-add/other-options</applyto>
+ <key>/schemas/apps/file-roller/dialogs/batch-add/other_options</key>
+ <applyto>/apps/file-roller/dialogs/batch-add/other_options</applyto>
<owner>file-roller</owner>
<type>bool</type>
<default>false</default>
@@ -365,9 +409,10 @@
<long></long>
</locale>
</schema>
+
<schema>
- <key>/schemas/apps/file-roller/dialogs/batch-add/volume-size</key>
- <applyto>/apps/file-roller/dialogs/batch-add/volume-size</applyto>
+ <key>/schemas/apps/file-roller/dialogs/batch-add/volume_size</key>
+ <applyto>/apps/file-roller/dialogs/batch-add/volume_size</applyto>
<owner>file-roller</owner>
<type>int</type>
<default>0</default>
@@ -376,5 +421,6 @@
<long>The default size for volumes.</long>
</locale>
</schema>
+
</schemalist>
</gconfschemafile>
diff --git a/src/Makefile.am b/src/Makefile.am
index 2e3022b..9970bf0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -130,6 +130,8 @@ file_roller_SOURCES = \
fr-process.h \
fr-window.c \
fr-window.h \
+ gconf-utils.c \
+ gconf-utils.h \
gio-utils.c \
gio-utils.h \
glib-utils.c \
diff --git a/src/actions.c b/src/actions.c
index ed9c7ef..7030c4b 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -39,6 +39,7 @@
#include "fr-window.h"
#include "file-utils.h"
#include "fr-process.h"
+#include "gconf-utils.h"
#include "glib-utils.h"
#include "main.h"
#include "typedefs.h"
@@ -427,7 +428,6 @@ save_file_response_cb (GtkWidget *w,
const char *password;
gboolean encrypt_header;
int volume_size;
- GSettings *settings;
if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
gtk_widget_destroy (data->dialog);
@@ -447,9 +447,7 @@ save_file_response_cb (GtkWidget *w,
encrypt_header = dlg_new_data_get_encrypt_header (data);
volume_size = dlg_new_data_get_volume_size (data);
- settings = g_settings_new (FILE_ROLLER_SCHEMA_BATCH_ADD);
- g_settings_set_int (settings, PREF_BATCH_ADD_VOLUME_SIZE, volume_size);
- g_object_unref (settings);
+ eel_gconf_set_integer (PREF_BATCH_VOLUME_SIZE, volume_size);
fr_window_archive_save_as (data->window, path, password, encrypt_header, volume_size);
gtk_widget_destroy (data->dialog);
@@ -725,11 +723,7 @@ void
activate_action_view_toolbar (GtkAction *action,
gpointer data)
{
- GSettings *settings;
-
- settings = g_settings_new (FILE_ROLLER_SCHEMA_UI);
- g_settings_set_boolean (settings, PREF_UI_VIEW_TOOLBAR, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
- g_object_unref (settings);
+ eel_gconf_set_boolean (PREF_UI_TOOLBAR, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
}
@@ -737,23 +731,15 @@ void
activate_action_view_statusbar (GtkAction *action,
gpointer data)
{
- GSettings *settings;
-
- settings = g_settings_new (FILE_ROLLER_SCHEMA_UI);
- g_settings_set_boolean (settings, PREF_UI_VIEW_STATUSBAR, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
- g_object_unref (settings);
+ eel_gconf_set_boolean (PREF_UI_STATUSBAR, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
}
void
activate_action_view_folders (GtkAction *action,
- gpointer data)
+ gpointer data)
{
- GSettings *settings;
-
- settings = g_settings_new (FILE_ROLLER_SCHEMA_UI);
- g_settings_set_boolean (settings, PREF_UI_VIEW_FOLDERS, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
- g_object_unref (settings);
+ eel_gconf_set_boolean (PREF_UI_FOLDERS, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
}
diff --git a/src/dlg-add-files.c b/src/dlg-add-files.c
index b77e7b6..8e3aecc 100644
--- a/src/dlg-add-files.c
+++ b/src/dlg-add-files.c
@@ -28,13 +28,13 @@
#include "file-utils.h"
#include "fr-stock.h"
#include "fr-window.h"
+#include "gconf-utils.h"
#include "gtk-utils.h"
#include "preferences.h"
typedef struct {
FrWindow *window;
- GSettings *settings;
GtkWidget *dialog;
GtkWidget *add_if_newer_checkbutton;
} DialogData;
@@ -44,7 +44,6 @@ static void
open_file_destroy_cb (GtkWidget *file_sel,
DialogData *data)
{
- g_object_unref (data->settings);
g_free (data);
}
@@ -64,11 +63,9 @@ file_sel_response_cb (GtkWidget *widget,
current_folder = gtk_file_chooser_get_current_folder_uri (file_sel);
uri = gtk_file_chooser_get_uri (file_sel);
-
- g_settings_set_string (data->settings, PREF_ADD_CURRENT_FOLDER, current_folder);
- g_settings_set_string (data->settings, PREF_ADD_FILENAME, uri);
+ eel_gconf_set_string (PREF_ADD_CURRENT_FOLDER, current_folder);
+ eel_gconf_set_string (PREF_ADD_FILENAME, uri);
fr_window_set_add_default_dir (window, current_folder);
-
g_free (uri);
if ((response == GTK_RESPONSE_CANCEL) || (response == GTK_RESPONSE_DELETE_EVENT)) {
@@ -141,7 +138,6 @@ add_files_cb (GtkWidget *widget,
data = g_new0 (DialogData, 1);
data->window = callback_data;
- data->settings = g_settings_new (FILE_ROLLER_SCHEMA_ADD);
data->dialog = file_sel =
gtk_file_chooser_dialog_new (_("Add Files"),
GTK_WINDOW (data->window),
@@ -172,7 +168,7 @@ add_files_cb (GtkWidget *widget,
/* set data */
- folder = g_settings_get_string (data->settings, PREF_ADD_CURRENT_FOLDER);
+ folder = eel_gconf_get_string (PREF_ADD_CURRENT_FOLDER, "");
if ((folder == NULL) || (strcmp (folder, "") == 0))
folder = g_strdup (fr_window_get_add_default_dir (data->window));
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (file_sel), folder);
diff --git a/src/dlg-add-folder.c b/src/dlg-add-folder.c
index 258466e..ef4391a 100644
--- a/src/dlg-add-folder.c
+++ b/src/dlg-add-folder.c
@@ -31,12 +31,12 @@
#include "file-utils.h"
#include "fr-stock.h"
#include "fr-window.h"
+#include "gconf-utils.h"
#include "gtk-utils.h"
#include "preferences.h"
typedef struct {
FrWindow *window;
- GSettings *settings;
GtkWidget *dialog;
GtkWidget *include_subfold_checkbutton;
GtkWidget *add_if_newer_checkbutton;
@@ -59,7 +59,6 @@ static void
open_file_destroy_cb (GtkWidget *widget,
DialogData *data)
{
- g_object_unref (data->settings);
g_free (data->last_options);
g_free (data);
}
@@ -211,8 +210,9 @@ add_folder_cb (GtkWidget *widget,
GtkWidget *align;
data = g_new0 (DialogData, 1);
- data->settings = g_settings_new (FILE_ROLLER_SCHEMA_ADD);
+
data->window = callback_data;
+
data->dialog = file_sel =
gtk_file_chooser_dialog_new (_("Add a Folder"),
GTK_WINDOW (data->window),
@@ -505,14 +505,14 @@ dlg_add_folder_load_last_options (DialogData *data)
gboolean recursive;
gboolean no_symlinks;
- base_dir = g_settings_get_string (data->settings, PREF_ADD_CURRENT_FOLDER);
- filename = g_settings_get_string (data->settings, PREF_ADD_FILENAME);
- include_files = g_settings_get_string (data->settings, PREF_ADD_INCLUDE_FILES);
- exclude_files = g_settings_get_string (data->settings, PREF_ADD_EXCLUDE_FILES);
- exclude_folders = g_settings_get_string (data->settings, PREF_ADD_EXCLUDE_FOLDERS);
- update = g_settings_get_boolean (data->settings, PREF_ADD_UPDATE);
- recursive = g_settings_get_boolean (data->settings, PREF_ADD_RECURSIVE);
- no_symlinks = g_settings_get_boolean (data->settings, PREF_ADD_NO_SYMLINKS);
+ base_dir = eel_gconf_get_string (PREF_ADD_CURRENT_FOLDER, "");
+ filename = eel_gconf_get_string (PREF_ADD_FILENAME, "");
+ include_files = eel_gconf_get_string (PREF_ADD_INCLUDE_FILES, "");
+ exclude_files = eel_gconf_get_string (PREF_ADD_EXCLUDE_FILES, "");
+ exclude_folders = eel_gconf_get_string (PREF_ADD_EXCLUDE_FOLDERS, "");
+ update = eel_gconf_get_boolean (PREF_ADD_UPDATE, FALSE);
+ recursive = eel_gconf_get_boolean (PREF_ADD_RECURSIVE, TRUE);
+ no_symlinks = eel_gconf_get_boolean (PREF_ADD_NO_SYMLINKS, FALSE);
sync_widgets_with_options (data,
base_dir,
@@ -629,14 +629,14 @@ dlg_add_folder_save_last_options (DialogData *data)
&recursive,
&no_symlinks);
- g_settings_set_string (data->settings, PREF_ADD_CURRENT_FOLDER, base_dir);
- g_settings_set_string (data->settings, PREF_ADD_FILENAME, filename);
- g_settings_set_string (data->settings, PREF_ADD_INCLUDE_FILES, include_files);
- g_settings_set_string (data->settings, PREF_ADD_EXCLUDE_FILES, exclude_files);
- g_settings_set_string (data->settings, PREF_ADD_EXCLUDE_FOLDERS, exclude_folders);
- g_settings_set_boolean (data->settings, PREF_ADD_UPDATE, update);
- g_settings_set_boolean (data->settings, PREF_ADD_RECURSIVE, recursive);
- g_settings_set_boolean (data->settings, PREF_ADD_NO_SYMLINKS, no_symlinks);
+ eel_gconf_set_string (PREF_ADD_CURRENT_FOLDER, base_dir);
+ eel_gconf_set_string (PREF_ADD_FILENAME, filename);
+ eel_gconf_set_string (PREF_ADD_INCLUDE_FILES, include_files);
+ eel_gconf_set_string (PREF_ADD_EXCLUDE_FILES, exclude_files);
+ eel_gconf_set_string (PREF_ADD_EXCLUDE_FOLDERS, exclude_folders);
+ eel_gconf_set_boolean (PREF_ADD_UPDATE, update);
+ eel_gconf_set_boolean (PREF_ADD_RECURSIVE, recursive);
+ eel_gconf_set_boolean (PREF_ADD_NO_SYMLINKS, no_symlinks);
g_free (base_dir);
g_free (filename);
diff --git a/src/dlg-batch-add.c b/src/dlg-batch-add.c
index c1832f8..65d9412 100644
--- a/src/dlg-batch-add.c
+++ b/src/dlg-batch-add.c
@@ -28,6 +28,7 @@
#include <gtk/gtk.h>
#include "file-utils.h"
#include "fr-stock.h"
+#include "gconf-utils.h"
#include "fr-window.h"
#include "typedefs.h"
#include "gtk-utils.h"
@@ -37,13 +38,12 @@
#define ARCHIVE_ICON_SIZE (48)
+#define DEFAULT_EXTENSION ".tar.gz"
#define BAD_CHARS "/\\*"
typedef struct {
FrWindow *window;
- GSettings *settings;
- GSettings *settings_general;
GtkBuilder *builder;
int *supported_types;
@@ -83,9 +83,9 @@ static void
destroy_cb (GtkWidget *widget,
DialogData *data)
{
- g_settings_set_string (data->settings, PREF_BATCH_ADD_DEFAULT_EXTENSION, get_ext (data));
- /*g_settings_set_boolean (data->settings, PREF_BATCH_ADD_OTHER_OPTIONS, data->add_clicked ? FALSE : gtk_expander_get_expanded (GTK_EXPANDER (data->a_other_options_expander)));*/
- g_settings_set_boolean (data->settings_general, PREF_GENERAL_ENCRYPT_HEADER, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton)));
+ eel_gconf_set_string (PREF_BATCH_ADD_DEFAULT_EXTENSION, get_ext (data));
+ /*eel_gconf_set_boolean (PREF_BATCH_OTHER_OPTIONS, data->add_clicked ? FALSE : gtk_expander_get_expanded (GTK_EXPANDER (data->a_other_options_expander)));*/
+ eel_gconf_set_boolean (PREF_ENCRYPT_HEADER, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton)));
if (! data->add_clicked) {
fr_window_pop_message (data->window);
@@ -93,8 +93,6 @@ destroy_cb (GtkWidget *widget,
}
g_object_unref (data->builder);
- g_object_unref (data->settings_general);
- g_object_unref (data->settings);
g_free (data);
}
@@ -126,7 +124,7 @@ set_archive_options (DialogData *data)
value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (data->a_volume_spinbutton));
size = floor (value * MEGABYTE);
- g_settings_set_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE, size);
+ eel_gconf_set_integer (PREF_BATCH_VOLUME_SIZE, size);
fr_window_set_volume_size (data->window, (guint) size);
}
}
@@ -481,8 +479,7 @@ dlg_batch_add_files (FrWindow *window,
return;
data = g_new0 (DialogData, 1);
- data->settings = g_settings_new (FILE_ROLLER_SCHEMA_BATCH_ADD);
- data->settings_general = g_settings_new (FILE_ROLLER_SCHEMA_GENERAL);
+
data->builder = _gtk_builder_new_from_file ("batch-add-files.ui");
if (data->builder == NULL) {
g_free (data);
@@ -524,9 +521,9 @@ dlg_batch_add_files (FrWindow *window,
gtk_button_set_use_stock (GTK_BUTTON (add_button), TRUE);
gtk_button_set_label (GTK_BUTTON (add_button), FR_STOCK_CREATE_ARCHIVE);
- gtk_expander_set_expanded (GTK_EXPANDER (data->a_other_options_expander), FALSE /*g_settings_get_boolean (data->settings, PREF_BATCH_ADD_OTHER_OPTIONS)*/);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton), g_settings_get_boolean (data->settings_general, PREF_GENERAL_ENCRYPT_HEADER));
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->a_volume_spinbutton), (double) g_settings_get_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE) / MEGABYTE);
+ gtk_expander_set_expanded (GTK_EXPANDER (data->a_other_options_expander), FALSE /*eel_gconf_get_boolean (PREF_BATCH_OTHER_OPTIONS, FALSE)*/);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton), eel_gconf_get_boolean (PREF_ENCRYPT_HEADER, FALSE));
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->a_volume_spinbutton), (double) eel_gconf_get_integer (PREF_BATCH_VOLUME_SIZE, 0) / MEGABYTE);
first_filename = (char*) file_list->data;
parent = remove_level_from_path (first_filename);
@@ -599,7 +596,7 @@ dlg_batch_add_files (FrWindow *window,
/* Run dialog. */
- default_ext = g_settings_get_string (data->settings, PREF_BATCH_ADD_DEFAULT_EXTENSION);
+ default_ext = eel_gconf_get_string (PREF_BATCH_ADD_DEFAULT_EXTENSION, DEFAULT_EXTENSION);
update_archive_type_combo_box_from_ext (data, default_ext);
g_free (default_ext);
diff --git a/src/dlg-extract.c b/src/dlg-extract.c
index 71726ed..27f9115 100644
--- a/src/dlg-extract.c
+++ b/src/dlg-extract.c
@@ -29,11 +29,11 @@
#include "gtk-utils.h"
#include "fr-window.h"
#include "typedefs.h"
+#include "gconf-utils.h"
typedef struct {
FrWindow *window;
- GSettings *settings;
GList *selected_files;
char *base_dir_for_selection;
@@ -63,7 +63,6 @@ destroy_cb (GtkWidget *widget,
}
path_list_free (data->selected_files);
g_free (data->base_dir_for_selection);
- g_object_unref (data->settings);
g_free (data);
}
@@ -191,10 +190,10 @@ extract_cb (GtkWidget *w,
skip_newer = ! gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (data->e_not_newer_checkbutton)) && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->e_not_newer_checkbutton));
junk_paths = ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->e_recreate_dir_checkbutton));
- g_settings_set_boolean (data->settings, PREF_EXTRACT_OVERWRITE, overwrite);
- if (! gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (data->e_not_newer_checkbutton)))
- g_settings_set_boolean (data->settings, PREF_EXTRACT_SKIP_NEWER, skip_newer);
- g_settings_set_boolean (data->settings, PREF_EXTRACT_RECREATE_FOLDERS, ! junk_paths);
+ eel_gconf_set_boolean (PREF_EXTRACT_OVERWRITE, overwrite);
+ if (!gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (data->e_not_newer_checkbutton)))
+ eel_gconf_set_boolean (PREF_EXTRACT_SKIP_NEWER, skip_newer);
+ eel_gconf_set_boolean (PREF_EXTRACT_RECREATE_FOLDERS, !junk_paths);
selected_files = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->e_selected_radiobutton));
pattern_files = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->e_files_radiobutton));
@@ -420,7 +419,7 @@ dlg_extract__common (FrWindow *window,
GtkWidget *file_sel;
data = g_new0 (DialogData, 1);
- data->settings = g_settings_new (FILE_ROLLER_SCHEMA_EXTRACT);
+
data->window = window;
data->selected_files = selected_files;
data->base_dir_for_selection = base_dir_for_selection;
@@ -454,14 +453,14 @@ dlg_extract__common (FrWindow *window,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->e_all_radiobutton), TRUE);
}
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->e_overwrite_checkbutton), g_settings_get_boolean (data->settings, PREF_EXTRACT_OVERWRITE));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->e_not_newer_checkbutton), g_settings_get_boolean (data->settings, PREF_EXTRACT_SKIP_NEWER));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->e_overwrite_checkbutton), eel_gconf_get_boolean (PREF_EXTRACT_OVERWRITE, FALSE));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->e_not_newer_checkbutton), eel_gconf_get_boolean (PREF_EXTRACT_SKIP_NEWER, FALSE));
if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->e_overwrite_checkbutton))) {
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (data->e_not_newer_checkbutton), TRUE);
gtk_widget_set_sensitive (data->e_not_newer_checkbutton, FALSE);
}
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->e_recreate_dir_checkbutton), g_settings_get_boolean (data->settings, PREF_EXTRACT_RECREATE_FOLDERS));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->e_recreate_dir_checkbutton), eel_gconf_get_boolean (PREF_EXTRACT_RECREATE_FOLDERS, TRUE));
/* Set the signals handlers. */
diff --git a/src/dlg-new.c b/src/dlg-new.c
index dac1d00..50b742e 100644
--- a/src/dlg-new.c
+++ b/src/dlg-new.c
@@ -28,6 +28,7 @@
#include "dlg-new.h"
#include "file-utils.h"
#include "fr-stock.h"
+#include "gconf-utils.h"
#include "gtk-utils.h"
#include "main.h"
#include "preferences.h"
@@ -270,7 +271,6 @@ dlg_new_archive (FrWindow *window,
DlgNewData *data;
GtkWidget *n_new_button;
GtkFileFilter *filter;
- GSettings *settings;
/*char *default_ext;*/
int i;
@@ -306,8 +306,16 @@ dlg_new_archive (FrWindow *window,
gtk_dialog_set_default_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK);
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (data->dialog), fr_window_get_open_default_dir (window));
- if (default_name != NULL)
+ if (default_name != NULL) {
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (data->dialog), default_name);
+ /*char *ext, *name_ext;
+
+ ext = eel_gconf_get_string (PREF_BATCH_ADD_DEFAULT_EXTENSION, ".tgz");
+ name_ext = g_strconcat (default_name, ext, NULL);
+ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (data->dialog), name_ext);
+ g_free (name_ext);
+ g_free (ext);*/
+ }
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, _("All archives"));
@@ -326,14 +334,8 @@ dlg_new_archive (FrWindow *window,
gtk_button_set_use_stock (GTK_BUTTON (n_new_button), TRUE);
gtk_button_set_label (GTK_BUTTON (n_new_button), FR_STOCK_CREATE_ARCHIVE);
gtk_expander_set_expanded (GTK_EXPANDER (data->n_other_options_expander), FALSE);
-
- settings = g_settings_new (FILE_ROLLER_SCHEMA_GENERAL);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->n_encrypt_header_checkbutton), g_settings_get_boolean (settings, PREF_GENERAL_ENCRYPT_HEADER));
- g_object_unref (settings);
-
- settings = g_settings_new (FILE_ROLLER_SCHEMA_BATCH_ADD);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->n_volume_spinbutton), (double) g_settings_get_int (settings, PREF_BATCH_ADD_VOLUME_SIZE) / MEGABYTE);
- g_object_unref (settings);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->n_encrypt_header_checkbutton), eel_gconf_get_boolean (PREF_ENCRYPT_HEADER, FALSE));
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->n_volume_spinbutton), (double) eel_gconf_get_integer (PREF_BATCH_VOLUME_SIZE, 0) / MEGABYTE);
/* format chooser */
@@ -420,6 +422,10 @@ dlg_new_archive (FrWindow *window,
/* Run dialog. */
+/* default_ext = eel_gconf_get_string (PREF_BATCH_ADD_DEFAULT_EXTENSION, DEFAULT_EXTENSION);
+ update_archive_type_combo_box_from_ext (data, default_ext);
+ g_free (default_ext);*/
+
update_sensitivity (data);
gtk_window_set_modal (GTK_WINDOW (data->dialog), TRUE);
diff --git a/src/dlg-open-with.c b/src/dlg-open-with.c
index b3b0a4c..6fdea07 100644
--- a/src/dlg-open-with.c
+++ b/src/dlg-open-with.c
@@ -22,8 +22,10 @@
#include <config.h>
#include <string.h>
+
#include <gtk/gtk.h>
#include "file-utils.h"
+#include "gconf-utils.h"
#include "glib-utils.h"
#include "gtk-utils.h"
#include "main.h"
@@ -36,8 +38,7 @@ enum { ICON_COLUMN, TEXT_COLUMN, DATA_COLUMN, N_COLUMNS };
typedef struct {
FrWindow *window;
- GSettings *settings;
- GtkBuilder *builder;
+ GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *o_app_tree_view;
@@ -61,12 +62,14 @@ static void
open_with__destroy_cb (GtkWidget *widget,
DialogData *data)
{
+ g_object_unref (G_OBJECT (data->builder));
+
if (data->app_list != NULL)
g_list_free (data->app_list);
+
if (data->file_list != NULL)
path_list_free (data->file_list);
- g_object_unref (data->builder);
- g_object_unref (data->settings);
+
g_free (data);
}
@@ -80,8 +83,7 @@ open_cb (GtkWidget *widget,
gboolean present = FALSE;
char *command = NULL;
GList *scan;
- char **editors;
- int i;
+ GSList *sscan, *editors;
application = gtk_entry_get_text (GTK_ENTRY (data->o_app_entry));
@@ -96,25 +98,23 @@ open_cb (GtkWidget *widget,
/* add the command to the editors list if not already present. */
- editors = g_settings_get_strv (data->settings, PREF_GENERAL_EDITORS);
- for (i = 0; ! present && editors[i] != NULL; i++) {
- if (strcmp (editors[i], application) == 0) {
- command = g_strdup (editors[i]);
+ editors = eel_gconf_get_string_list (PREF_EDIT_EDITORS);
+ for (sscan = editors; sscan && ! present; sscan = sscan->next) {
+ char *recent_command = sscan->data;
+ if (strcmp (recent_command, application) == 0) {
+ command = g_strdup (recent_command);
present = TRUE;
}
}
if (! present) {
- char **new_editors;
-
- new_editors = _g_strv_prepend (editors, g_strdup (application));
+ editors = g_slist_prepend (editors, g_strdup (application));
command = g_strdup (application);
- g_settings_set_strv (data->settings, PREF_GENERAL_EDITORS, (const gchar * const *) new_editors);
-
- g_strfreev (new_editors);
+ eel_gconf_set_string_list (PREF_EDIT_EDITORS, editors);
}
- g_strfreev (editors);
+ g_slist_foreach (editors, (GFunc) g_free, NULL);
+ g_slist_free (editors);
/* exec the application */
@@ -242,8 +242,8 @@ delete_recent_cb (GtkWidget *widget,
if (data->last_clicked_list == data->o_recent_tree_view) {
- char *editor;
- char **editors;
+ char *editor;
+ GSList *editors, *link;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->o_recent_tree_view));
if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
@@ -256,11 +256,17 @@ delete_recent_cb (GtkWidget *widget,
/**/
- editors = g_settings_get_strv (data->settings, PREF_GENERAL_EDITORS);
- if (_g_strv_remove (editors, editor))
- g_settings_set_strv (data->settings, PREF_GENERAL_EDITORS, (const gchar * const *) editors);
+ editors = eel_gconf_get_string_list (PREF_EDIT_EDITORS);
+ link = g_slist_find_custom (editors, editor, (GCompareFunc) strcmp);
+ if (link != NULL) {
+ editors = g_slist_remove_link (editors, link);
+ eel_gconf_set_string_list (PREF_EDIT_EDITORS, editors);
+ g_free (link->data);
+ g_slist_free (link);
+ }
+ g_slist_foreach (editors, (GFunc) g_free, NULL);
+ g_slist_free (editors);
- g_strfreev (editors);
g_free (editor);
}
else if (data->last_clicked_list == data->o_app_tree_view) {
@@ -290,23 +296,22 @@ void
dlg_open_with (FrWindow *window,
GList *file_list)
{
- DialogData *data;
- GAppInfo *app;
- GList *scan, *app_names = NULL;
- char **editors;
- int i;
- GtkWidget *cancel_button;
- GtkTreeIter iter;
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
- GtkIconTheme *theme;
- int icon_size;
+ DialogData *data;
+ GAppInfo *app;
+ GList *scan, *app_names = NULL;
+ GSList *sscan, *editors;
+ GtkWidget *cancel_button;
+ GtkTreeIter iter;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkIconTheme *theme;
+ int icon_size;
if (file_list == NULL)
return;
data = g_new0 (DialogData, 1);
- data->settings = g_settings_new (FILE_ROLLER_SCHEMA_GENERAL);
+
data->builder = _gtk_builder_new_from_file ("open-with.ui");
if (data->builder == NULL) {
g_free (data);
@@ -467,14 +472,17 @@ dlg_open_with (FrWindow *window,
data->recent_model);
g_object_unref (G_OBJECT (data->recent_model));
- editors = g_settings_get_strv (data->settings, PREF_GENERAL_EDITORS);
- for (i = 0; editors[i] != NULL; i++) {
+ editors = eel_gconf_get_string_list (PREF_EDIT_EDITORS);
+ for (sscan = editors; sscan; sscan = sscan->next) {
+ char *editor = sscan->data;
+
gtk_list_store_append (GTK_LIST_STORE (data->recent_model), &iter);
gtk_list_store_set (GTK_LIST_STORE (data->recent_model), &iter,
- 0, editors[i],
+ 0, editor,
-1);
}
- g_strfreev (editors);
+ g_slist_foreach (editors, (GFunc) g_free, NULL);
+ g_slist_free (editors);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (NULL,
diff --git a/src/dlg-password.c b/src/dlg-password.c
index fc8ef71..e258b42 100644
--- a/src/dlg-password.c
+++ b/src/dlg-password.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <gtk/gtk.h>
#include "fr-window.h"
+#include "gconf-utils.h"
#include "gtk-utils.h"
#include "preferences.h"
@@ -62,13 +63,7 @@ response_cb (GtkWidget *dialog,
g_free (password);
encrypt_header = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->pw_encrypt_header_checkbutton));
- {
- GSettings *settings;
-
- settings = g_settings_new (FILE_ROLLER_SCHEMA_GENERAL);
- g_settings_set_boolean (settings, PREF_GENERAL_ENCRYPT_HEADER, encrypt_header);
- g_object_unref (settings);
- }
+ eel_gconf_set_boolean (PREF_ENCRYPT_HEADER, encrypt_header);
fr_window_set_encrypt_header (data->window, encrypt_header);
break;
default:
diff --git a/src/dlg-update.c b/src/dlg-update.c
index a2c7e8a..f4c29fe 100644
--- a/src/dlg-update.c
+++ b/src/dlg-update.c
@@ -25,6 +25,7 @@
#include <gtk/gtk.h>
#include "dlg-update.h"
#include "file-utils.h"
+#include "gconf-utils.h"
#include "glib-utils.h"
#include "gtk-utils.h"
#include "main.h"
diff --git a/src/file-utils.c b/src/file-utils.c
index 838fc9b..e152ca0 100644
--- a/src/file-utils.c
+++ b/src/file-utils.c
@@ -33,8 +33,10 @@
#include <sys/time.h>
#include <sys/types.h>
#include <dirent.h>
+
#include <glib.h>
#include <gio/gio.h>
+#include <gconf/gconf-client.h>
#include "file-utils.h"
#include "glib-utils.h"
#include "main.h"
diff --git a/src/fr-archive.c b/src/fr-archive.c
index 81afdeb..741b478 100644
--- a/src/fr-archive.c
+++ b/src/fr-archive.c
@@ -1370,8 +1370,7 @@ create_tmp_base_dir (const char *base_dir,
dir = g_build_filename (temp_dir, "/", dest_dir, NULL);
debug (DEBUG_INFO, "symlink %s --> %s\n", dir, base_dir);
- if (! symlink (base_dir, dir))
- /* void */;
+ symlink (base_dir, dir);
g_free (dir);
g_free (dest_dir);
diff --git a/src/fr-window.c b/src/fr-window.c
index 6990482..43b928a 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -49,6 +49,7 @@
#include "glib-utils.h"
#include "main.h"
#include "gtk-utils.h"
+#include "gconf-utils.h"
#include "open-file.h"
#include "typedefs.h"
#include "ui.h"
@@ -386,11 +387,7 @@ struct _FrWindowPrivateData {
/* misc */
- GSettings *settings_listing;
- GSettings *settings_ui;
- GSettings *settings_general;
- GSettings *settings_dialogs;
- GSettings *settings_nautilus;
+ guint cnxn_id[GCONF_NOTIFICATIONS];
gulong theme_changed_handler_id;
gboolean non_interactive;
@@ -409,6 +406,17 @@ struct _FrWindowPrivateData {
static void
+fr_window_remove_notifications (FrWindow *window)
+{
+ int i;
+
+ for (i = 0; i < GCONF_NOTIFICATIONS; i++)
+ if (window->priv->cnxn_id[i] != -1)
+ eel_gconf_notification_remove (window->priv->cnxn_id[i]);
+}
+
+
+static void
fr_window_free_batch_data (FrWindow *window)
{
GList *scan;
@@ -537,48 +545,52 @@ fr_window_convert_data_free (FrWindow *window,
static void
fr_window_free_private_data (FrWindow *window)
{
- if (window->priv->update_timeout_handle != 0) {
- g_source_remove (window->priv->update_timeout_handle);
- window->priv->update_timeout_handle = 0;
+ FrWindowPrivateData *priv = window->priv;
+
+ if (priv->update_timeout_handle != 0) {
+ g_source_remove (priv->update_timeout_handle);
+ priv->update_timeout_handle = 0;
}
- if (window->priv->open_action != NULL) {
- g_object_unref (window->priv->open_action);
- window->priv->open_action = NULL;
+ fr_window_remove_notifications (window);
+
+ if (priv->open_action != NULL) {
+ g_object_unref (priv->open_action);
+ priv->open_action = NULL;
}
- if (window->priv->recent_toolbar_menu != NULL) {
- gtk_widget_destroy (window->priv->recent_toolbar_menu);
- window->priv->recent_toolbar_menu = NULL;
+ if (priv->recent_toolbar_menu != NULL) {
+ gtk_widget_destroy (priv->recent_toolbar_menu);
+ priv->recent_toolbar_menu = NULL;
}
- while (window->priv->activity_ref > 0)
+ while (priv->activity_ref > 0)
fr_window_stop_activity_mode (window);
- if (window->priv->progress_timeout != 0) {
- g_source_remove (window->priv->progress_timeout);
- window->priv->progress_timeout = 0;
+ if (priv->progress_timeout != 0) {
+ g_source_remove (priv->progress_timeout);
+ priv->progress_timeout = 0;
}
- if (window->priv->hide_progress_timeout != 0) {
- g_source_remove (window->priv->hide_progress_timeout);
- window->priv->hide_progress_timeout = 0;
+ if (priv->hide_progress_timeout != 0) {
+ g_source_remove (priv->hide_progress_timeout);
+ priv->hide_progress_timeout = 0;
}
- if (window->priv->theme_changed_handler_id != 0)
- g_signal_handler_disconnect (icon_theme, window->priv->theme_changed_handler_id);
+ if (priv->theme_changed_handler_id != 0)
+ g_signal_handler_disconnect (icon_theme, priv->theme_changed_handler_id);
fr_window_history_clear (window);
- g_free (window->priv->open_default_dir);
- g_free (window->priv->add_default_dir);
- g_free (window->priv->extract_default_dir);
- g_free (window->priv->archive_uri);
+ g_free (priv->open_default_dir);
+ g_free (priv->add_default_dir);
+ g_free (priv->extract_default_dir);
+ g_free (priv->archive_uri);
- g_free (window->priv->password);
- g_free (window->priv->password_for_paste);
+ g_free (priv->password);
+ g_free (priv->password_for_paste);
- g_object_unref (window->priv->list_store);
+ g_object_unref (priv->list_store);
if (window->priv->clipboard_data != NULL) {
fr_clipboard_data_unref (window->priv->clipboard_data);
@@ -588,32 +600,32 @@ fr_window_free_private_data (FrWindow *window)
fr_clipboard_data_unref (window->priv->copy_data);
window->priv->copy_data = NULL;
}
- if (window->priv->copy_from_archive != NULL) {
- g_object_unref (window->priv->copy_from_archive);
- window->priv->copy_from_archive = NULL;
+ if (priv->copy_from_archive != NULL) {
+ g_object_unref (priv->copy_from_archive);
+ priv->copy_from_archive = NULL;
}
fr_window_free_open_files (window);
fr_window_convert_data_free (window, TRUE);
- g_clear_error (&window->priv->drag_error);
- path_list_free (window->priv->drag_file_list);
- window->priv->drag_file_list = NULL;
+ g_clear_error (&priv->drag_error);
+ path_list_free (priv->drag_file_list);
+ priv->drag_file_list = NULL;
- if (window->priv->file_popup_menu != NULL) {
- gtk_widget_destroy (window->priv->file_popup_menu);
- window->priv->file_popup_menu = NULL;
+ if (priv->file_popup_menu != NULL) {
+ gtk_widget_destroy (priv->file_popup_menu);
+ priv->file_popup_menu = NULL;
}
- if (window->priv->folder_popup_menu != NULL) {
- gtk_widget_destroy (window->priv->folder_popup_menu);
- window->priv->folder_popup_menu = NULL;
+ if (priv->folder_popup_menu != NULL) {
+ gtk_widget_destroy (priv->folder_popup_menu);
+ priv->folder_popup_menu = NULL;
}
- if (window->priv->sidebar_folder_popup_menu != NULL) {
- gtk_widget_destroy (window->priv->sidebar_folder_popup_menu);
- window->priv->sidebar_folder_popup_menu = NULL;
+ if (priv->sidebar_folder_popup_menu != NULL) {
+ gtk_widget_destroy (priv->sidebar_folder_popup_menu);
+ priv->sidebar_folder_popup_menu = NULL;
}
g_free (window->priv->last_location);
@@ -621,19 +633,13 @@ fr_window_free_private_data (FrWindow *window)
fr_window_free_batch_data (window);
fr_window_reset_current_batch_action (window);
- g_free (window->priv->pd_last_archive);
- g_free (window->priv->extract_here_dir);
- g_free (window->priv->last_status_message);
-
- g_settings_set_enum (window->priv->settings_listing, PREF_LISTING_SORT_METHOD, window->priv->sort_method);
- g_settings_set_enum (window->priv->settings_listing, PREF_LISTING_SORT_TYPE, window->priv->sort_type);
- g_settings_set_enum (window->priv->settings_listing, PREF_LISTING_LIST_MODE, window->priv->last_list_mode);
+ g_free (priv->pd_last_archive);
+ g_free (priv->extract_here_dir);
+ g_free (priv->last_status_message);
- _g_object_unref (window->priv->settings_listing);
- _g_object_unref (window->priv->settings_ui);
- _g_object_unref (window->priv->settings_general);
- _g_object_unref (window->priv->settings_dialogs);
- _g_object_unref (window->priv->settings_nautilus);
+ preferences_set_sort_method (priv->sort_method);
+ preferences_set_sort_type (priv->sort_type);
+ preferences_set_list_mode (priv->last_list_mode);
}
@@ -698,16 +704,16 @@ fr_window_close (FrWindow *window)
int width, height;
gdk_drawable_get_size (gtk_widget_get_window (GTK_WIDGET (window)), &width, &height);
- g_settings_set_int (window->priv->settings_ui, PREF_UI_WINDOW_WIDTH, width);
- g_settings_set_int (window->priv->settings_ui, PREF_UI_WINDOW_HEIGHT, height);
+ eel_gconf_set_integer (PREF_UI_WINDOW_WIDTH, width);
+ eel_gconf_set_integer (PREF_UI_WINDOW_HEIGHT, height);
width = gtk_paned_get_position (GTK_PANED (window->priv->paned));
if (width > 0)
- g_settings_set_int (window->priv->settings_ui, PREF_UI_SIDEBAR_WIDTH, width);
+ eel_gconf_set_integer (PREF_UI_SIDEBAR_WIDTH, width);
width = gtk_tree_view_column_get_width (window->priv->filename_column);
if (width > 0)
- g_settings_set_int (window->priv->settings_listing, PREF_LISTING_NAME_COLUMN_WIDTH, width);
+ eel_gconf_set_integer (PREF_NAME_COLUMN_WIDTH, width);
}
g_idle_add (close__step2, window);
@@ -4571,12 +4577,15 @@ fr_window_delete_event_cb (GtkWidget *caller,
static gboolean
-is_single_click_policy (FrWindow *window)
+is_single_click_policy (void)
{
int click_policy;
- click_policy = g_settings_get_enum (window->priv->settings_nautilus, PREF_NAUTILUS_CLICK_POLICY);
- return click_policy == 0;
+ value = eel_gconf_get_string (PREF_NAUTILUS_CLICK_POLICY, "double");
+ result = strncmp (value, "single", 6) == 0;
+ g_free (value);
+
+ return result;
}
@@ -4699,7 +4708,7 @@ add_file_list_columns (FrWindow *window,
/* name */
- window->priv->single_click = is_single_click_policy (window);
+ window->priv->single_click = is_single_click_policy ();
renderer = gtk_cell_renderer_text_new ();
@@ -4716,7 +4725,7 @@ add_file_list_columns (FrWindow *window,
NULL);
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
- w = g_settings_get_int (window->priv->settings_listing, PREF_LISTING_NAME_COLUMN_WIDTH);
+ w = eel_gconf_get_integer (PREF_NAME_COLUMN_WIDTH, DEFAULT_NAME_COLUMN_WIDTH);
if (w <= 0)
w = DEFAULT_NAME_COLUMN_WIDTH;
gtk_tree_view_column_set_fixed_width (column, w);
@@ -4867,10 +4876,10 @@ fr_window_show_cb (GtkWidget *widget,
{
fr_window_update_current_location (window);
- set_active (window, "ViewToolbar", g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_TOOLBAR));
- set_active (window, "ViewStatusbar", g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_STATUSBAR));
+ set_active (window, "ViewToolbar", eel_gconf_get_boolean (PREF_UI_TOOLBAR, TRUE));
+ set_active (window, "ViewStatusbar", eel_gconf_get_boolean (PREF_UI_STATUSBAR, TRUE));
- window->priv->view_folders = g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_FOLDERS);
+ window->priv->view_folders = eel_gconf_get_boolean (PREF_UI_FOLDERS, FALSE);
set_active (window, "ViewFolders", window->priv->view_folders);
fr_window_update_filter_bar_visibility (window);
@@ -4883,56 +4892,61 @@ fr_window_show_cb (GtkWidget *widget,
static void
-pref_history_len_changed (GSettings *settings,
- const char *key,
- gpointer user_data)
+pref_history_len_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
{
FrWindow *window = user_data;
- gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->recent_chooser_menu),
- g_settings_get_int (settings, PREF_UI_HISTORY_LEN));
- gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->recent_chooser_toolbar),
- g_settings_get_int (settings, PREF_UI_HISTORY_LEN));
+ gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->recent_chooser_menu), eel_gconf_get_integer (PREF_UI_HISTORY_LEN, MAX_HISTORY_LEN));
+ gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->recent_chooser_toolbar), eel_gconf_get_integer (PREF_UI_HISTORY_LEN, MAX_HISTORY_LEN));
}
static void
-pref_view_toolbar_changed (GSettings *settings,
- const char *key,
- gpointer user_data)
+pref_view_toolbar_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
{
FrWindow *window = user_data;
- fr_window_set_toolbar_visibility (window, g_settings_get_boolean (settings, key));
+ g_return_if_fail (window != NULL);
+
+ fr_window_set_toolbar_visibility (window, gconf_value_get_bool (gconf_entry_get_value (entry)));
}
static void
-pref_view_statusbar_changed (GSettings *settings,
- const char *key,
- gpointer user_data)
+pref_view_statusbar_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
{
FrWindow *window = user_data;
- fr_window_set_statusbar_visibility (window, g_settings_get_boolean (settings, key));
+ fr_window_set_statusbar_visibility (window, gconf_value_get_bool (gconf_entry_get_value (entry)));
}
static void
-pref_view_folders_changed (GSettings *settings,
- const char *key,
- gpointer user_data)
+pref_view_folders_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
{
FrWindow *window = user_data;
- fr_window_set_folders_visibility (window, g_settings_get_boolean (settings, key));
+ fr_window_set_folders_visibility (window, gconf_value_get_bool (gconf_entry_get_value (entry)));
}
static void
-pref_show_field_changed (GSettings *settings,
- const char *key,
- gpointer user_data)
+pref_show_field_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
{
FrWindow *window = user_data;
@@ -4941,15 +4955,16 @@ pref_show_field_changed (GSettings *settings,
static void
-pref_click_policy_changed (GSettings *settings,
- const char *key,
- gpointer user_data)
+pref_click_policy_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
{
FrWindow *window = user_data;
GdkWindow *win = gtk_tree_view_get_bin_window (GTK_TREE_VIEW (window->priv->list_view));
GdkDisplay *display;
- window->priv->single_click = is_single_click_policy (window);
+ window->priv->single_click = is_single_click_policy ();
gdk_window_set_cursor (win, NULL);
display = gtk_widget_get_display (GTK_WIDGET (window->priv->list_view));
@@ -4964,9 +4979,10 @@ static void gh_unref_pixbuf (gpointer key,
static void
-pref_use_mime_icons_changed (GSettings *settings,
- const char *key,
- gpointer user_data)
+pref_use_mime_icons_changed (GConfClient *client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer user_data)
{
FrWindow *window = user_data;
@@ -5211,7 +5227,7 @@ fr_window_init_recent_chooser (FrWindow *window,
gtk_recent_chooser_add_filter (chooser, filter);
gtk_recent_chooser_set_local_only (chooser, FALSE);
- gtk_recent_chooser_set_limit (chooser, g_settings_get_int (window->priv->settings_ui, PREF_UI_HISTORY_LEN));
+ gtk_recent_chooser_set_limit (chooser, eel_gconf_get_integer (PREF_UI_HISTORY_LEN, MAX_HISTORY_LEN));
gtk_recent_chooser_set_show_not_found (chooser, TRUE);
gtk_recent_chooser_set_sort_type (chooser, GTK_RECENT_SORT_MRU);
@@ -5363,17 +5379,10 @@ fr_window_construct (FrWindow *window)
pixbuf_hash = g_hash_table_new (g_str_hash, g_str_equal);
if (tree_pixbuf_hash == NULL)
tree_pixbuf_hash = g_hash_table_new (g_str_hash, g_str_equal);
+
if (icon_theme == NULL)
icon_theme = gtk_icon_theme_get_default ();
- /* Create the settings objects */
-
- window->priv->settings_listing = g_settings_new (FILE_ROLLER_SCHEMA_LISTING);
- window->priv->settings_ui = g_settings_new (FILE_ROLLER_SCHEMA_UI);
- window->priv->settings_general = g_settings_new (FILE_ROLLER_SCHEMA_GENERAL);
- window->priv->settings_dialogs = g_settings_new (FILE_ROLLER_SCHEMA_DIALOGS);
- window->priv->settings_nautilus = g_settings_new (NAUTILUS_SCHEMA_PREFERENCES);
-
/* Create the application. */
window->priv->layout = gtk_table_new (4, 1, FALSE);
@@ -5409,8 +5418,8 @@ fr_window_construct (FrWindow *window)
dir_tree_icon_size = MAX (icon_width, icon_height);
gtk_window_set_default_size (GTK_WINDOW (window),
- g_settings_get_int (window->priv->settings_ui, PREF_UI_WINDOW_WIDTH),
- g_settings_get_int (window->priv->settings_ui, PREF_UI_WINDOW_HEIGHT));
+ eel_gconf_get_integer (PREF_UI_WINDOW_WIDTH, DEF_WIN_WIDTH),
+ eel_gconf_get_integer (PREF_UI_WINDOW_HEIGHT, DEF_WIN_HEIGHT));
gtk_drag_dest_set (GTK_WIDGET (window),
GTK_DEST_DEFAULT_ALL,
@@ -5466,17 +5475,17 @@ fr_window_construct (FrWindow *window)
fr_window_add_is_stoppable,
window);
- window->priv->sort_method = g_settings_get_enum (window->priv->settings_listing, PREF_LISTING_SORT_METHOD);
- window->priv->sort_type = g_settings_get_enum (window->priv->settings_listing, PREF_LISTING_SORT_TYPE);
-
- window->priv->list_mode = window->priv->last_list_mode = g_settings_get_enum (window->priv->settings_listing, PREF_LISTING_LIST_MODE);
- g_settings_set_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_PATH, (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT));
+ window->priv->sort_method = preferences_get_sort_method ();
+ window->priv->sort_type = preferences_get_sort_type ();
+ window->priv->list_mode = window->priv->last_list_mode = preferences_get_list_mode ();
window->priv->history = NULL;
window->priv->history_current = NULL;
window->priv->action = FR_ACTION_NONE;
+ eel_gconf_set_boolean (PREF_LIST_SHOW_PATH, (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT));
+
window->priv->open_default_dir = g_strdup (get_home_uri ());
window->priv->add_default_dir = g_strdup (get_home_uri ());
window->priv->extract_default_dir = g_strdup (get_home_uri ());
@@ -5504,8 +5513,8 @@ fr_window_construct (FrWindow *window)
window->priv->non_interactive = FALSE;
window->priv->password = NULL;
- window->priv->compression = g_settings_get_enum (window->priv->settings_general, PREF_GENERAL_COMPRESSION_LEVEL);
- window->priv->encrypt_header = g_settings_get_boolean (window->priv->settings_general, PREF_GENERAL_ENCRYPT_HEADER);
+ window->priv->compression = preferences_get_compression_level ();
+ window->priv->encrypt_header = eel_gconf_get_boolean (PREF_ENCRYPT_HEADER, FALSE);
window->priv->volume_size = 0;
window->priv->convert_data.converting = FALSE;
@@ -5731,7 +5740,7 @@ fr_window_construct (FrWindow *window)
window->priv->paned = gtk_hpaned_new ();
gtk_paned_pack1 (GTK_PANED (window->priv->paned), window->priv->sidepane, FALSE, TRUE);
gtk_paned_pack2 (GTK_PANED (window->priv->paned), list_scrolled_window, TRUE, TRUE);
- gtk_paned_set_position (GTK_PANED (window->priv->paned), g_settings_get_int (window->priv->settings_ui, PREF_UI_SIDEBAR_WIDTH));
+ gtk_paned_set_position (GTK_PANED (window->priv->paned), eel_gconf_get_integer (PREF_UI_SIDEBAR_WIDTH, DEF_SIDEBAR_WIDTH));
fr_window_attach (FR_WINDOW (window), window->priv->paned, FR_WINDOW_AREA_CONTENTS);
gtk_widget_show_all (window->priv->paned);
@@ -5874,7 +5883,7 @@ fr_window_construct (FrWindow *window)
/**/
fr_window_attach (FR_WINDOW (window), window->priv->toolbar, FR_WINDOW_AREA_TOOLBAR);
- if (g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_TOOLBAR))
+ if (eel_gconf_get_boolean (PREF_UI_TOOLBAR, TRUE))
gtk_widget_show (toolbar);
else
gtk_widget_hide (toolbar);
@@ -5920,7 +5929,7 @@ fr_window_construct (FrWindow *window)
gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (window->priv->statusbar), TRUE);
fr_window_attach (FR_WINDOW (window), window->priv->statusbar, FR_WINDOW_AREA_STATUSBAR);
- if (g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_STATUSBAR))
+ if (eel_gconf_get_boolean (PREF_UI_STATUSBAR, TRUE))
gtk_widget_show (window->priv->statusbar);
else
gtk_widget_hide (window->priv->statusbar);
@@ -5936,46 +5945,49 @@ fr_window_construct (FrWindow *window)
/* Add notification callbacks. */
- g_signal_connect (window->priv->settings_ui,
- "changed::" PREF_UI_HISTORY_LEN,
- G_CALLBACK (pref_history_len_changed),
- window);
- g_signal_connect (window->priv->settings_ui,
- "changed::" PREF_UI_VIEW_TOOLBAR,
- G_CALLBACK (pref_view_toolbar_changed),
- window);
- g_signal_connect (window->priv->settings_ui,
- "changed::" PREF_UI_VIEW_STATUSBAR,
- G_CALLBACK (pref_view_statusbar_changed),
- window);
- g_signal_connect (window->priv->settings_ui,
- "changed::" PREF_UI_VIEW_FOLDERS,
- G_CALLBACK (pref_view_folders_changed),
- window);
- g_signal_connect (window->priv->settings_listing,
- "changed::" PREF_LISTING_SHOW_TYPE,
- G_CALLBACK (pref_show_field_changed),
- window);
- g_signal_connect (window->priv->settings_listing,
- "changed::" PREF_LISTING_SHOW_SIZE,
- G_CALLBACK (pref_show_field_changed),
- window);
- g_signal_connect (window->priv->settings_listing,
- "changed::" PREF_LISTING_SHOW_TIME,
- G_CALLBACK (pref_show_field_changed),
- window);
- g_signal_connect (window->priv->settings_listing,
- "changed::" PREF_LISTING_SHOW_PATH,
- G_CALLBACK (pref_show_field_changed),
- window);
- g_signal_connect (window->priv->settings_listing,
- "changed::" PREF_LISTING_USE_MIME_ICONS,
- G_CALLBACK (pref_use_mime_icons_changed),
- window);
- g_signal_connect (window->priv->settings_nautilus,
- "changed::" PREF_NAUTILUS_CLICK_POLICY,
- G_CALLBACK (pref_click_policy_changed),
- window);
+ i = 0;
+
+ window->priv->cnxn_id[i++] = eel_gconf_notification_add (
+ PREF_UI_HISTORY_LEN,
+ pref_history_len_changed,
+ window);
+ window->priv->cnxn_id[i++] = eel_gconf_notification_add (
+ PREF_UI_TOOLBAR,
+ pref_view_toolbar_changed,
+ window);
+ window->priv->cnxn_id[i++] = eel_gconf_notification_add (
+ PREF_UI_STATUSBAR,
+ pref_view_statusbar_changed,
+ window);
+ window->priv->cnxn_id[i++] = eel_gconf_notification_add (
+ PREF_UI_FOLDERS,
+ pref_view_folders_changed,
+ window);
+ window->priv->cnxn_id[i++] = eel_gconf_notification_add (
+ PREF_LIST_SHOW_TYPE,
+ pref_show_field_changed,
+ window);
+ window->priv->cnxn_id[i++] = eel_gconf_notification_add (
+ PREF_LIST_SHOW_SIZE,
+ pref_show_field_changed,
+ window);
+ window->priv->cnxn_id[i++] = eel_gconf_notification_add (
+ PREF_LIST_SHOW_TIME,
+ pref_show_field_changed,
+ window);
+ window->priv->cnxn_id[i++] = eel_gconf_notification_add (
+ PREF_LIST_SHOW_PATH,
+ pref_show_field_changed,
+ window);
+ window->priv->cnxn_id[i++] = eel_gconf_notification_add (
+ PREF_LIST_USE_MIME_ICONS,
+ pref_use_mime_icons_changed,
+ window);
+
+ window->priv->cnxn_id[i++] = eel_gconf_notification_add (
+ PREF_NAUTILUS_CLICK_POLICY,
+ pref_click_policy_changed,
+ window);
/* Give focus to the list. */
@@ -6891,8 +6903,8 @@ fr_window_set_list_mode (FrWindow *window,
fr_window_history_add (window, "/");
}
- g_settings_set_enum (window->priv->settings_listing, PREF_LISTING_LIST_MODE, window->priv->last_list_mode);
- g_settings_set_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_PATH, (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT));
+ preferences_set_list_mode (window->priv->last_list_mode);
+ eel_gconf_set_boolean (PREF_LIST_SHOW_PATH, (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT));
fr_window_update_file_list (window, TRUE);
fr_window_update_dir_tree (window);
@@ -8410,16 +8422,16 @@ fr_window_update_columns_visibility (FrWindow *window)
GtkTreeViewColumn *column;
column = gtk_tree_view_get_column (tree_view, 1);
- gtk_tree_view_column_set_visible (column, g_settings_get_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_SIZE));
+ gtk_tree_view_column_set_visible (column, eel_gconf_get_boolean (PREF_LIST_SHOW_SIZE, TRUE));
column = gtk_tree_view_get_column (tree_view, 2);
- gtk_tree_view_column_set_visible (column, g_settings_get_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_TYPE));
+ gtk_tree_view_column_set_visible (column, eel_gconf_get_boolean (PREF_LIST_SHOW_TYPE, TRUE));
column = gtk_tree_view_get_column (tree_view, 3);
- gtk_tree_view_column_set_visible (column, g_settings_get_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_TIME));
+ gtk_tree_view_column_set_visible (column, eel_gconf_get_boolean (PREF_LIST_SHOW_TIME, TRUE));
column = gtk_tree_view_get_column (tree_view, 4);
- gtk_tree_view_column_set_visible (column, g_settings_get_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_PATH));
+ gtk_tree_view_column_set_visible (column, eel_gconf_get_boolean (PREF_LIST_SHOW_PATH, TRUE));
}
diff --git a/src/fr-window.h b/src/fr-window.h
index 905fd29..b136af2 100644
--- a/src/fr-window.h
+++ b/src/fr-window.h
@@ -28,6 +28,7 @@
#include "typedefs.h"
#include "fr-archive.h"
+#define GCONF_NOTIFICATIONS 10
enum {
COLUMN_FILE_DATA,
diff --git a/src/gconf-utils.c b/src/gconf-utils.c
new file mode 100644
index 0000000..3e74e1f
--- /dev/null
+++ b/src/gconf-utils.c
@@ -0,0 +1,862 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * File-Roller
+ *
+ * Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+ *
+ * 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 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+/* eel-gconf-extensions.c - Stuff to make GConf easier to use.
+
+ Copyright (C) 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Authors: Ramiro Estrugo <ramiro eazel com>
+*/
+
+/* Modified by Paolo Bacchilega <paolo bacch tin it> for File Roller. */
+
+#include <config.h>
+#include <string.h>
+#include <errno.h>
+
+#include <gconf/gconf-client.h>
+#include <gconf/gconf.h>
+#include "gconf-utils.h"
+#include "gtk-utils.h"
+#include "fr-error.h"
+
+static GConfClient *global_gconf_client = NULL;
+
+
+void
+eel_global_client_free (void)
+{
+ if (global_gconf_client == NULL) {
+ return;
+ }
+
+ g_object_unref (global_gconf_client);
+ global_gconf_client = NULL;
+}
+
+
+GConfClient *
+eel_gconf_client_get_global (void)
+{
+ /* Initialize gconf if needed */
+ if (!gconf_is_initialized ()) {
+ char *argv[] = { "eel-preferences", NULL };
+ GError *error = NULL;
+
+ if (!gconf_init (1, argv, &error)) {
+ if (eel_gconf_handle_error (&error)) {
+ return NULL;
+ }
+ }
+ }
+
+ if (global_gconf_client == NULL)
+ global_gconf_client = gconf_client_get_default ();
+
+ return global_gconf_client;
+}
+
+
+gboolean
+eel_gconf_handle_error (GError **error)
+{
+ static gboolean shown_dialog = FALSE;
+
+ g_return_val_if_fail (error != NULL, FALSE);
+
+ if (*error != NULL) {
+ g_warning ("GConf error:\n %s", (*error)->message);
+ if (! shown_dialog) {
+ GtkWidget *d;
+ shown_dialog = TRUE;
+ d = _gtk_error_dialog_new (NULL,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ NULL,
+ "GConf error",
+ "GConf error: %s\n"
+ "All further errors "
+ "shown only on terminal",
+ (*error)->message);
+ g_signal_connect (d, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ NULL);
+
+ gtk_widget_show (d);
+ }
+
+ g_error_free (*error);
+ *error = NULL;
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+static gboolean
+check_type (const char *key,
+ GConfValue *val,
+ GConfValueType t,
+ GError **err)
+{
+ if (val->type != t) {
+ g_set_error (err,
+ FR_ERROR,
+ errno,
+ "Type mismatch for key %s",
+ key);
+ return FALSE;
+ } else
+ return TRUE;
+}
+
+
+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 def)
+{
+ GError *error = NULL;
+ gboolean result = def;
+ GConfClient *client;
+ GConfValue *val;
+
+ g_return_val_if_fail (key != NULL, def);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, def);
+
+ val = gconf_client_get (client, key, &error);
+
+ if (val != NULL) {
+ if (check_type (key, val, GCONF_VALUE_BOOL, &error))
+ result = gconf_value_get_bool (val);
+ else
+ eel_gconf_handle_error (&error);
+ gconf_value_free (val);
+
+ } else if (error != NULL)
+ eel_gconf_handle_error (&error);
+
+ 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 def)
+{
+ GError *error = NULL;
+ int result = def;
+ GConfClient *client;
+ GConfValue *val;
+
+ g_return_val_if_fail (key != NULL, def);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, def);
+
+ val = gconf_client_get (client, key, &error);
+
+ if (val != NULL) {
+ if (check_type (key, val, GCONF_VALUE_INT, &error))
+ result = gconf_value_get_int (val);
+ else
+ eel_gconf_handle_error (&error);
+ gconf_value_free (val);
+
+ } else if (error != NULL)
+ eel_gconf_handle_error (&error);
+
+ return result;
+}
+
+
+void
+eel_gconf_set_float (const char *key,
+ float 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);
+}
+
+
+float
+eel_gconf_get_float (const char *key,
+ float def)
+{
+ GError *error = NULL;
+ float result = def;
+ GConfClient *client;
+ GConfValue *val;
+
+ g_return_val_if_fail (key != NULL, def);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, def);
+
+ val = gconf_client_get (client, key, &error);
+
+ if (val != NULL) {
+ if (check_type (key, val, GCONF_VALUE_FLOAT, &error))
+ result = gconf_value_get_float (val);
+ else
+ eel_gconf_handle_error (&error);
+ gconf_value_free (val);
+
+ } else if (error != NULL)
+ eel_gconf_handle_error (&error);
+
+ 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,
+ const char *def)
+{
+ GError *error = NULL;
+ char *result;
+ GConfClient *client;
+ char *val;
+
+ if (def != NULL)
+ result = g_strdup (def);
+ else
+ result = NULL;
+
+ g_return_val_if_fail (key != NULL, result);
+
+ client = eel_gconf_client_get_global ();
+ g_return_val_if_fail (client != NULL, result);
+
+ val = gconf_client_get_string (client, key, &error);
+
+ if (val != NULL) {
+ g_return_val_if_fail (error == NULL, result);
+ g_free (result);
+ result = g_strdup (val);
+ g_free (val);
+ } else if (error != NULL)
+ eel_gconf_handle_error (&error);
+
+ return result;
+}
+
+
+void
+eel_gconf_set_locale_string (const char *key,
+ const char *string_value)
+{
+ char *utf8;
+
+ utf8 = g_locale_to_utf8 (string_value, -1, 0, 0, 0);
+
+ if (utf8 != NULL) {
+ eel_gconf_set_string (key, utf8);
+ g_free (utf8);
+ }
+}
+
+
+char *
+eel_gconf_get_locale_string (const char *key,
+ const char *def)
+{
+ char *utf8;
+ char *result;
+
+ utf8 = eel_gconf_get_string (key, def);
+
+ if (utf8 == NULL)
+ return NULL;
+
+ result = g_locale_from_utf8 (utf8, -1, 0, 0, 0);
+ g_free (utf8);
+
+ 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;
+}
+
+
+GSList *
+eel_gconf_get_locale_string_list (const char *key)
+{
+ GSList *utf8_slist, *slist, *scan;
+
+ utf8_slist = eel_gconf_get_string_list (key);
+
+ slist = NULL;
+ for (scan = utf8_slist; scan; scan = scan->next) {
+ char *utf8 = scan->data;
+ char *locale = g_locale_from_utf8 (utf8, -1, 0, 0, 0);
+ slist = g_slist_prepend (slist, locale);
+ }
+
+ g_slist_foreach (utf8_slist, (GFunc) g_free, NULL);
+ g_slist_free (utf8_slist);
+
+ return g_slist_reverse (slist);
+}
+
+
+void
+eel_gconf_set_locale_string_list (const char *key,
+ const GSList *string_list_value)
+{
+ GSList *utf8_slist;
+ const GSList *scan;
+
+ utf8_slist = NULL;
+ for (scan = string_list_value; scan; scan = scan->next) {
+ char *locale = scan->data;
+ char *utf8 = g_locale_to_utf8 (locale, -1, 0, 0, 0);
+ utf8_slist = g_slist_prepend (utf8_slist, utf8);
+ }
+
+ utf8_slist = g_slist_reverse (utf8_slist);
+
+ eel_gconf_set_string_list (key, utf8_slist);
+
+ g_slist_foreach (utf8_slist, (GFunc) g_free, NULL);
+ g_slist_free (utf8_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_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 ();
+ break;
+ }
+
+ 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);
+ break;
+ }
+
+ 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);
+}
diff --git a/src/gconf-utils.h b/src/gconf-utils.h
new file mode 100644
index 0000000..0da6507
--- /dev/null
+++ b/src/gconf-utils.h
@@ -0,0 +1,137 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * File-Roller
+ *
+ * Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+ *
+ * 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 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+/* eel-gconf-extensions.h - Stuff to make GConf easier to use.
+
+ Copyright (C) 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Authors: Ramiro Estrugo <ramiro eazel com>
+*/
+
+/* Modified by Paolo Bacchilega <paolo bacch tin it> for File Roller. */
+
+#ifndef GCONF_UTILS_H
+#define GCONF_UTILS_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);
+
+void eel_global_client_free (void);
+
+gboolean eel_gconf_handle_error (GError **error);
+
+gboolean eel_gconf_get_boolean (const char *key,
+ gboolean def_val);
+
+void eel_gconf_set_boolean (const char *key,
+ gboolean value);
+
+int eel_gconf_get_integer (const char *key,
+ int def_val);
+
+void eel_gconf_set_integer (const char *key,
+ int value);
+
+float eel_gconf_get_float (const char *key,
+ float def_val);
+
+void eel_gconf_set_float (const char *key,
+ float value);
+
+char * eel_gconf_get_string (const char *key,
+ const char *def_val);
+
+void eel_gconf_set_string (const char *key,
+ const char *value);
+
+char * eel_gconf_get_locale_string (const char *key,
+ const char *def_val);
+
+void eel_gconf_set_locale_string (const char *key,
+ const char *value);
+
+GSList * eel_gconf_get_string_list (const char *key);
+
+void eel_gconf_set_string_list (const char *key,
+ const GSList *string_list_value);
+
+GSList * eel_gconf_get_locale_string_list(const char *key);
+
+void eel_gconf_set_locale_string_list(const char *key,
+ const GSList *string_list_value);
+
+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);
+
+G_END_DECLS
+
+#endif /* GCONF_UTILS_H */
diff --git a/src/glib-utils.c b/src/glib-utils.c
index 4773f36..7935f13 100644
--- a/src/glib-utils.c
+++ b/src/glib-utils.c
@@ -25,37 +25,12 @@
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gprintf.h>
-#include <glib-object.h>
#include "glib-utils.h"
#define MAX_PATTERNS 128
-/* gobject utils*/
-
-
-gpointer
-_g_object_ref (gpointer object)
-{
- if (object != NULL)
- return g_object_ref (object);
- else
- return NULL;
-}
-
-
-void
-_g_object_unref (gpointer object)
-{
- if (object != NULL)
- g_object_unref (object);
-}
-
-
-/* string utils */
-
-
gboolean
strchrs (const char *str,
const char *chars)
@@ -668,46 +643,3 @@ g_uri_display_basename (const char *uri)
return name;
}
-
-
-char **
-_g_strv_prepend (char **str_array,
- const char *str)
-{
- char **result;
- int i;
- int j;
-
- result = g_new (char *, g_strv_length (str_array) + 1);
- i = 0;
- result[i++] = g_strdup (str);
- for (j = 0; str_array[j] != NULL; j++)
- result[i++] = g_strdup (str_array[j]);
- result[i] = NULL;
-
- return result;
-}
-
-
-gboolean
-_g_strv_remove (char **str_array,
- const char *str)
-{
- int i;
- int j;
-
- if (str == NULL)
- return FALSE;
-
- for (i = 0; str_array[i] != NULL; i++)
- if (strcmp (str_array[i], str) == 0)
- break;
-
- if (str_array[i] == NULL)
- return FALSE;
-
- for (j = i; str_array[j] != NULL; j++)
- str_array[j] = str_array[j + 1];
-
- return TRUE;
-}
diff --git a/src/glib-utils.h b/src/glib-utils.h
index 233cb95..3ef92d2 100644
--- a/src/glib-utils.h
+++ b/src/glib-utils.h
@@ -29,13 +29,6 @@
g_signal_handlers_disconnect_matched ((instance), G_SIGNAL_MATCH_DATA, \
0, 0, NULL, NULL, (data))
-/* gobject utils */
-
-gpointer _g_object_ref (gpointer object);
-void _g_object_unref (gpointer object);
-
-/* string utils */
-
gboolean strchrs (const char *str,
const char *chars);
char * str_substitute (const char *str,
@@ -76,10 +69,6 @@ int g_ptr_array_binary_search (GPtrArray *array,
GCompareFunc func);
const char * get_static_string (const char *s);
char* g_uri_display_basename (const char *uri);
-char ** _g_strv_prepend (char **str_array,
- const char *str);
-gboolean _g_strv_remove (char **str_array,
- const char *str);
/**/
diff --git a/src/main.c b/src/main.c
index 4b54a5b..1056241 100644
--- a/src/main.c
+++ b/src/main.c
@@ -49,6 +49,7 @@
#include "fr-command-lrzip.h"
#include "fr-process.h"
#include "fr-stock.h"
+#include "gconf-utils.h"
#include "fr-window.h"
#include "typedefs.h"
#include "preferences.h"
@@ -334,6 +335,9 @@ main (int argc, char **argv)
static void
initialize_data (void)
{
+ eel_gconf_monitor_add ("/apps/file-roller");
+ eel_gconf_monitor_add (PREF_NAUTILUS_CLICK_POLICY);
+
ProgramsCache = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
@@ -381,12 +385,87 @@ release_data ()
{
g_hash_table_destroy (ProgramsCache);
+ eel_global_client_free ();
+
while (CommandList != NULL) {
CommandData *cdata = CommandList->data;
command_done (cdata);
}
}
+/* Create the windows. */
+
+
+static void
+migrate_dir_from_to (const char *from_dir,
+ const char *to_dir)
+{
+ char *from_path;
+ char *to_path;
+
+ from_path = get_home_relative_path (from_dir);
+ to_path = get_home_relative_path (to_dir);
+
+ if (uri_is_dir (from_path) && ! uri_exists (to_path)) {
+ char *line;
+ char *e1;
+ char *e2;
+
+ e1 = g_shell_quote (from_path);
+ e2 = g_shell_quote (to_path);
+ line = g_strdup_printf ("mv -f %s %s", e1, e2);
+ g_free (e1);
+ g_free (e2);
+
+ g_spawn_command_line_sync (line, NULL, NULL, NULL, NULL);
+ g_free (line);
+ }
+
+ g_free (from_path);
+ g_free (to_path);
+}
+
+
+static void
+migrate_file_from_to (const char *from_file,
+ const char *to_file)
+{
+ char *from_path;
+ char *to_path;
+
+ from_path = get_home_relative_path (from_file);
+ to_path = get_home_relative_path (to_file);
+
+ if (uri_is_file (from_path) && ! uri_exists (to_path)) {
+ char *line;
+ char *e1;
+ char *e2;
+
+ e1 = g_shell_quote (from_path);
+ e2 = g_shell_quote (to_path);
+ line = g_strdup_printf ("mv -f %s %s", e1, e2);
+ g_free (e1);
+ g_free (e2);
+
+ g_spawn_command_line_sync (line, NULL, NULL, NULL, NULL);
+ g_free (line);
+ }
+
+ g_free (from_path);
+ g_free (to_path);
+}
+
+
+static void
+migrate_to_new_directories (void)
+{
+ migrate_dir_from_to (OLD_RC_OPTIONS_DIR, RC_OPTIONS_DIR);
+ migrate_file_from_to (OLD_RC_BOOKMARKS_FILE, RC_BOOKMARKS_FILE);
+ migrate_file_from_to (OLD_RC_RECENT_FILE, RC_RECENT_FILE);
+
+ eel_gconf_set_boolean (PREF_MIGRATE_DIRECTORIES, FALSE);
+}
+
/* -- FrRegisteredCommand -- */
@@ -836,7 +915,7 @@ prepare_app (void)
uri = get_home_relative_uri (RC_DIR);
- if (uri_is_file (uri)) { /* before the GConf port this was a file, now it's folder. */
+ if (uri_is_file (uri)) { /* before the gconf port this was a file, now it's folder. */
GFile *file;
file = g_file_new_for_uri (uri);
@@ -847,6 +926,9 @@ prepare_app (void)
ensure_dir_exists (uri, 0700, NULL);
g_free (uri);
+ if (eel_gconf_get_boolean (PREF_MIGRATE_DIRECTORIES, TRUE))
+ migrate_to_new_directories ();
+
register_commands ();
compute_supported_archive_types ();
diff --git a/src/preferences.c b/src/preferences.c
index 176e059..22683d2 100644
--- a/src/preferences.c
+++ b/src/preferences.c
@@ -21,52 +21,248 @@
*/
#include <string.h>
+#include <gconf/gconf-client.h>
#include "typedefs.h"
#include "preferences.h"
#include "main.h"
#include "file-utils.h"
+#include "gconf-utils.h"
#include "fr-window.h"
+#define DIALOG_PREFIX "/apps/file-roller/dialogs/"
+
+
+typedef struct {
+ int i_value;
+ char *s_value;
+} EnumStringTable;
+
+
+static int
+get_enum_from_string (EnumStringTable *table,
+ const char *s_value)
+{
+ int i;
+
+ /* return the first value if s_value is invalid */
+
+ if (s_value == NULL)
+ return table[0].i_value;
+
+ for (i = 0; table[i].s_value != NULL; i++)
+ if (strcmp (s_value, table[i].s_value) == 0)
+ return table[i].i_value;
+
+ return table[0].i_value;
+}
+
+
+static char *
+get_string_from_enum (EnumStringTable *table,
+ int i_value)
+{
+ int i;
+
+ for (i = 0; table[i].s_value != NULL; i++)
+ if (i_value == table[i].i_value)
+ return table[i].s_value;
+
+ /* return the first value if i_value is invalid */
+
+ return table[0].s_value;
+}
+
+
+/* --------------- */
+
+
+static EnumStringTable sort_method_table [] = {
+ { FR_WINDOW_SORT_BY_NAME, "name" },
+ { FR_WINDOW_SORT_BY_SIZE, "size" },
+ { FR_WINDOW_SORT_BY_TYPE, "type" },
+ { FR_WINDOW_SORT_BY_TIME, "time" },
+ { FR_WINDOW_SORT_BY_PATH, "path" },
+ { 0, NULL }
+};
+
+static EnumStringTable sort_type_table [] = {
+ { GTK_SORT_ASCENDING, "ascending" },
+ { GTK_SORT_DESCENDING, "descending" },
+ { 0, NULL }
+};
+
+static EnumStringTable list_mode_table [] = {
+ { FR_WINDOW_LIST_MODE_FLAT, "all_files" },
+ { FR_WINDOW_LIST_MODE_AS_DIR, "as_folder" },
+ { 0, NULL }
+};
+
+static EnumStringTable compression_level_table [] = {
+ { FR_COMPRESSION_VERY_FAST, "very_fast" },
+ { FR_COMPRESSION_FAST, "fast" },
+ { FR_COMPRESSION_NORMAL, "normal" },
+ { FR_COMPRESSION_MAXIMUM, "maximum" },
+ { 0, NULL }
+};
+
+
+/* --------------- */
+
+
+FrWindowSortMethod
+preferences_get_sort_method (void)
+{
+ char *s_value;
+ int i_value;
+
+ s_value = eel_gconf_get_string (PREF_LIST_SORT_METHOD, "name");
+ i_value = get_enum_from_string (sort_method_table, s_value);
+ g_free (s_value);
+
+ return (FrWindowSortMethod) i_value;
+}
+
+
+void
+preferences_set_sort_method (FrWindowSortMethod i_value)
+{
+ char *s_value;
+
+ s_value = get_string_from_enum (sort_method_table, i_value);
+ eel_gconf_set_string (PREF_LIST_SORT_METHOD, s_value);
+}
+
+
+GtkSortType
+preferences_get_sort_type (void)
+{
+ char *s_value;
+ int i_value;
+
+ s_value = eel_gconf_get_string (PREF_LIST_SORT_TYPE, "ascending");
+ i_value = get_enum_from_string (sort_type_table, s_value);
+ g_free (s_value);
+
+ return (GtkSortType) i_value;
+}
+
+
+void
+preferences_set_sort_type (GtkSortType i_value)
+{
+ char *s_value;
+
+ s_value = get_string_from_enum (sort_type_table, i_value);
+ eel_gconf_set_string (PREF_LIST_SORT_TYPE, s_value);
+}
+
+
+FrWindowListMode
+preferences_get_list_mode (void)
+{
+ char *s_value;
+ int i_value;
+
+ s_value = eel_gconf_get_string (PREF_LIST_MODE, "as_folder");
+ i_value = get_enum_from_string (list_mode_table, s_value);
+ g_free (s_value);
+
+ return (FrWindowListMode) i_value;
+}
+
+
+void
+preferences_set_list_mode (FrWindowListMode i_value)
+{
+ char *s_value;
+
+ s_value = get_string_from_enum (list_mode_table, i_value);
+ eel_gconf_set_string (PREF_LIST_MODE, s_value);
+}
+
+
+FrCompression
+preferences_get_compression_level (void)
+{
+ char *s_value;
+ int i_value;
+
+ s_value = eel_gconf_get_string (PREF_ADD_COMPRESSION_LEVEL, "normal");
+ i_value = get_enum_from_string (compression_level_table, s_value);
+ g_free (s_value);
+
+ return (FrCompression) i_value;
+}
+
+
+void
+preferences_set_compression_level (FrCompression i_value)
+{
+ char *s_value;
+
+ s_value = get_string_from_enum (compression_level_table, i_value);
+ eel_gconf_set_string (PREF_ADD_COMPRESSION_LEVEL, s_value);
+}
+
+
+static void
+set_dialog_property_int (const char *dialog,
+ const char *property,
+ int value)
+{
+ char *key;
+
+ key = g_strconcat (DIALOG_PREFIX, dialog, "/", property, NULL);
+ eel_gconf_set_integer (key, value);
+ g_free (key);
+}
+
+
void
pref_util_save_window_geometry (GtkWindow *window,
- const char *dialog_id)
+ const char *dialog)
{
- char *schema;
- GSettings *settings;
- int width;
- int height;
+ int x, y, width, height;
- schema = g_strconcat (FILE_ROLLER_SCHEMA_DIALOGS, ".", dialog_id, NULL);
- settings = g_settings_new (schema);
+ gtk_window_get_position (window, &x, &y);
+ set_dialog_property_int (dialog, "x", x);
+ set_dialog_property_int (dialog, "y", y);
gtk_window_get_size (window, &width, &height);
- g_settings_set_int (settings, "width", width);
- g_settings_set_int (settings, "height", height);
+ set_dialog_property_int (dialog, "width", width);
+ set_dialog_property_int (dialog, "height", height);
+}
+
- g_object_unref (settings);
- g_free (schema);
+static int
+get_dialog_property_int (const char *dialog,
+ const char *property)
+{
+ char *key;
+ int value;
+
+ key = g_strconcat (DIALOG_PREFIX, dialog, "/", property, NULL);
+ value = eel_gconf_get_integer (key, -1);
+ g_free (key);
+
+ return value;
}
void
pref_util_restore_window_geometry (GtkWindow *window,
- const char *dialog_id)
+ const char *dialog)
{
- char *schema;
- GSettings *settings;
- int width;
- int height;
+ int x, y, width, height;
- schema = g_strconcat (FILE_ROLLER_SCHEMA_DIALOGS, ".", dialog_id, NULL);
- settings = g_settings_new (schema);
+ x = get_dialog_property_int (dialog, "x");
+ y = get_dialog_property_int (dialog, "y");
+ width = get_dialog_property_int (dialog, "width");
+ height = get_dialog_property_int (dialog, "height");
- width = g_settings_get_int (settings, "width");
- height = g_settings_get_int (settings, "height");
- if ((width != -1) && (height != 1))
+ if (width != -1 && height != 1)
gtk_window_set_default_size (window, width, height);
- gtk_window_present (window);
- g_object_unref (settings);
- g_free (schema);
+ gtk_window_present (window);
}
diff --git a/src/preferences.h b/src/preferences.h
index 4500c56..1cb9385 100644
--- a/src/preferences.h
+++ b/src/preferences.h
@@ -3,7 +3,7 @@
/*
* File-Roller
*
- * Copyright (C) 2001, 2003, 2010 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2003 Free Software Foundation, Inc.
*
* 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
@@ -27,61 +27,63 @@
#include "typedefs.h"
#include "fr-window.h"
-#define FILE_ROLLER_SCHEMA "org.gnome.file-roller"
-#define FILE_ROLLER_SCHEMA_LISTING FILE_ROLLER_SCHEMA ".listing"
-#define FILE_ROLLER_SCHEMA_UI FILE_ROLLER_SCHEMA ".ui"
-#define FILE_ROLLER_SCHEMA_GENERAL FILE_ROLLER_SCHEMA ".general"
-#define FILE_ROLLER_SCHEMA_DIALOGS FILE_ROLLER_SCHEMA ".dialogs"
-#define FILE_ROLLER_SCHEMA_ADD FILE_ROLLER_SCHEMA_DIALOGS ".add"
-#define FILE_ROLLER_SCHEMA_BATCH_ADD FILE_ROLLER_SCHEMA_DIALOGS ".batch-add"
-#define FILE_ROLLER_SCHEMA_EXTRACT FILE_ROLLER_SCHEMA_DIALOGS ".extract"
-#define FILE_ROLLER_SCHEMA_LAST_OUTPUT FILE_ROLLER_SCHEMA_DIALOGS ".last-output"
+#define PREF_LIST_SORT_METHOD "/apps/file-roller/listing/sort_method"
+#define PREF_LIST_SORT_TYPE "/apps/file-roller/listing/sort_type"
+#define PREF_LIST_MODE "/apps/file-roller/listing/list_mode"
+#define PREF_LIST_SHOW_TYPE "/apps/file-roller/listing/show_type"
+#define PREF_LIST_SHOW_SIZE "/apps/file-roller/listing/show_size"
+#define PREF_LIST_SHOW_TIME "/apps/file-roller/listing/show_time"
+#define PREF_LIST_SHOW_PATH "/apps/file-roller/listing/show_path"
+#define PREF_LIST_USE_MIME_ICONS "/apps/file-roller/listing/use_mime_icons"
+#define PREF_NAME_COLUMN_WIDTH "/apps/file-roller/listing/name_column_width"
-#define PREF_LISTING_SORT_METHOD "sort-method"
-#define PREF_LISTING_SORT_TYPE "sort-type"
-#define PREF_LISTING_LIST_MODE "list-mode"
-#define PREF_LISTING_SHOW_TYPE "show-type"
-#define PREF_LISTING_SHOW_SIZE "show-size"
-#define PREF_LISTING_SHOW_TIME "show-time"
-#define PREF_LISTING_SHOW_PATH "show-path"
-#define PREF_LISTING_USE_MIME_ICONS "use-mime-icons"
-#define PREF_LISTING_NAME_COLUMN_WIDTH "name-column-width"
+#define PREF_UI_WINDOW_WIDTH "/apps/file-roller/ui/window_width"
+#define PREF_UI_WINDOW_HEIGHT "/apps/file-roller/ui/window_height"
+#define PREF_UI_SIDEBAR_WIDTH "/apps/file-roller/ui/sidebar_width"
+#define PREF_UI_HISTORY_LEN "/apps/file-roller/ui/history_len"
+#define PREF_UI_TOOLBAR "/apps/file-roller/ui/view_toolbar"
+#define PREF_UI_STATUSBAR "/apps/file-roller/ui/view_statusbar"
+#define PREF_UI_FOLDERS "/apps/file-roller/ui/view_folders"
-#define PREF_UI_WINDOW_WIDTH "window-width"
-#define PREF_UI_WINDOW_HEIGHT "window-height"
-#define PREF_UI_SIDEBAR_WIDTH "sidebar-width"
-#define PREF_UI_HISTORY_LEN "history-len"
-#define PREF_UI_VIEW_TOOLBAR "view-toolbar"
-#define PREF_UI_VIEW_STATUSBAR "view-statusbar"
-#define PREF_UI_VIEW_FOLDERS "view-folders"
+#define PREF_EDIT_EDITORS "/apps/file-roller/general/editors"
+#define PREF_ADD_COMPRESSION_LEVEL "/apps/file-roller/general/compression_level"
+#define PREF_ENCRYPT_HEADER "/apps/file-roller/general/encrypt_header"
+#define PREF_MIGRATE_DIRECTORIES "/apps/file-roller/general/migrate_directories"
-#define PREF_GENERAL_EDITORS "editors"
-#define PREF_GENERAL_COMPRESSION_LEVEL "compression-level"
-#define PREF_GENERAL_ENCRYPT_HEADER "encrypt-header"
+#define PREF_EXTRACT_OVERWRITE "/apps/file-roller/dialogs/extract/overwrite"
+#define PREF_EXTRACT_SKIP_NEWER "/apps/file-roller/dialogs/extract/skip_newer"
+#define PREF_EXTRACT_RECREATE_FOLDERS "/apps/file-roller/dialogs/extract/recreate_folders"
-#define PREF_EXTRACT_OVERWRITE "overwrite"
-#define PREF_EXTRACT_SKIP_NEWER "skip-newer"
-#define PREF_EXTRACT_RECREATE_FOLDERS "recreate-folders"
+#define PREF_ADD_CURRENT_FOLDER "/apps/file-roller/dialogs/add/current_folder"
+#define PREF_ADD_FILENAME "/apps/file-roller/dialogs/add/filename"
+#define PREF_ADD_INCLUDE_FILES "/apps/file-roller/dialogs/add/include_files"
+#define PREF_ADD_EXCLUDE_FILES "/apps/file-roller/dialogs/add/exclude_files"
+#define PREF_ADD_EXCLUDE_FOLDERS "/apps/file-roller/dialogs/add/exclude_folders"
+#define PREF_ADD_UPDATE "/apps/file-roller/dialogs/add/update"
+#define PREF_ADD_RECURSIVE "/apps/file-roller/dialogs/add/recursive"
+#define PREF_ADD_NO_SYMLINKS "/apps/file-roller/dialogs/add/no_symlinks"
-#define PREF_ADD_CURRENT_FOLDER "current-folder"
-#define PREF_ADD_FILENAME "filename"
-#define PREF_ADD_INCLUDE_FILES "include-files"
-#define PREF_ADD_EXCLUDE_FILES "exclude-files"
-#define PREF_ADD_EXCLUDE_FOLDERS "exclude-folders"
-#define PREF_ADD_UPDATE "update"
-#define PREF_ADD_RECURSIVE "recursive"
-#define PREF_ADD_NO_SYMLINKS "no-symlinks"
+#define PREF_BATCH_ADD_DEFAULT_EXTENSION "/apps/file-roller/dialogs/batch-add/default_extension"
+#define PREF_BATCH_OTHER_OPTIONS "/apps/file-roller/dialogs/batch-add/other_options"
+#define PREF_BATCH_VOLUME_SIZE "/apps/file-roller/dialogs/batch-add/volume_size"
-#define PREF_BATCH_ADD_DEFAULT_EXTENSION "default-extension"
-#define PREF_BATCH_ADD_OTHER_OPTIONS "other-options"
-#define PREF_BATCH_ADD_VOLUME_SIZE "volume-size"
+#define PREF_DESKTOP_ICON_THEME "/desktop/gnome/file_views/icon_theme"
+#define PREF_DESKTOP_MENUS_HAVE_TEAROFF "/desktop/gnome/interface/menus_have_tearoff"
+#define PREF_DESKTOP_MENUBAR_DETACHABLE "/desktop/gnome/interface/menubar_detachable"
+#define PREF_DESKTOP_TOOLBAR_DETACHABLE "/desktop/gnome/interface/toolbar_detachable"
+#define PREF_NAUTILUS_CLICK_POLICY "/apps/nautilus/preferences/click_policy"
-#define NAUTILUS_SCHEMA_PREFERENCES "org.gnome.nautilus.preferences"
-#define PREF_NAUTILUS_CLICK_POLICY "click-policy"
-
-void pref_util_save_window_geometry (GtkWindow *window,
- const char *dialog_id);
-void pref_util_restore_window_geometry (GtkWindow *window,
- const char *dialog_id);
+FrWindowSortMethod preferences_get_sort_method (void);
+void preferences_set_sort_method (FrWindowSortMethod i_value);
+GtkSortType preferences_get_sort_type (void);
+void preferences_set_sort_type (GtkSortType i_value);
+FrWindowListMode preferences_get_list_mode (void);
+void preferences_set_list_mode (FrWindowListMode i_value);
+FrCompression preferences_get_compression_level (void);
+void preferences_set_compression_level (FrCompression i_value);
+void pref_util_save_window_geometry (GtkWindow *window,
+ const char *dialog);
+void pref_util_restore_window_geometry (GtkWindow *window,
+ const char *dialog);
#endif /* PREFERENCES_H */
diff --git a/src/typedefs.h b/src/typedefs.h
index 0f7bb51..2fe31d7 100644
--- a/src/typedefs.h
+++ b/src/typedefs.h
@@ -23,9 +23,6 @@
#ifndef TYPEDEFS_H
#define TYPEDEFS_H
-#include <glib.h>
-#include <glib-object.h>
-
#define MEGABYTE (1024 * 1024)
#define RC_DIR ".gnome2/file-roller"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]