forked from AuroraMiddleware/gtk
Add an "activate_cursor_item" action signal and bind it to the return key.
2004-07-05 Anders Carlsson <andersca@gnome.org> * gtk/gtkiconview.c: (gtk_icon_view_class_init), (gtk_icon_view_real_select_cursor_item), (gtk_icon_view_real_activate_cursor_item): * gtk/gtkiconview.h: Add an "activate_cursor_item" action signal and bind it to the return key.
This commit is contained in:
parent
57f0d6a21f
commit
d8ef8e3673
@ -1,3 +1,12 @@
|
|||||||
|
2004-07-05 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
|
* gtk/gtkiconview.c: (gtk_icon_view_class_init),
|
||||||
|
(gtk_icon_view_real_select_cursor_item),
|
||||||
|
(gtk_icon_view_real_activate_cursor_item):
|
||||||
|
* gtk/gtkiconview.h:
|
||||||
|
Add an "activate_cursor_item" action signal
|
||||||
|
and bind it to the return key.
|
||||||
|
|
||||||
2004-07-04 Anders Carlsson <andersca@gnome.org>
|
2004-07-04 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
* demos/gtk-demo/Makefile.am:
|
* demos/gtk-demo/Makefile.am:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2004-07-05 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
|
* gtk/gtkiconview.c: (gtk_icon_view_class_init),
|
||||||
|
(gtk_icon_view_real_select_cursor_item),
|
||||||
|
(gtk_icon_view_real_activate_cursor_item):
|
||||||
|
* gtk/gtkiconview.h:
|
||||||
|
Add an "activate_cursor_item" action signal
|
||||||
|
and bind it to the return key.
|
||||||
|
|
||||||
2004-07-04 Anders Carlsson <andersca@gnome.org>
|
2004-07-04 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
* demos/gtk-demo/Makefile.am:
|
* demos/gtk-demo/Makefile.am:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2004-07-05 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
|
* gtk/gtkiconview.c: (gtk_icon_view_class_init),
|
||||||
|
(gtk_icon_view_real_select_cursor_item),
|
||||||
|
(gtk_icon_view_real_activate_cursor_item):
|
||||||
|
* gtk/gtkiconview.h:
|
||||||
|
Add an "activate_cursor_item" action signal
|
||||||
|
and bind it to the return key.
|
||||||
|
|
||||||
2004-07-04 Anders Carlsson <andersca@gnome.org>
|
2004-07-04 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
* demos/gtk-demo/Makefile.am:
|
* demos/gtk-demo/Makefile.am:
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2004-07-05 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
|
* gtk/gtkiconview.c: (gtk_icon_view_class_init),
|
||||||
|
(gtk_icon_view_real_select_cursor_item),
|
||||||
|
(gtk_icon_view_real_activate_cursor_item):
|
||||||
|
* gtk/gtkiconview.h:
|
||||||
|
Add an "activate_cursor_item" action signal
|
||||||
|
and bind it to the return key.
|
||||||
|
|
||||||
2004-07-04 Anders Carlsson <andersca@gnome.org>
|
2004-07-04 Anders Carlsson <andersca@gnome.org>
|
||||||
|
|
||||||
* demos/gtk-demo/Makefile.am:
|
* demos/gtk-demo/Makefile.am:
|
||||||
|
@ -124,6 +124,7 @@ enum
|
|||||||
SELECT_CURSOR_ITEM,
|
SELECT_CURSOR_ITEM,
|
||||||
TOGGLE_CURSOR_ITEM,
|
TOGGLE_CURSOR_ITEM,
|
||||||
MOVE_CURSOR,
|
MOVE_CURSOR,
|
||||||
|
ACTIVATE_CURSOR_ITEM,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -178,6 +179,7 @@ static void gtk_icon_view_real_select_all (GtkIconView
|
|||||||
static void gtk_icon_view_real_unselect_all (GtkIconView *icon_view);
|
static void gtk_icon_view_real_unselect_all (GtkIconView *icon_view);
|
||||||
static void gtk_icon_view_real_select_cursor_item (GtkIconView *icon_view);
|
static void gtk_icon_view_real_select_cursor_item (GtkIconView *icon_view);
|
||||||
static void gtk_icon_view_real_toggle_cursor_item (GtkIconView *icon_view);
|
static void gtk_icon_view_real_toggle_cursor_item (GtkIconView *icon_view);
|
||||||
|
static gboolean gtk_icon_view_real_activate_cursor_item (GtkIconView *icon_view);
|
||||||
|
|
||||||
/* Internal functions */
|
/* Internal functions */
|
||||||
static void gtk_icon_view_adjustment_changed (GtkAdjustment *adjustment,
|
static void gtk_icon_view_adjustment_changed (GtkAdjustment *adjustment,
|
||||||
@ -294,6 +296,7 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
|||||||
klass->unselect_all = gtk_icon_view_real_unselect_all;
|
klass->unselect_all = gtk_icon_view_real_unselect_all;
|
||||||
klass->select_cursor_item = gtk_icon_view_real_select_cursor_item;
|
klass->select_cursor_item = gtk_icon_view_real_select_cursor_item;
|
||||||
klass->toggle_cursor_item = gtk_icon_view_real_toggle_cursor_item;
|
klass->toggle_cursor_item = gtk_icon_view_real_toggle_cursor_item;
|
||||||
|
klass->activate_cursor_item = gtk_icon_view_real_activate_cursor_item;
|
||||||
klass->move_cursor = gtk_icon_view_real_move_cursor;
|
klass->move_cursor = gtk_icon_view_real_move_cursor;
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
@ -412,7 +415,7 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
|||||||
g_cclosure_marshal_VOID__VOID,
|
g_cclosure_marshal_VOID__VOID,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
icon_view_signals[SELECT_CURSOR_ITEM] =
|
icon_view_signals[TOGGLE_CURSOR_ITEM] =
|
||||||
g_signal_new ("toggle_cursor_item",
|
g_signal_new ("toggle_cursor_item",
|
||||||
G_TYPE_FROM_CLASS (gobject_class),
|
G_TYPE_FROM_CLASS (gobject_class),
|
||||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||||
@ -421,6 +424,15 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
|||||||
g_cclosure_marshal_VOID__VOID,
|
g_cclosure_marshal_VOID__VOID,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
|
icon_view_signals[ACTIVATE_CURSOR_ITEM] =
|
||||||
|
g_signal_new ("activate_cursor_item",
|
||||||
|
G_TYPE_FROM_CLASS (gobject_class),
|
||||||
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||||
|
G_STRUCT_OFFSET (GtkIconViewClass, activate_cursor_item),
|
||||||
|
NULL, NULL,
|
||||||
|
_gtk_marshal_BOOLEAN__VOID,
|
||||||
|
G_TYPE_BOOLEAN, 0);
|
||||||
|
|
||||||
icon_view_signals[MOVE_CURSOR] =
|
icon_view_signals[MOVE_CURSOR] =
|
||||||
g_signal_new ("move_cursor",
|
g_signal_new ("move_cursor",
|
||||||
G_TYPE_FROM_CLASS (gobject_class),
|
G_TYPE_FROM_CLASS (gobject_class),
|
||||||
@ -438,6 +450,10 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
|||||||
gtk_binding_entry_add_signal (binding_set, GDK_space, 0, "select_cursor_item", 0);
|
gtk_binding_entry_add_signal (binding_set, GDK_space, 0, "select_cursor_item", 0);
|
||||||
gtk_binding_entry_add_signal (binding_set, GDK_space, GDK_CONTROL_MASK, "toggle_cursor_item", 0);
|
gtk_binding_entry_add_signal (binding_set, GDK_space, GDK_CONTROL_MASK, "toggle_cursor_item", 0);
|
||||||
|
|
||||||
|
gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "activate_cursor_item", 0);
|
||||||
|
gtk_binding_entry_add_signal (binding_set, GDK_ISO_Enter, 0, "activate_cursor_item", 0);
|
||||||
|
gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "activate_cursor_item", 0);
|
||||||
|
|
||||||
gtk_icon_view_add_move_binding (binding_set, GDK_Up, 0,
|
gtk_icon_view_add_move_binding (binding_set, GDK_Up, 0,
|
||||||
GTK_MOVEMENT_DISPLAY_LINES, -1);
|
GTK_MOVEMENT_DISPLAY_LINES, -1);
|
||||||
gtk_icon_view_add_move_binding (binding_set, GDK_KP_Up, 0,
|
gtk_icon_view_add_move_binding (binding_set, GDK_KP_Up, 0,
|
||||||
@ -1308,6 +1324,23 @@ gtk_icon_view_real_select_cursor_item (GtkIconView *icon_view)
|
|||||||
gtk_icon_view_select_item (icon_view, icon_view->priv->cursor_item);
|
gtk_icon_view_select_item (icon_view, icon_view->priv->cursor_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_icon_view_real_activate_cursor_item (GtkIconView *icon_view)
|
||||||
|
{
|
||||||
|
GtkTreePath *path;
|
||||||
|
|
||||||
|
if (!icon_view->priv->cursor_item)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
path = gtk_tree_path_new_from_indices (icon_view->priv->cursor_item->index, -1);
|
||||||
|
|
||||||
|
gtk_icon_view_item_activated (icon_view, path);
|
||||||
|
|
||||||
|
gtk_tree_path_free (path);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_icon_view_real_toggle_cursor_item (GtkIconView *icon_view)
|
gtk_icon_view_real_toggle_cursor_item (GtkIconView *icon_view)
|
||||||
{
|
{
|
||||||
|
@ -66,6 +66,7 @@ struct _GtkIconViewClass
|
|||||||
gboolean (* move_cursor) (GtkIconView *icon_view,
|
gboolean (* move_cursor) (GtkIconView *icon_view,
|
||||||
GtkMovementStep step,
|
GtkMovementStep step,
|
||||||
gint count);
|
gint count);
|
||||||
|
gboolean (* activate_cursor_item) (GtkIconView *icon_view);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gtk_icon_view_get_type (void);
|
GType gtk_icon_view_get_type (void);
|
||||||
|
Loading…
Reference in New Issue
Block a user