Re: dynamic accelerators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2008/7/29 Wesley Smith <wesley.hoke@xxxxxxxxx>:
> I'm trying to get runtime-settable accelerators to work with my app.

Have you added the accel group to the window? Also, I'd use UI manager
to make the abse set of menus, then hang extra run-time menus off that
if necessary.

The boilerplate is something like:

        action_group = gtk_action_group_new( log_class->action_name );
        gtk_action_group_set_translation_domain( action_group,
                GETTEXT_PACKAGE );
        gtk_action_group_add_actions( action_group,
                log_class->actions, log_class->n_actions,
                GTK_WINDOW( log ) );
        gtk_action_group_add_toggle_actions( action_group,
                log_class->toggle_actions, log_class->n_toggle_actions,
                GTK_WINDOW( log ) );

        ui_manager = gtk_ui_manager_new();
        gtk_ui_manager_insert_action_group( ui_manager, action_group, 0 );

        accel_group = gtk_ui_manager_get_accel_group( ui_manager );
        gtk_window_add_accel_group( GTK_WINDOW( log ), accel_group );

        if( !gtk_ui_manager_add_ui_from_string( ui_manager,
                log_class->ui_description, -1, &error ) ) {
                g_message( "building menus failed: %s", error->message );
                g_error_free( error );
                exit( EXIT_FAILURE );
        }

Here's the program edit window from my app:

http://vips.svn.sourceforge.net/viewvc/vips/nip2/trunk/src/program.c?view=markup

search for "accel" to find the menus being built.

John
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux