summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/actions.c24
-rw-r--r--src/dlg-add-files.c10
-rw-r--r--src/dlg-add-folder.c37
-rw-r--r--src/dlg-batch-add.c26
-rw-r--r--src/dlg-extract.c20
-rw-r--r--src/dlg-new.c25
-rw-r--r--src/dlg-open-with.c83
-rw-r--r--src/dlg-password.c9
-rw-r--r--src/dlg-update.c1
-rw-r--r--src/file-utils.c3
-rw-r--r--src/fr-archive.c3
-rw-r--r--src/fr-window.c338
-rw-r--r--src/fr-window.h1
-rw-r--r--src/glib-utils.c68
-rw-r--r--src/glib-utils.h11
-rw-r--r--src/main.c85
-rw-r--r--src/mateconf-utils.c862
-rw-r--r--src/mateconf-utils.h137
-rw-r--r--src/preferences.c244
-rw-r--r--src/preferences.h100
-rw-r--r--src/typedefs.h3
22 files changed, 449 insertions, 1643 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 008b457..3fd656b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -130,8 +130,6 @@ engrampa_SOURCES = \
fr-process.h \
fr-window.c \
fr-window.h \
- mateconf-utils.c \
- mateconf-utils.h \
gio-utils.c \
gio-utils.h \
glib-utils.c \
diff --git a/src/actions.c b/src/actions.c
index 41066a7..bf41c37 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -39,7 +39,6 @@
#include "fr-window.h"
#include "file-utils.h"
#include "fr-process.h"
-#include "mateconf-utils.h"
#include "glib-utils.h"
#include "main.h"
#include "typedefs.h"
@@ -428,6 +427,7 @@ 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,7 +447,9 @@ save_file_response_cb (GtkWidget *w,
encrypt_header = dlg_new_data_get_encrypt_header (data);
volume_size = dlg_new_data_get_volume_size (data);
- eel_mateconf_set_integer (PREF_BATCH_VOLUME_SIZE, volume_size);
+ settings = g_settings_new (ENGRAMPA_SCHEMA_BATCH_ADD);
+ g_settings_set_int (settings, PREF_BATCH_ADD_VOLUME_SIZE, volume_size);
+ g_object_unref (settings);
fr_window_archive_save_as (data->window, path, password, encrypt_header, volume_size);
gtk_widget_destroy (data->dialog);
@@ -723,7 +725,11 @@ void
activate_action_view_toolbar (GtkAction *action,
gpointer data)
{
- eel_mateconf_set_boolean (PREF_UI_TOOLBAR, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ GSettings *settings;
+
+ settings = g_settings_new (ENGRAMPA_SCHEMA_UI);
+ g_settings_set_boolean (settings, PREF_UI_VIEW_TOOLBAR, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ g_object_unref (settings);
}
@@ -731,7 +737,11 @@ void
activate_action_view_statusbar (GtkAction *action,
gpointer data)
{
- eel_mateconf_set_boolean (PREF_UI_STATUSBAR, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ GSettings *settings;
+
+ settings = g_settings_new (ENGRAMPA_SCHEMA_UI);
+ g_settings_set_boolean (settings, PREF_UI_VIEW_STATUSBAR, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ g_object_unref (settings);
}
@@ -739,7 +749,11 @@ void
activate_action_view_folders (GtkAction *action,
gpointer data)
{
- eel_mateconf_set_boolean (PREF_UI_FOLDERS, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ GSettings *settings;
+
+ settings = g_settings_new (ENGRAMPA_SCHEMA_UI);
+ g_settings_set_boolean (settings, PREF_UI_VIEW_FOLDERS, gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+ g_object_unref (settings);
}
diff --git a/src/dlg-add-files.c b/src/dlg-add-files.c
index ce53043..6de4e57 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 "mateconf-utils.h"
#include "gtk-utils.h"
#include "preferences.h"
typedef struct {
FrWindow *window;
+ GSettings *settings;
GtkWidget *dialog;
GtkWidget *add_if_newer_checkbutton;
} DialogData;
@@ -44,6 +44,7 @@ static void
open_file_destroy_cb (GtkWidget *file_sel,
DialogData *data)
{
+ g_object_unref (data->settings);
g_free (data);
}
@@ -63,8 +64,8 @@ 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);
- eel_mateconf_set_string (PREF_ADD_CURRENT_FOLDER, current_folder);
- eel_mateconf_set_string (PREF_ADD_FILENAME, uri);
+ g_settings_set_string (data->settings, PREF_ADD_CURRENT_FOLDER, current_folder);
+ g_settings_set_string (data->settings, PREF_ADD_FILENAME, uri);
fr_window_set_add_default_dir (window, current_folder);
g_free (uri);
@@ -138,6 +139,7 @@ add_files_cb (GtkWidget *widget,
data = g_new0 (DialogData, 1);
data->window = callback_data;
+ data->settings = g_settings_new (ENGRAMPA_SCHEMA_ADD);
data->dialog = file_sel =
gtk_file_chooser_dialog_new (_("Add Files"),
GTK_WINDOW (data->window),
@@ -168,7 +170,7 @@ add_files_cb (GtkWidget *widget,
/* set data */
- folder = eel_mateconf_get_string (PREF_ADD_CURRENT_FOLDER, "");
+ folder = g_settings_get_string (data->settings, 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 0b8a973..1e80305 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 "mateconf-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,6 +59,7 @@ static void
open_file_destroy_cb (GtkWidget *widget,
DialogData *data)
{
+ g_object_unref (data->settings);
g_free (data->last_options);
g_free (data);
}
@@ -210,7 +211,7 @@ add_folder_cb (GtkWidget *widget,
GtkWidget *align;
data = g_new0 (DialogData, 1);
-
+ data->settings = g_settings_new (ENGRAMPA_SCHEMA_ADD);
data->window = callback_data;
data->dialog = file_sel =
@@ -505,14 +506,14 @@ dlg_add_folder_load_last_options (DialogData *data)
gboolean recursive;
gboolean no_symlinks;
- base_dir = eel_mateconf_get_string (PREF_ADD_CURRENT_FOLDER, "");
- filename = eel_mateconf_get_string (PREF_ADD_FILENAME, "");
- include_files = eel_mateconf_get_string (PREF_ADD_INCLUDE_FILES, "");
- exclude_files = eel_mateconf_get_string (PREF_ADD_EXCLUDE_FILES, "");
- exclude_folders = eel_mateconf_get_string (PREF_ADD_EXCLUDE_FOLDERS, "");
- update = eel_mateconf_get_boolean (PREF_ADD_UPDATE, FALSE);
- recursive = eel_mateconf_get_boolean (PREF_ADD_RECURSIVE, TRUE);
- no_symlinks = eel_mateconf_get_boolean (PREF_ADD_NO_SYMLINKS, FALSE);
+ 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);
sync_widgets_with_options (data,
base_dir,
@@ -629,14 +630,14 @@ dlg_add_folder_save_last_options (DialogData *data)
&recursive,
&no_symlinks);
- eel_mateconf_set_string (PREF_ADD_CURRENT_FOLDER, base_dir);
- eel_mateconf_set_string (PREF_ADD_FILENAME, filename);
- eel_mateconf_set_string (PREF_ADD_INCLUDE_FILES, include_files);
- eel_mateconf_set_string (PREF_ADD_EXCLUDE_FILES, exclude_files);
- eel_mateconf_set_string (PREF_ADD_EXCLUDE_FOLDERS, exclude_folders);
- eel_mateconf_set_boolean (PREF_ADD_UPDATE, update);
- eel_mateconf_set_boolean (PREF_ADD_RECURSIVE, recursive);
- eel_mateconf_set_boolean (PREF_ADD_NO_SYMLINKS, 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);
g_free (base_dir);
g_free (filename);
diff --git a/src/dlg-batch-add.c b/src/dlg-batch-add.c
index f3e22fd..28dbc01 100644
--- a/src/dlg-batch-add.c
+++ b/src/dlg-batch-add.c
@@ -28,7 +28,6 @@
#include <gtk/gtk.h>
#include "file-utils.h"
#include "fr-stock.h"
-#include "mateconf-utils.h"
#include "fr-window.h"
#include "typedefs.h"
#include "gtk-utils.h"
@@ -38,12 +37,13 @@
#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,10 @@ static void
destroy_cb (GtkWidget *widget,
DialogData *data)
{
- eel_mateconf_set_string (PREF_BATCH_ADD_DEFAULT_EXTENSION, get_ext (data));
- /*eel_mateconf_set_boolean (PREF_BATCH_OTHER_OPTIONS, data->add_clicked ? FALSE : gtk_expander_get_expanded (GTK_EXPANDER (data->a_other_options_expander)));*/
- eel_mateconf_set_boolean (PREF_ENCRYPT_HEADER, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton)));
+ 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)));
+
if (! data->add_clicked) {
fr_window_pop_message (data->window);
@@ -93,6 +94,8 @@ destroy_cb (GtkWidget *widget,
}
g_object_unref (data->builder);
+ g_object_unref (data->settings_general);
+ g_object_unref (data->settings);
g_free (data);
}
@@ -124,7 +127,7 @@ set_archive_options (DialogData *data)
value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (data->a_volume_spinbutton));
size = floor (value * MEGABYTE);
- eel_mateconf_set_integer (PREF_BATCH_VOLUME_SIZE, size);
+ g_settings_set_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE, size);
fr_window_set_volume_size (data->window, (guint) size);
}
}
@@ -479,6 +482,8 @@ dlg_batch_add_files (FrWindow *window,
return;
data = g_new0 (DialogData, 1);
+ data->settings = g_settings_new (ENGRAMPA_SCHEMA_BATCH_ADD);
+ data->settings_general = g_settings_new (ENGRAMPA_SCHEMA_GENERAL);
data->builder = _gtk_builder_new_from_file ("batch-add-files.ui");
if (data->builder == NULL) {
@@ -521,9 +526,10 @@ 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 /*eel_mateconf_get_boolean (PREF_BATCH_OTHER_OPTIONS, FALSE)*/);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->a_encrypt_header_checkbutton), eel_mateconf_get_boolean (PREF_ENCRYPT_HEADER, FALSE));
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->a_volume_spinbutton), (double) eel_mateconf_get_integer (PREF_BATCH_VOLUME_SIZE, 0) / MEGABYTE);
+ 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);
+
first_filename = (char*) file_list->data;
parent = remove_level_from_path (first_filename);
@@ -596,7 +602,7 @@ dlg_batch_add_files (FrWindow *window,
/* Run dialog. */
- default_ext = eel_mateconf_get_string (PREF_BATCH_ADD_DEFAULT_EXTENSION, DEFAULT_EXTENSION);
+ default_ext = g_settings_get_string (data->settings, PREF_BATCH_ADD_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 4ddcd74..b4c5228 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 "mateconf-utils.h"
typedef struct {
FrWindow *window;
+ GSettings *settings;
GList *selected_files;
char *base_dir_for_selection;
@@ -63,6 +63,7 @@ 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);
}
@@ -190,10 +191,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));
- eel_mateconf_set_boolean (PREF_EXTRACT_OVERWRITE, overwrite);
- if (!gtk_toggle_button_get_inconsistent (GTK_TOGGLE_BUTTON (data->e_not_newer_checkbutton)))
- eel_mateconf_set_boolean (PREF_EXTRACT_SKIP_NEWER, skip_newer);
- eel_mateconf_set_boolean (PREF_EXTRACT_RECREATE_FOLDERS, !junk_paths);
+ 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);
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));
@@ -419,7 +420,7 @@ dlg_extract__common (FrWindow *window,
GtkWidget *file_sel;
data = g_new0 (DialogData, 1);
-
+ data->settings = g_settings_new (ENGRAMPA_SCHEMA_EXTRACT);
data->window = window;
data->selected_files = selected_files;
data->base_dir_for_selection = base_dir_for_selection;
@@ -453,14 +454,15 @@ 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), eel_mateconf_get_boolean (PREF_EXTRACT_OVERWRITE, FALSE));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->e_not_newer_checkbutton), eel_mateconf_get_boolean (PREF_EXTRACT_SKIP_NEWER, FALSE));
+ 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));
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), eel_mateconf_get_boolean (PREF_EXTRACT_RECREATE_FOLDERS, TRUE));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->e_recreate_dir_checkbutton), g_settings_get_boolean (data->settings, PREF_EXTRACT_RECREATE_FOLDERS));
+
/* Set the signals handlers. */
diff --git a/src/dlg-new.c b/src/dlg-new.c
index e2ceaa5..d160c06 100644
--- a/src/dlg-new.c
+++ b/src/dlg-new.c
@@ -28,7 +28,6 @@
#include "dlg-new.h"
#include "file-utils.h"
#include "fr-stock.h"
-#include "mateconf-utils.h"
#include "gtk-utils.h"
#include "main.h"
#include "preferences.h"
@@ -271,6 +270,7 @@ dlg_new_archive (FrWindow *window,
DlgNewData *data;
GtkWidget *n_new_button;
GtkFileFilter *filter;
+ GSettings *settings;
/*char *default_ext;*/
int i;
@@ -306,16 +306,8 @@ 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_mateconf_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"));
@@ -334,8 +326,13 @@ 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);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->n_encrypt_header_checkbutton), eel_mateconf_get_boolean (PREF_ENCRYPT_HEADER, FALSE));
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (data->n_volume_spinbutton), (double) eel_mateconf_get_integer (PREF_BATCH_VOLUME_SIZE, 0) / MEGABYTE);
+ settings = g_settings_new (ENGRAMPA_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 (ENGRAMPA_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);
/* format chooser */
@@ -422,10 +419,6 @@ dlg_new_archive (FrWindow *window,
/* Run dialog. */
-/* default_ext = eel_mateconf_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 303a08c..3d04889 100644
--- a/src/dlg-open-with.c
+++ b/src/dlg-open-with.c
@@ -25,7 +25,6 @@
#include <gtk/gtk.h>
#include "file-utils.h"
-#include "mateconf-utils.h"
#include "glib-utils.h"
#include "gtk-utils.h"
#include "main.h"
@@ -38,7 +37,8 @@ enum { ICON_COLUMN, TEXT_COLUMN, DATA_COLUMN, N_COLUMNS };
typedef struct {
FrWindow *window;
- GtkBuilder *builder;
+ GSettings *settings;
+ GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *o_app_tree_view;
@@ -62,14 +62,13 @@ 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);
}
@@ -83,7 +82,8 @@ open_cb (GtkWidget *widget,
gboolean present = FALSE;
char *command = NULL;
GList *scan;
- GSList *sscan, *editors;
+ char **editors;
+ int i;
application = gtk_entry_get_text (GTK_ENTRY (data->o_app_entry));
@@ -98,23 +98,25 @@ open_cb (GtkWidget *widget,
/* add the command to the editors list if not already present. */
- editors = eel_mateconf_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);
+ 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]);
present = TRUE;
}
}
if (! present) {
- editors = g_slist_prepend (editors, g_strdup (application));
+ char **new_editors;
+
+ new_editors = _g_strv_prepend (editors, g_strdup (application));
command = g_strdup (application);
- eel_mateconf_set_string_list (PREF_EDIT_EDITORS, editors);
+ g_settings_set_strv (data->settings, PREF_GENERAL_EDITORS, (const gchar * const *) new_editors);
+
+ g_strfreev (new_editors);
}
- g_slist_foreach (editors, (GFunc) g_free, NULL);
- g_slist_free (editors);
+ g_strfreev (editors);
/* exec the application */
@@ -242,8 +244,8 @@ delete_recent_cb (GtkWidget *widget,
if (data->last_clicked_list == data->o_recent_tree_view) {
- char *editor;
- GSList *editors, *link;
+ char *editor;
+ char **editors;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (data->o_recent_tree_view));
if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
@@ -256,17 +258,10 @@ delete_recent_cb (GtkWidget *widget,
/**/
- editors = eel_mateconf_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_mateconf_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);
-
+ 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);
+ g_strfreev (editors);
g_free (editor);
}
else if (data->last_clicked_list == data->o_app_tree_view) {
@@ -296,22 +291,23 @@ void
dlg_open_with (FrWindow *window,
GList *file_list)
{
- DialogData *data;
- GAppInfo *app;
- GList *scan, *app_names = NULL;
- GSList *sscan, *editors;
- GtkWidget *cancel_button;
- GtkTreeIter iter;
- GtkCellRenderer *renderer;
+ 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;
+ GtkIconTheme *theme;
+ int icon_size;
if (file_list == NULL)
return;
data = g_new0 (DialogData, 1);
-
+ data->settings = g_settings_new (ENGRAMPA_SCHEMA_GENERAL);
data->builder = _gtk_builder_new_from_file ("open-with.ui");
if (data->builder == NULL) {
g_free (data);
@@ -472,17 +468,14 @@ dlg_open_with (FrWindow *window,
data->recent_model);
g_object_unref (G_OBJECT (data->recent_model));
- editors = eel_mateconf_get_string_list (PREF_EDIT_EDITORS);
- for (sscan = editors; sscan; sscan = sscan->next) {
- char *editor = sscan->data;
-
+ editors = g_settings_get_strv (data->settings, PREF_GENERAL_EDITORS);
+ for (i = 0; editors[i] != NULL; i++) {
gtk_list_store_append (GTK_LIST_STORE (data->recent_model), &iter);
gtk_list_store_set (GTK_LIST_STORE (data->recent_model), &iter,
- 0, editor,
+ 0, editors[i],
-1);
}
- g_slist_foreach (editors, (GFunc) g_free, NULL);
- g_slist_free (editors);
+ g_strfreev (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 738022d..cd2a3f8 100644
--- a/src/dlg-password.c
+++ b/src/dlg-password.c
@@ -24,7 +24,6 @@
#include <string.h>
#include <gtk/gtk.h>
#include "fr-window.h"
-#include "mateconf-utils.h"
#include "gtk-utils.h"
#include "preferences.h"
@@ -63,7 +62,13 @@ response_cb (GtkWidget *dialog,
g_free (password);
encrypt_header = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->pw_encrypt_header_checkbutton));
- eel_mateconf_set_boolean (PREF_ENCRYPT_HEADER, encrypt_header);
+ {
+ GSettings *settings;
+
+ settings = g_settings_new (ENGRAMPA_SCHEMA_GENERAL);
+ g_settings_set_boolean (settings, PREF_GENERAL_ENCRYPT_HEADER, encrypt_header);
+ g_object_unref (settings);
+ }
fr_window_set_encrypt_header (data->window, encrypt_header);
break;
default:
diff --git a/src/dlg-update.c b/src/dlg-update.c
index 2d53ada..6dfdecd 100644
--- a/src/dlg-update.c
+++ b/src/dlg-update.c
@@ -25,7 +25,6 @@
#include <gtk/gtk.h>
#include "dlg-update.h"
#include "file-utils.h"
-#include "mateconf-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 94c99ad..1491790 100644
--- a/src/file-utils.c
+++ b/src/file-utils.c
@@ -36,7 +36,6 @@
#include <glib.h>
#include <gio/gio.h>
-#include <mateconf/mateconf-client.h>
#include "file-utils.h"
#include "glib-utils.h"
#include "main.h"
@@ -954,7 +953,7 @@ gboolean
is_temp_work_dir (const char *dir)
{
int i;
- const char *folder;
+ char *folder;
if (strncmp (dir, "file://", 7) == 0)
dir = dir + 7;
diff --git a/src/fr-archive.c b/src/fr-archive.c
index 87acc03..0758acf 100644
--- a/src/fr-archive.c
+++ b/src/fr-archive.c
@@ -1370,7 +1370,8 @@ 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);
- symlink (base_dir, dir);
+ if (! symlink (base_dir, dir))
+ /* void */;
g_free (dir);
g_free (dest_dir);
diff --git a/src/fr-window.c b/src/fr-window.c
index 14f6595..cf3cc5c 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -49,7 +49,6 @@
#include "glib-utils.h"
#include "main.h"
#include "gtk-utils.h"
-#include "mateconf-utils.h"
#include "open-file.h"
#include "typedefs.h"
#include "ui.h"
@@ -387,7 +386,11 @@ struct _FrWindowPrivateData {
/* misc */
- guint cnxn_id[MATECONF_NOTIFICATIONS];
+ GSettings *settings_listing;
+ GSettings *settings_ui;
+ GSettings *settings_general;
+ GSettings *settings_dialogs;
+ GSettings *settings_caja;
gulong theme_changed_handler_id;
gboolean non_interactive;
@@ -406,17 +409,6 @@ struct _FrWindowPrivateData {
static void
-fr_window_remove_notifications (FrWindow *window)
-{
- int i;
-
- for (i = 0; i < MATECONF_NOTIFICATIONS; i++)
- if (window->priv->cnxn_id[i] != -1)
- eel_mateconf_notification_remove (window->priv->cnxn_id[i]);
-}
-
-
-static void
fr_window_free_batch_data (FrWindow *window)
{
GList *scan;
@@ -545,52 +537,48 @@ fr_window_convert_data_free (FrWindow *window,
static void
fr_window_free_private_data (FrWindow *window)
{
- 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->update_timeout_handle != 0) {
+ g_source_remove (window->priv->update_timeout_handle);
+ window->priv->update_timeout_handle = 0;
}
- fr_window_remove_notifications (window);
-
- if (priv->open_action != NULL) {
- g_object_unref (priv->open_action);
- priv->open_action = NULL;
+ if (window->priv->open_action != NULL) {
+ g_object_unref (window->priv->open_action);
+ window->priv->open_action = NULL;
}
- if (priv->recent_toolbar_menu != NULL) {
- gtk_widget_destroy (priv->recent_toolbar_menu);
- priv->recent_toolbar_menu = NULL;
+ if (window->priv->recent_toolbar_menu != NULL) {
+ gtk_widget_destroy (window->priv->recent_toolbar_menu);
+ window->priv->recent_toolbar_menu = NULL;
}
- while (priv->activity_ref > 0)
+ while (window->priv->activity_ref > 0)
fr_window_stop_activity_mode (window);
- if (priv->progress_timeout != 0) {
- g_source_remove (priv->progress_timeout);
- priv->progress_timeout = 0;
+ if (window->priv->progress_timeout != 0) {
+ g_source_remove (window->priv->progress_timeout);
+ window->priv->progress_timeout = 0;
}
- if (priv->hide_progress_timeout != 0) {
- g_source_remove (priv->hide_progress_timeout);
- priv->hide_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->theme_changed_handler_id != 0)
- g_signal_handler_disconnect (icon_theme, priv->theme_changed_handler_id);
+ if (window->priv->theme_changed_handler_id != 0)
+ g_signal_handler_disconnect (icon_theme, window->priv->theme_changed_handler_id);
fr_window_history_clear (window);
- 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->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->password);
- g_free (priv->password_for_paste);
+ g_free (window->priv->password);
+ g_free (window->priv->password_for_paste);
- g_object_unref (priv->list_store);
+ g_object_unref (window->priv->list_store);
if (window->priv->clipboard_data != NULL) {
fr_clipboard_data_unref (window->priv->clipboard_data);
@@ -600,32 +588,32 @@ fr_window_free_private_data (FrWindow *window)
fr_clipboard_data_unref (window->priv->copy_data);
window->priv->copy_data = NULL;
}
- if (priv->copy_from_archive != NULL) {
- g_object_unref (priv->copy_from_archive);
- priv->copy_from_archive = NULL;
+ if (window->priv->copy_from_archive != NULL) {
+ g_object_unref (window->priv->copy_from_archive);
+ window->priv->copy_from_archive = NULL;
}
fr_window_free_open_files (window);
fr_window_convert_data_free (window, TRUE);
- g_clear_error (&priv->drag_error);
- path_list_free (priv->drag_file_list);
- priv->drag_file_list = NULL;
+ g_clear_error (&window->priv->drag_error);
+ path_list_free (window->priv->drag_file_list);
+ window->priv->drag_file_list = NULL;
- if (priv->file_popup_menu != NULL) {
- gtk_widget_destroy (priv->file_popup_menu);
- priv->file_popup_menu = NULL;
+ if (window->priv->file_popup_menu != NULL) {
+ gtk_widget_destroy (window->priv->file_popup_menu);
+ window->priv->file_popup_menu = NULL;
}
- if (priv->folder_popup_menu != NULL) {
- gtk_widget_destroy (priv->folder_popup_menu);
- priv->folder_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->sidebar_folder_popup_menu != NULL) {
- gtk_widget_destroy (priv->sidebar_folder_popup_menu);
- priv->sidebar_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;
}
g_free (window->priv->last_location);
@@ -633,13 +621,19 @@ fr_window_free_private_data (FrWindow *window)
fr_window_free_batch_data (window);
fr_window_reset_current_batch_action (window);
- g_free (priv->pd_last_archive);
- g_free (priv->extract_here_dir);
- g_free (priv->last_status_message);
+ 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);
- preferences_set_sort_method (priv->sort_method);
- preferences_set_sort_type (priv->sort_type);
- preferences_set_list_mode (priv->last_list_mode);
+ _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_caja);
}
@@ -710,16 +704,16 @@ fr_window_close (FrWindow *window)
gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(window)), &width, &height);
#endif
- eel_mateconf_set_integer (PREF_UI_WINDOW_WIDTH, width);
- eel_mateconf_set_integer (PREF_UI_WINDOW_HEIGHT, 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);
width = gtk_paned_get_position (GTK_PANED (window->priv->paned));
if (width > 0)
- eel_mateconf_set_integer (PREF_UI_SIDEBAR_WIDTH, width);
+ g_settings_set_int (window->priv->settings_ui, PREF_UI_SIDEBAR_WIDTH, width);
width = gtk_tree_view_column_get_width (window->priv->filename_column);
if (width > 0)
- eel_mateconf_set_integer (PREF_NAME_COLUMN_WIDTH, width);
+ g_settings_set_int (window->priv->settings_listing, PREF_LISTING_NAME_COLUMN_WIDTH, width);
}
g_idle_add (close__step2, window);
@@ -4583,13 +4577,13 @@ fr_window_delete_event_cb (GtkWidget *caller,
static gboolean
-is_single_click_policy (void)
+is_single_click_policy (FrWindow *window)
{
char *value;
gboolean result;
- value = eel_mateconf_get_string (PREF_CAJA_CLICK_POLICY, "double");
- result = strncmp (value, "single", 6) == 0;
+ value = g_settings_get_string (window->priv->settings_caja, CAJA_CLICK_POLICY);
+ result = (value != NULL) && (strncmp (value, "single", 6) == 0);
g_free (value);
return result;
@@ -4715,7 +4709,7 @@ add_file_list_columns (FrWindow *window,
/* name */
- window->priv->single_click = is_single_click_policy ();
+ window->priv->single_click = is_single_click_policy (window);
renderer = gtk_cell_renderer_text_new ();
@@ -4732,7 +4726,7 @@ add_file_list_columns (FrWindow *window,
NULL);
gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
- w = eel_mateconf_get_integer (PREF_NAME_COLUMN_WIDTH, DEFAULT_NAME_COLUMN_WIDTH);
+ w = g_settings_get_int (window->priv->settings_listing, PREF_LISTING_NAME_COLUMN_WIDTH);
if (w <= 0)
w = DEFAULT_NAME_COLUMN_WIDTH;
gtk_tree_view_column_set_fixed_width (column, w);
@@ -4883,10 +4877,10 @@ fr_window_show_cb (GtkWidget *widget,
{
fr_window_update_current_location (window);
- set_active (window, "ViewToolbar", eel_mateconf_get_boolean (PREF_UI_TOOLBAR, TRUE));
- set_active (window, "ViewStatusbar", eel_mateconf_get_boolean (PREF_UI_STATUSBAR, TRUE));
+ 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));
- window->priv->view_folders = eel_mateconf_get_boolean (PREF_UI_FOLDERS, FALSE);
+ window->priv->view_folders = g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_FOLDERS);
set_active (window, "ViewFolders", window->priv->view_folders);
fr_window_update_filter_bar_visibility (window);
@@ -4899,61 +4893,56 @@ fr_window_show_cb (GtkWidget *widget,
static void
-pref_history_len_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+pref_history_len_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
FrWindow *window = user_data;
- gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->recent_chooser_menu), eel_mateconf_get_integer (PREF_UI_HISTORY_LEN, MAX_HISTORY_LEN));
- gtk_recent_chooser_set_limit (GTK_RECENT_CHOOSER (window->priv->recent_chooser_toolbar), eel_mateconf_get_integer (PREF_UI_HISTORY_LEN, MAX_HISTORY_LEN));
+ 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));
}
static void
-pref_view_toolbar_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+pref_view_toolbar_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
FrWindow *window = user_data;
- g_return_if_fail (window != NULL);
-
- fr_window_set_toolbar_visibility (window, mateconf_value_get_bool (mateconf_entry_get_value (entry)));
+ fr_window_set_toolbar_visibility (window, g_settings_get_boolean (settings, key));
}
static void
-pref_view_statusbar_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+pref_view_statusbar_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
FrWindow *window = user_data;
- fr_window_set_statusbar_visibility (window, mateconf_value_get_bool (mateconf_entry_get_value (entry)));
+ fr_window_set_statusbar_visibility (window, g_settings_get_boolean (settings, key));
}
static void
-pref_view_folders_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+pref_view_folders_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
FrWindow *window = user_data;
- fr_window_set_folders_visibility (window, mateconf_value_get_bool (mateconf_entry_get_value (entry)));
+ fr_window_set_folders_visibility (window, g_settings_get_boolean (settings, key));
}
static void
-pref_show_field_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+pref_show_field_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
FrWindow *window = user_data;
@@ -4962,16 +4951,15 @@ pref_show_field_changed (MateConfClient *client,
static void
-pref_click_policy_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+pref_click_policy_changed (GSettings *settings,
+ const char *key,
+ 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->priv->single_click = is_single_click_policy (window);
gdk_window_set_cursor (win, NULL);
display = gtk_widget_get_display (GTK_WIDGET (window->priv->list_view));
@@ -4986,10 +4974,9 @@ static void gh_unref_pixbuf (gpointer key,
static void
-pref_use_mime_icons_changed (MateConfClient *client,
- guint cnxn_id,
- MateConfEntry *entry,
- gpointer user_data)
+pref_use_mime_icons_changed (GSettings *settings,
+ const char *key,
+ gpointer user_data)
{
FrWindow *window = user_data;
@@ -5234,7 +5221,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, eel_mateconf_get_integer (PREF_UI_HISTORY_LEN, MAX_HISTORY_LEN));
+ gtk_recent_chooser_set_limit (chooser, g_settings_get_int (window->priv->settings_ui, PREF_UI_HISTORY_LEN));
gtk_recent_chooser_set_show_not_found (chooser, TRUE);
gtk_recent_chooser_set_sort_type (chooser, GTK_RECENT_SORT_MRU);
@@ -5390,6 +5377,14 @@ fr_window_construct (FrWindow *window)
if (icon_theme == NULL)
icon_theme = gtk_icon_theme_get_default ();
+ /* Create the settings objects */
+
+ window->priv->settings_listing = g_settings_new (ENGRAMPA_SCHEMA_LISTING);
+ window->priv->settings_ui = g_settings_new (ENGRAMPA_SCHEMA_UI);
+ window->priv->settings_general = g_settings_new (ENGRAMPA_SCHEMA_GENERAL);
+ window->priv->settings_dialogs = g_settings_new (ENGRAMPA_SCHEMA_DIALOGS);
+ window->priv->settings_caja = g_settings_new (CAJA_SCHEMA);
+
/* Create the application. */
window->priv->layout = gtk_table_new (4, 1, FALSE);
@@ -5425,8 +5420,8 @@ fr_window_construct (FrWindow *window)
dir_tree_icon_size = MAX (icon_width, icon_height);
gtk_window_set_default_size (GTK_WINDOW (window),
- eel_mateconf_get_integer (PREF_UI_WINDOW_WIDTH, DEF_WIN_WIDTH),
- eel_mateconf_get_integer (PREF_UI_WINDOW_HEIGHT, DEF_WIN_HEIGHT));
+ g_settings_get_int (window->priv->settings_ui, PREF_UI_WINDOW_WIDTH),
+ g_settings_get_int (window->priv->settings_ui, PREF_UI_WINDOW_HEIGHT));
gtk_drag_dest_set (GTK_WIDGET (window),
GTK_DEST_DEFAULT_ALL,
@@ -5482,17 +5477,17 @@ fr_window_construct (FrWindow *window)
fr_window_add_is_stoppable,
window);
- window->priv->sort_method = preferences_get_sort_method ();
- window->priv->sort_type = preferences_get_sort_type ();
+ 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->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_mateconf_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 ());
@@ -5520,8 +5515,8 @@ fr_window_construct (FrWindow *window)
window->priv->non_interactive = FALSE;
window->priv->password = NULL;
- window->priv->compression = preferences_get_compression_level ();
- window->priv->encrypt_header = eel_mateconf_get_boolean (PREF_ENCRYPT_HEADER, FALSE);
+ 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->volume_size = 0;
window->priv->convert_data.converting = FALSE;
@@ -5747,7 +5742,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), eel_mateconf_get_integer (PREF_UI_SIDEBAR_WIDTH, DEF_SIDEBAR_WIDTH));
+ gtk_paned_set_position (GTK_PANED (window->priv->paned), g_settings_get_int (window->priv->settings_ui, PREF_UI_SIDEBAR_WIDTH));
fr_window_attach (FR_WINDOW (window), window->priv->paned, FR_WINDOW_AREA_CONTENTS);
gtk_widget_show_all (window->priv->paned);
@@ -5890,7 +5885,7 @@ fr_window_construct (FrWindow *window)
/**/
fr_window_attach (FR_WINDOW (window), window->priv->toolbar, FR_WINDOW_AREA_TOOLBAR);
- if (eel_mateconf_get_boolean (PREF_UI_TOOLBAR, TRUE))
+ if (g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_TOOLBAR))
gtk_widget_show (toolbar);
else
gtk_widget_hide (toolbar);
@@ -5936,7 +5931,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 (eel_mateconf_get_boolean (PREF_UI_STATUSBAR, TRUE))
+ if (g_settings_get_boolean (window->priv->settings_ui, PREF_UI_VIEW_STATUSBAR))
gtk_widget_show (window->priv->statusbar);
else
gtk_widget_hide (window->priv->statusbar);
@@ -5952,49 +5947,46 @@ fr_window_construct (FrWindow *window)
/* Add notification callbacks. */
- i = 0;
-
- window->priv->cnxn_id[i++] = eel_mateconf_notification_add (
- PREF_UI_HISTORY_LEN,
- pref_history_len_changed,
- window);
- window->priv->cnxn_id[i++] = eel_mateconf_notification_add (
- PREF_UI_TOOLBAR,
- pref_view_toolbar_changed,
- window);
- window->priv->cnxn_id[i++] = eel_mateconf_notification_add (
- PREF_UI_STATUSBAR,
- pref_view_statusbar_changed,
- window);
- window->priv->cnxn_id[i++] = eel_mateconf_notification_add (
- PREF_UI_FOLDERS,
- pref_view_folders_changed,
- window);
- window->priv->cnxn_id[i++] = eel_mateconf_notification_add (
- PREF_LIST_SHOW_TYPE,
- pref_show_field_changed,
- window);
- window->priv->cnxn_id[i++] = eel_mateconf_notification_add (
- PREF_LIST_SHOW_SIZE,
- pref_show_field_changed,
- window);
- window->priv->cnxn_id[i++] = eel_mateconf_notification_add (
- PREF_LIST_SHOW_TIME,
- pref_show_field_changed,
- window);
- window->priv->cnxn_id[i++] = eel_mateconf_notification_add (
- PREF_LIST_SHOW_PATH,
- pref_show_field_changed,
- window);
- window->priv->cnxn_id[i++] = eel_mateconf_notification_add (
- PREF_LIST_USE_MIME_ICONS,
- pref_use_mime_icons_changed,
- window);
-
- window->priv->cnxn_id[i++] = eel_mateconf_notification_add (
- PREF_CAJA_CLICK_POLICY,
- pref_click_policy_changed,
- window);
+ 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_caja,
+ "changed::" CAJA_CLICK_POLICY,
+ G_CALLBACK (pref_click_policy_changed),
+ window);
/* Give focus to the list. */
@@ -6910,8 +6902,8 @@ fr_window_set_list_mode (FrWindow *window,
fr_window_history_add (window, "/");
}
- preferences_set_list_mode (window->priv->last_list_mode);
- eel_mateconf_set_boolean (PREF_LIST_SHOW_PATH, (window->priv->list_mode == FR_WINDOW_LIST_MODE_FLAT));
+ 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));
fr_window_update_file_list (window, TRUE);
fr_window_update_dir_tree (window);
@@ -8429,16 +8421,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, eel_mateconf_get_boolean (PREF_LIST_SHOW_SIZE, TRUE));
+ gtk_tree_view_column_set_visible (column, g_settings_get_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_SIZE));
column = gtk_tree_view_get_column (tree_view, 2);
- gtk_tree_view_column_set_visible (column, eel_mateconf_get_boolean (PREF_LIST_SHOW_TYPE, TRUE));
+ gtk_tree_view_column_set_visible (column, g_settings_get_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_TYPE));
column = gtk_tree_view_get_column (tree_view, 3);
- gtk_tree_view_column_set_visible (column, eel_mateconf_get_boolean (PREF_LIST_SHOW_TIME, TRUE));
+ gtk_tree_view_column_set_visible (column, g_settings_get_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_TIME));
column = gtk_tree_view_get_column (tree_view, 4);
- gtk_tree_view_column_set_visible (column, eel_mateconf_get_boolean (PREF_LIST_SHOW_PATH, TRUE));
+ gtk_tree_view_column_set_visible (column, g_settings_get_boolean (window->priv->settings_listing, PREF_LISTING_SHOW_PATH));
}
diff --git a/src/fr-window.h b/src/fr-window.h
index a9c7a9f..cb1f38c 100644
--- a/src/fr-window.h
+++ b/src/fr-window.h
@@ -28,7 +28,6 @@
#include "typedefs.h"
#include "fr-archive.h"
-#define MATECONF_NOTIFICATIONS 10
enum {
COLUMN_FILE_DATA,
diff --git a/src/glib-utils.c b/src/glib-utils.c
index a484fcf..176370c 100644
--- a/src/glib-utils.c
+++ b/src/glib-utils.c
@@ -25,12 +25,36 @@
#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)
@@ -643,3 +667,47 @@ 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 fdd746a..dcc64a5 100644
--- a/src/glib-utils.h
+++ b/src/glib-utils.h
@@ -29,6 +29,13 @@
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,
@@ -69,6 +76,10 @@ 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 2276e58..898547d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -49,7 +49,6 @@
#include "fr-command-lrzip.h"
#include "fr-process.h"
#include "fr-stock.h"
-#include "mateconf-utils.h"
#include "fr-window.h"
#include "typedefs.h"
#include "preferences.h"
@@ -335,9 +334,6 @@ main (int argc, char **argv)
static void
initialize_data (void)
{
- eel_mateconf_monitor_add ("/apps/engrampa");
- eel_mateconf_monitor_add (PREF_CAJA_CLICK_POLICY);
-
ProgramsCache = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
@@ -385,88 +381,12 @@ 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_mateconf_set_boolean (PREF_MIGRATE_DIRECTORIES, FALSE);
-}
-
-
/* -- FrRegisteredCommand -- */
@@ -915,7 +835,7 @@ prepare_app (void)
uri = get_home_relative_uri (RC_DIR);
- if (uri_is_file (uri)) { /* before the mateconf port this was a file, now it's folder. */
+ if (uri_is_file (uri)) { /* before the MateConf port this was a file, now it's folder. */
GFile *file;
file = g_file_new_for_uri (uri);
@@ -926,9 +846,6 @@ prepare_app (void)
ensure_dir_exists (uri, 0700, NULL);
g_free (uri);
- if (eel_mateconf_get_boolean (PREF_MIGRATE_DIRECTORIES, TRUE))
- migrate_to_new_directories ();
-
register_commands ();
compute_supported_archive_types ();
diff --git a/src/mateconf-utils.c b/src/mateconf-utils.c
deleted file mode 100644
index c285435..0000000
--- a/src/mateconf-utils.c
+++ /dev/null
@@ -1,862 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Engrampa
- *
- * 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 02110-1301, USA.
- */
-
-/* eel-mateconf-extensions.c - Stuff to make MateConf easier to use.
-
- Copyright (C) 2000, 2001 Eazel, Inc.
-
- The Mate 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 Mate 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 Mate Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- Authors: Ramiro Estrugo <[email protected]>
-*/
-
-/* Modified by Paolo Bacchilega <[email protected]> for File Roller. */
-
-#include <config.h>
-#include <string.h>
-#include <errno.h>
-
-#include <mateconf/mateconf-client.h>
-#include <mateconf/mateconf.h>
-#include "mateconf-utils.h"
-#include "gtk-utils.h"
-#include "fr-error.h"
-
-static MateConfClient *global_mateconf_client = NULL;
-
-
-void
-eel_global_client_free (void)
-{
- if (global_mateconf_client == NULL) {
- return;
- }
-
- g_object_unref (global_mateconf_client);
- global_mateconf_client = NULL;
-}
-
-
-MateConfClient *
-eel_mateconf_client_get_global (void)
-{
- /* Initialize mateconf if needed */
- if (!mateconf_is_initialized ()) {
- char *argv[] = { "eel-preferences", NULL };
- GError *error = NULL;
-
- if (!mateconf_init (1, argv, &error)) {
- if (eel_mateconf_handle_error (&error)) {
- return NULL;
- }
- }
- }
-
- if (global_mateconf_client == NULL)
- global_mateconf_client = mateconf_client_get_default ();
-
- return global_mateconf_client;
-}
-
-
-gboolean
-eel_mateconf_handle_error (GError **error)
-{
- static gboolean shown_dialog = FALSE;
-
- g_return_val_if_fail (error != NULL, FALSE);
-
- if (*error != NULL) {
- g_warning ("MateConf 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,
- "MateConf error",
- "MateConf 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,
- MateConfValue *val,
- MateConfValueType 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_mateconf_set_boolean (const char *key,
- gboolean boolean_value)
-{
- MateConfClient *client;
- GError *error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = eel_mateconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- mateconf_client_set_bool (client, key, boolean_value, &error);
- eel_mateconf_handle_error (&error);
-}
-
-
-gboolean
-eel_mateconf_get_boolean (const char *key,
- gboolean def)
-{
- GError *error = NULL;
- gboolean result = def;
- MateConfClient *client;
- MateConfValue *val;
-
- g_return_val_if_fail (key != NULL, def);
-
- client = eel_mateconf_client_get_global ();
- g_return_val_if_fail (client != NULL, def);
-
- val = mateconf_client_get (client, key, &error);
-
- if (val != NULL) {
- if (check_type (key, val, MATECONF_VALUE_BOOL, &error))
- result = mateconf_value_get_bool (val);
- else
- eel_mateconf_handle_error (&error);
- mateconf_value_free (val);
-
- } else if (error != NULL)
- eel_mateconf_handle_error (&error);
-
- return result;
-}
-
-
-void
-eel_mateconf_set_integer (const char *key,
- int int_value)
-{
- MateConfClient *client;
- GError *error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = eel_mateconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- mateconf_client_set_int (client, key, int_value, &error);
- eel_mateconf_handle_error (&error);
-}
-
-
-int
-eel_mateconf_get_integer (const char *key,
- int def)
-{
- GError *error = NULL;
- int result = def;
- MateConfClient *client;
- MateConfValue *val;
-
- g_return_val_if_fail (key != NULL, def);
-
- client = eel_mateconf_client_get_global ();
- g_return_val_if_fail (client != NULL, def);
-
- val = mateconf_client_get (client, key, &error);
-
- if (val != NULL) {
- if (check_type (key, val, MATECONF_VALUE_INT, &error))
- result = mateconf_value_get_int (val);
- else
- eel_mateconf_handle_error (&error);
- mateconf_value_free (val);
-
- } else if (error != NULL)
- eel_mateconf_handle_error (&error);
-
- return result;
-}
-
-
-void
-eel_mateconf_set_float (const char *key,
- float float_value)
-{
- MateConfClient *client;
- GError *error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = eel_mateconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- mateconf_client_set_float (client, key, float_value, &error);
- eel_mateconf_handle_error (&error);
-}
-
-
-float
-eel_mateconf_get_float (const char *key,
- float def)
-{
- GError *error = NULL;
- float result = def;
- MateConfClient *client;
- MateConfValue *val;
-
- g_return_val_if_fail (key != NULL, def);
-
- client = eel_mateconf_client_get_global ();
- g_return_val_if_fail (client != NULL, def);
-
- val = mateconf_client_get (client, key, &error);
-
- if (val != NULL) {
- if (check_type (key, val, MATECONF_VALUE_FLOAT, &error))
- result = mateconf_value_get_float (val);
- else
- eel_mateconf_handle_error (&error);
- mateconf_value_free (val);
-
- } else if (error != NULL)
- eel_mateconf_handle_error (&error);
-
- return result;
-}
-
-
-void
-eel_mateconf_set_string (const char *key,
- const char *string_value)
-{
- MateConfClient *client;
- GError *error = NULL;
-
- g_return_if_fail (key != NULL);
-
- client = eel_mateconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- mateconf_client_set_string (client, key, string_value, &error);
- eel_mateconf_handle_error (&error);
-}
-
-
-char *
-eel_mateconf_get_string (const char *key,
- const char *def)
-{
- GError *error = NULL;
- char *result;
- MateConfClient *client;
- char *val;
-
- if (def != NULL)
- result = g_strdup (def);
- else
- result = NULL;
-
- g_return_val_if_fail (key != NULL, result);
-
- client = eel_mateconf_client_get_global ();
- g_return_val_if_fail (client != NULL, result);
-
- val = mateconf_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_mateconf_handle_error (&error);
-
- return result;
-}
-
-
-void
-eel_mateconf_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_mateconf_set_string (key, utf8);
- g_free (utf8);
- }
-}
-
-
-char *
-eel_mateconf_get_locale_string (const char *key,
- const char *def)
-{
- char *utf8;
- char *result;
-
- utf8 = eel_mateconf_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_mateconf_set_string_list (const char *key,
- const GSList *slist)
-{
- MateConfClient *client;
- GError *error;
-
- g_return_if_fail (key != NULL);
-
- client = eel_mateconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- error = NULL;
- mateconf_client_set_list (client, key, MATECONF_VALUE_STRING,
- /* Need cast cause of MateConf api bug */
- (GSList *) slist,
- &error);
- eel_mateconf_handle_error (&error);
-}
-
-
-GSList *
-eel_mateconf_get_string_list (const char *key)
-{
- GSList *slist;
- MateConfClient *client;
- GError *error;
-
- g_return_val_if_fail (key != NULL, NULL);
-
- client = eel_mateconf_client_get_global ();
- g_return_val_if_fail (client != NULL, NULL);
-
- error = NULL;
- slist = mateconf_client_get_list (client, key, MATECONF_VALUE_STRING, &error);
- if (eel_mateconf_handle_error (&error)) {
- slist = NULL;
- }
-
- return slist;
-}
-
-
-GSList *
-eel_mateconf_get_locale_string_list (const char *key)
-{
- GSList *utf8_slist, *slist, *scan;
-
- utf8_slist = eel_mateconf_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_mateconf_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_mateconf_set_string_list (key, utf8_slist);
-
- g_slist_foreach (utf8_slist, (GFunc) g_free, NULL);
- g_slist_free (utf8_slist);
-}
-
-
-gboolean
-eel_mateconf_is_default (const char *key)
-{
- gboolean result;
- MateConfValue *value;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, FALSE);
-
- value = mateconf_client_get_without_default (eel_mateconf_client_get_global (), key, &error);
-
- if (eel_mateconf_handle_error (&error)) {
- if (value != NULL) {
- mateconf_value_free (value);
- }
- return FALSE;
- }
-
- result = (value == NULL);
- eel_mateconf_value_free (value);
- return result;
-}
-
-
-gboolean
-eel_mateconf_monitor_add (const char *directory)
-{
- GError *error = NULL;
- MateConfClient *client;
-
- g_return_val_if_fail (directory != NULL, FALSE);
-
- client = mateconf_client_get_default ();
- g_return_val_if_fail (client != NULL, FALSE);
-
- mateconf_client_add_dir (client,
- directory,
- MATECONF_CLIENT_PRELOAD_NONE,
- &error);
-
- if (eel_mateconf_handle_error (&error)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-gboolean
-eel_mateconf_monitor_remove (const char *directory)
-{
- GError *error = NULL;
- MateConfClient *client;
-
- if (directory == NULL) {
- return FALSE;
- }
-
- client = mateconf_client_get_default ();
- g_return_val_if_fail (client != NULL, FALSE);
-
- mateconf_client_remove_dir (client,
- directory,
- &error);
-
- if (eel_mateconf_handle_error (&error)) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-void
-eel_mateconf_preload_cache (const char *directory,
- MateConfClientPreloadType preload_type)
-{
- GError *error = NULL;
- MateConfClient *client;
-
- if (directory == NULL) {
- return;
- }
-
- client = mateconf_client_get_default ();
- g_return_if_fail (client != NULL);
-
- mateconf_client_preload (client,
- directory,
- preload_type,
- &error);
-
- eel_mateconf_handle_error (&error);
-}
-
-
-void
-eel_mateconf_suggest_sync (void)
-{
- MateConfClient *client;
- GError *error = NULL;
-
- client = eel_mateconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- mateconf_client_suggest_sync (client, &error);
- eel_mateconf_handle_error (&error);
-}
-
-
-MateConfValue*
-eel_mateconf_get_value (const char *key)
-{
- MateConfValue *value = NULL;
- MateConfClient *client;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, NULL);
-
- client = eel_mateconf_client_get_global ();
- g_return_val_if_fail (client != NULL, NULL);
-
- value = mateconf_client_get (client, key, &error);
-
- if (eel_mateconf_handle_error (&error)) {
- if (value != NULL) {
- mateconf_value_free (value);
- value = NULL;
- }
- }
-
- return value;
-}
-
-
-MateConfValue*
-eel_mateconf_get_default_value (const char *key)
-{
- MateConfValue *value = NULL;
- MateConfClient *client;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, NULL);
-
- client = eel_mateconf_client_get_global ();
- g_return_val_if_fail (client != NULL, NULL);
-
- value = mateconf_client_get_default_from_schema (client, key, &error);
-
- if (eel_mateconf_handle_error (&error)) {
- if (value != NULL) {
- mateconf_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 MateConfValue *a,
- const MateConfValue *b)
-{
- g_return_val_if_fail (a != NULL, FALSE);
- g_return_val_if_fail (b != NULL, FALSE);
-
- switch (a->type) {
- case MATECONF_VALUE_STRING:
- return eel_str_is_equal (mateconf_value_get_string (a),
- mateconf_value_get_string (b));
- break;
-
- case MATECONF_VALUE_INT:
- return mateconf_value_get_int (a) ==
- mateconf_value_get_int (b);
- break;
-
- case MATECONF_VALUE_FLOAT:
- return mateconf_value_get_float (a) ==
- mateconf_value_get_float (b);
- break;
-
- case MATECONF_VALUE_BOOL:
- return mateconf_value_get_bool (a) ==
- mateconf_value_get_bool (b);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- return FALSE;
-}
-
-
-gboolean
-eel_mateconf_value_is_equal (const MateConfValue *a,
- const MateConfValue *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 MATECONF_VALUE_STRING:
- case MATECONF_VALUE_INT:
- case MATECONF_VALUE_FLOAT:
- case MATECONF_VALUE_BOOL:
- return simple_value_is_equal (a, b);
- break;
-
- case MATECONF_VALUE_LIST:
- if (mateconf_value_get_list_type (a) !=
- mateconf_value_get_list_type (b)) {
- return FALSE;
- }
-
- node_a = mateconf_value_get_list (a);
- node_b = mateconf_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_mateconf_value_free (MateConfValue *value)
-{
- if (value == NULL) {
- return;
- }
-
- mateconf_value_free (value);
-}
-
-
-guint
-eel_mateconf_notification_add (const char *key,
- MateConfClientNotifyFunc notification_callback,
- gpointer callback_data)
-{
- guint notification_id;
- MateConfClient *client;
- GError *error = NULL;
-
- g_return_val_if_fail (key != NULL, EEL_MATECONF_UNDEFINED_CONNECTION);
- g_return_val_if_fail (notification_callback != NULL, EEL_MATECONF_UNDEFINED_CONNECTION);
-
- client = eel_mateconf_client_get_global ();
- g_return_val_if_fail (client != NULL, EEL_MATECONF_UNDEFINED_CONNECTION);
-
- notification_id = mateconf_client_notify_add (client,
- key,
- notification_callback,
- callback_data,
- NULL,
- &error);
-
- if (eel_mateconf_handle_error (&error)) {
- if (notification_id != EEL_MATECONF_UNDEFINED_CONNECTION) {
- mateconf_client_notify_remove (client, notification_id);
- notification_id = EEL_MATECONF_UNDEFINED_CONNECTION;
- }
- }
-
- return notification_id;
-}
-
-
-void
-eel_mateconf_notification_remove (guint notification_id)
-{
- MateConfClient *client;
-
- if (notification_id == EEL_MATECONF_UNDEFINED_CONNECTION) {
- return;
- }
-
- client = eel_mateconf_client_get_global ();
- g_return_if_fail (client != NULL);
-
- mateconf_client_notify_remove (client, notification_id);
-}
-
-
-GSList *
-eel_mateconf_value_get_string_list (const MateConfValue *value)
-{
- GSList *result;
- const GSList *slist;
- const GSList *node;
- const char *string;
- const MateConfValue *next_value;
-
- if (value == NULL) {
- return NULL;
- }
-
- g_return_val_if_fail (value->type == MATECONF_VALUE_LIST, NULL);
- g_return_val_if_fail (mateconf_value_get_list_type (value) == MATECONF_VALUE_STRING, NULL);
-
- slist = mateconf_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 == MATECONF_VALUE_STRING, NULL);
- string = mateconf_value_get_string (next_value);
- result = g_slist_append (result, g_strdup (string));
- }
- return result;
-}
-
-
-void
-eel_mateconf_value_set_string_list (MateConfValue *value,
- const GSList *string_list)
-{
- const GSList *node;
- MateConfValue *next_value;
- GSList *value_list;
-
- g_return_if_fail (value->type == MATECONF_VALUE_LIST);
- g_return_if_fail (mateconf_value_get_list_type (value) == MATECONF_VALUE_STRING);
-
- value_list = NULL;
- for (node = string_list; node != NULL; node = node->next) {
- next_value = mateconf_value_new (MATECONF_VALUE_STRING);
- mateconf_value_set_string (next_value, node->data);
- value_list = g_slist_append (value_list, next_value);
- }
-
- mateconf_value_set_list (value, value_list);
-
- for (node = value_list; node != NULL; node = node->next) {
- mateconf_value_free (node->data);
- }
- g_slist_free (value_list);
-}
diff --git a/src/mateconf-utils.h b/src/mateconf-utils.h
deleted file mode 100644
index 528b83a..0000000
--- a/src/mateconf-utils.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Engrampa
- *
- * 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 02110-1301, USA.
- */
-
-/* eel-mateconf-extensions.h - Stuff to make MateConf easier to use.
-
- Copyright (C) 2000, 2001 Eazel, Inc.
-
- The Mate 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 Mate 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 Mate Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- Boston, MA 02110-1301, USA.
-
- Authors: Ramiro Estrugo <[email protected]>
-*/
-
-/* Modified by Paolo Bacchilega <[email protected]> for File Roller. */
-
-#ifndef MATECONF_UTILS_H
-#define MATECONF_UTILS_H
-
-#include <glib.h>
-#include <mateconf/mateconf.h>
-#include <mateconf/mateconf-client.h>
-
-G_BEGIN_DECLS
-
-#define EEL_MATECONF_UNDEFINED_CONNECTION 0
-
-MateConfClient *eel_mateconf_client_get_global (void);
-
-void eel_global_client_free (void);
-
-gboolean eel_mateconf_handle_error (GError **error);
-
-gboolean eel_mateconf_get_boolean (const char *key,
- gboolean def_val);
-
-void eel_mateconf_set_boolean (const char *key,
- gboolean value);
-
-int eel_mateconf_get_integer (const char *key,
- int def_val);
-
-void eel_mateconf_set_integer (const char *key,
- int value);
-
-float eel_mateconf_get_float (const char *key,
- float def_val);
-
-void eel_mateconf_set_float (const char *key,
- float value);
-
-char * eel_mateconf_get_string (const char *key,
- const char *def_val);
-
-void eel_mateconf_set_string (const char *key,
- const char *value);
-
-char * eel_mateconf_get_locale_string (const char *key,
- const char *def_val);
-
-void eel_mateconf_set_locale_string (const char *key,
- const char *value);
-
-GSList * eel_mateconf_get_string_list (const char *key);
-
-void eel_mateconf_set_string_list (const char *key,
- const GSList *string_list_value);
-
-GSList * eel_mateconf_get_locale_string_list(const char *key);
-
-void eel_mateconf_set_locale_string_list(const char *key,
- const GSList *string_list_value);
-
-gboolean eel_mateconf_is_default (const char *key);
-
-gboolean eel_mateconf_monitor_add (const char *directory);
-
-gboolean eel_mateconf_monitor_remove (const char *directory);
-
-void eel_mateconf_preload_cache (const char *directory,
- MateConfClientPreloadType preload_type);
-
-void eel_mateconf_suggest_sync (void);
-
-MateConfValue* eel_mateconf_get_value (const char *key);
-
-MateConfValue* eel_mateconf_get_default_value (const char *key);
-
-gboolean eel_mateconf_value_is_equal (const MateConfValue *a,
- const MateConfValue *b);
-
-void eel_mateconf_value_free (MateConfValue *value);
-
-guint eel_mateconf_notification_add (const char *key,
- MateConfClientNotifyFunc notification_callback,
- gpointer callback_data);
-
-void eel_mateconf_notification_remove (guint notification_id);
-
-GSList * eel_mateconf_value_get_string_list (const MateConfValue *value);
-
-void eel_mateconf_value_set_string_list (MateConfValue *value,
- const GSList *string_list);
-
-G_END_DECLS
-
-#endif /* MATECONF_UTILS_H */
diff --git a/src/preferences.c b/src/preferences.c
index 3c877cd..7fbdf8f 100644
--- a/src/preferences.c
+++ b/src/preferences.c
@@ -21,248 +21,52 @@
*/
#include <string.h>
-#include <mateconf/mateconf-client.h>
#include "typedefs.h"
#include "preferences.h"
#include "main.h"
#include "file-utils.h"
-#include "mateconf-utils.h"
#include "fr-window.h"
-#define DIALOG_PREFIX "/apps/engrampa/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_mateconf_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_mateconf_set_string (PREF_LIST_SORT_METHOD, s_value);
-}
-
-
-GtkSortType
-preferences_get_sort_type (void)
-{
- char *s_value;
- int i_value;
-
- s_value = eel_mateconf_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_mateconf_set_string (PREF_LIST_SORT_TYPE, s_value);
-}
-
-
-FrWindowListMode
-preferences_get_list_mode (void)
-{
- char *s_value;
- int i_value;
-
- s_value = eel_mateconf_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_mateconf_set_string (PREF_LIST_MODE, s_value);
-}
-
-
-FrCompression
-preferences_get_compression_level (void)
-{
- char *s_value;
- int i_value;
-
- s_value = eel_mateconf_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_mateconf_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_mateconf_set_integer (key, value);
- g_free (key);
-}
-
-
void
pref_util_save_window_geometry (GtkWindow *window,
- const char *dialog)
+ const char *dialog_id)
{
- int x, y, width, height;
+ char *schema;
+ GSettings *settings;
+ int width;
+ int height;
- gtk_window_get_position (window, &x, &y);
- set_dialog_property_int (dialog, "x", x);
- set_dialog_property_int (dialog, "y", y);
+ schema = g_strconcat (ENGRAMPA_SCHEMA_DIALOGS, ".", dialog_id, NULL);
+ settings = g_settings_new (schema);
gtk_window_get_size (window, &width, &height);
- set_dialog_property_int (dialog, "width", width);
- set_dialog_property_int (dialog, "height", height);
-}
-
-
-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_mateconf_get_integer (key, -1);
- g_free (key);
-
- return value;
+ g_settings_set_int (settings, "width", width);
+ g_settings_set_int (settings, "height", height);
+ g_object_unref (settings);
+ g_free (schema);
}
void
pref_util_restore_window_geometry (GtkWindow *window,
- const char *dialog)
+ const char *dialog_id)
{
- int x, y, width, height;
+ char *schema;
+ GSettings *settings;
+ int width;
+ int height;
- 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");
+ schema = g_strconcat (ENGRAMPA_SCHEMA_DIALOGS, ".", dialog_id, NULL);
+ settings = g_settings_new (schema);
- if (width != -1 && height != 1)
+ width = g_settings_get_int (settings, "width");
+ height = g_settings_get_int (settings, "height");
+ if ((width != -1) && (height != 1))
gtk_window_set_default_size (window, width, height);
gtk_window_present (window);
+
+ g_object_unref (settings);
+ g_free (schema);
}
diff --git a/src/preferences.h b/src/preferences.h
index 89502e6..c60e558 100644
--- a/src/preferences.h
+++ b/src/preferences.h
@@ -27,63 +27,61 @@
#include "typedefs.h"
#include "fr-window.h"
-#define PREF_LIST_SORT_METHOD "/apps/engrampa/listing/sort_method"
-#define PREF_LIST_SORT_TYPE "/apps/engrampa/listing/sort_type"
-#define PREF_LIST_MODE "/apps/engrampa/listing/list_mode"
-#define PREF_LIST_SHOW_TYPE "/apps/engrampa/listing/show_type"
-#define PREF_LIST_SHOW_SIZE "/apps/engrampa/listing/show_size"
-#define PREF_LIST_SHOW_TIME "/apps/engrampa/listing/show_time"
-#define PREF_LIST_SHOW_PATH "/apps/engrampa/listing/show_path"
-#define PREF_LIST_USE_MIME_ICONS "/apps/engrampa/listing/use_mime_icons"
-#define PREF_NAME_COLUMN_WIDTH "/apps/engrampa/listing/name_column_width"
+#define ENGRAMPA_SCHEMA "org.mate.engrampa"
+#define ENGRAMPA_SCHEMA_LISTING ENGRAMPA_SCHEMA ".listing"
+#define ENGRAMPA_SCHEMA_UI ENGRAMPA_SCHEMA ".ui"
+#define ENGRAMPA_SCHEMA_GENERAL ENGRAMPA_SCHEMA ".general"
+#define ENGRAMPA_SCHEMA_DIALOGS ENGRAMPA_SCHEMA ".dialogs"
+#define ENGRAMPA_SCHEMA_ADD ENGRAMPA_SCHEMA_DIALOGS ".add"
+#define ENGRAMPA_SCHEMA_BATCH_ADD ENGRAMPA_SCHEMA_DIALOGS ".batch-add"
+#define ENGRAMPA_SCHEMA_EXTRACT ENGRAMPA_SCHEMA_DIALOGS ".extract"
+#define ENGRAMPA_SCHEMA_LAST_OUTPUT ENGRAMPA_SCHEMA_DIALOGS ".last-output"
-#define PREF_UI_WINDOW_WIDTH "/apps/engrampa/ui/window_width"
-#define PREF_UI_WINDOW_HEIGHT "/apps/engrampa/ui/window_height"
-#define PREF_UI_SIDEBAR_WIDTH "/apps/engrampa/ui/sidebar_width"
-#define PREF_UI_HISTORY_LEN "/apps/engrampa/ui/history_len"
-#define PREF_UI_TOOLBAR "/apps/engrampa/ui/view_toolbar"
-#define PREF_UI_STATUSBAR "/apps/engrampa/ui/view_statusbar"
-#define PREF_UI_FOLDERS "/apps/engrampa/ui/view_folders"
+#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_EDIT_EDITORS "/apps/engrampa/general/editors"
-#define PREF_ADD_COMPRESSION_LEVEL "/apps/engrampa/general/compression_level"
-#define PREF_ENCRYPT_HEADER "/apps/engrampa/general/encrypt_header"
-#define PREF_MIGRATE_DIRECTORIES "/apps/engrampa/general/migrate_directories"
+#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_EXTRACT_OVERWRITE "/apps/engrampa/dialogs/extract/overwrite"
-#define PREF_EXTRACT_SKIP_NEWER "/apps/engrampa/dialogs/extract/skip_newer"
-#define PREF_EXTRACT_RECREATE_FOLDERS "/apps/engrampa/dialogs/extract/recreate_folders"
+#define PREF_GENERAL_EDITORS "editors"
+#define PREF_GENERAL_COMPRESSION_LEVEL "compression-level"
+#define PREF_GENERAL_ENCRYPT_HEADER "encrypt-header"
-#define PREF_ADD_CURRENT_FOLDER "/apps/engrampa/dialogs/add/current_folder"
-#define PREF_ADD_FILENAME "/apps/engrampa/dialogs/add/filename"
-#define PREF_ADD_INCLUDE_FILES "/apps/engrampa/dialogs/add/include_files"
-#define PREF_ADD_EXCLUDE_FILES "/apps/engrampa/dialogs/add/exclude_files"
-#define PREF_ADD_EXCLUDE_FOLDERS "/apps/engrampa/dialogs/add/exclude_folders"
-#define PREF_ADD_UPDATE "/apps/engrampa/dialogs/add/update"
-#define PREF_ADD_RECURSIVE "/apps/engrampa/dialogs/add/recursive"
-#define PREF_ADD_NO_SYMLINKS "/apps/engrampa/dialogs/add/no_symlinks"
+#define PREF_EXTRACT_OVERWRITE "overwrite"
+#define PREF_EXTRACT_SKIP_NEWER "skip-newer"
+#define PREF_EXTRACT_RECREATE_FOLDERS "recreate-folders"
-#define PREF_BATCH_ADD_DEFAULT_EXTENSION "/apps/engrampa/dialogs/batch-add/default_extension"
-#define PREF_BATCH_OTHER_OPTIONS "/apps/engrampa/dialogs/batch-add/other_options"
-#define PREF_BATCH_VOLUME_SIZE "/apps/engrampa/dialogs/batch-add/volume_size"
+#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_DESKTOP_ICON_THEME "/desktop/mate/file_views/icon_theme"
-#define PREF_DESKTOP_MENUS_HAVE_TEAROFF "/desktop/mate/interface/menus_have_tearoff"
-#define PREF_DESKTOP_MENUBAR_DETACHABLE "/desktop/mate/interface/menubar_detachable"
-#define PREF_DESKTOP_TOOLBAR_DETACHABLE "/desktop/mate/interface/toolbar_detachable"
-#define PREF_CAJA_CLICK_POLICY "/apps/caja/preferences/click_policy"
+#define PREF_BATCH_ADD_DEFAULT_EXTENSION "default-extension"
+#define PREF_BATCH_ADD_OTHER_OPTIONS "other-options"
+#define PREF_BATCH_ADD_VOLUME_SIZE "volume-size"
-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);
+#define CAJA_SCHEMA "org.mate.caja.preferences"
+#define CAJA_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);
#endif /* PREFERENCES_H */
diff --git a/src/typedefs.h b/src/typedefs.h
index 6202eb9..56660b5 100644
--- a/src/typedefs.h
+++ b/src/typedefs.h
@@ -23,6 +23,9 @@
#ifndef TYPEDEFS_H
#define TYPEDEFS_H
+#include <glib.h>
+#include <glib-object.h>
+
#define MEGABYTE (1024 * 1024)
#define RC_DIR ".config/mate/engrampa"