Re: custom gtk container



Hm... have you tested this patch? Because it seems that it's not working . At least for me...

Though here is what is working:

     BaseClassType *const base = static_cast<BaseClassType*>(
g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
     );

-    //Call the original underlying C function:
+    if(G_OBJECT_CLASS_TYPE(base) == Gtk::Container::get_base_type())
+      return;
+
     if(base && base->remove)
       (*base->remove)(self, p0);

If I'm comparing the base gtype with container base type (after peeking the parent) then it works.
Can you explain?

Jonathon Jongsma wrote:
On Wed, Jul 8, 2009 at 12:53 PM, dexter<dexter balabit hu> wrote:
Of course I ment to write gtkmm container.

I think something like this is missing from the bug (as patch )and from the
code
(maybe it is not the best solution, because I'm not that familiar with
gtypes, but I figured this out from the comment of the bug):

diff --git a/gtk/gtkmm/container.cc b/gtk/gtkmm/container.cc
index f7d0d9b..3630b70 100644
--- a/gtk/gtkmm/container.cc
+++ b/gtk/gtkmm/container.cc
@@ -173,7 +173,7 @@ void Container_Class::remove_callback(GtkContainer*
self, GtkWidget* p0)
    );

    //Call the original underlying C function:
-    if(base && base->remove)
+    if(base && base->remove && G_TYPE_FROM_CLASS(base) !=
g_type_from_name("GtkContainer"))
      (*base->remove)(self, p0);
  }
 }


dexter wrote:
Hi,

I'm trying to implement a custom gtk container, and getting a warning:

Gtk-WARNING **: GtkContainerClass::remove not implemented for
`gtkmm__CustomObject_entrylink'

After googling, I found this bug:
http://bugzilla.gnome.org/show_bug.cgi?id=518002

Although it is fixed, but I can't seem to find the patch either in the bug
or in git log. Where is it?
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

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


It seems that this patch got applied to an old maintenance branch
instead of master, so it regressed on future releases.  I've now
applied it to master as well.



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