[gthumb] splitted dlg-preferences in one file per tab



commit c07584a0f9d0f891aeb58b08dcbd7b197a62159c
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Oct 26 12:22:18 2014 +0100

    splitted dlg-preferences in one file per tab

 data/ui/Makefile.am                   |    1 +
 data/ui/browser-preferences.ui        |  170 ++++++++++++++++++++++
 data/ui/preferences.ui                |  205 +-------------------------
 extensions/photo_importer/callbacks.c |    2 +-
 extensions/search/callbacks.c         |    2 +-
 gthumb/Makefile.am                    |    4 +
 gthumb/dlg-preferences-browser.c      |  169 ++++++++++++++++++++++
 gthumb/dlg-preferences-browser.h      |   34 +++++
 gthumb/dlg-preferences-extensions.c   |   11 +-
 gthumb/dlg-preferences-extensions.h   |    6 +-
 gthumb/dlg-preferences-general.c      |  254 ++++++++++++++++++++++++++++++++
 gthumb/dlg-preferences-general.h      |   34 +++++
 gthumb/dlg-preferences.c              |  256 ---------------------------------
 gthumb/gth-main-default-types.c       |    6 +
 14 files changed, 688 insertions(+), 466 deletions(-)
---
diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am
index 1bf7f37..b108c9b 100644
--- a/data/ui/Makefile.am
+++ b/data/ui/Makefile.am
@@ -1,5 +1,6 @@
 uidir = $(pkgdatadir)/ui
 ui_DATA =                              \
+       browser-preferences.ui          \
        extensions-preferences.ui       \
        filter-editor.ui                \
        histogram-info.ui               \
diff --git a/data/ui/browser-preferences.ui b/data/ui/browser-preferences.ui
new file mode 100644
index 0000000..14286b0
--- /dev/null
+++ b/data/ui/browser-preferences.ui
@@ -0,0 +1,170 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkBox" id="browser_page">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">12</property>
+    <property name="orientation">vertical</property>
+    <property name="spacing">12</property>
+    <child>
+      <object class="GtkFrame" id="frame4">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label_xalign">0</property>
+        <property name="shadow_type">none</property>
+        <child>
+          <object class="GtkAlignment" id="alignment4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="top_padding">6</property>
+            <property name="left_padding">12</property>
+            <child>
+              <object class="GtkScrolledWindow" id="caption_scrolledwindow">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Caption</property>
+            <property name="use_markup">True</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkFrame" id="frame5">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label_xalign">0</property>
+        <property name="shadow_type">none</property>
+        <child>
+          <object class="GtkAlignment" id="alignment5">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="top_padding">6</property>
+            <property name="left_padding">12</property>
+            <child>
+              <object class="GtkBox" id="box1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkBox" id="box7">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkLabel" id="label9">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Thumbnail _size:</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">thumbnail_size_combobox</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="thumbnail_size_box">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkComboBoxText" id="thumbnail_size_combobox">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <items>
+                              <item translatable="yes">48</item>
+                              <item translatable="yes">64</item>
+                              <item translatable="yes">85</item>
+                              <item translatable="yes">95</item>
+                              <item translatable="yes">112</item>
+                              <item translatable="yes">128</item>
+                              <item translatable="yes">164</item>
+                              <item translatable="yes">200</item>
+                              <item translatable="yes">256</item>
+                            </items>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="slow_mime_type_checkbutton">
+                    <property name="label" translatable="yes">D_etermine image type from content 
(slower)</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkLabel" id="label8">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Other</property>
+            <property name="use_markup">True</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/data/ui/preferences.ui b/data/ui/preferences.ui
index 6eb9943..6dfd490 100644
--- a/data/ui/preferences.ui
+++ b/data/ui/preferences.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Tue Nov 19 11:20:04 2013 -->
+<!-- Generated with glade 3.18.3 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.0"/>
   <object class="GtkListStore" id="file_properties_position_liststore">
     <columns>
       <!-- column-name name -->
@@ -25,7 +25,7 @@
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
+        <property name="spacing">8</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
@@ -50,16 +50,15 @@
             <property name="expand">False</property>
             <property name="fill">True</property>
             <property name="pack_type">end</property>
-            <property name="position">0</property>
+            <property name="position">1</property>
           </packing>
         </child>
         <child>
           <object class="GtkNotebook" id="notebook">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="border_width">5</property>
             <child>
-              <object class="GtkBox" id="general_vbox">
+              <object class="GtkBox" id="general_page">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="border_width">12</property>
@@ -99,8 +98,6 @@
                                   <packing>
                                     <property name="left_attach">0</property>
                                     <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -115,8 +112,6 @@
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="top_attach">0</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -131,8 +126,6 @@
                                   <packing>
                                     <property name="left_attach">0</property>
                                     <property name="top_attach">1</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -150,8 +143,6 @@
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="top_attach">1</property>
-                                    <property name="width">1</property>
-                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                               </object>
@@ -233,7 +224,6 @@
                                     <property name="receives_default">False</property>
                                     <property name="use_underline">True</property>
                                     <property name="xalign">0</property>
-                                    <property name="active">True</property>
                                     <property name="draw_indicator">True</property>
                                     <property name="group">go_to_last_location_radiobutton</property>
                                   </object>
@@ -432,192 +422,11 @@
                 <property name="tab_fill">False</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkBox" id="browser_box">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="border_width">12</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">12</property>
