Re: FileChooserDialog



John Hobbs wrote:
I've seen this as well, with the 2.14-2 release, I just ignore it because it all seems to work and, well, I'm lazy.
Why did this thread die with no answer (resolution)?  Did someone
get an answer privately?  I am having the same trouble with a
FileChooserButton and I am guessing it is the same issue connected
with the FileChooser dialog.

I have done a little more testing with the FileChooserButton in order
to learn about the conditions where this error message occurs.  In
Glade I created a simple window with a Layout container that has only
a FileChooserButton.  This is the glade file

--------------------hello.glade-------------------------------------

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--*- mode: xml -*-->
<glade-interface>
  <widget class="GtkWindow" id="hello_main_window">
    <child>
      <widget class="GtkLayout" id="layout1">
        <property name="width_request">450</property>
        <property name="height_request">450</property>
        <property name="visible">True</property>
        <property name="width">450</property>
        <property name="height">450</property>
        <child>
          <widget class="GtkFileChooserButton" id="filechooserbutton1">
            <property name="width_request">200</property>
            <property name="height_request">30</property>
            <property name="visible">True</property>
          </widget>
          <packing>
            <property name="x">62</property>
            <property name="y">175</property>
          </packing>
        </child>
      </widget>
    </child>
  </widget>
</glade-interface>

---------------------------------------------------------------------

I then created the following simple C and C++ apps and noted which ones
gave the "assertion `G_IS_OBJECT (object)' failed" message.  I would like
to find out why this happens with only some.

1. libglade    C                          error
2. libglademm  C++                        no error
3. libglademm  C++ with hello class       error
4. gtk-builder C                          error
5. gtk-builder C++                        no error
6. gtk-builder C++ with hello class       error

Most of my apps use method 6 so that is the one on which I am focusing
my effort.  I am pasting each hello file to this message

Damon Register

---------------------------------- 1. libglade -----------------------

#include <gtk/gtk.h>
#include <glade/glade.h>

int main(int argc, char *argv[])
{
    GladeXML *xml;
    GtkWidget *window;

    gtk_init(&argc, &argv);

    xml = glade_xml_new("../hello.glade", NULL, NULL);
    window = glade_xml_get_widget (xml, "hello_main_window");

    g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (gtk_main_quit), NULL);
    gtk_widget_show_all (window);

    gtk_main();
    g_object_unref (G_OBJECT (xml));
    g_print( "it finished !\n" );

    return 0;
}

---------------------------------- 2. libglademm ---------------------
#include <gtkmm.h>
#include <libglademm/xml.h>
#include <iostream>

Gtk::Window* pWindow = 0;

int main (int argc, char **argv)
{
  Gtk::Main kit(argc, argv);

  Glib::RefPtr<Gnome::Glade::Xml> refXml;

  refXml = Gnome::Glade::Xml::create("../hello.glade");

  refXml->get_widget("hello_main_window", pWindow);
  if(pWindow)
  {

    kit.run(*pWindow);
  }

  return 0;
}


---------------------------------- 3. libglademm hello class ---------
#include <gtkmm.h>
#include <libglademm/xml.h>
#include <iostream>

Gtk::Window* pWindow = 0;

int main (int argc, char **argv)
{
  Gtk::Main kit(argc, argv);

  Glib::RefPtr<Gnome::Glade::Xml> refXml;

  refXml = Gnome::Glade::Xml::create("../hello.glade");

  refXml->get_widget("hello_main_window", pWindow);
  if(pWindow)
  {

    kit.run(*pWindow);
  }

  return 0;
}


---------------------------------- 4. gtk-builder --------------------
#include <gtk/gtk.h>


int main(int argc, char *argv[])
{
    GtkBuilder      *builder;
    GtkWidget       *window;

    gtk_init(&argc, &argv);
    builder = gtk_builder_new ();
    gtk_builder_add_from_file (builder, "../hello.xml", NULL);
    window = GTK_WIDGET (gtk_builder_get_object (builder, "hello_main_window"));

    g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (gtk_main_quit), NULL);
    gtk_widget_show (window);

    gtk_main ();
    g_object_unref (G_OBJECT (builder));
    g_print( "it finished !\n" );

    return 0;
}

---------------------------------- 5. gtk-builder C++ ----------------
#include <gtkmm.h>
#include <iostream>


Gtk::Window* pWindow = 0;

int main (int argc, char **argv)
{
  Gtk::Main kit(argc, argv);

  Glib::RefPtr<Gtk::Builder>  refXml;

  refXml = Gtk::Builder::create_from_file("../hello.xml");

  refXml->get_widget("hello_main_window", pWindow);
  if(pWindow)
  {

    kit.run(*pWindow);
  }

  return 0;
}


---------------------------------- 6. gtk-builder C++ hello class ----
#include <gtkmm.h>
#include <iostream>

class hello : public Gtk::Window
{
public:
  hello();
  virtual ~hello();

protected:

    Glib::RefPtr<Gtk::Builder>  refXml;
};

hello::hello()
{
    refXml = Gtk::Builder::create_from_file("../hello.xml");
    Gtk::Layout *layout1;
    refXml->get_widget("layout1", layout1);
    layout1->reparent(*this);
}

hello::~hello()
{
    std::cout << "~hello()" << std::endl;
}

int main (int argc, char *argv[])
{
  Gtk::Main kit(argc, argv);
  hello window;
  kit.run(window);
  return 0;
}



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