mirror of https://github.com/GNOME/gimp.git
connect to "button_press_event" and start editing immidiately instead of
2005-01-09 Sven Neumann <sven@gimp.org> * app/widgets/gimpactionview.c (gimp_action_view_new): connect to "button_press_event" and start editing immidiately instead of waiting for a second click. Fixes bug #163385.
This commit is contained in:
parent
f571ceebec
commit
ae128ff635
|
@ -1,3 +1,9 @@
|
|||
2005-01-09 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimpactionview.c (gimp_action_view_new): connect to
|
||||
"button_press_event" and start editing immidiately instead of
|
||||
waiting for a second click. Fixes bug #163385.
|
||||
|
||||
2005-01-09 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimpdialogfactory.c (gimp_dialog_factories_toggle):
|
||||
|
|
|
@ -136,6 +136,68 @@ gimp_action_view_dispose (GObject *object)
|
|||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
idle_start_editing (GtkTreeView *tree_view)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
|
||||
path = g_object_get_data (G_OBJECT (tree_view), "start_editing_path");
|
||||
|
||||
if (path)
|
||||
{
|
||||
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
|
||||
|
||||
gtk_tree_view_set_cursor (tree_view, path,
|
||||
gtk_tree_view_get_column (tree_view, 1),
|
||||
TRUE);
|
||||
|
||||
g_object_set_data (G_OBJECT (tree_view), "start_editing_path", NULL);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_action_view_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
|
||||
GtkTreePath *path;
|
||||
|
||||
if (event->window != gtk_tree_view_get_bin_window (tree_view))
|
||||
return FALSE;
|
||||
|
||||
if (gtk_tree_view_get_path_at_pos (tree_view,
|
||||
(gint) event->x,
|
||||
(gint) event->y,
|
||||
&path, NULL,
|
||||
NULL, NULL))
|
||||
{
|
||||
GClosure *closure;
|
||||
GSource *source;
|
||||
|
||||
if (gtk_tree_path_get_depth (path) == 1)
|
||||
{
|
||||
gtk_tree_path_free (path);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_object_set_data_full (G_OBJECT (tree_view), "start_editing_path",
|
||||
path, (GDestroyNotify) gtk_tree_path_free);
|
||||
|
||||
g_signal_stop_emission_by_name (tree_view, "button_press_event");
|
||||
|
||||
closure = g_cclosure_new_object (G_CALLBACK (idle_start_editing),
|
||||
G_OBJECT (tree_view));
|
||||
|
||||
source = g_idle_source_new ();
|
||||
g_source_set_closure (source, closure);
|
||||
g_source_attach (source, NULL);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gimp_action_view_new (GimpUIManager *manager,
|
||||
const gchar *select_action,
|
||||
|
@ -309,6 +371,10 @@ gimp_action_view_new (GimpUIManager *manager,
|
|||
|
||||
if (show_shortcuts)
|
||||
{
|
||||
g_signal_connect (view, "button_press_event",
|
||||
G_CALLBACK (gimp_action_view_button_press),
|
||||
NULL);
|
||||
|
||||
g_signal_connect (accel_group, "accel-changed",
|
||||
G_CALLBACK (gimp_action_view_accel_changed),
|
||||
view);
|
||||
|
|
Loading…
Reference in New Issue