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

added ability to change click policy from the preferences dialog

parent 188c09e7
......@@ -80,6 +80,9 @@
<key name="thumbnail-caption" type="s">
<default>'comment::note,comment::time'</default>
</key>
<key name="single-click-activation" type="b">
<default>true</default>
</key>
<key name="sort-type" type="s">
<default>'file::mtime'</default>
</key>
......@@ -95,9 +98,6 @@
<key name="maximized" type="b">
<default>false</default>
</key>
<key name="image-pane-visible" type="b">
<default>true</default>
</key>
<key name="statusbar-visible" type="b">
<default>true</default>
</key>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.19.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkBox" id="browser_page">
......@@ -17,9 +17,9 @@
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Caption</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
......@@ -59,6 +59,85 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Behavior</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkRadioButton" id="single_click_radiobutton">
<property name="label" translatable="yes">_Single click to open files</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="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="double_click_radiobutton">
<property name="label" translatable="yes">_Double click to open files</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="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">single_click_radiobutton</property>
</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">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box3">
<property name="visible">True</property>
......@@ -69,9 +148,9 @@
<object class="GtkLabel" id="label8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Other</property>
<property name="use_markup">True</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
......@@ -182,7 +261,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>
......
......@@ -98,6 +98,14 @@ thumbnail_caption_chooser_changed_cb (GthMetadataChooser *chooser,
}
static void
click_behavior_changed_cb (GtkToggleButton *button,
BrowserData *data)
{
g_settings_set_boolean (data->browser_settings, PREF_BROWSER_SINGLE_CLICK_ACTIVATION, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_click_radiobutton"))));
}
void
browser__dlg_preferences_construct_cb (GtkWidget *dialog,
GthBrowser *browser,
......@@ -125,6 +133,15 @@ browser__dlg_preferences_construct_cb (GtkWidget *dialog,
gth_metadata_chooser_set_selection (GTH_METADATA_CHOOSER (data->thumbnail_caption_chooser), current_caption);
g_free (current_caption);
/* behavior */
if (g_settings_get_boolean (data->browser_settings, PREF_BROWSER_SINGLE_CLICK_ACTIVATION))
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_click_radiobutton")), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("double_click_radiobutton")), TRUE);
/* other */
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")),
......@@ -140,6 +157,14 @@ browser__dlg_preferences_construct_cb (GtkWidget *dialog,
"toggled",
G_CALLBACK (fast_file_type_toggled_cb),
data);
g_signal_connect (G_OBJECT (GET_WIDGET ("single_click_radiobutton")),
"toggled",
G_CALLBACK (click_behavior_changed_cb),
data);
g_signal_connect (G_OBJECT (GET_WIDGET ("double_click_radiobutton")),
"toggled",
G_CALLBACK (click_behavior_changed_cb),
data);
g_signal_connect (G_OBJECT (data->thumbnail_caption_chooser),
"changed",
G_CALLBACK (thumbnail_caption_chooser_changed_cb),
......
......@@ -4155,6 +4155,18 @@ pref_thumbnail_caption_changed (GSettings *settings,
}
static void
pref_single_click_activation_changed (GSettings *settings,
const char *key,
gpointer user_data)
{
GthBrowser *browser = user_data;
gboolean single_click = g_settings_get_boolean (settings, key);
gth_file_view_set_activate_on_single_click (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (browser->priv->file_list))), single_click);
}
static gboolean
_gth_browser_realize (GtkWidget *browser,
gpointer *data)
......@@ -4766,7 +4778,7 @@ gth_browser_init (GthBrowser *browser)
g_settings_get_int (browser->priv->browser_settings, PREF_BROWSER_THUMBNAIL_SIZE));
caption = g_settings_get_string (browser->priv->browser_settings, PREF_BROWSER_THUMBNAIL_CAPTION);
gth_file_list_set_caption (GTH_FILE_LIST (browser->priv->file_list), caption);
gth_file_view_set_activate_on_single_click (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (browser->priv->file_list))), FALSE);
gth_file_view_set_activate_on_single_click (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (browser->priv->file_list))), g_settings_get_boolean (browser->priv->browser_settings, PREF_BROWSER_SINGLE_CLICK_ACTIVATION));
g_free (caption);
g_free (sort_type);
......@@ -4987,6 +4999,10 @@ gth_browser_init (GthBrowser *browser)
"changed::" PREF_BROWSER_THUMBNAIL_CAPTION,
G_CALLBACK (pref_thumbnail_caption_changed),
browser);
g_signal_connect (browser->priv->browser_settings,
"changed::" PREF_BROWSER_SINGLE_CLICK_ACTIVATION,
G_CALLBACK (pref_single_click_activation_changed),
browser);
browser->priv->constructed = TRUE;
}
......
......@@ -61,7 +61,7 @@ G_BEGIN_DECLS
#define PREF_BROWSER_THUMBNAIL_SIZE "thumbnail-size"
#define PREF_BROWSER_THUMBNAIL_LIMIT "thumbnail-limit"
#define PREF_BROWSER_THUMBNAIL_CAPTION "thumbnail-caption"
#define PREF_BROWSER_CLICK_POLICY "click-policy"
#define PREF_BROWSER_SINGLE_CLICK_ACTIVATION "single-click-activation"
#define PREF_BROWSER_SORT_TYPE "sort-type"
#define PREF_BROWSER_SORT_INVERSE "sort-inverse"
#define PREF_BROWSER_WINDOW_WIDTH "window-width"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment