Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7017625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:56:17+00:00 2026-05-27T22:56:17+00:00

I changed this: static GtkActionEntry menu_items[] = { { OpenFile, GTK_STOCK_OPEN, NULL, <control>O, NULL,

  • 0

I changed this:

static GtkActionEntry menu_items[] = {
  { "OpenFile", GTK_STOCK_OPEN, NULL, "<control>O", NULL, G_CALLBACK(file_open) },
  ...
},

… to this:

static GtkActionEntry menu_items[] = {
  { "OpenFile", GTK_STOCK_OPEN, NULL, gtk_accelerator_name(GDK_o, GDK_CONTROL_MASK), NULL, G_CALLBACK(file_open) }, 
  ...
},

… and now I get “error: initializer element is not constant”. What changes do I need to make to get this working?

GtkActionEntry‘s fourth argument is a gchar pointer and gtk_accelerator_name returns that as far as I can see.

menu_items is used in a static function, like this:

static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);

static GtkWidget *get_menubar_menu(GtkWidget *win) {
  GtkActionGroup *action_group = gtk_action_group_new("Menu");
  gtk_action_group_add_actions(action_group, menu_items, nmenu_items, 0);
  ...
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:56:17+00:00Added an answer on May 27, 2026 at 10:56 pm

    You can’t do that, the static data needs to be determined at compile-time, but gtk_accelerator_name() probably resides in a shared object that might not even be available when you compile.

    So, you need to add code to go through the array once at startup, before you actually use it in the call to gtk_action_group_add_actions(), to pass each string to gtk_accelerator_name() as needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to make this work in Java? public static void change(List<?
This is a compiler error (slightly changed for readability). This one always puzzled me.
This should be fine seeing as the CLR hasn't actually changed? The boxes running
Has this happened to anyone? Nothing has changed on my system, yet TFS no
This question is connected to my other question but I changed the logic a
The other day this code was working. I changed some things and re-ran it
This is the gallery I've been asked to implement http://sandbox.leigeber.com/slideshow/ I've chopped and changed
I changed my wordpress permalinks to %pagname%. Prior to doing this i posted two
I changed the folder that my WordPress installation was in. However, this worked fine,
I have this method (modified code) : public static void PublishXmlForCustomTypes(MyOwnClass DefaultOutputInformation) { if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.