-                <child>
-                  <object class="GtkFrame" id="frame4">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label_xalign">0</property>
-                    <property name="shadow_type">none</property>
-                    <child>
-                      <object class="GtkAlignment" id="alignment4">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="top_padding">6</property>
-                        <property name="left_padding">12</property>
-                        <child>
-                          <object class="GtkScrolledWindow" id="caption_scrolledwindow">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="shadow_type">in</property>
-                            <child>
-                              <placeholder/>
-                            </child>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child type="label">
-                      <object class="GtkLabel" id="label4">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Caption</property>
-                        <property name="use_markup">True</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                        </attributes>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkFrame" id="frame5">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label_xalign">0</property>
-                    <property name="shadow_type">none</property>
-                    <child>
-                      <object class="GtkAlignment" id="alignment5">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="top_padding">6</property>
-                        <property name="left_padding">12</property>
-                        <child>
-                          <object class="GtkBox" id="box1">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="orientation">vertical</property>
-                            <property name="spacing">6</property>
-                            <child>
-                              <object class="GtkBox" id="box7">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="spacing">6</property>
-                                <child>
-                                  <object class="GtkLabel" id="label9">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">Thumbnail _size:</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="mnemonic_widget">thumbnail_size_combobox</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <object class="GtkBox" id="thumbnail_size_box">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <child>
-                                      <object class="GtkComboBoxText" id="thumbnail_size_combobox">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <items>
-                                          <item translatable="yes">48</item>
-                                          <item translatable="yes">64</item>
-                                          <item translatable="yes">85</item>
-                                          <item translatable="yes">95</item>
-                                          <item translatable="yes">112</item>
-                                          <item translatable="yes">128</item>
-                                          <item translatable="yes">164</item>
-                                          <item translatable="yes">200</item>
-                                          <item translatable="yes">256</item>
-                                        </items>
-                                      </object>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">0</property>
-                                      </packing>
-                                    </child>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">1</property>
-                                  </packing>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkCheckButton" id="slow_mime_type_checkbutton">
-                                <property name="label" translatable="yes">D_etermine image type from content 
(slower)</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
-                                <property name="use_underline">True</property>
-                                <property name="xalign">0</property>
-                                <property name="draw_indicator">True</property>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child type="label">
-                      <object class="GtkLabel" id="label8">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Other</property>
-                        <property name="use_markup">True</property>
-                        <attributes>
-                          <attribute name="weight" value="bold"/>
-                        </attributes>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label2">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Browser</property>
-              </object>
-              <packing>
-                <property name="position">1</property>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
           </object>
           <packing>
-            <property name="expand">True</property>
+            <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="position">0</property>
           </packing>
         </child>
       </object>
