On Sat, 16 Jun 2001, Christian Robottom Reis wrote:

> It might not be that trivial. It depends on how you destroy the popup
> window;

Are there many non-trivial ways to destroy a popup window?

> I think you'll need to tie up some signals to avoid these errors.
> Can we see a code snippet?

Sure, included is a gtk application based on glade whose only function is
to reproduce the errors when opening about and preferences. Note that
first time you open it, it is fine. Then, when you close it by pressing
the X or something and try opening it again, it will produce the following
error:

Gtk-CRITICAL **: file gtkstyle.c: line 513 (gtk_style_attach): assertion
`style != NULL' failed.

Gtk-CRITICAL **: file gtkstyle.c: line 1134 (gtk_style_set_background):
assertion `style != NULL' failed.

Gtk-CRITICAL **: file gtkstyle.c: line 3613 (gtk_paint_flat_box):
assertion `style != NULL' failed.

Gtk-CRITICAL **: file gtkcontainer.c: line 739
(gtk_container_dequeue_resize_handler): assertion
`GTK_CONTAINER_RESIZE_PENDING (container)' failed.


> > ask these kinds of questions? If so, would anyone be so kind as to tell me
> > what list I should go to instead?
> I think the proper procedure it to write here and if nobody answers, whine
> a bit about it. You did get a lot of answers to your repost, so I say it
> works, too. 8-P

Indeed, and this puzzles me. But as long as I can keep on coding I can
ponder about the mailinglist in between. ;)

Cheers

  Nik
import traceback, threading, sys
import gtk, gnome.config, libglade
from gnome.ui import *
from GDK import *


class Window:
        def __init__(self,filename):
                self.xml  = libglade.GladeXML(filename)
                self.registerWidgets(self.xml)
                self.registerHandlers(self.xml)
                
        def registerWidgets(self,xml):
                # Main Windows
                self.win         = xml.get_widget('client')
                self.preferences = xml.get_widget('preferences')
                self.about       = xml.get_widget('about')

                # Window components
                self.status      = xml.get_widget('statusBar')

        def registerHandlers(self,xml):
                xml.signal_connect('close_window',     gtk.mainquit)
                xml.signal_connect('on_exit_activate', gtk.mainquit)

                xml.signal_connect('on_preferences_activate',  self.menuPreferences)
                xml.signal_connect('on_about_activate',        self.menuAbout)

        def menuPreferences(self, *args):
                self.preferences = self.xml.get_widget('preferences')
                self.preferences.show_all()

        def menuAbout(self, *args):
                self.about.show()


def main():
        win = Window('client.glade')
        gtk.mainloop()
        gnome.config.sync()


if __name__ == '__main__':
 main()

<?xml version="1.0"?>
<GTK-Interface>

<project>
  <name>Client</name>
  <program_name>client</program_name>
  <directory></directory>
  <source_directory>src</source_directory>
  <pixmaps_directory>pixmaps</pixmaps_directory>
  <language>C</language>
  <gnome_support>True</gnome_support>
  <gettext_support>True</gettext_support>
</project>

<widget>
  <class>GnomeApp</class>
  <name>client</name>
  <title>Client</title>
  <type>GTK_WINDOW_TOPLEVEL</type>
  <position>GTK_WIN_POS_NONE</position>
  <modal>False</modal>
  <allow_shrink>False</allow_shrink>
  <allow_grow>True</allow_grow>
  <auto_shrink>False</auto_shrink>
  <enable_layout_config>True</enable_layout_config>

  <widget>
    <class>GnomeDock</class>
    <child_name>GnomeApp:dock</child_name>
    <name>dock1</name>
    <allow_floating>True</allow_floating>
    <child>
      <padding>0</padding>
      <expand>True</expand>
      <fill>True</fill>
    </child>

    <widget>
      <class>GnomeDockItem</class>
      <name>dockitem1</name>
      <border_width>2</border_width>
      <placement>GNOME_DOCK_TOP</placement>
      <band>0</band>
      <position>0</position>
      <offset>0</offset>
      <locked>False</locked>
      <exclusive>True</exclusive>
      <never_floating>False</never_floating>
      <never_vertical>True</never_vertical>
      <never_horizontal>False</never_horizontal>
      <shadow_type>GTK_SHADOW_OUT</shadow_type>

      <widget>
        <class>GtkMenuBar</class>
        <name>menubar1</name>
        <shadow_type>GTK_SHADOW_NONE</shadow_type>

        <widget>
          <class>GtkMenuItem</class>
          <name>file1</name>
          <stock_item>GNOMEUIINFO_MENU_FILE_TREE</stock_item>

          <widget>
            <class>GtkMenu</class>
            <name>file1_menu</name>

            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>new_file1</name>
              <signal>
                <name>activate</name>
                <handler>on_new_file1_activate</handler>
                <last_modification_time>Tue, 19 Jun 2001 16:22:26 
