Web lists-archives.com

GtkMenuToolButton - signal "show-menu" on hide.




Hello,

I'm trying to use the show-menu signal on GtkMenuToolButton with GTK+3.18. It works but I also have the signal on hide. Do I miss something ? It is the right behavior ?

Thanks for the help.

Vincent

Here a very simple example (main.c, main.ui) :

main.c
#include <gtk/gtk.h>
#include <stdio.h>

void show (GtkButton *button, void*)
{
  printf ("eituan\n");
}

int main (int argc, char   *argv[])
{
  gtk_init (&argc, &argv);
  GtkBuilder * build = gtk_builder_new ();

  gtk_builder_add_from_file (build, "/home/legarrec/info/programmation/tmp/gtktest/main.ui", NULL);

  GObject * obj = gtk_builder_get_object (build, "buttonUndo");
  if (obj == NULL)
  {
  printf ("obj\n");
    return 1;
  }
  g_signal_connect (obj, "show-menu", G_CALLBACK (show), NULL);

  GtkWidget * p_win = (GtkWidget *) gtk_builder_get_object ( build, "window1");

  gtk_widget_show_all (p_win);
  gtk_main ();
}





main.ui
<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <requires lib="gtk+" version="3.18"/>
  <object class="GtkApplicationWindow" id="window1">
    <property name="can_focus">False</property>
    <property name="default_width">800</property>
    <property name="default_height">600</property>
    <child type="titlebar">
      <object class="GtkHeaderBar" id="headerbar1">
        <property name="visible">True</property>
        <property name="title">codegui</property>
        <property name="spacing">12</property>
        <property name="show_close_button">True</property>
        <child>
          <object class="GtkGrid" id="grid1">
            <property name="visible">True</property>
            <child>
              <object id="buttonUndo"class="GtkMenuToolButton">
                <property name="visible">True</property>
                <child type="menu">
                  <object class="GtkMenu" id="menuUndo"/>
                </child>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">0</property>
              </packing>
            </child>
          </object>
        </child>
      </object>
    </child>
  </object>
</interface>

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