Re: Debugging widgets



Thanks Daniel for the tip.
I tried gtk_init() but it looks like it is not enough for mm version.
Instead, I called Gtk::Application::run() and it works. The code is
follow:

        auto app = Gtk::Application::create("mytest");
        Gtk::Box box;
        app->run();
        BOOST_TEST(box.get_homogeneous() == false);

I also substituted Gtk::Box with my custom widget and everything seems
works just fine.

Thanks.

-Pavlo


On Wed, 2019-09-18 at 20:48 +0100, Daniel Boles wrote:
sounds like you just never initialised gtk via an application or
gtk_init()


On Wed, 18 Sep 2019, 20:45 Pavlo Solntsev via gtkmm-list, <
gtkmm-list gnome org> wrote:
Hi, 

I am trying to understand how to debug a widget. I am trying to do
something like this. This is just a test.

        Gtk::Box box;
        BOOST_TEST(box.get_homogeneous() == true);

I get the following error:

(process:25274): Gtk-CRITICAL **: 14:36:20.149:
_gtk_css_lookup_resolve: assertion '(((__extension__ ({
GTypeInstance
*__inst = (GTypeInstance*) ((provider)); GType __t =
((_gtk_style_provider_private_get_type ())); gboolean __r; if
(!__inst)
__r = (0); else if (__inst->g_class && __inst->g_class->g_type ==
__t)
__r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t);
__r;
}))))' failed

(process:25274): GLib-GObject-CRITICAL **: 14:36:20.149:
g_object_set_data_full: assertion 'G_IS_OBJECT (object)' failed

(process:25274): Gtk-ERROR **: 14:36:20.149: ../../checkout/gtk+-
3/gtk/gtkstylecontext.c:348:gtk_style_context_init: Can't create a
GtkStyleContext without a display connection

Since Gtk::Box is not a top level widget is has no CSS styles
associated with it. What would be the best practice to add CSS
styles
(ctor?) and eventually, how to debug a widget? I assume, we don't
need
to call any show() methods. 

Thanks.
-Pavlo

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list



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