GMT</last_modification_time>
              </signal>
              <stock_item>GNOMEUIINFO_MENU_NEW_ITEM</stock_item>
              <label>_New File</label>
            </widget>

            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>open1</name>
              <signal>
                <name>activate</name>
                <handler>on_open1_activate</handler>
                <last_modification_time>Tue, 19 Jun 2001 16:22:26 
GMT</last_modification_time>
              </signal>
              <stock_item>GNOMEUIINFO_MENU_OPEN_ITEM</stock_item>
            </widget>

            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>save1</name>
              <signal>
                <name>activate</name>
                <handler>on_save1_activate</handler>
                <last_modification_time>Tue, 19 Jun 2001 16:22:26 
GMT</last_modification_time>
              </signal>
              <stock_item>GNOMEUIINFO_MENU_SAVE_ITEM</stock_item>
            </widget>

            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>save_as1</name>
              <signal>
                <name>activate</name>
                <handler>on_save_as1_activate</handler>
                <last_modification_time>Tue, 19 Jun 2001 16:22:26 
GMT</last_modification_time>
              </signal>
              <stock_item>GNOMEUIINFO_MENU_SAVE_AS_ITEM</stock_item>
            </widget>

            <widget>
              <class>GtkMenuItem</class>
              <name>separator1</name>
              <right_justify>False</right_justify>
            </widget>

            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>exit1</name>
              <signal>
                <name>activate</name>
                <handler>on_exit1_activate</handler>
                <last_modification_time>Tue, 19 Jun 2001 16:22:26 
GMT</last_modification_time>
              </signal>
              <stock_item>GNOMEUIINFO_MENU_EXIT_ITEM</stock_item>
            </widget>
          </widget>
        </widget>

        <widget>
          <class>GtkMenuItem</class>
          <name>edit1</name>
          <stock_item>GNOMEUIINFO_MENU_EDIT_TREE</stock_item>

          <widget>
            <class>GtkMenu</class>
            <name>edit1_menu</name>

            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>cut1</name>
              <signal>
                <name>activate</name>
                <handler>on_cut1_activate</handler>
                <last_modification_time>Tue, 19 Jun 2001 16:22:26 
GMT</last_modification_time>
              </signal>
              <stock_item>GNOMEUIINFO_MENU_CUT_ITEM</stock_item>
            </widget>

            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>copy1</name>
              <signal>
                <name>activate</name>
                <handler>on_copy1_activate</handler>
                <last_modification_time>Tue, 19 Jun 2001 16:22:26 
GMT</last_modification_time>
              </signal>
              <stock_item>GNOMEUIINFO_MENU_COPY_ITEM</stock_item>
            </widget>

            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>paste1</name>
              <signal>
                <name>activate</name>
                <handler>on_paste1_activate</handler>
                <last_modification_time>Tue, 19 Jun 2001 16:22:26 
GMT</last_modification_time>
              </signal>
              <stock_item>GNOMEUIINFO_MENU_PASTE_ITEM</stock_item>
            </widget>

            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>clear1</name>
              <signal>
                <name>activate</name>
                <handler>on_clear1_activate</handler>
                <last_modification_time>Tue, 19 Jun 2001 16:22:26 
GMT</last_modification_time>
              </signal>
              <stock_item>GNOMEUIINFO_MENU_CLEAR_ITEM</stock_item>
            </widget>

            <widget>
              <class>GtkMenuItem</class>
              <name>separator2</name>
              <right_justify>False</right_justify>
            </widget>

            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>properties1</name>
              <signal>
                <name>activate</name>
                <handler>on_properties1_activate</handler>
                <last_modification_time>Tue, 19 Jun 2001 16:22:26 
GMT</last_modification_time>
              </signal>
              <stock_item>GNOMEUIINFO_MENU_PROPERTIES_ITEM</stock_item>
            </widget>
          </widget>
        </widget>

        <widget>
          <class>GtkMenuItem</class>
          <name>view1</name>
          <stock_item>GNOMEUIINFO_MENU_VIEW_TREE</stock_item>

          <widget>
            <class>GtkMenu</class>
            <name>view1_menu</name>
          </widget>
        </widget>

        <widget>
          <class>GtkMenuItem</class>
          <name>settings1</name>
          <stock_item>GNOMEUIINFO_MENU_SETTINGS_TREE</stock_item>

          <widget>
            <class>GtkMenu</class>
            <name>settings1_menu</name>

            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>preferences1</name>
              <signal>
                <name>activate</name>
                <handler>on_preferences_activate</handler>
                <last_modification_time>Tue, 19 Jun 2001 16:26:08 
GMT</last_modification_time>
              </signal>
              <stock_item>GNOMEUIINFO_MENU_PREFERENCES_ITEM</stock_item>
            </widget>
          </widget>
        </widget>

        <widget>
          <class>GtkMenuItem</class>
          <name>help1</name>
          <stock_item>GNOMEUIINFO_MENU_HELP_TREE</stock_item>

          <widget>
            <class>GtkMenu</class>
            <name>help1_menu</name>

            <widget>
              <class>GtkPixmapMenuItem</class>
              <name>about1</name>
              <signal>
                <name>activate</name>
                <handler>on_about_activate</handler>
                <last_modification_time>Tue, 19 Jun 2001 16:26:17 
