1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-11-25 05:55:20 +02:00

gui_frame.c: allow scrolling through packages also on the name template

This commit is contained in:
Werner Almesberger 2012-08-21 02:13:55 -03:00
parent 8982d09474
commit 23a33488d4

View File

@ -1538,6 +1538,34 @@ static void unselect_pkg_name(void *data)
}
static gboolean pkg_scroll_event(GtkWidget *widget, GdkEventScroll *event,
gpointer data)
{
struct pkg *pkg, *last;
switch (event->direction) {
case GDK_SCROLL_UP:
if (active_pkg->next)
active_pkg = active_pkg->next;
else
active_pkg = pkgs->next;
change_world();
break;
case GDK_SCROLL_DOWN:
last = NULL;
for (pkg = pkgs->next; pkg && (!last || pkg != active_pkg);
pkg = pkg->next)
last = pkg;
active_pkg = last;
change_world();
break;
default:
/* ignore */;
}
return TRUE;
}
static gboolean pkg_name_edit_event(GtkWidget *widget, GdkEventButton *event,
gpointer data)
{
@ -1569,6 +1597,8 @@ static GtkWidget *build_pkg_name(void)
g_signal_connect(G_OBJECT(box_of_label(label)),
"button_press_event", G_CALLBACK(pkg_name_edit_event), NULL);
g_signal_connect(G_OBJECT(box_of_label(label)),
"scroll_event", G_CALLBACK(pkg_scroll_event), NULL);
return box_of_label(label);
}
@ -1577,34 +1607,6 @@ static GtkWidget *build_pkg_name(void)
/* ----- packages ---------------------------------------------------------- */
static gboolean pkg_scroll_event(GtkWidget *widget, GdkEventScroll *event,
gpointer data)
{
struct pkg *pkg, *last;
switch (event->direction) {
case GDK_SCROLL_UP:
if (active_pkg->next)
active_pkg = active_pkg->next;
else
active_pkg = pkgs->next;
change_world();
break;
case GDK_SCROLL_DOWN:
last = NULL;
for (pkg = pkgs->next; pkg && (!last || pkg != active_pkg);
pkg = pkg->next)
last = pkg;
active_pkg = last;
change_world();
break;
default:
/* ignore */;
}
return TRUE;
}
static gboolean pkg_select_event(GtkWidget *widget, GdkEventButton *event,
gpointer data)
{