Re: accelerators do not work?
- From: Robert Wilhelm <robert physiol med tu-muenchen de>
- To: gnome-list gnome org
- Subject: Re: accelerators do not work?
- Date: Wed, 18 Mar 1998 12:44:16 +0100
I had a closer look on my problem with gnome_app_create_menus and
accelerators.
Apparently, the accelerator table is not added to the main widget.
I have appended a fix for this.
However I am not sure that this is "The Right Thing", maybe one
to call gtk_window_add_accelerator_table() manually in the application?
Robert
--- ../../../cvs/gnome-libs/libgnomeui/gnome-app-helper.c Thu Feb 26 19:36:57 1998
+++ gnome-app-helper.c Wed Mar 18 12:28:40 1998
@@ -32,6 +32,7 @@ static void gnome_app_do_ui_signal_conne
static void gnome_app_do_ui_accelerator_setup (GnomeApp *app,
gchar *signal_name,
GnomeUIInfo *menuinfo_item);
+static void gnome_ui_do_add_accelerator_table (GnomeApp *app);
static void gnome_app_do_toolbar_creation (GnomeApp *app,
GtkWidget *parent_widget,
GnomeUIInfo *tbinfo,
@@ -133,6 +134,8 @@ gnome_app_do_menu_creation(GnomeApp *app
}
}
menuinfo[i].widget = parent_widget;
+
+ gnome_ui_do_add_accelerator_table(app);
}
static void
@@ -481,4 +484,17 @@ static void gnome_app_do_ui_accelerator_
signal_name,
menuinfo_item->accelerator_key,
menuinfo_item->ac_mods);
+}
+
+static void gnome_ui_do_add_accelerator_table (GnomeApp *app)
+{
+ GtkAcceleratorTable *at;
+
+ at = gtk_object_get_data(GTK_OBJECT(app),
+ "GtkAcceleratorTable");
+
+ if(at == NULL)
+ return;
+
+ gtk_window_add_accelerator_table(GTK_WINDOW(app), at);
}
On Tue, Mar 17, 1998 at 05:24:14PM +0100, Robert Wilhelm wrote:
>
>
> When pressing the "a" button, nothing happens.
> What I am doing wrong here?
>
> Robert
>
>
> #include <gnome.h>
> #include <gdk/gdkkeysyms.h>
>
> GtkWidget *app;
>
>
> static int press(GtkWidget* widget, GdkEventButton *event, gpointer data)
> {
> printf("press\n");
> }
>
> GnomeUIInfo menu2[] = {
> {
> GNOME_APP_UI_ITEM,"bla","hint",press,NULL,
> NULL, GNOME_APP_PIXMAP_NONE,NULL,GDK_a,0,NULL},
>
> GNOMEUIINFO_END
> };
>
> GnomeUIInfo mainmenu[] = {
>
> {GNOME_APP_UI_SUBTREE, N_("Help"), NULL, menu2, NULL, NULL,
> GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL},
>
> GNOMEUIINFO_END
> };
>
> int main(int argc, char *argv[])
> {
> gnome_init ( "foo", NULL, argc, argv, 0, NULL);
> app = gnome_app_new ("foo", "Gnomified foo");
> gnome_app_create_menus (GNOME_APP(app),mainmenu);
> gtk_widget_show (app);
> gtk_main ();
>
> return 0;
> }
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]