GMT</last_modification_time>
              </signal>
              <stock_item>GNOMEUIINFO_MENU_ABOUT_ITEM</stock_item>
            </widget>
          </widget>
        </widget>
      </widget>
    </widget>

    <widget>
      <class>GnomeDockItem</class>
      <name>dockitem2</name>
      <border_width>1</border_width>
      <placement>GNOME_DOCK_TOP</placement>
      <band>1</band>
      <position>0</position>
      <offset>0</offset>
      <locked>False</locked>
      <exclusive>True</exclusive>
      <never_floating>False</never_floating>
      <never_vertical>False</never_vertical>
      <never_horizontal>False</never_horizontal>
      <shadow_type>GTK_SHADOW_OUT</shadow_type>

      <widget>
        <class>GtkToolbar</class>
        <name>toolbar1</name>
        <border_width>1</border_width>
        <orientation>GTK_ORIENTATION_HORIZONTAL</orientation>
        <type>GTK_TOOLBAR_BOTH</type>
        <space_size>16</space_size>
        <space_style>GTK_TOOLBAR_SPACE_LINE</space_style>
        <relief>GTK_RELIEF_NONE</relief>
        <tooltips>True</tooltips>

        <widget>
          <class>GtkButton</class>
          <child_name>Toolbar:button</child_name>
          <name>button1</name>
          <tooltip>New File</tooltip>
          <label>New</label>
          <stock_pixmap>GNOME_STOCK_PIXMAP_NEW</stock_pixmap>
        </widget>

        <widget>
          <class>GtkButton</class>
          <child_name>Toolbar:button</child_name>
          <name>button2</name>
          <tooltip>Open File</tooltip>
          <label>Open</label>
          <stock_pixmap>GNOME_STOCK_PIXMAP_OPEN</stock_pixmap>
        </widget>

        <widget>
          <class>GtkButton</class>
          <child_name>Toolbar:button</child_name>
          <name>button3</name>
          <tooltip>Save File</tooltip>
          <label>Save</label>
          <stock_pixmap>GNOME_STOCK_PIXMAP_SAVE</stock_pixmap>
        </widget>
      </widget>
    </widget>

    <widget>
      <class>Placeholder</class>
      <child_name>GnomeDock:contents</child_name>
    </widget>
  </widget>

  <widget>
    <class>GnomeAppBar</class>
    <child_name>GnomeApp:appbar</child_name>
    <name>appbar1</name>
    <has_progress>True</has_progress>
    <has_status>True</has_status>
    <child>
      <padding>0</padding>
      <expand>True</expand>
      <fill>True</fill>
    </child>
  </widget>
</widget>

<widget>
  <class>GnomeDialog</class>
  <name>preferences</name>
  <visible>False</visible>
  <type>GTK_WINDOW_TOPLEVEL</type>
  <position>GTK_WIN_POS_NONE</position>
  <modal>False</modal>
  <allow_shrink>False</allow_shrink>
  <allow_grow>False</allow_grow>
  <auto_shrink>False</auto_shrink>
  <auto_close>False</auto_close>
  <hide_on_close>False</hide_on_close>

  <widget>
    <class>GtkVBox</class>
    <child_name>GnomeDialog:vbox</child_name>
    <name>dialog-vbox1</name>
    <homogeneous>False</homogeneous>
    <spacing>8</spacing>
    <child>
      <padding>4</padding>
      <expand>True</expand>
      <fill>True</fill>
    </child>

    <widget>
      <class>GtkHButtonBox</class>
      <child_name>GnomeDialog:action_area</child_name>
      <name>dialog-action_area1</name>
      <layout_style>GTK_BUTTONBOX_END</layout_style>
      <spacing>8</spacing>
      <child_min_width>85</child_min_width>
      <child_min_height>27</child_min_height>
      <child_ipad_x>7</child_ipad_x>
      <child_ipad_y>0</child_ipad_y>
      <child>
        <padding>0</padding>
        <expand>False</expand>
        <fill>True</fill>
        <pack>GTK_PACK_END</pack>
      </child>

      <widget>
        <class>GtkButton</class>
        <name>button4</name>
        <can_default>True</can_default>
        <can_focus>True</can_focus>
        <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
      </widget>

      <widget>
        <class>GtkButton</class>
        <name>button5</name>
        <can_default>True</can_default>
        <can_focus>True</can_focus>
        <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
      </widget>

      <widget>
        <class>GtkButton</class>
        <name>button6</name>
        <can_default>True</can_default>
        <can_focus>True</can_focus>
        <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
      </widget>
    </widget>

    <widget>
      <class>Placeholder</class>
    </widget>
  </widget>
</widget>

<widget>
  <class>GnomeAbout</class>
  <name>about</name>
  <visible>False</visible>
  <modal>True</modal>
  <copyright></copyright>
  <authors></authors>
  <comments></comments>
</widget>

</GTK-Interface>

Reply via email to