[Glade-devel] Missing Stock Menu Item Accelerators



Hello,

I have built a window using Glade2/libglade2.0.1. There are several
accelerators attached to menu items, and in Glade2 they are correctly
showing up in the menu (e.g. File/"Quit Ctrl+Q").

But when I load the window in my program using libglade, the
accelerators do not work. (they are also not showing up in the menu).

This happens only with the stock menu items. The accelerators of
non-stock items work fine.

Test case appended. Any ideas?

I have not found a libglade list, so please let me know if this is wrong
place for this request.

-Samuel



-------------------------------
Compiled using:

gcc `pkg-config --libs --cflags libglade-2.0 gtk+-2.0` -o test main.c && ./test


*************************************************************
* main.c
*************************************************************
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <stdio.h>
#include <stdlib.h>

/*
 * Initialize the GUI at program start.
 */
GtkWidget *dialog_create(void)
{
  GladeXML *xml = NULL;
  
  if (!(xml = glade_xml_new("example.glade", NULL, NULL))) {
    fprintf(stderr, "Error: gui_init(): at glade_xml_new()");
    exit(1);
  }
  glade_xml_signal_autoconnect(xml);
  
  return glade_xml_get_widget(xml, "DialogBasic");
}


int main (int argc, char **argv)
{
  GtkWidget *dialog = NULL;
  
  gtk_set_locale();
  gtk_init(&argc, &argv);
  
  dialog = dialog_create();
  gtk_widget_show(dialog);
  
  gtk_main();
  
  gtk_widget_destroy(dialog);
  
  return 0;
}

*************************************************************
* example.glade
*************************************************************
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>

<glade-interface>

<widget class="GtkDialog" id="DialogBasic">
  <property name="height_request">200</property>
  <property name="title" translatable="yes">libglademm example</property>
  <property name="type">GTK_WINDOW_TOPLEVEL</property>
  <property name="window_position">GTK_WIN_POS_NONE</property>
  <property name="modal">False</property>
  <property name="resizable">True</property>
  <property name="destroy_with_parent">False</property>
  <property name="has_separator">True</property>

  <child internal-child="vbox">
    <widget class="GtkVBox" id="dialog-vbox2">
      <property name="visible">True</property>
      <property name="homogeneous">False</property>
      <property name="spacing">0</property>

      <child internal-child="action_area">
        <widget class="GtkHButtonBox" id="dialog-action_area2">
          <property name="visible">True</property>
          <property name="layout_style">GTK_BUTTONBOX_END</property>

          <child>
            <widget class="GtkButton" id="quit_button">
              <property name="visible">True</property>
              <property name="can_default">True</property>
              <property name="can_focus">True</property>
              <property name="label">gtk-quit</property>
              <property name="use_stock">True</property>
              <property name="relief">GTK_RELIEF_NORMAL</property>
              <property name="response_id">0</property>
            </widget>
          </child>
        </widget>
        <packing>
          <property name="padding">0</property>
          <property name="expand">False</property>
          <property name="fill">True</property>
          <property name="pack_type">GTK_PACK_END</property>
        </packing>
      </child>

      <child>
        <widget class="GtkMenuBar" id="menubar1">
          <property name="visible">True</property>

          <child>
            <widget class="GtkMenuItem" id="menuitem1">
              <property name="visible">True</property>
              <property name="label" translatable="yes">_File</property>
              <property name="use_underline">True</property>

              <child>
                <widget class="GtkMenu" id="menuitem1_menu">

                  <child>
                    <widget class="GtkImageMenuItem" id="menu_file_new">
                      <property name="visible">True</property>
                      <property name="label">gtk-new</property>
                      <property name="use_stock">True</property>
                    </widget>
                  </child>

                  <child>
                    <widget class="GtkImageMenuItem" id="menu_file_open">
                      <property name="visible">True</property>
                      <property name="label">gtk-open</property>
                      <property name="use_stock">True</property>
                    </widget>
                  </child>

                  <child>
                    <widget class="GtkImageMenuItem" id="menu_file_save">
                      <property name="visible">True</property>
                      <property name="label">gtk-save</property>
                      <property name="use_stock">True</property>
                    </widget>
                  </child>

                  <child>
                    <widget class="GtkImageMenuItem" id="menu_file_saveas">
                      <property name="visible">True</property>
                      <property name="label">gtk-save-as</property>
                      <property name="use_stock">True</property>
                    </widget>
                  </child>

                  <child>
                    <widget class="GtkMenuItem" id="separatormenuitem1">
                      <property name="visible">True</property>
                    </widget>
                  </child>

                  <child>
                    <widget class="GtkImageMenuItem" id="menu_file_quit">
                      <property name="visible">True</property>
                      <property name="label">gtk-quit</property>
                      <property name="use_stock">True</property>
                    </widget>
                  </child>
                </widget>
              </child>
            </widget>
          </child>

          <child>
            <widget class="GtkMenuItem" id="menuitem4">
              <property name="visible">True</property>
              <property name="label" translatable="yes">_Help</property>
              <property name="use_underline">True</property>

              <child>
                <widget class="GtkMenu" id="menuitem4_menu">

                  <child>
                    <widget class="GtkMenuItem" id="menu_file_about">
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">_About</property>
                      <property name="use_underline">True</property>
                      <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/>
                    </widget>
                  </child>
                </widget>
              </child>
            </widget>
          </child>
        </widget>
        <packing>
          <property name="padding">0</property>
          <property name="expand">False</property>
          <property name="fill">False</property>
        </packing>
      </child>

      <child>
        <widget class="GtkLabel" id="label1">
          <property name="visible">True</property>
          <property name="label" translatable="yes">This is a libglademm example.
The File/New, File/Save, and File/Quit menu items are connected to signal handlers.</property>
          <property name="use_underline">False</property>
          <property name="use_markup">False</property>
          <property name="justify">GTK_JUSTIFY_LEFT</property>
          <property name="wrap">False</property>
          <property name="selectable">False</property>
          <property name="xalign">0.5</property>
          <property name="yalign">0.5</property>
          <property name="xpad">0</property>
          <property name="ypad">0</property>
        </widget>
        <packing>
          <property name="padding">0</property>
          <property name="expand">True</property>
          <property name="fill">False</property>
        </packing>
      </child>
    </widget>
  </child>
</widget>

</glade-interface>

-- 
 ------------------------------------------------------
|      Samuel Abels       |   http://www.debain.org    |
| spam ad debain dod org  | knipknap ad jabber dod org |
 ------------------------------------------------------




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