diff --git a/extensions/photo_importer/callbacks.c b/extensions/photo_importer/callbacks.c
index f160a9c..9d4e0a0 100644
--- a/extensions/photo_importer/callbacks.c
+++ b/extensions/photo_importer/callbacks.c
@@ -164,7 +164,7 @@ pi__dlg_preferences_construct_cb (GtkWidget  *dialog,
        data->builder = gtk_builder_new_from_resource 
("/org/gnome/gThumb/photo_importer/data/ui/photo-importer-options.ui");
        data->settings = g_settings_new (GTHUMB_PHOTO_IMPORTER_SCHEMA);
 
-       general_vbox = _gtk_builder_get_widget (dialog_builder, "general_vbox");
+       general_vbox = _gtk_builder_get_widget (dialog_builder, "general_page");
        importer_options = _gtk_builder_get_widget (data->builder, "importer_options");
        gtk_box_pack_start (GTK_BOX (general_vbox),
                            importer_options,
diff --git a/extensions/search/callbacks.c b/extensions/search/callbacks.c
index 776b0d7..bdbdfa2 100644
--- a/extensions/search/callbacks.c
+++ b/extensions/search/callbacks.c
@@ -141,7 +141,7 @@ search__dlg_catalog_properties (GtkBuilder  *builder,
 
        vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
        gtk_widget_show (vbox);
-       gtk_box_pack_start (GTK_BOX (_gtk_builder_get_widget (builder, "general_vbox")), vbox, FALSE, FALSE, 
0);
+       gtk_box_pack_start (GTK_BOX (_gtk_builder_get_widget (builder, "general_page")), vbox, FALSE, FALSE, 
0);
 
        /* Translators: This is not a verb, it's a name as in "the search properties". */
        label = gtk_label_new (_("Search"));
diff --git a/gthumb/Makefile.am b/gthumb/Makefile.am
index ce882b9..81e6f37 100644
--- a/gthumb/Makefile.am
+++ b/gthumb/Makefile.am
@@ -126,7 +126,9 @@ PUBLIC_HEADER_FILES =                                       \
        
 PRIVATE_HEADER_FILES =                                         \
        dlg-location.h                                  \
+       dlg-preferences-browser.h                       \
        dlg-preferences-extensions.h                    \
+       dlg-preferences-general.h                       \
        gth-browser-actions-callbacks.h                 \
        gth-browser-actions-entries.h                   \
        gth-metadata-provider-file.h                    \
@@ -155,7 +157,9 @@ gthumb_SOURCES =                                    \
        dlg-location.c                                  \
        dlg-personalize-filters.c                       \
        dlg-preferences.c                               \
+       dlg-preferences-browser.c                       \
        dlg-preferences-extensions.c                    \
+       dlg-preferences-general.c                       \
        dlg-sort-order.c                                \
        dom.c                                           \
        gio-utils.c                                     \
diff --git a/gthumb/dlg-preferences-browser.c b/gthumb/dlg-preferences-browser.c
new file mode 100644
index 0000000..4ed2f31
--- /dev/null
+++ b/gthumb/dlg-preferences-browser.c
@@ -0,0 +1,169 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2014 The 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <gtk/gtk.h>
+#include "dlg-preferences-browser.h"
+#include "glib-utils.h"
+#include "gth-browser.h"
+#include "gth-main.h"
+#include "gth-metadata-chooser.h"
+#include "gth-preferences.h"
+#include "gtk-utils.h"
+#include "main.h"
+
+
+#define BROWSER_DATA_KEY "browser-preference-data"
+#define GET_WIDGET(name) _gtk_builder_get_widget (data->builder, (name))
+
+
+typedef struct {
+       GthBrowser   *browser;
+       GtkBuilder   *builder;
+       GSettings    *browser_settings;
+       GtkWidget    *dialog;
+       GtkWidget    *thumbnail_caption_chooser;
+} BrowserData;
+
+
+static int thumb_size[] = { 48, 64, 85, 95, 112, 128, 164, 200, 256 };
+static int thumb_sizes = sizeof (thumb_size) / sizeof (int);
+
+
+static void
+browser_data_free (BrowserData *data)
+{
+       g_object_unref (data->browser_settings);
+       g_object_unref (data->builder);
+       g_free (data);
+}
+
+
+static int
+get_idx_from_size (int size)
+{
+       int i;
+
+       for (i = 0; i < thumb_sizes; i++)
+               if (size == thumb_size[i])
+                       return i;
+       return -1;
+}
+
+
+static void
+thumbnail_size_changed_cb (GtkWidget   *widget,
+                          BrowserData *data)
+{
+       g_settings_set_int (data->browser_settings, PREF_BROWSER_THUMBNAIL_SIZE, 
thumb_size[gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnail_size_combobox")))]);
+}
+
+
+static void
+fast_file_type_toggled_cb (GtkToggleButton *button,
+                          BrowserData     *data)
+{
+       g_settings_set_boolean (data->browser_settings, PREF_BROWSER_FAST_FILE_TYPE, ! 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("slow_mime_type_checkbutton"))));
+}
+
+
+static void
+thumbnail_caption_chooser_changed_cb (GthMetadataChooser *chooser,
+                                     BrowserData        *data)
+{
+       char *attributes;
+
+       attributes = gth_metadata_chooser_get_selection (chooser);
+       g_settings_set_string (data->browser_settings, PREF_BROWSER_THUMBNAIL_CAPTION, attributes);
+
+       g_free (attributes);
+}
+
+
+void
+browser__dlg_preferences_construct_cb (GtkWidget  *dialog,
+                                      GthBrowser *browser,
+                                      GtkBuilder *dialog_builder)
+{
+       BrowserData   *data;
+       char          *startup_location;
+       GthFileSource *file_source;
+       char          *current_caption;
+       GtkWidget     *label;
+       GtkWidget     *page;
+
+       data = g_new0 (BrowserData, 1);
+       data->builder = _gtk_builder_new_from_file ("browser-preferences.ui", NULL);
+       data->browser_settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+       data->dialog = dialog;
+
+       /* caption list */
+
+       data->thumbnail_caption_chooser = gth_metadata_chooser_new (GTH_METADATA_ALLOW_IN_FILE_LIST);
+       gtk_widget_show (data->thumbnail_caption_chooser);
+       gtk_container_add (GTK_CONTAINER (GET_WIDGET ("caption_scrolledwindow")), 
data->thumbnail_caption_chooser);
+
+       current_caption = g_settings_get_string (data->browser_settings, PREF_BROWSER_THUMBNAIL_CAPTION);
+       gth_metadata_chooser_set_selection (GTH_METADATA_CHOOSER (data->thumbnail_caption_chooser), 
current_caption);
+       g_free (current_caption);
+
+       gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnail_size_combobox")),
+                                 get_idx_from_size (g_settings_get_int (data->browser_settings, 
PREF_BROWSER_THUMBNAIL_SIZE)));
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("slow_mime_type_checkbutton")),
+                                     ! g_settings_get_boolean (data->browser_settings, 
PREF_BROWSER_FAST_FILE_TYPE));
+       gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("file_properties_position_combobox")),
+                                 g_settings_get_boolean (data->browser_settings, 
PREF_BROWSER_PROPERTIES_ON_THE_RIGHT) ? 1 : 0);
+
+       /* signal handlers */
+
+       g_signal_connect (G_OBJECT (GET_WIDGET ("thumbnail_size_combobox")),
+                         "changed",
+                         G_CALLBACK (thumbnail_size_changed_cb),
+                         data);
+       g_signal_connect (G_OBJECT (GET_WIDGET ("slow_mime_type_checkbutton")),
+                         "toggled",
+                         G_CALLBACK (fast_file_type_toggled_cb),
+                         data);
+       g_signal_connect (G_OBJECT (data->thumbnail_caption_chooser),
+                         "changed",
+                         G_CALLBACK (thumbnail_caption_chooser_changed_cb),
+                         data);
+
+       /* add the page to the preferences dialog */
+
+       label = gtk_label_new (_("Browser"));
+       gtk_widget_show (label);
+
+       page = _gtk_builder_get_widget (data->builder, "browser_page");
+       gtk_widget_show (page);
+       gtk_notebook_append_page (GTK_NOTEBOOK (_gtk_builder_get_widget (dialog_builder, "notebook")), page, 
label);
+
+       g_object_set_data_full (G_OBJECT (dialog), BROWSER_DATA_KEY, data, (GDestroyNotify) 
browser_data_free);
+}
+
+
+void
+browser__dlg_preferences_apply (GtkWidget  *dialog,
+                               GthBrowser *browser,
+                               GtkBuilder *dialog_builder)
+{
+       /* void */
+}
diff --git a/gthumb/dlg-preferences-browser.h b/gthumb/dlg-preferences-browser.h
new file mode 100644
index 0000000..0e160e9
--- /dev/null
+++ b/gthumb/dlg-preferences-browser.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2014 The 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DLG_PREFERENCES_BROWSER_H
+#define DLG_PREFERENCES_BROWSER_H
+
+#include "gth-browser.h"
+
+void browser__dlg_preferences_construct_cb (GtkWidget  *dialog,
+                                           GthBrowser *browser,
+                                           GtkBuilder *dialog_builder);
+void browser__dlg_preferences_apply        (GtkWidget  *dialog,
+                                           GthBrowser *browser,
+                                           GtkBuilder *dialog_builder);
+
+#endif /* DLG_PREFERENCES_BROWSER_H */
diff --git a/gthumb/dlg-preferences-extensions.c b/gthumb/dlg-preferences-extensions.c
index 55af875..9b7ed3d 100644
--- a/gthumb/dlg-preferences-extensions.c
+++ b/gthumb/dlg-preferences-extensions.c
@@ -618,8 +618,6 @@ extensions__dlg_preferences_construct_cb (GtkWidget  *dialog,
                                          GtkBuilder *dialog_builder)
 {
        BrowserData          *data;
-       GtkWidget            *notebook;
-       GtkWidget            *page;
        GthExtensionManager  *manager;
        GList                *extensions;
        GList                *descriptions;
@@ -627,6 +625,7 @@ extensions__dlg_preferences_construct_cb (GtkWidget  *dialog,
        char                **all_active_extensions;
        int                   i;
        GtkWidget            *label;
+       GtkWidget            *page;
 
        data = g_new0 (BrowserData, 1);
        data->builder = _gtk_builder_new_from_file ("extensions-preferences.ui", NULL);
@@ -652,10 +651,6 @@ extensions__dlg_preferences_construct_cb (GtkWidget  *dialog,
        data->active_extensions = g_list_reverse (data->active_extensions);
        g_strfreev (all_active_extensions);
 
-       notebook = _gtk_builder_get_widget (dialog_builder, "notebook");
-       page = _gtk_builder_get_widget (data->builder, "preferences_page");
-       gtk_widget_show (page);
-
        /* the extensions list */
 
        data->extensions_list = gtk_list_box_new ();
@@ -739,7 +734,9 @@ extensions__dlg_preferences_construct_cb (GtkWidget  *dialog,
        label = gtk_label_new (_("Extensions"));
        gtk_widget_show (label);
 
-       gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label);
+       page = _gtk_builder_get_widget (data->builder, "preferences_page");
+       gtk_widget_show (page);
+       gtk_notebook_append_page (GTK_NOTEBOOK (_gtk_builder_get_widget (dialog_builder, "notebook")), page, 
label);
 
        g_object_set_data_full (G_OBJECT (dialog), BROWSER_DATA_KEY, data, (GDestroyNotify) 
browser_data_free);
 }
diff --git a/gthumb/dlg-preferences-extensions.h b/gthumb/dlg-preferences-extensions.h
index c6cfc40..39f5137 100644
--- a/gthumb/dlg-preferences-extensions.h
+++ b/gthumb/dlg-preferences-extensions.h
@@ -19,8 +19,8 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef DLG_EXTENSIONS_H
-#define DLG_EXTENSIONS_H
+#ifndef DLG_PREFERENCES_EXTENSIONS_H
+#define DLG_PREFERENCES_EXTENSIONS_H
 
 #include "gth-browser.h"
 
@@ -31,4 +31,4 @@ void extensions__dlg_preferences_apply        (GtkWidget  *dialog,
                                               GthBrowser *browser,
                                               GtkBuilder *dialog_builder);
 
-#endif /* DLG_EXTENSIONS_H */
+#endif /* DLG_PREFERENCES_EXTENSIONS_H */
diff --git a/gthumb/dlg-preferences-general.c b/gthumb/dlg-preferences-general.c
new file mode 100644
index 0000000..4943a24
--- /dev/null
+++ b/gthumb/dlg-preferences-general.c
@@ -0,0 +1,254 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2014 The 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <gtk/gtk.h>
+#include "dlg-preferences-general.h"
+#include "glib-utils.h"
+#include "gth-browser.h"
+#include "gth-file-source-vfs.h"
+#include "gth-main.h"
+#include "gth-preferences.h"
+#include "gtk-utils.h"
+#include "main.h"
+
+
+#define BROWSER_DATA_KEY "general-preference-data"
+#define GET_WIDGET(name) _gtk_builder_get_widget (data->builder, (name))
+
+
+typedef struct {
+       GthBrowser *browser;
+       GtkBuilder *builder;
+       GSettings  *general_settings;
+       GSettings  *browser_settings;
+       GSettings  *messages_settings;
+       GtkWidget  *dialog;
+} BrowserData;
+
+
+static void
+browser_data_free (BrowserData *data)
+{
+       g_object_unref (data->general_settings);
+       g_object_unref (data->browser_settings);
+       g_object_unref (data->messages_settings);
+       g_object_unref (data->builder);
+       g_free (data);
+}
+
+
+static void
+use_startup_toggled_cb (GtkWidget   *widget,
+                       BrowserData *data)
+{
+       gtk_widget_set_sensitive (GET_WIDGET ("startup_dir_filechooserbutton"), gtk_toggle_button_get_active 
(GTK_TOGGLE_BUTTON (widget)));
+       gtk_widget_set_sensitive (GET_WIDGET ("set_to_current_button"), gtk_toggle_button_get_active 
(GTK_TOGGLE_BUTTON (widget)));
+}
+
+
+static void
+set_to_current_cb (GtkWidget   *widget,
+                  BrowserData *data)
+{
+       GthFileSource *file_source;
+
+       file_source = gth_main_get_file_source (gth_browser_get_location (data->browser));
+       if (GTH_IS_FILE_SOURCE_VFS (file_source)) {
+               GFile *gio_file;
+               char  *uri;
+
+               gio_file = gth_file_source_to_gio_file (file_source, gth_browser_get_location 
(data->browser));
+               uri = g_file_get_uri (gio_file);
+               gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (GET_WIDGET ("startup_dir_filechooserbutton")), 
uri);
+
+               g_free (uri);
+               g_object_unref (gio_file);
+       }
+       g_object_unref (file_source);
+}
+
+
+static void
+thumbnails_pane_orientation_changed_cb (GtkWidget   *widget,
+                                       BrowserData *data)
+{
+       g_settings_set_enum (data->browser_settings, PREF_BROWSER_VIEWER_THUMBNAILS_ORIENT, 
gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnails_pane_orient_combobox"))));
+}
+
+
+static void
+file_properties_position_combobox_changed_cb (GtkWidget   *widget,
+                                             BrowserData *data)
+{
+       g_settings_set_boolean (data->browser_settings, PREF_BROWSER_PROPERTIES_ON_THE_RIGHT, 
gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("file_properties_position_combobox"))) == 1);
+}
+
+
+static void
+reuse_active_window_checkbutton_toggled_cb (GtkToggleButton *button,
+                                           BrowserData     *data)
+{
+       g_settings_set_boolean (data->browser_settings, PREF_BROWSER_REUSE_ACTIVE_WINDOW, 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("reuse_active_window_checkbutton"))));
+}
+
+
+static void
+confirm_deletion_toggled_cb (GtkToggleButton *button,
+                            BrowserData     *data)
+{
+       g_settings_set_boolean (data->messages_settings, PREF_MSG_CONFIRM_DELETION, 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("confirm_deletion_checkbutton"))));
+}
+
+
+static void
+ask_to_save_toggled_cb (GtkToggleButton *button,
+                       BrowserData     *data)
+{
+       g_settings_set_boolean (data->messages_settings, PREF_MSG_SAVE_MODIFIED_IMAGE, 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("ask_to_save_checkbutton"))));
+}
+
+
+void
+general__dlg_preferences_construct_cb (GtkWidget  *dialog,
+                                      GthBrowser *browser,
+                                      GtkBuilder *dialog_builder)
+{
+       BrowserData   *data;
+       char          *startup_location;
+       GthFileSource *file_source;
+       char          *current_caption;
+       GtkWidget     *label;
+       GtkWidget     *page;
+
+       data = g_new0 (BrowserData, 1);
+       data->builder = g_object_ref (dialog_builder);
+       data->general_settings = g_settings_new (GTHUMB_GENERAL_SCHEMA);
+       data->browser_settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
+       data->messages_settings = g_settings_new (GTHUMB_MESSAGES_SCHEMA);
+       data->dialog = dialog;
+
+       /* widgets */
+
+       if (g_settings_get_boolean (data->browser_settings, PREF_BROWSER_USE_STARTUP_LOCATION))
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET 
("use_startup_location_radiobutton")), TRUE);
+       else
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET 
("go_to_last_location_radiobutton")), TRUE);
+
+       if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET 
("use_startup_location_radiobutton")))) {
+               gtk_widget_set_sensitive (GET_WIDGET ("startup_dir_filechooserbutton"), FALSE);
+               gtk_widget_set_sensitive (GET_WIDGET ("set_to_current_button"), FALSE);
+       }
+
+       startup_location = _g_settings_get_uri (data->browser_settings, PREF_BROWSER_STARTUP_LOCATION);
+       if (startup_location == NULL)
+               startup_location = g_strdup (get_home_uri ());
+       file_source = gth_main_get_file_source_for_uri (startup_location);
+       if (GTH_IS_FILE_SOURCE_VFS (file_source)) {
+               GFile *location;
+               GFile *folder;
+               char  *folder_uri;
+
+               location = g_file_new_for_uri (startup_location);
+               folder = gth_file_source_to_gio_file (file_source, location);
+               folder_uri = g_file_get_uri (folder);
+               gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (GET_WIDGET ("startup_dir_filechooserbutton")), 
folder_uri);
+
+               g_free (folder_uri);
+               g_object_unref (folder);
+               g_object_unref (location);
+       }
+       g_object_unref (file_source);
+       g_free (startup_location);
+
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("reuse_active_window_checkbutton")),
+                                     g_settings_get_boolean (data->browser_settings, 
PREF_BROWSER_REUSE_ACTIVE_WINDOW));
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("confirm_deletion_checkbutton")),
+                                     g_settings_get_boolean (data->messages_settings, 
PREF_MSG_CONFIRM_DELETION));
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("ask_to_save_checkbutton")),
+                                     g_settings_get_boolean (data->messages_settings, 
PREF_MSG_SAVE_MODIFIED_IMAGE));
+       gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnails_pane_orient_combobox")),
+                                 g_settings_get_enum (data->browser_settings, 
PREF_BROWSER_VIEWER_THUMBNAILS_ORIENT));
+
+       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("embed_metadata_checkbutton")),
+                                     g_settings_get_boolean (data->general_settings, 
PREF_GENERAL_STORE_METADATA_IN_FILES));
+
+       /* signal handlers */
+
+       g_signal_connect (GET_WIDGET ("thumbnails_pane_orient_combobox"),
+                         "changed",
+                         G_CALLBACK (thumbnails_pane_orientation_changed_cb),
+                         data);
+       g_signal_connect (GET_WIDGET ("file_properties_position_combobox"),
+                         "changed",
+                         G_CALLBACK (file_properties_position_combobox_changed_cb),
+                         data);
+       g_signal_connect (G_OBJECT (GET_WIDGET ("use_startup_location_radiobutton")),
+                         "toggled",
+                         G_CALLBACK (use_startup_toggled_cb),
+                         data);
+       g_signal_connect (G_OBJECT (GET_WIDGET ("set_to_current_button")),
+                         "clicked",
+                         G_CALLBACK (set_to_current_cb),
+                         data);
+       g_signal_connect (G_OBJECT (GET_WIDGET ("reuse_active_window_checkbutton")),
+                         "toggled",
+                         G_CALLBACK (reuse_active_window_checkbutton_toggled_cb),
+                         data);
+       g_signal_connect (G_OBJECT (GET_WIDGET ("confirm_deletion_checkbutton")),
+                         "toggled",
+                         G_CALLBACK (confirm_deletion_toggled_cb),
+                         data);
+       g_signal_connect (G_OBJECT (GET_WIDGET ("ask_to_save_checkbutton")),
+                         "toggled",
+                         G_CALLBACK (ask_to_save_toggled_cb),
+                         data);
+
+       g_object_set_data_full (G_OBJECT (dialog), BROWSER_DATA_KEY, data, (GDestroyNotify) 
browser_data_free);
+}
+
+
+void
+general__dlg_preferences_apply (GtkWidget  *dialog,
+                               GthBrowser *browser,
+                               GtkBuilder *dialog_builder)
+{
+       BrowserData *data;
+
+       data = g_object_get_data (G_OBJECT (dialog), BROWSER_DATA_KEY);
+       g_return_if_fail (data != NULL);
+
+       /* Startup dir. */
+
+       g_settings_set_boolean (data->browser_settings, PREF_BROWSER_GO_TO_LAST_LOCATION, 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("go_to_last_location_radiobutton"))));
+       g_settings_set_boolean (data->browser_settings, PREF_BROWSER_USE_STARTUP_LOCATION, 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("use_startup_location_radiobutton"))));
+       g_settings_set_boolean (data->general_settings, PREF_GENERAL_STORE_METADATA_IN_FILES, 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("embed_metadata_checkbutton"))));
+
+       if (g_settings_get_boolean (data->browser_settings, PREF_BROWSER_USE_STARTUP_LOCATION)) {
+               char *location;
+
+               location = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (GET_WIDGET 
("startup_dir_filechooserbutton")));
+               _g_settings_set_uri (data->browser_settings, PREF_BROWSER_STARTUP_LOCATION, location);
+               gth_pref_set_startup_location (location);
+               g_free (location);
+       }
+
+}
diff --git a/gthumb/dlg-preferences-general.h b/gthumb/dlg-preferences-general.h
new file mode 100644
index 0000000..bd3f709
--- /dev/null
+++ b/gthumb/dlg-preferences-general.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2014 The 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DLG_PREFERENCES_GENERAL_H
+#define DLG_PREFERENCES_GENERAL_H
+
+#include "gth-browser.h"
+
+void general__dlg_preferences_construct_cb (GtkWidget  *dialog,
+                                           GthBrowser *browser,
+                                           GtkBuilder *dialog_builder);
+void general__dlg_preferences_apply        (GtkWidget  *dialog,
+                                           GthBrowser *browser,
+                                           GtkBuilder *dialog_builder);
+
+#endif /* DLG_PREFERENCES_GENERAL_H */
diff --git a/gthumb/dlg-preferences.c b/gthumb/dlg-preferences.c
index e273877..d86e435 100644
--- a/gthumb/dlg-preferences.c
+++ b/gthumb/dlg-preferences.c
@@ -24,9 +24,7 @@
 #include "dlg-preferences.h"
 #include "gth-browser.h"
 #include "gth-enum-types.h"
