Re: cannot register existing type

Andrea Zagli <[email protected]> Thu, 30 Jan 2014 12:10:59 +0000
Newsgroups gmane.comp.gnome.glade.user
Message-ID <20140130121059.Horde.erDrVxWG436bytSeR6m_Hg4@saetta.dyndns-free.com>
Il giorno mer 29 gen 2014 18:01:07 CET, Tristan Van Berkom ha scritto:
> On Wed, Jan 29, 2014 at 7:34 PM, Andrea Zagli <[email protected]> wrote:
>> i have 2 custom widgets: GtkMaskedEntry and GtkDateEntry
>>
>> GtkDateEntry is a GtkBin with inside GtkMaskedEntry
>>
>> i created catalogs and pixmaps to use them with glade (version 3.14.3); but
>> when i try to insert widget GtkDateEntry inside a container (ex. GtkBox) i
>> got the error
>>
>> GLib-GObject-WARNING **: cannot register existing type `GtkMaskedEntry'
>> (glade.exe:5052): GLib-CRITICAL **: g_once_init_leave: assertion `result !=
>> 0' failed
>> (glade.exe:5052): GLib-GObject-CRITICAL **: g_object_new: assertion
>> `G_TYPE_IS_OBJECT (object_type)' failed
>>
>> and glade crash (if i insert GtkMaskedEntry it works)
>>
>> in glade 3.8.x they works perfectly
>>
>> what could be the problem?
>
> Does one derive from the other ?

no

as i said GtkDateEntry is derived from GtkBin with GtkHBox as child;  
inside the GtkHBox there are a GtkMaskedEntry (derived from GtkEntry)  
and others widgets


> If it does, the parent class should be defined before the child class inside
> the catalog.
>
> How is the catalog defined ? Are you linking to the module/library containing
> these widgets or are you faking the type using the "parent" xml attribute of
> the <glade-widget-class> tag ?
>
> If you can send us the catalog we could make a better guess at what's going
> wrong here.

attached


> Also, a little besides the point: NEVER define custom widgets that are called
> GtkAnything, 'Gtk' is reserved for the GTK+ namespace, so as soon as GTK+
> decides to go ahead and declare a GtkDateEntry of its own, your code breaks.
>
> Call it PonyDateEntry, assuming your widget library or application is
> called Pony.


yes i know :-(


thanks

_______________________________________________
Glade-users maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/glade-users
gtkmaskedentry.xml (application/xml, 644 B)
<?xml version="1.0" encoding="UTF-8"?>
<glade-catalog name="gtkmaskedentry" library="gtkmaskedentry" depends="gtk+" domain="gtkmaskedentry" book="gtkmaskedentry" >

	<glade-widget-classes>
		<glade-widget-class name="GtkMaskedEntry" generic-name="gtkmaskedentry" title="Masked Entry">
			<properties>
				<property name="Mask" id="mask" />
				<property name="Tab Inside" id="tab-inside" default="False" />
			</properties>
		</glade-widget-class>
	</glade-widget-classes>
  
	<glade-widget-group name="gtk-control-display" title="Control and Display">
		<glade-widget-class-ref name="GtkMaskedEntry"/>
	</glade-widget-group>

</glade-catalog>
gtkdateentry.xml (application/xml, 1 KB)
<?xml version="1.0" encoding="UTF-8"?>
<glade-catalog name="gtkdateentry" library="gtkdateentry" depends="gtk+" domain="gtkdateentry" book="gtkdatedentry">

	<glade-widget-classes>
		<glade-widget-class name="GtkDateEntry" generic-name="gtkdateentry" title="Date Entry">
			<properties>
				<property name="Separator" id="separator" />
				<property name="Time separator" id="time-separator" />
				<property name="Format" id="format" />
				<property name="Editable only from calendar" id="editable-from-calendar" />
				<property name="Calendar's button visible" id="calendar-button-visible" />
				<property name="Date part visible" id="date-visible" />
				<property name="Time part visible" id="time-visible" />
				<property name="Seconds in time part visible" id="time-with-seconds" />
			</properties>
		</glade-widget-class>
	</glade-widget-classes>

	<glade-widget-group name="gtk-control-display" title="Control and Display">
		<glade-widget-class-ref name="GtkDateEntry" />
	</glade-widget-group>

</glade-catalog>