Commit 188c09e7 authored by Paolo Bacchilega's avatar Paolo Bacchilega
Browse files

added support for double click activation

parent 5bbebdc4
......@@ -4353,6 +4353,7 @@ gth_browser_init (GthBrowser *browser)
gth_file_list_set_caption (GTH_FILE_LIST (browser->priv->thumbnail_list), "none");
gth_grid_view_set_cell_spacing (GTH_GRID_VIEW (gth_file_list_get_view (GTH_FILE_LIST (browser->priv->thumbnail_list))), 0);
gth_file_list_set_thumb_size (GTH_FILE_LIST (browser->priv->thumbnail_list), 95);
if (browser->priv->viewer_thumbnails_orientation == GTK_ORIENTATION_HORIZONTAL) {
gth_paned_set_position2 (GTH_PANED (browser->priv->viewer_thumbnails_pane), g_settings_get_int (browser->priv->browser_settings, PREF_BROWSER_THUMBNAIL_LIST_SIZE));
gtk_paned_pack2 (GTK_PANED (browser->priv->viewer_thumbnails_pane), browser->priv->thumbnail_list, FALSE, FALSE);
......@@ -4765,6 +4766,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);
g_free (caption);
g_free (sort_type);
......
......@@ -86,6 +86,12 @@ gth_file_view_default_init (GthFileViewInterface *iface)
G_MAXINT32,
DEFAULT_THUMBNAIL_SIZE,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
g_object_interface_install_property (iface,
g_param_spec_boolean ("activate-on-single-click",
"Activate on single click",
"Emit the activated signal after a single click",
TRUE,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}
......@@ -158,6 +164,29 @@ gth_file_view_get_thumbnail_size (GthFileView *self)
}
void
gth_file_view_set_activate_on_single_click (GthFileView *self,
gboolean single)
{
g_return_if_fail (GTH_IS_FILE_VIEW (self));
g_object_set (self, "activate-on-single-click", single, NULL);
}
gboolean
gth_file_view_get_activate_on_single_click (GthFileView *self)
{
gboolean value;
g_return_val_if_fail (GTH_IS_FILE_VIEW (self), FALSE);
g_object_get (self, "activate-on-single-click", &value, NULL);
return value;
}
void
gth_file_view_scroll_to (GthFileView *self,
int pos,
......
......@@ -107,6 +107,11 @@ char * gth_file_view_get_caption (GthFileView *self)
void gth_file_view_set_thumbnail_size (GthFileView *self,
int value);
gboolean gth_file_view_get_thumbnail_size (GthFileView *self);
void gth_file_view_set_activate_on_single_click
(GthFileView *self,
gboolean single);
gboolean gth_file_view_get_activate_on_single_click
(GthFileView *self);
void gth_file_view_scroll_to (GthFileView *self,
int pos,
double yalign);
......
......@@ -89,6 +89,7 @@ enum {
PROP_HSCROLL_POLICY,
PROP_MODEL,
PROP_THUMBNAIL_SIZE,
PROP_ACTIVATE_ON_SINGLE_CLICK,
PROP_VADJUSTMENT,
PROP_VSCROLL_POLICY
};
......@@ -3042,7 +3043,8 @@ gth_grid_view_button_release (GtkWidget *widget,
_gth_grid_view_set_item_selected_and_emit_signal (self, TRUE, self->priv->select_pending_pos);
self->priv->last_selected_pos = self->priv->select_pending_pos;
self->priv->last_selected_item = self->priv->select_pending_item;
gth_file_view_activated (GTH_FILE_VIEW (self), self->priv->last_selected_pos);
if (self->priv->activate_on_single_click)
gth_file_view_activated (GTH_FILE_VIEW (self), self->priv->last_selected_pos);
}
if (self->priv->activate_pending) {
......@@ -3533,6 +3535,15 @@ _gth_grid_view_set_caption (GthGridView *self,
}
static void
_gth_grid_view_set_activate_on_single_click (GthGridView *self,
gboolean value)
{
self->priv->activate_on_single_click = value;
g_object_notify (G_OBJECT (self), "activate-on-single-click");
}
static void
gth_grid_view_set_property (GObject *object,
guint prop_id,
......@@ -3559,6 +3570,9 @@ gth_grid_view_set_property (GObject *object,
case PROP_THUMBNAIL_SIZE:
_gth_grid_view_set_thumbnail_size (self, g_value_get_int (value));
break;
case PROP_ACTIVATE_ON_SINGLE_CLICK:
_gth_grid_view_set_activate_on_single_click (self, g_value_get_boolean (value));
break;
case PROP_VADJUSTMENT:
_gth_grid_view_set_vadjustment (self, g_value_get_object (value));
break;
......@@ -3600,6 +3614,9 @@ gth_grid_view_get_property (GObject *object,
case PROP_THUMBNAIL_SIZE:
g_value_set_int (value, self->priv->thumbnail_size);
break;
case PROP_ACTIVATE_ON_SINGLE_CLICK:
g_value_set_boolean (value, self->priv->activate_on_single_click);
break;
case PROP_VADJUSTMENT:
g_value_set_object (value, self->priv->vadjustment);
break;
......@@ -3732,6 +3749,7 @@ gth_grid_view_class_init (GthGridViewClass *grid_view_class)
g_object_class_override_property (gobject_class, PROP_CAPTION, "caption");
g_object_class_override_property (gobject_class, PROP_MODEL, "model");
g_object_class_override_property (gobject_class, PROP_THUMBNAIL_SIZE, "thumbnail-size");
g_object_class_override_property (gobject_class, PROP_ACTIVATE_ON_SINGLE_CLICK, "activate-on-single-click");
/* Key bindings */
......
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