-#include "gth-file-source-vfs.h"
 #include "gth-main.h"
-#include "gth-metadata-chooser.h"
 #include "gth-preferences.h"
 #include "gtk-utils.h"
 #include "glib-utils.h"
@@ -40,46 +38,12 @@ typedef struct {
        GthBrowser *browser;
        GtkBuilder *builder;
        GtkWidget  *dialog;
-       GtkWidget  *thumbnail_caption_chooser;
-       GSettings  *general_settings;
-       GSettings  *browser_settings;
-       GSettings  *messages_settings;
 } DialogData;
 
-static int thumb_size[] = { 48, 64, 85, 95, 112, 128, 164, 200, 256 };
-static int thumb_sizes = sizeof (thumb_size) / sizeof (int);
-
-
-static int
-get_idx_from_size (gint size)
-{
-       int i;
-
-       for (i = 0; i < thumb_sizes; i++)
-               if (size == thumb_size[i])
-                       return i;
-       return -1;
-}
-
 
 static void
 apply_changes (DialogData *data)
 {
-       /* Startup dir. */
-
-       g_settings_set_boolean (data->browser_settings, PREF_BROWSER_GO_TO_LAST_LOCATION, 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("go_to_last_location_radiobutton"))));
-       g_settings_set_boolean (data->browser_settings, PREF_BROWSER_USE_STARTUP_LOCATION, 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("use_startup_location_radiobutton"))));
-       g_settings_set_boolean (data->general_settings, PREF_GENERAL_STORE_METADATA_IN_FILES, 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("embed_metadata_checkbutton"))));
-
-       if (g_settings_get_boolean (data->browser_settings, PREF_BROWSER_USE_STARTUP_LOCATION)) {
-               char *location;
-
-               location = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (GET_WIDGET 
("startup_dir_filechooserbutton")));
-               _g_settings_set_uri (data->browser_settings, PREF_BROWSER_STARTUP_LOCATION, location);
-               gth_pref_set_startup_location (location);
-               g_free (location);
-       }
-
        gth_hook_invoke ("dlg-preferences-apply", data->dialog, data->browser, data->builder);
 }
 
