Commit f56a7a62 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

Ported the extensions to GSettings

parent fdd2c090
......@@ -361,22 +361,26 @@ source_dialog_response_cb (GtkDialog *dialog,
burn_content_to_disc (task);
}
else {
gboolean recursive;
GSettings *settings;
gboolean recursive;
_g_object_list_unref (task->priv->selected_files);
task->priv->selected_files = NULL;
settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
recursive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (_gtk_builder_get_widget (task->priv->builder, "folder_recursive_radiobutton")));
task->priv->test = gth_main_get_general_filter ();
task->priv->file_source = gth_main_get_file_source (task->priv->location);
gth_file_source_for_each_child (task->priv->file_source,
task->priv->location,
recursive,
eel_gconf_get_boolean (PREF_FAST_FILE_TYPE, TRUE) ? GFILE_STANDARD_ATTRIBUTES_WITH_FAST_CONTENT_TYPE : GFILE_STANDARD_ATTRIBUTES_WITH_CONTENT_TYPE,
g_settings_get_boolean (settings, PREF_BROWSER_FAST_FILE_TYPE) ? GFILE_STANDARD_ATTRIBUTES_WITH_FAST_CONTENT_TYPE : GFILE_STANDARD_ATTRIBUTES_WITH_CONTENT_TYPE,
start_dir_func,
for_each_file_func,
done_func,
task);
g_object_unref (settings);
}
}
else
......
......@@ -351,10 +351,12 @@ gth_browser_activate_action_catalog_remove (GtkAction *action,
GthBrowser *browser)
{
GthFileData *file_data;
GSettings *settings;
file_data = gth_browser_get_folder_popup_file_data (browser);
if (eel_gconf_get_boolean (PREF_MSG_CONFIRM_DELETION, DEFAULT_MSG_CONFIRM_DELETION)) {
settings = g_settings_new (GTHUMB_MESSAGES_SCHEMA);
if (g_settings_get_boolean (settings, PREF_MSG_CONFIRM_DELETION)) {
char *prompt;
GtkWidget *d;
......@@ -376,6 +378,8 @@ gth_browser_activate_action_catalog_remove (GtkAction *action,
remove_catalog (GTK_WINDOW (browser), file_data);
g_object_unref (file_data);
}
g_object_unref (settings);
}
......
......@@ -35,6 +35,7 @@
typedef struct {
GthBrowser *browser;
GtkBuilder *builder;
GSettings *settings;
GtkWidget *dialog;
GtkWidget *date_selector;
GList *file_list;
......@@ -46,6 +47,7 @@ dialog_destroy_cb (GtkWidget *widget,
DialogData *data)
{
_g_object_list_unref (data->file_list);
g_object_unref (data->settings);
g_object_unref (data->builder);
g_free (data);
}
......@@ -95,23 +97,23 @@ ok_button_clicked (GtkWidget *button,
/* save the preferences */
eel_gconf_set_boolean (PREF_CHANGE_DATE_SET_LAST_MODIFIED_DATE, (change_fields & GTH_CHANGE_LAST_MODIFIED_DATE) == GTH_CHANGE_LAST_MODIFIED_DATE);
eel_gconf_set_boolean (PREF_CHANGE_DATE_SET_COMMENT_DATE, (change_fields & GTH_CHANGE_COMMENT_DATE) == GTH_CHANGE_COMMENT_DATE);
eel_gconf_set_boolean (PREF_CHANGE_DATE_SET_EXIF_DATETIMEORIGINAL_TAG, (change_fields & GTH_CHANGE_EXIF_DATETIMEORIGINAL_TAG) == GTH_CHANGE_EXIF_DATETIMEORIGINAL_TAG);
g_settings_set_boolean (data->settings, PREF_CHANGE_DATE_SET_LAST_MODIFIED_DATE, (change_fields & GTH_CHANGE_LAST_MODIFIED_DATE) == GTH_CHANGE_LAST_MODIFIED_DATE);
g_settings_set_boolean (data->settings, PREF_CHANGE_DATE_SET_COMMENT_DATE, (change_fields & GTH_CHANGE_COMMENT_DATE) == GTH_CHANGE_COMMENT_DATE);
g_settings_set_boolean (data->settings, PREF_CHANGE_DATE_SET_EXIF_DATETIMEORIGINAL_TAG, (change_fields & GTH_CHANGE_EXIF_DATETIMEORIGINAL_TAG) == GTH_CHANGE_EXIF_DATETIMEORIGINAL_TAG);
eel_gconf_set_boolean (PREF_CHANGE_DATE_TO_FOLLOWING_DATE, change_type == GTH_CHANGE_TO_FOLLOWING_DATE);
g_settings_set_boolean (data->settings, PREF_CHANGE_DATE_TO_FOLLOWING_DATE, change_type == GTH_CHANGE_TO_FOLLOWING_DATE);
if (change_type == GTH_CHANGE_TO_FOLLOWING_DATE) {
char *s;
s = gth_datetime_to_exif_date (date_time);
eel_gconf_set_string (PREF_CHANGE_DATE_DATE, s);
g_settings_set_string (data->settings, PREF_CHANGE_DATE_DATE, s);
g_free (s);
}
eel_gconf_set_boolean (PREF_CHANGE_DATE_TO_FILE_MODIFIED_DATE, change_type == GTH_CHANGE_TO_FILE_MODIFIED_DATE);
eel_gconf_set_boolean (PREF_CHANGE_DATE_TO_FILE_CREATION_DATE, change_type == GTH_CHANGE_TO_FILE_CREATION_DATE);
eel_gconf_set_boolean (PREF_CHANGE_DATE_TO_PHOTO_ORIGINAL_DATE, change_type == GTH_CHANGE_TO_PHOTO_ORIGINAL_DATE);
eel_gconf_set_boolean (PREF_CHANGE_DATE_ADJUST_TIME, change_type == GTH_CHANGE_ADJUST_TIME);
g_settings_set_boolean (data->settings, PREF_CHANGE_DATE_TO_FILE_MODIFIED_DATE, change_type == GTH_CHANGE_TO_FILE_MODIFIED_DATE);
g_settings_set_boolean (data->settings, PREF_CHANGE_DATE_TO_FILE_CREATION_DATE, change_type == GTH_CHANGE_TO_FILE_CREATION_DATE);
g_settings_set_boolean (data->settings, PREF_CHANGE_DATE_TO_PHOTO_ORIGINAL_DATE, change_type == GTH_CHANGE_TO_PHOTO_ORIGINAL_DATE);
g_settings_set_boolean (data->settings, PREF_CHANGE_DATE_ADJUST_TIME, change_type == GTH_CHANGE_ADJUST_TIME);
if (change_type == GTH_CHANGE_ADJUST_TIME)
eel_gconf_set_integer (PREF_CHANGE_DATE_TIME_ADJUSTMENT, time_adjustment);
g_settings_set_int (data->settings, PREF_CHANGE_DATE_TIME_ADJUSTMENT, time_adjustment);
/* exec the task */
......@@ -177,6 +179,7 @@ dlg_change_date (GthBrowser *browser,
data->browser = browser;
data->file_list = _g_object_list_ref (file_list);
data->builder = _gtk_builder_new_from_file ("change-date.ui", "change_date");
data->settings = g_settings_new (GTHUMB_CHANGE_DATE_SCHEMA);
/* Get the widgets. */
......@@ -188,17 +191,21 @@ dlg_change_date (GthBrowser *browser,
/* Set widgets data. */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("change_last_modified_checkbutton")), eel_gconf_get_boolean (PREF_CHANGE_DATE_SET_LAST_MODIFIED_DATE, FALSE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("change_comment_checkbutton")), eel_gconf_get_boolean (PREF_CHANGE_DATE_SET_COMMENT_DATE, FALSE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("change_datetimeoriginal_checkbutton")), eel_gconf_get_boolean (PREF_CHANGE_DATE_SET_EXIF_DATETIMEORIGINAL_TAG, FALSE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("change_last_modified_checkbutton")),
g_settings_get_boolean (data->settings, PREF_CHANGE_DATE_SET_LAST_MODIFIED_DATE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("change_comment_checkbutton")),
g_settings_get_boolean (data->settings, PREF_CHANGE_DATE_SET_COMMENT_DATE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("change_datetimeoriginal_checkbutton")),
g_settings_get_boolean (data->settings, PREF_CHANGE_DATE_SET_EXIF_DATETIMEORIGINAL_TAG));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("to_following_date_radiobutton")), eel_gconf_get_boolean (PREF_CHANGE_DATE_TO_FOLLOWING_DATE, TRUE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("to_following_date_radiobutton")),
g_settings_get_boolean (data->settings, PREF_CHANGE_DATE_TO_FOLLOWING_DATE));
datetime = gth_datetime_new ();
g_get_current_time (&timeval);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("to_following_date_radiobutton")))) {
char *s;
s = eel_gconf_get_string (PREF_CHANGE_DATE_DATE, "");
s = g_settings_get_string (data->settings, PREF_CHANGE_DATE_DATE);
if (strcmp (s, "") != 0)
gth_datetime_from_exif_date (datetime, s);
else
......@@ -210,10 +217,14 @@ dlg_change_date (GthBrowser *browser,
gth_time_selector_set_value (GTH_TIME_SELECTOR (data->date_selector), datetime);
gth_datetime_free (datetime);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("to_last_modified_date_radiobutton")), eel_gconf_get_boolean (PREF_CHANGE_DATE_TO_FILE_MODIFIED_DATE, FALSE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("to_creation_date_radiobutton")), eel_gconf_get_boolean (PREF_CHANGE_DATE_TO_FILE_CREATION_DATE, FALSE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("to_photo_original_date_radiobutton")), eel_gconf_get_boolean (PREF_CHANGE_DATE_TO_PHOTO_ORIGINAL_DATE, FALSE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("adjust_time_radiobutton")), eel_gconf_get_boolean (PREF_CHANGE_DATE_ADJUST_TIME, FALSE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("to_last_modified_date_radiobutton")),
g_settings_get_boolean (data->settings, PREF_CHANGE_DATE_TO_FILE_MODIFIED_DATE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("to_creation_date_radiobutton")),
g_settings_get_boolean (data->settings, PREF_CHANGE_DATE_TO_FILE_CREATION_DATE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("to_photo_original_date_radiobutton")),
g_settings_get_boolean (data->settings, PREF_CHANGE_DATE_TO_PHOTO_ORIGINAL_DATE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("adjust_time_radiobutton")),
g_settings_get_boolean (data->settings, PREF_CHANGE_DATE_ADJUST_TIME));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("adjust_time_radiobutton")))) {
int adjustement;
int sign;
......@@ -221,7 +232,7 @@ dlg_change_date (GthBrowser *browser,
int minutes;
int seconds;
adjustement = eel_gconf_get_integer (PREF_CHANGE_DATE_TIME_ADJUSTMENT, 0);
adjustement = g_settings_get_int (data->settings, PREF_CHANGE_DATE_TIME_ADJUSTMENT);
if (adjustement < 0) {
sign = -1;
adjustement = - adjustement;
......
......@@ -3,7 +3,7 @@
/*
* GThumb
*
* Copyright (C) 2011 Free Software Foundation, Inc.
* Copyright © 2011 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
......@@ -26,16 +26,22 @@
G_BEGIN_DECLS
#define PREF_CHANGE_DATE_SET_LAST_MODIFIED_DATE "/apps/gthumb/ext/change_date/set_last_modified_date"
#define PREF_CHANGE_DATE_SET_COMMENT_DATE "/apps/gthumb/ext/change_date/set_comment_date"
#define PREF_CHANGE_DATE_SET_EXIF_DATETIMEORIGINAL_TAG "/apps/gthumb/ext/change_date/set_exif_datetimeoriginal_tag"
#define PREF_CHANGE_DATE_TO_FOLLOWING_DATE "/apps/gthumb/ext/change_date/to_following_date"
#define PREF_CHANGE_DATE_DATE "/apps/gthumb/ext/change_date/date"
#define PREF_CHANGE_DATE_TO_FILE_MODIFIED_DATE "/apps/gthumb/ext/change_date/to_file_modified_date"
#define PREF_CHANGE_DATE_TO_FILE_CREATION_DATE "/apps/gthumb/ext/change_date/to_file_creation_date"
#define PREF_CHANGE_DATE_TO_PHOTO_ORIGINAL_DATE "/apps/gthumb/ext/change_date/to_photo_original_date"
#define PREF_CHANGE_DATE_ADJUST_TIME "/apps/gthumb/ext/change_date/adjust_time"
#define PREF_CHANGE_DATE_TIME_ADJUSTMENT "/apps/gthumb/ext/change_date/time_adjustment"
/* schema */
#define GTHUMB_CHANGE_DATE_SCHEMA GTHUMB_SCHEMA ".change-date"
/* keys */
#define PREF_CHANGE_DATE_SET_LAST_MODIFIED_DATE "set-last-modified-date"
#define PREF_CHANGE_DATE_SET_COMMENT_DATE "set-comment-date"
#define PREF_CHANGE_DATE_SET_EXIF_DATETIMEORIGINAL_TAG "set-exif-datetimeoriginal-tag"
#define PREF_CHANGE_DATE_TO_FOLLOWING_DATE "to-following-date"
#define PREF_CHANGE_DATE_DATE "date"
#define PREF_CHANGE_DATE_TO_FILE_MODIFIED_DATE "to-file-modified-date"
#define PREF_CHANGE_DATE_TO_FILE_CREATION_DATE "to-file-creation-date"
#define PREF_CHANGE_DATE_TO_PHOTO_ORIGINAL_DATE "to-photo-original-date"
#define PREF_CHANGE_DATE_ADJUST_TIME "adjust-time"
#define PREF_CHANGE_DATE_TIME_ADJUSTMENT "time-adjustment"
G_END_DECLS
......
......@@ -27,6 +27,7 @@
typedef struct {
GtkBuilder *builder;
GSettings *settings;
GtkWidget *dialog;
} DialogData;
......@@ -36,6 +37,7 @@ destroy_cb (GtkWidget *widget,
DialogData *data)
{
g_object_unref (data->builder);
g_object_unref (data->settings);
g_free (data);
}
......@@ -44,7 +46,9 @@ static void
sync_checkbutton_clicked_cb (GtkWidget *widget,
DialogData *data)
{
eel_gconf_set_boolean (PREF_COMMENTS_SYNCHRONIZE, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (data->builder, "sync_checkbutton"))));
g_settings_set_boolean (data->settings,
PREF_COMMENTS_SYNCHRONIZE,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (data->builder, "sync_checkbutton"))));
}
......@@ -55,6 +59,7 @@ dlg_comments_preferences (GtkWindow *parent)
data = g_new0 (DialogData, 1);
data->builder = _gtk_builder_new_from_file ("comments-preferences.ui", "comments");
data->settings = g_settings_new (GTHUMB_COMMENTS_SCHEMA);
/* Get the widgets. */
......@@ -62,7 +67,8 @@ dlg_comments_preferences (GtkWindow *parent)
/* Set widgets data. */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (data->builder, "sync_checkbutton")), eel_gconf_get_boolean (PREF_COMMENTS_SYNCHRONIZE, TRUE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (data->builder, "sync_checkbutton")),
g_settings_get_boolean (data->settings, PREF_COMMENTS_SYNCHRONIZE));
/* Set the signals handlers. */
......
......@@ -80,7 +80,10 @@ static void
comments__read_metadata_ready_cb (GthFileData *file_data,
const char *attributes)
{
gboolean write_comment = FALSE;
GSettings *settings;
gboolean store_metadata_in_files;
gboolean synchronize;
gboolean write_comment;
GthMetadata *metadata;
GthStringList *comment_categories;
GList *scan;
......@@ -88,8 +91,12 @@ comments__read_metadata_ready_cb (GthFileData *file_data,
GthComment *comment;
GthStringList *categories;
if (! eel_gconf_get_boolean (PREF_STORE_METADATA_IN_FILES, TRUE)) {
/* if PREF_STORE_METADATA_IN_FILES is false, avoid to
settings = g_settings_new (GTHUMB_GENERAL_SCHEMA);
store_metadata_in_files = g_settings_get_boolean (settings, PREF_GENERAL_STORE_METADATA_IN_FILES);
g_object_unref (settings);
if (! store_metadata_in_files) {
/* if PREF_GENERAL_STORE_METADATA_IN_FILES is false, avoid to
* synchronize the .comment metadata because the embedded
* metadata is likely to be out-of-date.
* Give priority to the .comment metadata which, if present,
......@@ -100,9 +107,15 @@ comments__read_metadata_ready_cb (GthFileData *file_data,
return;
}
if (! eel_gconf_get_boolean (PREF_COMMENTS_SYNCHRONIZE, TRUE))
settings = g_settings_new (GTHUMB_COMMENTS_SCHEMA);
synchronize = g_settings_get_boolean (settings, PREF_COMMENTS_SYNCHRONIZE);
g_object_unref (settings);
if (! synchronize)
return;
write_comment = FALSE;
comment = gth_comment_new ();
gth_comment_set_note (comment, g_file_info_get_attribute_string (file_data->info, "comment::note"));
gth_comment_set_caption (comment, g_file_info_get_attribute_string (file_data->info, "comment::caption"));
......
......@@ -22,6 +22,12 @@
#ifndef PREFERENCES_H
#define PREFERENCES_H
#define PREF_COMMENTS_SYNCHRONIZE "/apps/gthumb/ext/comments/synchronize"
/* schema */
#define GTHUMB_COMMENTS_SCHEMA GTHUMB_SCHEMA ".comments"
/* keys */
#define PREF_COMMENTS_SYNCHRONIZE "synchronize"
#endif /* PREFERENCES_H */
......@@ -29,8 +29,6 @@
#define GET_WIDGET(name) _gtk_builder_get_widget (data->builder, (name))
#define STRING_IS_VOID(x) (((x) == NULL) || (*(x) == 0))
#define DEFAULT_CONTACT_SHEET_THEME "default"
#define DEFAULT_CONTACT_SHEET_THUMBNAIL_CAPTION ("general::datetime,general::dimensions,gth::file::display-size")
#define PREVIEW_SIZE 112
enum {
......@@ -56,6 +54,7 @@ enum {
typedef struct {
GthBrowser *browser;
GSettings *settings;
GList *file_list;
GtkBuilder *builder;
GtkWidget *dialog;
......@@ -85,6 +84,7 @@ destroy_cb (GtkWidget *widget,
{
gth_browser_set_dialog (data->browser, "contact_sheet", NULL);
_g_object_list_unref (data->file_list);
g_object_unref (data->settings);
g_object_unref (data->builder);
g_free (data);
}
......@@ -153,18 +153,18 @@ ok_clicked_cb (GtkWidget *widget,
/* save the options */
header = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("header_entry")));
eel_gconf_set_string (PREF_CONTACT_SHEET_HEADER, header);
g_settings_set_string (data->settings, PREF_CONTACT_SHEET_HEADER, header);
footer = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("footer_entry")));
eel_gconf_set_string (PREF_CONTACT_SHEET_FOOTER, footer);
g_settings_set_string (data->settings, PREF_CONTACT_SHEET_FOOTER, footer);
s_value = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (GET_WIDGET ("destination_filechooserbutton")));
destination = g_file_new_for_uri (s_value);
eel_gconf_set_path (PREF_CONTACT_SHEET_DESTINATION, s_value);
_g_settings_set_uri (data->settings, PREF_CONTACT_SHEET_DESTINATION, s_value);
g_free (s_value);
template = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("template_entry")));
eel_gconf_set_string (PREF_CONTACT_SHEET_TEMPLATE, template);
g_settings_set_string (data->settings, PREF_CONTACT_SHEET_TEMPLATE, template);
mime_type = NULL;
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (GET_WIDGET ("filetype_combobox")), &iter)) {
......@@ -173,48 +173,48 @@ ok_clicked_cb (GtkWidget *widget,
FILE_TYPE_COLUMN_MIME_TYPE, &mime_type,
FILE_TYPE_COLUMN_DEFAULT_EXTENSION, &file_extension,
-1);
eel_gconf_set_string (PREF_CONTACT_SHEET_MIME_TYPE, mime_type);
g_settings_set_string (data->settings, PREF_CONTACT_SHEET_MIME_TYPE, mime_type);
}
create_image_map = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("image_map_checkbutton")));
eel_gconf_set_boolean (PREF_CONTACT_SHEET_HTML_IMAGE_MAP, create_image_map);
g_settings_set_boolean (data->settings, PREF_CONTACT_SHEET_HTML_IMAGE_MAP, create_image_map);
theme = get_selected_theme (data);
g_return_if_fail (theme != NULL);
theme_name = g_file_get_basename (theme->file);
eel_gconf_set_string (PREF_CONTACT_SHEET_THEME, theme_name);
g_settings_set_string (data->settings, PREF_CONTACT_SHEET_THEME, theme_name);
images_per_index = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("images_per_index_spinbutton")));
eel_gconf_set_integer (PREF_CONTACT_SHEET_IMAGES_PER_PAGE, images_per_index);
g_settings_set_int (data->settings, PREF_CONTACT_SHEET_IMAGES_PER_PAGE, images_per_index);
single_page = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_index_checkbutton")));
eel_gconf_set_boolean (PREF_CONTACT_SHEET_SINGLE_PAGE, single_page);
g_settings_set_boolean (data->settings, PREF_CONTACT_SHEET_SINGLE_PAGE, single_page);
columns = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("cols_spinbutton")));
eel_gconf_set_integer (PREF_CONTACT_SHEET_COLUMNS, columns);
g_settings_set_int (data->settings, PREF_CONTACT_SHEET_COLUMNS, columns);
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (GET_WIDGET ("sort_combobox")), &iter)) {
gtk_tree_model_get (GTK_TREE_MODEL (GET_WIDGET ("sort_liststore")),
&iter,
SORT_TYPE_COLUMN_DATA, &sort_type,
-1);
eel_gconf_set_string (PREF_CONTACT_SHEET_SORT_TYPE, sort_type->name);
g_settings_set_string (data->settings, PREF_CONTACT_SHEET_SORT_TYPE, sort_type->name);
}
sort_inverse = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("reverse_order_checkbutton")));
eel_gconf_set_boolean (PREF_CONTACT_SHEET_SORT_INVERSE, sort_inverse);
g_settings_set_boolean (data->settings, PREF_CONTACT_SHEET_SORT_INVERSE, sort_inverse);
same_size = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("same_size_checkbutton")));
eel_gconf_set_boolean (PREF_CONTACT_SHEET_SAME_SIZE, same_size);
g_settings_set_boolean (data->settings, PREF_CONTACT_SHEET_SAME_SIZE, same_size);
thumbnail_size = thumb_size[gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnail_size_combobox")))];
eel_gconf_set_integer (PREF_CONTACT_SHEET_THUMBNAIL_SIZE, thumbnail_size);
g_settings_set_int (data->settings, PREF_CONTACT_SHEET_THUMBNAIL_SIZE, thumbnail_size);
squared_thumbnail = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("squared_thumbnail_checkbutton")));
eel_gconf_set_boolean (PREF_CONTACT_SHEET_SQUARED_THUMBNAIL, squared_thumbnail);
g_settings_set_boolean (data->settings, PREF_CONTACT_SHEET_SQUARED_THUMBNAIL, squared_thumbnail);
thumbnail_caption = gth_metadata_chooser_get_selection (GTH_METADATA_CHOOSER (data->thumbnail_caption_chooser));
eel_gconf_set_string (PREF_CONTACT_SHEET_THUMBNAIL_CAPTION, thumbnail_caption);
g_settings_set_string (data->settings, PREF_CONTACT_SHEET_THUMBNAIL_CAPTION, thumbnail_caption);
/* exec the task */
......@@ -402,7 +402,7 @@ load_themes (DialogData *data)
(PREVIEW_SIZE + col_spacing * 2));
gtk_widget_realize (GET_WIDGET ("theme_iconview"));
default_theme = eel_gconf_get_string (PREF_CONTACT_SHEET_THEME, DEFAULT_CONTACT_SHEET_THEME);
default_theme = g_settings_get_string (data->settings, PREF_CONTACT_SHEET_THEME);
model = GTK_TREE_MODEL (GET_WIDGET ("theme_liststore"));
if (gtk_tree_model_get_iter_first (model, &iter)) {
gboolean theme_selected = FALSE;
......@@ -699,6 +699,7 @@ dlg_contact_sheet (GthBrowser *browser,
data->browser = browser;
data->file_list = _g_object_list_ref (file_list);
data->builder = _gtk_builder_new_from_file ("contact-sheet.ui", "contact_sheet");
data->settings = g_settings_new (GTHUMB_CONTACT_SHEET_SCHEMA);
data->dialog = _gtk_builder_get_widget (data->builder, "contact_sheet_dialog");
gth_browser_set_dialog (browser, "contact_sheet", data->dialog);
......@@ -713,11 +714,11 @@ dlg_contact_sheet (GthBrowser *browser,
gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("header_entry")),
g_file_info_get_edit_name (gth_browser_get_location_data (browser)->info));
s_value = eel_gconf_get_string (PREF_CONTACT_SHEET_FOOTER, "");
s_value = g_settings_get_string (data->settings, PREF_CONTACT_SHEET_FOOTER);
gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("footer_entry")), s_value);
g_free (s_value);
s_value = eel_gconf_get_path (PREF_CONTACT_SHEET_DESTINATION, NULL);
s_value = _g_settings_get_uri (data->settings, PREF_CONTACT_SHEET_DESTINATION);
if (s_value == NULL) {
GFile *location = gth_browser_get_location (data->browser);
if (location != NULL)
......@@ -728,11 +729,11 @@ dlg_contact_sheet (GthBrowser *browser,
gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (GET_WIDGET ("destination_filechooserbutton")), s_value);
g_free (s_value);
s_value = eel_gconf_get_path (PREF_CONTACT_SHEET_TEMPLATE, NULL);
s_value = _g_settings_get_uri (data->settings, PREF_CONTACT_SHEET_TEMPLATE);
gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("template_entry")), s_value);
g_free (s_value);
default_mime_type = eel_gconf_get_string (PREF_CONTACT_SHEET_MIME_TYPE, "image/jpeg");
default_mime_type = g_settings_get_string (data->settings, PREF_CONTACT_SHEET_MIME_TYPE);
active_index = 0;
savers = gth_main_get_type_set ("pixbuf-saver");
for (i = 0; (savers != NULL) && (i < savers->len); i++) {
......@@ -756,19 +757,19 @@ dlg_contact_sheet (GthBrowser *browser,
gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("filetype_combobox")), active_index);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(GET_WIDGET("image_map_checkbutton")), eel_gconf_get_boolean (PREF_CONTACT_SHEET_HTML_IMAGE_MAP, FALSE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(GET_WIDGET("image_map_checkbutton")), g_settings_get_boolean (data->settings, PREF_CONTACT_SHEET_HTML_IMAGE_MAP));
load_themes (data);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (GET_WIDGET ("theme_liststore")),
THEME_COLUMN_DISPLAY_NAME,
GTK_SORT_ASCENDING);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("images_per_index_spinbutton")), eel_gconf_get_integer (PREF_CONTACT_SHEET_IMAGES_PER_PAGE, 25));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_index_checkbutton")), eel_gconf_get_boolean (PREF_CONTACT_SHEET_SINGLE_PAGE, FALSE));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("cols_spinbutton")), eel_gconf_get_integer (PREF_CONTACT_SHEET_COLUMNS, 5));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("same_size_checkbutton")), eel_gconf_get_boolean (PREF_CONTACT_SHEET_SAME_SIZE, FALSE));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("images_per_index_spinbutton")), g_settings_get_int (data->settings, PREF_CONTACT_SHEET_IMAGES_PER_PAGE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_index_checkbutton")), g_settings_get_boolean (data->settings, PREF_CONTACT_SHEET_SINGLE_PAGE));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("cols_spinbutton")), g_settings_get_int (data->settings, PREF_CONTACT_SHEET_COLUMNS));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("same_size_checkbutton")), g_settings_get_boolean (data->settings, PREF_CONTACT_SHEET_SAME_SIZE));
default_sort_type = eel_gconf_get_string (PREF_CONTACT_SHEET_SORT_TYPE, "general::unsorted");
default_sort_type = g_settings_get_string (data->settings, PREF_CONTACT_SHEET_SORT_TYPE);
active_index = 0;
sort_types = gth_main_get_all_sort_types ();
for (i = 0, scan = sort_types; scan; scan = scan->next, i++) {
......@@ -788,7 +789,7 @@ dlg_contact_sheet (GthBrowser *browser,
g_free (default_sort_type);
gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("sort_combobox")), active_index);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("reverse_order_checkbutton")), eel_gconf_get_boolean (PREF_CONTACT_SHEET_SORT_INVERSE, FALSE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("reverse_order_checkbutton")), g_settings_get_boolean (data->settings, PREF_CONTACT_SHEET_SORT_INVERSE));
for (i = 0; i < thumb_sizes; i++) {
char *name;
......@@ -804,10 +805,10 @@ dlg_contact_sheet (GthBrowser *browser,
g_free (name);
}
gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnail_size_combobox")), get_idx_from_size (eel_gconf_get_integer (PREF_CONTACT_SHEET_THUMBNAIL_SIZE, 128)));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("squared_thumbnail_checkbutton")), eel_gconf_get_boolean (PREF_CONTACT_SHEET_SQUARED_THUMBNAIL, FALSE));
gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnail_size_combobox")), get_idx_from_size (g_settings_get_int (data->settings, PREF_CONTACT_SHEET_THUMBNAIL_SIZE)));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("squared_thumbnail_checkbutton")), g_settings_get_boolean (data->settings, PREF_CONTACT_SHEET_SQUARED_THUMBNAIL));
caption = eel_gconf_get_string (PREF_CONTACT_SHEET_THUMBNAIL_CAPTION, DEFAULT_CONTACT_SHEET_THUMBNAIL_CAPTION);
caption = g_settings_get_string (data->settings, PREF_CONTACT_SHEET_THUMBNAIL_CAPTION);
gth_metadata_chooser_set_selection (GTH_METADATA_CHOOSER (data->thumbnail_caption_chooser), caption);
g_free (caption);
......
......@@ -47,6 +47,7 @@ enum {
typedef struct {
GthBrowser *browser;
GSettings *settings;
GList *file_list;
GtkBuilder *builder;
GtkWidget *dialog;
......@@ -75,6 +76,7 @@ destroy_cb (GtkWidget *widget,
{
gth_browser_set_dialog (data->browser, "image_wall", NULL);
_g_object_list_unref (data->file_list);
g_object_unref (data->settings);
g_object_unref (data->builder);
g_free (data);
}
......@@ -111,11 +113,11 @@ ok_clicked_cb (GtkWidget *widget,
s_value = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (GET_WIDGET ("destination_filechooserbutton")));
destination = g_file_new_for_uri (s_value);
eel_gconf_set_path (PREF_IMAGE_WALL_DESTINATION, s_value);
_g_settings_set_uri (data->settings, PREF_IMAGE_WALL_DESTINATION, s_value);
g_free (s_value);
template = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("template_entry")));
eel_gconf_set_string (PREF_IMAGE_WALL_TEMPLATE, template);
g_settings_set_string (data->settings, PREF_IMAGE_WALL_TEMPLATE, template);
mime_type = NULL;
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (GET_WIDGET ("filetype_combobox")), &iter)) {
......@@ -124,31 +126,31 @@ ok_clicked_cb (GtkWidget *widget,
FILE_TYPE_COLUMN_MIME_TYPE, &mime_type,
FILE_TYPE_COLUMN_DEFAULT_EXTENSION, &file_extension,
-1);
eel_gconf_set_string (PREF_IMAGE_WALL_MIME_TYPE, mime_type);
g_settings_set_string (data->settings, PREF_IMAGE_WALL_MIME_TYPE, mime_type);
}
images_per_index = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("images_per_index_spinbutton")));
eel_gconf_set_integer (PREF_IMAGE_WALL_IMAGES_PER_PAGE, images_per_index);
g_settings_set_int (data->settings, PREF_IMAGE_WALL_IMAGES_PER_PAGE, images_per_index);
single_page = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_index_checkbutton")));
eel_gconf_set_boolean (PREF_IMAGE_WALL_SINGLE_PAGE, single_page);
g_settings_set_boolean (data->settings, PREF_IMAGE_WALL_SINGLE_PAGE, single_page);
columns = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (GET_WIDGET ("cols_spinbutton")));
eel_gconf_set_integer (PREF_IMAGE_WALL_COLUMNS, columns);
g_settings_set_int (data->settings, PREF_IMAGE_WALL_COLUMNS, columns);
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (GET_WIDGET ("sort_combobox")), &iter)) {
gtk_tree_model_get (GTK_TREE_MODEL (GET_WIDGET ("sort_liststore")),
&iter,
SORT_TYPE_COLUMN_DATA, &sort_type,
-1);
eel_gconf_set_string (PREF_IMAGE_WALL_SORT_TYPE, sort_type->name);
g_settings_set_string (data->settings, PREF_IMAGE_WALL_SORT_TYPE, sort_type->name);
}
sort_inverse = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("reverse_order_checkbutton")));
eel_gconf_set_boolean (PREF_IMAGE_WALL_SORT_INVERSE, sort_inverse);
g_settings_set_boolean (data->settings, PREF_IMAGE_WALL_SORT_INVERSE, sort_inverse);
thumbnail_size = thumb_size[gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnail_size_combobox")))];
eel_gconf_set_integer (PREF_IMAGE_WALL_THUMBNAIL_SIZE, thumbnail_size);
g_settings_set_int (data->settings, PREF_IMAGE_WALL_THUMBNAIL_SIZE, thumbnail_size);
theme = gth_contact_sheet_theme_new ();
theme->background_type = GTH_CONTACT_SHEET_BACKGROUND_TYPE_SOLID;
......@@ -241,6 +243,7 @@ dlg_image_wall (GthBrowser *browser,
data->browser = browser;
data->file_list = _g_object_list_ref (file_list);
data->builder = _gtk_builder_new_from_file ("image-wall.ui", "contact_sheet");
data->settings = g_settings_new (