Re: Patch for GtkOrientable et GtkEntry (again) 2.16




On Jan 11, 2009, at 10:44 AM, Emmanuel Rodriguez wrote:

Here's the patch for adding GtkOrientable, a new interface added in Gtk 2.16. I tried to do my best and took a look at other interfaces (Gtk2::Editable and Gtk2::Buildable). This patch might need some guidance.

I've resubmitted GtkEntry, because I realized that svn diff doesn't take into a count the files that it doesn't know (the ones svn status lists with '?'). This new version adds the typemap for 2.16.

Looking pretty good. However, your patch folded inline in the message instead of being an attachment. Also, please break the orientable and entry patches into two different files, so we can commit them separately.



+MODULE = Gtk2::Orientable PACKAGE = Gtk2::Orientable PREFIX = gtk_orientable_
+
+=for object Gtk2::Orientable - Interface for flippable widgets
+=cut
+
+=for apidoc __hide__
+=cut
+void
+_ADD_INTERFACE (class, const char * target_class)
+    CODE:
+    {
+       static const GInterfaceInfo iface_info = {
+               (GInterfaceInitFunc) NULL,
+               (GInterfaceFinalizeFunc) NULL,
+               (gpointer) NULL
+       };
+       GType gtype = gperl_object_type_from_package (target_class);
+ g_type_add_interface_static (gtype, GTK_TYPE_ORIENTABLE, &iface_info);
+    }

This will compile and should run alright, until somebody tries to use this to create a perl widget that implements Gtk2::Orientable. In order to make the interface implementable, you'll have to add an interface init function that wires in a bunch of marshalers to invoke perl ALLCAPSMETHODS. You can see an example of this in some of our other iface wrappers. (Warning: It can get pretty involved.)


--
Leia/Lois:  Aren't you a little fat for a stormtrooper?
Luke/Chris: Well, stay here and rot, you stuck-up bitch.
  -- Family Guy, "Blue Harvest" (A "Star Wars" parody)




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