@@ -91,9 +55,6 @@ destroy_cb (GtkWidget *widget,
        apply_changes (data);
        gth_browser_set_dialog (data->browser, "preferences", NULL);
 
-       g_object_unref (data->general_settings);
-       g_object_unref (data->browser_settings);
-       g_object_unref (data->messages_settings);
        g_object_unref (data->builder);
        g_free (data);
 }
@@ -107,113 +68,10 @@ close_button_clicked_cb (GtkWidget  *widget,
 }
 
 
-static void
-use_startup_toggled_cb (GtkWidget *widget,
-                       DialogData *data)
-{
-       gtk_widget_set_sensitive (GET_WIDGET ("startup_dir_filechooserbutton"), gtk_toggle_button_get_active 
(GTK_TOGGLE_BUTTON (widget)));
-       gtk_widget_set_sensitive (GET_WIDGET ("set_to_current_button"), gtk_toggle_button_get_active 
(GTK_TOGGLE_BUTTON (widget)));
-}
-
-
-static void
-set_to_current_cb (GtkWidget  *widget,
-                  DialogData *data)
-{
-       GthFileSource *file_source;
-
-       file_source = gth_main_get_file_source (gth_browser_get_location (data->browser));
-       if (GTH_IS_FILE_SOURCE_VFS (file_source)) {
-               GFile *gio_file;
-               char  *uri;
-
-               gio_file = gth_file_source_to_gio_file (file_source, gth_browser_get_location 
(data->browser));
-               uri = g_file_get_uri (gio_file);
-               gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (GET_WIDGET ("startup_dir_filechooserbutton")), 
uri);
-
-               g_free (uri);
-               g_object_unref (gio_file);
-       }
-       g_object_unref (file_source);
-}
-
-
-static void
-thumbnails_pane_orientation_changed_cb (GtkWidget  *widget,
-                                       DialogData *data)
-{
-       g_settings_set_enum (data->browser_settings, PREF_BROWSER_VIEWER_THUMBNAILS_ORIENT, 
gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnails_pane_orient_combobox"))));
-}
-
-
-static void
-file_properties_position_combobox_changed_cb (GtkWidget  *widget,
-                                             DialogData *data)
-{
-       g_settings_set_boolean (data->browser_settings, PREF_BROWSER_PROPERTIES_ON_THE_RIGHT, 
gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("file_properties_position_combobox"))) == 1);
-}
-
-
-static void
-reuse_active_window_checkbutton_toggled_cb (GtkToggleButton *button,
-                                           DialogData      *data)
-{
-       g_settings_set_boolean (data->browser_settings, PREF_BROWSER_REUSE_ACTIVE_WINDOW, 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("reuse_active_window_checkbutton"))));
-}
-
-
-static void
-confirm_deletion_toggled_cb (GtkToggleButton *button,
-                            DialogData      *data)
-{
-       g_settings_set_boolean (data->messages_settings, PREF_MSG_CONFIRM_DELETION, 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("confirm_deletion_checkbutton"))));
-}
-
-
-static void
-ask_to_save_toggled_cb (GtkToggleButton *button,
-                       DialogData      *data)
-{
-       g_settings_set_boolean (data->messages_settings, PREF_MSG_SAVE_MODIFIED_IMAGE, 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("ask_to_save_checkbutton"))));
-}
-
-
-static void
-thumbnail_size_changed_cb (GtkWidget  *widget,
-                          DialogData *data)
-{
-       g_settings_set_int (data->browser_settings, PREF_BROWSER_THUMBNAIL_SIZE, 
thumb_size[gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnail_size_combobox")))]);
-}
-
-
-static void
-fast_file_type_toggled_cb (GtkToggleButton *button,
-                          DialogData      *data)
-{
-       g_settings_set_boolean (data->browser_settings, PREF_BROWSER_FAST_FILE_TYPE, ! 
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("slow_mime_type_checkbutton"))));
-}
-
-
-static void
-thumbnail_caption_chooser_changed_cb (GthMetadataChooser *chooser,
-                                     DialogData         *data)
-{
-       char *attributes;
-
-       attributes = gth_metadata_chooser_get_selection (chooser);
-       g_settings_set_string (data->browser_settings, PREF_BROWSER_THUMBNAIL_CAPTION, attributes);
-
-       g_free (attributes);
-}
-
-
 void
 dlg_preferences (GthBrowser *browser)
 {
        DialogData       *data;
-       char             *startup_location;
-       GthFileSource    *file_source;
-       char             *current_caption;
 
        if (gth_browser_get_dialog (browser, "preferences") != NULL) {
                gtk_window_present (GTK_WINDOW (gth_browser_get_dialog (browser, "preferences")));
@@ -224,76 +82,8 @@ dlg_preferences (GthBrowser *browser)
        data->browser = browser;
        data->builder = _gtk_builder_new_from_file ("preferences.ui", NULL);
        data->dialog = GET_WIDGET ("preferences_dialog");
-       data->general_settings = g_settings_new (GTHUMB_GENERAL_SCHEMA);
-       data->browser_settings = g_settings_new (GTHUMB_BROWSER_SCHEMA);
-       data->messages_settings = g_settings_new (GTHUMB_MESSAGES_SCHEMA);
 
        gth_browser_set_dialog (browser, "preferences", data->dialog);
-
-       /* caption list */
-
-       data->thumbnail_caption_chooser = gth_metadata_chooser_new (GTH_METADATA_ALLOW_IN_FILE_LIST);
-       gtk_widget_show (data->thumbnail_caption_chooser);
-       gtk_container_add (GTK_CONTAINER (GET_WIDGET ("caption_scrolledwindow")), 
data->thumbnail_caption_chooser);
-
-       current_caption = g_settings_get_string (data->browser_settings, PREF_BROWSER_THUMBNAIL_CAPTION);
-       gth_metadata_chooser_set_selection (GTH_METADATA_CHOOSER (data->thumbnail_caption_chooser), 
current_caption);
-       g_free (current_caption);
-
-       /* * general */
-
-       if (g_settings_get_boolean (data->browser_settings, PREF_BROWSER_USE_STARTUP_LOCATION))
-               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET 
("use_startup_location_radiobutton")), TRUE);
-       else
-               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET 
("go_to_last_location_radiobutton")), TRUE);
-
-       if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET 
("use_startup_location_radiobutton")))) {
-               gtk_widget_set_sensitive (GET_WIDGET ("startup_dir_filechooserbutton"), FALSE);
-               gtk_widget_set_sensitive (GET_WIDGET ("set_to_current_button"), FALSE);
-       }
-
-       startup_location = _g_settings_get_uri (data->browser_settings, PREF_BROWSER_STARTUP_LOCATION);
-       if (startup_location == NULL)
-               startup_location = g_strdup (get_home_uri ());
-       file_source = gth_main_get_file_source_for_uri (startup_location);
-       if (GTH_IS_FILE_SOURCE_VFS (file_source)) {
-               GFile *location;
-               GFile *folder;
-               char  *folder_uri;
-
-               location = g_file_new_for_uri (startup_location);
-               folder = gth_file_source_to_gio_file (file_source, location);
-               folder_uri = g_file_get_uri (folder);
-               gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (GET_WIDGET ("startup_dir_filechooserbutton")), 
folder_uri);
-
-               g_free (folder_uri);
-               g_object_unref (folder);
-               g_object_unref (location);
-       }
-       g_object_unref (file_source);
-       g_free (startup_location);
-
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("reuse_active_window_checkbutton")),
-                                     g_settings_get_boolean (data->browser_settings, 
PREF_BROWSER_REUSE_ACTIVE_WINDOW));
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("confirm_deletion_checkbutton")),
-                                     g_settings_get_boolean (data->messages_settings, 
PREF_MSG_CONFIRM_DELETION));
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("ask_to_save_checkbutton")),
-                                     g_settings_get_boolean (data->messages_settings, 
PREF_MSG_SAVE_MODIFIED_IMAGE));
-       gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnails_pane_orient_combobox")),
-                                 g_settings_get_enum (data->browser_settings, 
PREF_BROWSER_VIEWER_THUMBNAILS_ORIENT));
-
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("embed_metadata_checkbutton")),
-                                     g_settings_get_boolean (data->general_settings, 
PREF_GENERAL_STORE_METADATA_IN_FILES));
-
-       /* * browser */
-
-       gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("thumbnail_size_combobox")),
-                                 get_idx_from_size (g_settings_get_int (data->browser_settings, 
PREF_BROWSER_THUMBNAIL_SIZE)));
-       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("slow_mime_type_checkbutton")),
-                                     ! g_settings_get_boolean (data->browser_settings, 
PREF_BROWSER_FAST_FILE_TYPE));
-       gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("file_properties_position_combobox")),
-                                 g_settings_get_boolean (data->browser_settings, 
PREF_BROWSER_PROPERTIES_ON_THE_RIGHT) ? 1 : 0);
-
        gth_hook_invoke ("dlg-preferences-construct", data->dialog, data->browser, data->builder);
 
        /* Set the signals handlers. */
