forked from AuroraMiddleware/gtk
Spread single-click-activate api
This makes sense to have in all the views, not just GtkListView.
This commit is contained in:
parent
12b1007046
commit
f611d55f16
@ -504,6 +504,8 @@ gtk_column_view_get_sorter
|
||||
gtk_column_view_get_show_separators
|
||||
gtk_column_view_set_show_separators
|
||||
gtk_column_view_sort_by_column
|
||||
gtk_column_view_set_single_click_activate
|
||||
gtk_column_view_get_single_click_activate
|
||||
<SUBSECTION Standard>
|
||||
GTK_COLUMN_VIEW
|
||||
GTK_COLUMN_VIEW_CLASS
|
||||
@ -550,6 +552,8 @@ gtk_grid_view_set_max_columns
|
||||
gtk_grid_view_get_max_columns
|
||||
gtk_grid_view_set_min_columns
|
||||
gtk_grid_view_get_min_columns
|
||||
gtk_grid_view_set_single_click_activate
|
||||
gtk_grid_view_get_single_click_activate
|
||||
<SUBSECTION Standard>
|
||||
GTK_GRID_VIEW
|
||||
GTK_GRID_VIEW_CLASS
|
||||
|
@ -81,6 +81,7 @@ enum
|
||||
PROP_SORTER,
|
||||
PROP_VADJUSTMENT,
|
||||
PROP_VSCROLL_POLICY,
|
||||
PROP_SINGLE_CLICK_ACTIVATE,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
@ -317,6 +318,10 @@ gtk_column_view_get_property (GObject *object,
|
||||
g_value_set_object (value, self->sorter);
|
||||
break;
|
||||
|
||||
case PROP_SINGLE_CLICK_ACTIVATE:
|
||||
g_value_set_boolean (value, gtk_column_view_get_single_click_activate (self));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@ -373,6 +378,10 @@ gtk_column_view_set_property (GObject *object,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_SINGLE_CLICK_ACTIVATE:
|
||||
gtk_column_view_set_single_click_activate (self, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@ -457,6 +466,18 @@ gtk_column_view_class_init (GtkColumnViewClass *klass)
|
||||
GTK_TYPE_SORTER,
|
||||
G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GtkColumnView:single-click-activate:
|
||||
*
|
||||
* Activate rows on single click and select them on hover
|
||||
*/
|
||||
properties[PROP_SINGLE_CLICK_ACTIVATE] =
|
||||
g_param_spec_boolean ("single-click-activate",
|
||||
P_("Single click activate"),
|
||||
P_("Activate rows on single click"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
|
||||
/**
|
||||
@ -769,3 +790,42 @@ gtk_column_view_sort_by_column (GtkColumnView *self,
|
||||
column,
|
||||
direction == GTK_SORT_DESCENDING);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_column_view_set_single_click_activate:
|
||||
* @self: a #GtkColumnView
|
||||
* @single_click_activate: %TRUE to activate items on single click
|
||||
*
|
||||
* Sets whether rows should be activated on single click and
|
||||
* selected on hover.
|
||||
*/
|
||||
void
|
||||
gtk_column_view_set_single_click_activate (GtkColumnView *self,
|
||||
gboolean single_click_activate)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_COLUMN_VIEW (self));
|
||||
|
||||
if (single_click_activate == gtk_list_view_get_single_click_activate (self->listview))
|
||||
return;
|
||||
|
||||
gtk_list_view_set_single_click_activate (self->listview, single_click_activate);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SINGLE_CLICK_ACTIVATE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_column_view_get_single_click_activate:
|
||||
* @self: a #GtkColumnView
|
||||
*
|
||||
* Returns whether rows will be activated on single click and
|
||||
* selected on hover.
|
||||
*
|
||||
* Returns: %TRUE if rows are activated on single click
|
||||
*/
|
||||
gboolean
|
||||
gtk_column_view_get_single_click_activate (GtkColumnView *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_COLUMN_VIEW (self), FALSE);
|
||||
|
||||
return gtk_list_view_get_single_click_activate (self->listview);
|
||||
}
|
||||
|
@ -81,6 +81,12 @@ void gtk_column_view_sort_by_column (GtkColumnView
|
||||
GtkColumnViewColumn *column,
|
||||
GtkSortType direction);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_column_view_set_single_click_activate (GtkColumnView *self,
|
||||
gboolean single_click_activate);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_column_view_get_single_click_activate (GtkColumnView *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_COLUMN_VIEW_H__ */
|
||||
|
@ -90,6 +90,7 @@ enum
|
||||
PROP_MAX_COLUMNS,
|
||||
PROP_MIN_COLUMNS,
|
||||
PROP_MODEL,
|
||||
PROP_SINGLE_CLICK_ACTIVATE,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
@ -909,6 +910,10 @@ gtk_grid_view_get_property (GObject *object,
|
||||
g_value_set_object (value, gtk_list_base_get_model (GTK_LIST_BASE (self)));
|
||||
break;
|
||||
|
||||
case PROP_SINGLE_CLICK_ACTIVATE:
|
||||
g_value_set_boolean (value, gtk_list_item_manager_get_single_click_activate (self->item_manager));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@ -941,6 +946,10 @@ gtk_grid_view_set_property (GObject *object,
|
||||
gtk_grid_view_set_model (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_SINGLE_CLICK_ACTIVATE:
|
||||
gtk_grid_view_set_single_click_activate (self, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@ -1041,6 +1050,18 @@ gtk_grid_view_class_init (GtkGridViewClass *klass)
|
||||
G_TYPE_LIST_MODEL,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GtkGridView:single-click-activate:
|
||||
*
|
||||
* Activate rows on single click and select them on hover
|
||||
*/
|
||||
properties[PROP_SINGLE_CLICK_ACTIVATE] =
|
||||
g_param_spec_boolean ("single-click-activate",
|
||||
P_("Single click activate"),
|
||||
P_("Activate rows on single click"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
|
||||
/**
|
||||
@ -1311,3 +1332,41 @@ gtk_grid_view_set_min_columns (GtkGridView *self,
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MIN_COLUMNS]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_grid_view_set_single_click_activate:
|
||||
* @self: a #GtkGridView
|
||||
* @single_click_activate: %TRUE to activate items on single click
|
||||
*
|
||||
* Sets whether items should be activated on single click and
|
||||
* selected on hover.
|
||||
*/
|
||||
void
|
||||
gtk_grid_view_set_single_click_activate (GtkGridView *self,
|
||||
gboolean single_click_activate)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_GRID_VIEW (self));
|
||||
|
||||
if (single_click_activate == gtk_list_item_manager_get_single_click_activate (self->item_manager))
|
||||
return;
|
||||
|
||||
gtk_list_item_manager_set_single_click_activate (self->item_manager, single_click_activate);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SINGLE_CLICK_ACTIVATE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_grid_view_get_single_click_activate:
|
||||
* @self: a #GtkListView
|
||||
*
|
||||
* Returns whether items will be activated on single click and
|
||||
* selected on hover.
|
||||
*
|
||||
* Returns: %TRUE if items are activated on single click
|
||||
*/
|
||||
gboolean
|
||||
gtk_grid_view_get_single_click_activate (GtkGridView *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_GRID_VIEW (self), FALSE);
|
||||
|
||||
return gtk_list_item_manager_get_single_click_activate (self->item_manager);
|
||||
}
|
||||
|
@ -74,6 +74,12 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gtk_grid_view_set_max_columns (GtkGridView *self,
|
||||
guint max_columns);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_grid_view_set_single_click_activate (GtkGridView *self,
|
||||
gboolean single_click_activate);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_grid_view_get_single_click_activate (GtkGridView *self);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user