ToggleItem in item_factory



Hello,

I use a ToggleItem in an item_factory-entry this way:

/* ... */

  GtkAccelGroup  *accel_group;
  GtkItemFactoryEntry
     menu_items[] = {
      /*        ...         */
     {"/_Options",                      NULL, NULL,           0, "<Branch>" },
     {"/Options/Show _advanced options", "a", AdvancedToggle, 0, "<ToggleItem>" },
      /*        ...         */
  };

  /* create the dialog box */
  shell = gtk_dialog_new ();
  gtk_signal_connect (GTK_OBJECT (shell), "delete_event", GTK_SIGNAL_FUNC (win_delete), NULL);

  /* create the main vbox */
  vbox = GTK_DIALOG (shell)->vbox;

  /* create the menubar */

  accel_group = gtk_accel_group_new();
  item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
  gtk_item_factory_create_items(item_factory, sizeof(menu_items)/sizeof(menu_items[0]), menu_items, 
                                NULL);
  gtk_accel_group_attach (accel_group, GTK_OBJECT(vbox));

  /* ..... */

What do I have to do, that the item is set to OFF when the program starts
instead of the default ON state?

Second question:
How can I disable menu items when the program starts and how can
I enable them under certain circumstance when the program is running?

Kind regards

       Andreas.



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