@@ -307,52 +97,6 @@ dlg_preferences (GthBrowser *browser)
                          G_CALLBACK (close_button_clicked_cb),
                          data);
 
-       /* general */
-
-       g_signal_connect (GET_WIDGET ("thumbnails_pane_orient_combobox"),
-                         "changed",
-                         G_CALLBACK (thumbnails_pane_orientation_changed_cb),
-                         data);
-       g_signal_connect (GET_WIDGET ("file_properties_position_combobox"),
-                         "changed",
-                         G_CALLBACK (file_properties_position_combobox_changed_cb),
-                         data);
-       g_signal_connect (G_OBJECT (GET_WIDGET ("use_startup_location_radiobutton")),
-                         "toggled",
-                         G_CALLBACK (use_startup_toggled_cb),
-                         data);
-       g_signal_connect (G_OBJECT (GET_WIDGET ("set_to_current_button")),
-                         "clicked",
-                         G_CALLBACK (set_to_current_cb),
-                         data);
-       g_signal_connect (G_OBJECT (GET_WIDGET ("reuse_active_window_checkbutton")),
-                         "toggled",
-                         G_CALLBACK (reuse_active_window_checkbutton_toggled_cb),
-                         data);
-       g_signal_connect (G_OBJECT (GET_WIDGET ("confirm_deletion_checkbutton")),
-                         "toggled",
-                         G_CALLBACK (confirm_deletion_toggled_cb),
-                         data);
-       g_signal_connect (G_OBJECT (GET_WIDGET ("ask_to_save_checkbutton")),
-                         "toggled",
-                         G_CALLBACK (ask_to_save_toggled_cb),
-                         data);
-
-       /* browser */
-
-       g_signal_connect (G_OBJECT (GET_WIDGET ("thumbnail_size_combobox")),
-                         "changed",
-                         G_CALLBACK (thumbnail_size_changed_cb),
-                         data);
-       g_signal_connect (G_OBJECT (GET_WIDGET ("slow_mime_type_checkbutton")),
-                         "toggled",
-                         G_CALLBACK (fast_file_type_toggled_cb),
-                         data);
-       g_signal_connect (G_OBJECT (data->thumbnail_caption_chooser),
-                         "changed",
-                         G_CALLBACK (thumbnail_caption_chooser_changed_cb),
-                         data);
-
        /* run dialog. */
 
        gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (browser));
