/**** Locks the given accelerator group ****/ int clip_GTK_ACCELGROUPLOCK(ClipMachine * ClipMachineMemory) { C_widget *caccelg = _fetch_cw_arg(ClipMachineMemory); CHECKCWID(caccelg, GTK_IS_ACCEL_GROUP); gtk_accel_group_lock(GTK_ACCEL_GROUP(caccelg->widget)); return 0; err: return 1; }
/* Name is in the form "<panel>" */ GtkItemFactory* menu_create(GtkItemFactoryEntry *def, int n_entries, const gchar *name, GtkAccelGroup *keys) { if (!keys) { keys = gtk_accel_group_new(); gtk_accel_group_lock(keys); } GtkItemFactory* item_factory = gtk_item_factory_new(GTK_TYPE_MENU, name, keys); GtkItemFactoryEntry* translated = def;//translate_entries(def, n_entries); gtk_item_factory_create_items(item_factory, n_entries, translated, NULL); //free_translated_entries(translated, n_entries); return item_factory; }
JNIEXPORT void JNICALL Java_org_gnome_gtk_GtkAccelGroup_gtk_1accel_1group_1lock ( JNIEnv* env, jclass cls, jlong _self ) { GtkAccelGroup* self; // convert parameter self self = (GtkAccelGroup*) _self; // call function gtk_accel_group_lock(self); // cleanup parameter self }
static GtkUIManager * ui_manager_new (GtkWidget *window) { static const GtkActionEntry actions[] = { { "back", GTK_STOCK_GO_BACK, NULL, "<alt>Left", N_("Go back one page"), G_CALLBACK (back_callback) }, { "forward", GTK_STOCK_GO_FORWARD, NULL, "<alt>Right", N_("Go forward one page"), G_CALLBACK (forward_callback) }, { "reload", GTK_STOCK_REFRESH, N_("_Reload"), "<control>R", N_("Reload current page"), G_CALLBACK (reload_callback) }, { "stop", GTK_STOCK_CANCEL, N_("_Stop"), "Escape", N_("Stop loading this page"), G_CALLBACK (stop_callback) }, { "home", GTK_STOCK_HOME, NULL, "<alt>Home", N_("Go to the index page"), G_CALLBACK (home_callback) }, { "copy-location", GTK_STOCK_COPY, N_("C_opy location"), "", N_("Copy the location of this page to the clipboard"), G_CALLBACK (copy_location_callback) }, { "copy-selection", GTK_STOCK_COPY, NULL, "<control>C", NULL, G_CALLBACK (copy_selection_callback) }, { "zoom-in", GTK_STOCK_ZOOM_IN, NULL, "<control>plus", NULL, G_CALLBACK (zoom_in_callback) }, { "zoom-out", GTK_STOCK_ZOOM_OUT, NULL, "<control>minus", NULL, G_CALLBACK (zoom_out_callback) }, { "find", GTK_STOCK_FIND, NULL, "<control>F", N_("Find text in current page"), G_CALLBACK (find_callback) }, { "find-again", NULL, N_("Find _Again"), "<control>G", NULL, G_CALLBACK (find_again_callback) }, { "close", GTK_STOCK_CLOSE, NULL, "<control>W", NULL, G_CALLBACK (close_callback) }, { "quit", GTK_STOCK_QUIT, NULL, "<control>Q", NULL, G_CALLBACK (close_callback) } }; static const GtkToggleActionEntry toggle_actions[] = { { "show-index", NULL, N_("S_how Index"), "<control>I", N_("Toggle the visibility of the sidebar"), G_CALLBACK (show_index_callback), FALSE } }; GtkUIManager *ui_manager = gtk_ui_manager_new (); GtkActionGroup *group = gtk_action_group_new ("Actions"); GtkAction *action; GError *error = NULL; gtk_action_group_set_translation_domain (group, NULL); gtk_action_group_add_actions (group, actions, G_N_ELEMENTS (actions), NULL); gtk_action_group_add_toggle_actions (group, toggle_actions, G_N_ELEMENTS (toggle_actions), NULL); action = gimp_throbber_action_new ("website", "docs.gimp.org", _("Visit the GIMP documentation website"), GIMP_STOCK_USER_MANUAL); g_signal_connect_closure (action, "activate", g_cclosure_new (G_CALLBACK (website_callback), NULL, NULL), FALSE); gtk_action_group_add_action (group, action); g_object_unref (action); gtk_window_add_accel_group (GTK_WINDOW (window), gtk_ui_manager_get_accel_group (ui_manager)); gtk_accel_group_lock (gtk_ui_manager_get_accel_group (ui_manager)); gtk_ui_manager_insert_action_group (ui_manager, group, -1); g_object_unref (group); gtk_ui_manager_add_ui_from_string (ui_manager, "<ui>" " <toolbar name=\"help-browser-toolbar\">" " <toolitem action=\"reload\" />" " <toolitem action=\"stop\" />" " <toolitem action=\"home\" />" " <separator name=\"space\" />" " <toolitem action=\"website\" />" " </toolbar>" " <accelerator action=\"close\" />" " <accelerator action=\"quit\" />" "</ui>", -1, &error); if (error) { g_warning ("error parsing ui: %s", error->message); g_clear_error (&error); } gtk_ui_manager_add_ui_from_string (ui_manager, "<ui>" " <popup name=\"help-browser-popup\">" " <menuitem action=\"back\" />" " <menuitem action=\"forward\" />" " <menuitem action=\"reload\" />" " <menuitem action=\"stop\" />" " <separator />" " <menuitem action=\"home\" />" " <menuitem action=\"copy-location\" />" " <menuitem action=\"show-index\" />" " <separator />" " <menuitem action=\"find\" />" " <menuitem action=\"find-again\" />" " <separator />" " <menuitem action=\"zoom-in\" />" " <menuitem action=\"zoom-out\" />" " <separator />" " <menuitem action=\"close\" />" " </popup>" "</ui>", -1, &error); if (error) { g_warning ("error parsing ui: %s", error->message); g_clear_error (&error); } gtk_ui_manager_add_ui_from_string (ui_manager, "<ui>" " <popup name=\"help-browser-copy-popup\">" " <menuitem action=\"copy-selection\" />" " </popup>" "</ui>", -1, &error); if (error) { g_warning ("error parsing ui: %s", error->message); g_clear_error (&error); } return ui_manager; }