diff --git a/gthumb/gth-main-default-types.c b/gthumb/gth-main-default-types.c
index e1844d9..8d89f2c 100644
--- a/gthumb/gth-main-default-types.c
+++ b/gthumb/gth-main-default-types.c
@@ -22,7 +22,9 @@
 
 #include <config.h>
 #include <glib/gi18n.h>
+#include "dlg-preferences-browser.h"
 #include "dlg-preferences-extensions.h"
+#include "dlg-preferences-general.h"
 #include "gth-file-properties.h"
 #include "gth-main.h"
 #include "pixbuf-io.h"
@@ -60,6 +62,10 @@ gth_main_register_default_types (void)
 {
        gth_main_register_type ("file-properties", GTH_TYPE_FILE_PROPERTIES);
        gth_main_register_default_file_loader ();
+       gth_hook_add_callback ("dlg-preferences-construct", 1, G_CALLBACK 
(general__dlg_preferences_construct_cb), NULL);
+       gth_hook_add_callback ("dlg-preferences-apply", 1, G_CALLBACK (general__dlg_preferences_apply), NULL);
+       gth_hook_add_callback ("dlg-preferences-construct", 2, G_CALLBACK 
(browser__dlg_preferences_construct_cb), NULL);
+       gth_hook_add_callback ("dlg-preferences-apply", 2, G_CALLBACK (browser__dlg_preferences_apply), NULL);
        gth_hook_add_callback ("dlg-preferences-construct", 9999, G_CALLBACK 
(extensions__dlg_preferences_construct_cb), NULL);
        gth_hook_add_callback ("dlg-preferences-apply", 9999 /* Must be the last callback */, G_CALLBACK 
(extensions__dlg_preferences_apply), NULL);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]