Discussion:
[Glade-users] adding custom widgets written with Gtkmm
Tristan Wibberley
2008-09-20 14:09:37 UTC
Permalink
Hi

I've made a widget in a custom widget library (I think that's what I've
managed). The so is built with one source file (as below) from a gtkmm
tutorial and I've added the lines in the extern "C" section. This seems
like it should be correct.

Then I wrote a catalog xml file below which I copied
to /usr/share/glade3/catalogs and I copied the library libcustom.so
to /usr/lib/glad3/modules.

glade-3 doesn't load my widget into the toolbox and says:

====================================================
GladeUI-Message: 1 missing displayable value for
GnomeDateEdit::dateedit-flags

(glade-3:10870): GladeUI-CRITICAL **: Unable to load module 'custom'
from any search paths

(glade-3:10870): GladeUI-WARNING **: Failed to load external library
'custom'

(glade-3:10870): GladeUI-WARNING **: We could not find the symbol
"mywidget_get_type"

(glade-3:10870): GladeUI-WARNING **: Could not get the type from
"Mywidget"

(glade-3:10870): GladeUI-WARNING **: Failed to load the GType for
'Mywidget'

(glade-3:10870): GladeUI-WARNING **: Tried to include undefined widget
class 'Mywidget' in a widget group
====================================================

catalog file
====================================================
<glade-catalog name="custom" library="custom" requires="gtk+">

<glade-widget-classes>
<glade-widget-class name="Mywidget" generic-name="mywidget"
title="Frobnicator"/>
</glade-widget-classes>

<glade-widget-group name="foo" title="Foo">
<glade-widget-class-ref name="Mywidget"/>
</glade-widget-group>

</glade-catalog>
====================================================

libcustom.so source file
====================================================
#include <gtkmm/widget.h>

class MyWidget : public Gtk::Widget
{
public:
MyWidget();
virtual ~MyWidget();

protected:

//Overrides:
virtual void on_size_request(Gtk::Requisition* requisition);
virtual void on_size_allocate(Gtk::Allocation& allocation);
virtual void on_map();
virtual void on_unmap();
virtual void on_realize();
virtual void on_unrealize();
virtual bool on_expose_event(GdkEventExpose* event);

Glib::RefPtr<Gdk::Window> m_refGdkWindow;

int m_scale;
};

#include <gdkmm/drawable.h>
#include <gdkmm/general.h> // for cairo helper functions
#include <gtkmm/widget.h>
#include <iostream>
//#include <gtk/gtkwidget.h> //For GTK_IS_WIDGET()

extern "C" {
GType mywidget_get_type (void) {
return MyWidget::get_type();
}
GtkWidget *
mywidget_new (void)
{
return manage(new MyWidget())->gobj();
}
}

MyWidget::MyWidget() :
//The GType name will actually be gtkmm__CustomObject_mywidget
Glib::ObjectBase("mywidget"),
Gtk::Widget(),
m_scale(1000)
{
set_flags(Gtk::NO_WINDOW);

//This shows the GType name, which must be used in the RC file.
std::cout << "GType name: " << G_OBJECT_TYPE_NAME(gobj()) <<
std::endl;

//This show that the GType still derives from GtkWidget:
//std::cout << "Gtype is a GtkWidget?:" << GTK_IS_WIDGET(gobj()) <<
std::endl;

//Install a style so that an aspect of this widget may be themed via
an RC
//file:
gtk_widget_class_install_style_property(GTK_WIDGET_CLASS(
G_OBJECT_GET_CLASS(gobj())),
g_param_spec_int("example_scale",
"Scale of Example Drawing",
"The scale to use when drawing. This is just a silly example.",
G_MININT,
G_MAXINT,
0,
G_PARAM_READABLE) );

gtk_rc_parse("custom_gtkrc");
}

MyWidget::~MyWidget()
{
}

void MyWidget::on_size_request(Gtk::Requisition* requisition)
{
//Initialize the output parameter:
*requisition = Gtk::Requisition();

//Discover the total amount of minimum space needed by this widget.

//Let's make this simple example widget always need 50 by 50:
requisition->height = 50;
requisition->width = 50;
}

void MyWidget::on_size_allocate(Gtk::Allocation& allocation)
{
//Do something with the space that we have actually been given:
//(We will not be given heights or widths less than we have requested,
though
//we might get more)

//Use the offered allocation for this container:
set_allocation(allocation);

if(m_refGdkWindow)
{
m_refGdkWindow->move_resize( allocation.get_x(), allocation.get_y(),
allocation.get_width(), allocation.get_height() );
}
}

void MyWidget::on_map()
{
//Call base class:
Gtk::Widget::on_map();
}

void MyWidget::on_unmap()
{
//Call base class:
Gtk::Widget::on_unmap();
}

void MyWidget::on_realize()
{
//Call base class:
Gtk::Widget::on_realize();

ensure_style();

//Get the themed style from the RC file:
get_style_property("example_scale", m_scale);
std::cout << "m_scale (example_scale from the theme/rc-file) is: "
<< m_scale << std::endl;

if(!m_refGdkWindow)
{
//Create the GdkWindow:

GdkWindowAttr attributes = {0};

Gtk::Allocation allocation = get_allocation();

//Set initial position and size of the Gdk::Window:
attributes.x = allocation.get_x();
attributes.y = allocation.get_y();
attributes.width = allocation.get_width();
attributes.height = allocation.get_height();

attributes.event_mask = get_events () | Gdk::EXPOSURE_MASK;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;


m_refGdkWindow = Gdk::Window::create(get_window() /* parent */,
&attributes,
GDK_WA_X | GDK_WA_Y);
unset_flags(Gtk::NO_WINDOW);
set_window(m_refGdkWindow);

//set colors
modify_bg(Gtk::STATE_NORMAL , Gdk::Color("red"));
modify_fg(Gtk::STATE_NORMAL , Gdk::Color("blue"));

//make the widget receive expose events
m_refGdkWindow->set_user_data(gobj());
}
}

void MyWidget::on_unrealize()
{
m_refGdkWindow.clear();

//Call base class:
Gtk::Widget::on_unrealize();
}

bool MyWidget::on_expose_event(GdkEventExpose* event)
{
if(m_refGdkWindow)
{
double scale_x = (double)get_allocation().get_width() / m_scale;
double scale_y = (double)get_allocation().get_height() / m_scale;

Cairo::RefPtr<Cairo::Context> cr =
m_refGdkWindow->create_cairo_context();
if(event)
{
// clip to the area that needs to be re-exposed so we don't draw
any
// more than we need to.
cr->rectangle(event->area.x, event->area.y,
event->area.width, event->area.height);
cr->clip();
}

// paint the background
Gdk::Cairo::set_source_color(cr,
get_style()->get_bg(Gtk::STATE_NORMAL));
cr->paint();

// draw the foreground
Gdk::Cairo::set_source_color(cr,
get_style()->get_fg(Gtk::STATE_NORMAL));
cr->move_to(155.*scale_x, 165.*scale_y);
cr->line_to(155.*scale_x, 838.*scale_y);
cr->line_to(265.*scale_x, 900.*scale_y);
cr->line_to(849.*scale_x, 564.*scale_y);
cr->line_to(849.*scale_x, 438.*scale_y);
cr->line_to(265.*scale_x, 100.*scale_y);
cr->line_to(155.*scale_x, 165.*scale_y);
cr->move_to(265.*scale_x, 100.*scale_y);
cr->line_to(265.*scale_x, 652.*scale_y);
cr->line_to(526.*scale_x, 502.*scale_y);
cr->move_to(369.*scale_x, 411.*scale_y);
cr->line_to(633.*scale_x, 564.*scale_y);
cr->move_to(369.*scale_x, 286.*scale_y);
cr->line_to(369.*scale_x, 592.*scale_y);
cr->move_to(369.*scale_x, 286.*scale_y);
cr->line_to(849.*scale_x, 564.*scale_y);
cr->move_to(633.*scale_x, 564.*scale_y);
cr->line_to(155.*scale_x, 838.*scale_y);
cr->stroke();
}
return true;
}
--
Tristan Wibberley
Tristan Wibberley
2008-09-20 14:31:19 UTC
Permalink
Post by Tristan Wibberley
Then I wrote a catalog xml file below which I copied
to /usr/share/glade3/catalogs and I copied the library libcustom.so
to /usr/lib/glad3/modules.
I meant /usr/lib/glade3/modules

It seems if I put libc.so.6 into modules as libc.so and change the
catalog file to library="c" then libc gets loaded. This is a bit odd
because I'm sure the libc authors didn't do anything special to make
libc loadable from glade.
--
Tristan Wibberley
Tristan Wibberley
2008-09-20 15:48:51 UTC
Permalink
Tristan, (it feels really weird addressing an email to "Tristan" as I've
never met anybody with the same name as me before :)

Thanks for the reply, I'm sending this reply to the maillist as it looks
like you meant yours to go there (the headers look like it didn't unless
it was BCC'd)
Hi,
Im not familliar with gtkmm nor have I worked much with c++, the cpp file
you have here, can a normal C compiled program link to it and use the
GType created
by the cpp class ? if so - I dont see why it cant work in theory.
I don't yet know how to check really. I was a long time Linux coder with
non-gui server and algorithmic stuff now I work on Windows with GUI and
I want to start doing GNOME gui programming.

I've gone straight to writing custom controls how I would do it on
Windows.

I'll try figuring out how to make anjuta link libcustom.so into another
program to look at this new issue.
Could it be a matter of feeding some obscure flags to the cpp linker ?
As in my other mail which you should hopefully have received by now
anjuta was not correctly setting up a shared object module which I have
now learned how to correct (strip numbers from the module name as listed
in the project modules/packages list, replace spaces with underscore,
upper-case it all and put $(THAT_STUFF) into the libraries textbox of
the module properties.
what does "nm libcustom.so | grep mywidget_get_type" have to say,
objdump and friends. Seems your lib didnt even pass g_module_open().
after discovering that

"//The GType name will actually be gtkmm__CustomObject_mywidget"

which I hadn't notice in the sample widget code and changing the extern
"C" stuff to:

gtkmm___custom_object_mywidget_get_type and
gtkmm___custom_object_mywidget_new

and the catalog file to
<glade-widget-class name="gtkmm__CustomObject_mywidget"
generic-name="gtkmm__CustomObject_mywidget" title="Frobnicator"/>


glade-3 now says (upon adding my widget to a toplevel !YAY!):

**
** Gtk:ERROR:(/build/buildd/gtk
+2.0-2.12.9/gtk/gtkwidget.c:7967):gtk_widget_real_realize: assertion
failed: (GTK_WIDGET_NO_WINDOW (widget))
Aborted

nm now says (ignore the _Z* symbols - they are c++ stuff)

***@maihem:~/dev/anjuta/src$ nm .libs/libcustom.so
0000000000208f30 d DW.ref.__gxx_personality_v0
00000000002089a8 a _DYNAMIC
0000000000208cd8 a _GLOBAL_OFFSET_TABLE_
0000000000005cb0 t _GLOBAL__I_diffscroll.cc
w _Jv_RegisterClasses
U _Unwind_Resume@@GCC_3.0
U _ZN3Atk11Implementor21ref_accessibile_vfuncEv
U _ZN3Atk11ImplementorD0Ev
U _ZN3Atk11ImplementorD1Ev
U
_ZN3Gdk5Cairo16set_source_colorERN5Cairo6RefPtrINS1_7ContextEEERKNS_5ColorE
U _ZN3Gdk5ColorC1ERKN4Glib7ustringE
U _ZN3Gdk5ColorD1Ev
U _ZN3Gdk6Window11move_resizeEiiii
U _ZN3Gdk6Window13set_user_dataEPv
U
_ZN3Gdk6Window6createERKN4Glib6RefPtrIS0_EEP14_GdkWindowAttri
U _ZN3Gdk8Drawable20create_cairo_contextEv
U _ZN3Gtk6Object10set_manageEv
U _ZN3Gtk6Object15destroy_notify_Ev
U _ZN3Gtk6ObjectD0Ev
U _ZN3Gtk6ObjectD1Ev
U _ZN3Gtk6Widget10get_windowEv
U _ZN3Gtk6Widget10on_realizeEv
U
_ZN3Gtk6Widget10set_windowERKN4Glib6RefPtrIN3Gdk6WindowEEE
U
_ZN3Gtk6Widget11on_drag_endERKN4Glib6RefPtrIN3Gdk11DragContextEEE
U _ZN3Gtk6Widget11unset_flagsENS_11WidgetFlagsE
U _ZN3Gtk6Widget12ensure_styleEv
U
_ZN3Gtk6Widget12on_drag_dropERKN4Glib6RefPtrIN3Gdk11DragContextEEEiij
U _ZN3Gtk6Widget12on_map_eventEP12_GdkEventAny
U _ZN3Gtk6Widget12on_unrealizeEv
U
_ZN3Gtk6Widget13on_drag_beginERKN4Glib6RefPtrIN3Gdk11DragContextEEE
U
_ZN3Gtk6Widget13on_drag_leaveERKN4Glib6RefPtrIN3Gdk11DragContextEEEj
U _ZN3Gtk6Widget13on_grab_focusEv
U _ZN3Gtk6Widget14hide_all_vfuncEv
U
_ZN3Gtk6Widget14on_drag_motionERKN4Glib6RefPtrIN3Gdk11DragContextEEEiij
U _ZN3Gtk6Widget14on_grab_notifyEb
U _ZN3Gtk6Widget14on_unmap_eventEP12_GdkEventAny
U _ZN3Gtk6Widget14set_allocationERKN3Gdk9RectangleE
U _ZN3Gtk6Widget14show_all_vfuncEv
U _ZN3Gtk6Widget15on_child_notifyEP11_GParamSpec
U _ZN3Gtk6Widget15on_client_eventEP15_GdkEventClient
U _ZN3Gtk6Widget15on_delete_eventEP12_GdkEventAny
U _ZN3Gtk6Widget15on_expose_eventEP15_GdkEventExpose
U _ZN3Gtk6Widget15on_scroll_eventEP15_GdkEventScroll
U _ZN3Gtk6Widget15on_size_requestEP15_GtkRequisition
U
_ZN3Gtk6Widget16on_drag_data_getERKN4Glib6RefPtrIN3Gdk11DragContextEEERNS_13SelectionDataEjj
U
_ZN3Gtk6Widget16on_selection_getERNS_13SelectionDataEjj
U _ZN3Gtk6Widget16on_size_allocateERN3Gdk9RectangleE
U _ZN3Gtk6Widget16on_state_changedENS_9StateTypeE
U
_ZN3Gtk6Widget16on_style_changedERKN4Glib6RefPtrINS_5StyleEEE
U _ZN3Gtk6Widget17on_focus_in_eventEP14_GdkEventFocus
U _ZN3Gtk6Widget17on_get_accessibleEv
U _ZN3Gtk6Widget17on_parent_changedEPS0_
U
_ZN3Gtk6Widget17on_screen_changedERKN4Glib6RefPtrIN3Gdk6ScreenEEE
U
_ZN3Gtk6Widget18on_configure_eventEP18_GdkEventConfigure
U _ZN3Gtk6Widget18on_focus_out_eventEP14_GdkEventFocus
U _ZN3Gtk6Widget18on_key_press_eventEP12_GdkEventKey
U _ZN3Gtk6Widget18on_no_expose_eventEP12_GdkEventAny
U
_ZN3Gtk6Widget19on_drag_data_deleteERKN4Glib6RefPtrIN3Gdk11DragContextEEE
U _ZN3Gtk6Widget20get_accessible_vfuncEv
U
_ZN3Gtk6Widget20on_direction_changedENS_13TextDirectionE
U _ZN3Gtk6Widget20on_hierarchy_changedEPS0_
U _ZN3Gtk6Widget20on_key_release_eventEP12_GdkEventKey
U _ZN3Gtk6Widget20on_mnemonic_activateEb
U
_ZN3Gtk6Widget21on_button_press_eventEP15_GdkEventButton
U
_ZN3Gtk6Widget21on_drag_data_receivedERKN4Glib6RefPtrIN3Gdk11DragContextEEEiiRKNS_13SelectionDataEjj
U
_ZN3Gtk6Widget21on_enter_notify_eventEP17_GdkEventCrossing
U
_ZN3Gtk6Widget21on_leave_notify_eventEP17_GdkEventCrossing
U
_ZN3Gtk6Widget21on_proximity_in_eventEP18_GdkEventProximity
U
_ZN3Gtk6Widget21on_selection_receivedERKNS_13SelectionDataEj
U
_ZN3Gtk6Widget21on_window_state_eventEP20_GdkEventWindowState
U
_ZN3Gtk6Widget22on_motion_notify_eventEP15_GdkEventMotion
U
_ZN3Gtk6Widget22on_proximity_out_eventEP18_GdkEventProximity
U
_ZN3Gtk6Widget23on_button_release_eventEP15_GdkEventButton
U
_ZN3Gtk6Widget24on_property_notify_eventEP17_GdkEventProperty
U
_ZN3Gtk6Widget24on_selection_clear_eventEP18_GdkEventSelection
U
_ZN3Gtk6Widget25on_selection_notify_eventEP18_GdkEventSelection
U
_ZN3Gtk6Widget26on_selection_request_eventEP18_GdkEventSelection
U
_ZN3Gtk6Widget26on_visibility_notify_eventEP19_GdkEventVisibility
U
_ZN3Gtk6Widget39dispatch_child_properties_changed_vfuncEjPP11_GParamSpec
U _ZN3Gtk6Widget6on_mapEv
U _ZN3Gtk6Widget7on_hideEv
U _ZN3Gtk6Widget7on_showEv
U _ZN3Gtk6Widget8get_typeEv
U _ZN3Gtk6Widget8on_eventEP9_GdkEvent
U _ZN3Gtk6Widget8on_focusENS_13DirectionTypeE
U _ZN3Gtk6Widget8on_unmapEv
U _ZN3Gtk6Widget9get_styleEv
U _ZN3Gtk6Widget9modify_bgENS_9StateTypeERKN3Gdk5ColorE
U _ZN3Gtk6Widget9modify_fgENS_9StateTypeERKN3Gdk5ColorE
U _ZN3Gtk6Widget9set_flagsENS_11WidgetFlagsE
U _ZN3Gtk6WidgetC2Ev
U _ZN3Gtk6WidgetD0Ev
U _ZN3Gtk6WidgetD1Ev
U _ZN3Gtk6WidgetD2Ev
U _ZN4Glib10ObjectBase10set_manageEv
U _ZN4Glib10ObjectBase15destroy_notify_Ev
U _ZN4Glib10ObjectBaseC2EPKc
U _ZN4Glib10ObjectBaseD2Ev
U _ZN4Glib5ValueIiE10value_typeEv
U _ZN4Glib6ObjectD0Ev
U _ZN4Glib6ObjectD1Ev
0000000000006d90 W _ZN4Glib6RefPtrIN3Gdk6WindowEED1Ev
U _ZN4Glib7ustringC1EPKc
U _ZN4Glib7ustringD1Ev
U _ZN4Glib9InterfaceD0Ev
U _ZN4Glib9InterfaceD1Ev
U _ZN4Glib9ValueBase4initEm
U _ZN4Glib9ValueBaseC2Ev
U _ZN4Glib9ValueBaseD2Ev
U _ZN4sigc9trackableC2Ev
U _ZN4sigc9trackableD2Ev
U _ZN5Cairo7Context4clipEv
U _ZN5Cairo7Context5paintEv
U _ZN5Cairo7Context6strokeEv
U _ZN5Cairo7Context7line_toEdd
U _ZN5Cairo7Context7move_toEdd
U _ZN5Cairo7Context9rectangleEdddd
0000000000006510 T _ZN8MyWidget10on_realizeEv
0000000000006000 T _ZN8MyWidget12on_unrealizeEv
00000000000068a0 T _ZN8MyWidget15on_expose_eventEP15_GdkEventExpose
0000000000005c80 T _ZN8MyWidget15on_size_requestEP15_GtkRequisition
0000000000005ce0 T _ZN8MyWidget16on_size_allocateERN3Gdk9RectangleE
0000000000005c90 T _ZN8MyWidget6on_mapEv
0000000000005ca0 T _ZN8MyWidget8on_unmapEv
0000000000006030 T _ZN8MyWidgetC1Ev
00000000000062f0 T _ZN8MyWidgetC2Ev
0000000000005dc0 T _ZN8MyWidgetD0Ev
0000000000005ec0 T _ZN8MyWidgetD1Ev
0000000000005f90 T _ZN8MyWidgetD2Ev
U _ZNK3Gdk9Rectangle10get_heightEv
U _ZNK3Gdk9Rectangle5get_xEv
U _ZNK3Gdk9Rectangle5get_yEv
U _ZNK3Gdk9Rectangle9get_widthEv
U _ZNK3Gtk5Style6get_bgENS_9StateTypeE
U _ZNK3Gtk5Style6get_fgENS_9StateTypeE
U _ZNK3Gtk6Widget10get_eventsEv
U _ZNK3Gtk6Widget14get_allocationEv
0000000000006dc0 W
_ZNK3Gtk6Widget18get_style_propertyIiEEvRKN4Glib7ustringERT_
U
_ZNK3Gtk6Widget24get_style_property_valueERKN4Glib7ustringERNS1_9ValueBaseE
U _ZNK4Glib10ObjectBase11unreferenceEv
U _ZNK4Glib10ObjectBase9referenceEv
U _ZNK4Glib5ValueIiE3getEv
U _ZNSo3putEc@@GLIBCXX_3.4
U _ZNSo5flushEv@@GLIBCXX_3.4
U _ZNSolsEi@@GLIBCXX_3.4
U _ZNSt8ios_base4InitC1Ev@@GLIBCXX_3.4
U _ZNSt8ios_base4InitD1Ev@@GLIBCXX_3.4
U
_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate@@GLIBCXX_3.4
U
_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_l@@GLIBCXX_3.4.9
U _ZSt16__throw_bad_castv@@GLIBCXX_3.4
U _ZSt4cout@@GLIBCXX_3.4
0000000000208f48 b _ZStL8__ioinit
0000000000208680 V _ZTC8MyWidget0_N3Gtk6ObjectE
00000000002083a0 V _ZTC8MyWidget0_N3Gtk6WidgetE
0000000000208740 V _ZTC8MyWidget0_N4Glib6ObjectE
00000000002087e0 V _ZTC8MyWidget16_N3Atk11ImplementorE
00000000002088a0 V _ZTC8MyWidget16_N4Glib9InterfaceE
0000000000208940 V _ZTC8MyWidget40_N4Glib10ObjectBaseE
0000000000208990 V _ZTI8MyWidget
U _ZTIN3Atk11ImplementorE
U _ZTIN3Gtk6ObjectE
U _ZTIN3Gtk6WidgetE
U _ZTIN4Glib10ObjectBaseE
U _ZTIN4Glib6ObjectE
U _ZTIN4Glib9InterfaceE
0000000000006f68 V _ZTS8MyWidget
0000000000208320 V _ZTT8MyWidget
0000000000208040 V _ZTV8MyWidget
U _ZTVN10__cxxabiv120__si_class_type_infoE@@CXXABI_1.3
U _ZThn16_N3Gtk6WidgetD0Ev
U _ZThn16_N3Gtk6WidgetD1Ev
0000000000005db0 T _ZThn16_N8MyWidgetD0Ev
0000000000005eb0 T _ZThn16_N8MyWidgetD1Ev
U _ZTv0_n32_N3Atk11ImplementorD0Ev
U _ZTv0_n32_N3Atk11ImplementorD1Ev
U _ZTv0_n32_N3Gtk6ObjectD0Ev
U _ZTv0_n32_N3Gtk6ObjectD1Ev
U _ZTv0_n32_N3Gtk6WidgetD0Ev
U _ZTv0_n32_N3Gtk6WidgetD1Ev
U _ZTv0_n32_N4Glib6ObjectD0Ev
U _ZTv0_n32_N4Glib6ObjectD1Ev
U _ZTv0_n32_N4Glib9InterfaceD0Ev
U _ZTv0_n32_N4Glib9InterfaceD1Ev
0000000000005da0 T _ZTv0_n32_N8MyWidgetD0Ev
0000000000005ea0 T _ZTv0_n32_N8MyWidgetD1Ev
U _ZTv0_n56_N3Gtk6Object15destroy_notify_Ev
U _ZTv0_n64_N3Gtk6Object10set_manageEv
U _ZdlPv@@GLIBCXX_3.4
U _Znwm@@GLIBCXX_3.4
0000000000208010 d __CTOR_END__
0000000000208000 d __CTOR_LIST__
0000000000208020 d __DTOR_END__
0000000000208018 d __DTOR_LIST__
0000000000007340 r __FRAME_END__
0000000000208028 d __JCR_END__
0000000000208028 d __JCR_LIST__
0000000000208f38 A __bss_start
U __cxa_atexit@@GLIBC_2.2.5
w __cxa_finalize@@GLIBC_2.2.5
U __cxa_pure_virtual@@CXXABI_1.3
0000000000006e50 t __do_global_ctors_aux
0000000000005bd0 t __do_global_dtors_aux
0000000000208f28 d __dso_handle
w __gmon_start__
U __gxx_personality_v0@@CXXABI_1.3
0000000000208f38 A _edata
0000000000208f50 A _end
0000000000006e88 T _fini
0000000000005710 T _init
0000000000005bb0 t call_gmon_start
0000000000208f38 b completed.6688
0000000000208f40 b dtor_idx.6690
0000000000005c50 t frame_dummy
U g_param_spec_int
U g_type_check_class_cast
U g_type_name
U gtk_rc_parse
U gtk_widget_class_install_style_property
U gtk_widget_get_type
0000000000005d90 T gtkmm___custom_object_mywidget_get_type
00000000000062a0 T gtkmm___custom_object_mywidget_new
Any thoughts on this Juan ?
Cheers,
-Tristan
On Sat, Sep 20, 2008 at 10:31 AM, Tristan Wibberley
Post by Tristan Wibberley
Post by Tristan Wibberley
Then I wrote a catalog xml file below which I copied
to /usr/share/glade3/catalogs and I copied the library libcustom.so
to /usr/lib/glad3/modules.
I meant /usr/lib/glade3/modules
It seems if I put libc.so.6 into modules as libc.so and change the
catalog file to library="c" then libc gets loaded. This is a bit odd
because I'm sure the libc authors didn't do anything special to make
libc loadable from glade.
--
Tristan Wibberley
_______________________________________________
http://lists.ximian.com/mailman/listinfo/glade-users
Tristan Van Berkom
2008-09-20 15:58:02 UTC
Permalink
On Sat, Sep 20, 2008 at 11:48 AM, Tristan Wibberley
Post by Tristan Wibberley
Tristan, (it feels really weird addressing an email to "Tristan" as I've
never met anybody with the same name as me before :)
You have to start somewhere :) Im 29 yrs old and Ive met about 4.

[...]
Post by Tristan Wibberley
**
** Gtk:ERROR:(/build/buildd/gtk
+2.0-2.12.9/gtk/gtkwidget.c:7967):gtk_widget_real_realize: assertion
failed: (GTK_WIDGET_NO_WINDOW (widget))
Aborted
Please tell me that your widget already works and that your
not making your tests in an experimental glade environment :D

Just have to double check ;-)

What does "/gtk/gtkwidget.c:7967):gtk_widget_real_realize()" have to
say about it, did you look at the source around the assertion ?

I think your widget may try to create a widget->window when you
didnt unset the GTK_WIDGET_NO_WINDOW flag in your init()
routine, something like that.

Cheers,
-Tristan
Post by Tristan Wibberley
nm now says (ignore the _Z* symbols - they are c++ stuff)
0000000000208f30 d DW.ref.__gxx_personality_v0
00000000002089a8 a _DYNAMIC
0000000000208cd8 a _GLOBAL_OFFSET_TABLE_
0000000000005cb0 t _GLOBAL__I_diffscroll.cc
w _Jv_RegisterClasses
U _ZN3Atk11Implementor21ref_accessibile_vfuncEv
U _ZN3Atk11ImplementorD0Ev
U _ZN3Atk11ImplementorD1Ev
U
_ZN3Gdk5Cairo16set_source_colorERN5Cairo6RefPtrINS1_7ContextEEERKNS_5ColorE
U _ZN3Gdk5ColorC1ERKN4Glib7ustringE
U _ZN3Gdk5ColorD1Ev
U _ZN3Gdk6Window11move_resizeEiiii
U _ZN3Gdk6Window13set_user_dataEPv
U
_ZN3Gdk6Window6createERKN4Glib6RefPtrIS0_EEP14_GdkWindowAttri
U _ZN3Gdk8Drawable20create_cairo_contextEv
U _ZN3Gtk6Object10set_manageEv
U _ZN3Gtk6Object15destroy_notify_Ev
U _ZN3Gtk6ObjectD0Ev
U _ZN3Gtk6ObjectD1Ev
U _ZN3Gtk6Widget10get_windowEv
U _ZN3Gtk6Widget10on_realizeEv
U
_ZN3Gtk6Widget10set_windowERKN4Glib6RefPtrIN3Gdk6WindowEEE
U
_ZN3Gtk6Widget11on_drag_endERKN4Glib6RefPtrIN3Gdk11DragContextEEE
U _ZN3Gtk6Widget11unset_flagsENS_11WidgetFlagsE
U _ZN3Gtk6Widget12ensure_styleEv
U
_ZN3Gtk6Widget12on_drag_dropERKN4Glib6RefPtrIN3Gdk11DragContextEEEiij
U _ZN3Gtk6Widget12on_map_eventEP12_GdkEventAny
U _ZN3Gtk6Widget12on_unrealizeEv
U
_ZN3Gtk6Widget13on_drag_beginERKN4Glib6RefPtrIN3Gdk11DragContextEEE
U
_ZN3Gtk6Widget13on_drag_leaveERKN4Glib6RefPtrIN3Gdk11DragContextEEEj
U _ZN3Gtk6Widget13on_grab_focusEv
U _ZN3Gtk6Widget14hide_all_vfuncEv
U
_ZN3Gtk6Widget14on_drag_motionERKN4Glib6RefPtrIN3Gdk11DragContextEEEiij
U _ZN3Gtk6Widget14on_grab_notifyEb
U _ZN3Gtk6Widget14on_unmap_eventEP12_GdkEventAny
U _ZN3Gtk6Widget14set_allocationERKN3Gdk9RectangleE
U _ZN3Gtk6Widget14show_all_vfuncEv
U _ZN3Gtk6Widget15on_child_notifyEP11_GParamSpec
U _ZN3Gtk6Widget15on_client_eventEP15_GdkEventClient
U _ZN3Gtk6Widget15on_delete_eventEP12_GdkEventAny
U _ZN3Gtk6Widget15on_expose_eventEP15_GdkEventExpose
U _ZN3Gtk6Widget15on_scroll_eventEP15_GdkEventScroll
U _ZN3Gtk6Widget15on_size_requestEP15_GtkRequisition
U
_ZN3Gtk6Widget16on_drag_data_getERKN4Glib6RefPtrIN3Gdk11DragContextEEERNS_13SelectionDataEjj
U
_ZN3Gtk6Widget16on_selection_getERNS_13SelectionDataEjj
U _ZN3Gtk6Widget16on_size_allocateERN3Gdk9RectangleE
U _ZN3Gtk6Widget16on_state_changedENS_9StateTypeE
U
_ZN3Gtk6Widget16on_style_changedERKN4Glib6RefPtrINS_5StyleEEE
U _ZN3Gtk6Widget17on_focus_in_eventEP14_GdkEventFocus
U _ZN3Gtk6Widget17on_get_accessibleEv
U _ZN3Gtk6Widget17on_parent_changedEPS0_
U
_ZN3Gtk6Widget17on_screen_changedERKN4Glib6RefPtrIN3Gdk6ScreenEEE
U
_ZN3Gtk6Widget18on_configure_eventEP18_GdkEventConfigure
U _ZN3Gtk6Widget18on_focus_out_eventEP14_GdkEventFocus
U _ZN3Gtk6Widget18on_key_press_eventEP12_GdkEventKey
U _ZN3Gtk6Widget18on_no_expose_eventEP12_GdkEventAny
U
_ZN3Gtk6Widget19on_drag_data_deleteERKN4Glib6RefPtrIN3Gdk11DragContextEEE
U _ZN3Gtk6Widget20get_accessible_vfuncEv
U
_ZN3Gtk6Widget20on_direction_changedENS_13TextDirectionE
U _ZN3Gtk6Widget20on_hierarchy_changedEPS0_
U _ZN3Gtk6Widget20on_key_release_eventEP12_GdkEventKey
U _ZN3Gtk6Widget20on_mnemonic_activateEb
U
_ZN3Gtk6Widget21on_button_press_eventEP15_GdkEventButton
U
_ZN3Gtk6Widget21on_drag_data_receivedERKN4Glib6RefPtrIN3Gdk11DragContextEEEiiRKNS_13SelectionDataEjj
U
_ZN3Gtk6Widget21on_enter_notify_eventEP17_GdkEventCrossing
U
_ZN3Gtk6Widget21on_leave_notify_eventEP17_GdkEventCrossing
U
_ZN3Gtk6Widget21on_proximity_in_eventEP18_GdkEventProximity
U
_ZN3Gtk6Widget21on_selection_receivedERKNS_13SelectionDataEj
U
_ZN3Gtk6Widget21on_window_state_eventEP20_GdkEventWindowState
U
_ZN3Gtk6Widget22on_motion_notify_eventEP15_GdkEventMotion
U
_ZN3Gtk6Widget22on_proximity_out_eventEP18_GdkEventProximity
U
_ZN3Gtk6Widget23on_button_release_eventEP15_GdkEventButton
U
_ZN3Gtk6Widget24on_property_notify_eventEP17_GdkEventProperty
U
_ZN3Gtk6Widget24on_selection_clear_eventEP18_GdkEventSelection
U
_ZN3Gtk6Widget25on_selection_notify_eventEP18_GdkEventSelection
U
_ZN3Gtk6Widget26on_selection_request_eventEP18_GdkEventSelection
U
_ZN3Gtk6Widget26on_visibility_notify_eventEP19_GdkEventVisibility
U
_ZN3Gtk6Widget39dispatch_child_properties_changed_vfuncEjPP11_GParamSpec
U _ZN3Gtk6Widget6on_mapEv
U _ZN3Gtk6Widget7on_hideEv
U _ZN3Gtk6Widget7on_showEv
U _ZN3Gtk6Widget8get_typeEv
U _ZN3Gtk6Widget8on_eventEP9_GdkEvent
U _ZN3Gtk6Widget8on_focusENS_13DirectionTypeE
U _ZN3Gtk6Widget8on_unmapEv
U _ZN3Gtk6Widget9get_styleEv
U _ZN3Gtk6Widget9modify_bgENS_9StateTypeERKN3Gdk5ColorE
U _ZN3Gtk6Widget9modify_fgENS_9StateTypeERKN3Gdk5ColorE
U _ZN3Gtk6Widget9set_flagsENS_11WidgetFlagsE
U _ZN3Gtk6WidgetC2Ev
U _ZN3Gtk6WidgetD0Ev
U _ZN3Gtk6WidgetD1Ev
U _ZN3Gtk6WidgetD2Ev
U _ZN4Glib10ObjectBase10set_manageEv
U _ZN4Glib10ObjectBase15destroy_notify_Ev
U _ZN4Glib10ObjectBaseC2EPKc
U _ZN4Glib10ObjectBaseD2Ev
U _ZN4Glib5ValueIiE10value_typeEv
U _ZN4Glib6ObjectD0Ev
U _ZN4Glib6ObjectD1Ev
0000000000006d90 W _ZN4Glib6RefPtrIN3Gdk6WindowEED1Ev
U _ZN4Glib7ustringC1EPKc
U _ZN4Glib7ustringD1Ev
U _ZN4Glib9InterfaceD0Ev
U _ZN4Glib9InterfaceD1Ev
U _ZN4Glib9ValueBase4initEm
U _ZN4Glib9ValueBaseC2Ev
U _ZN4Glib9ValueBaseD2Ev
U _ZN4sigc9trackableC2Ev
U _ZN4sigc9trackableD2Ev
U _ZN5Cairo7Context4clipEv
U _ZN5Cairo7Context5paintEv
U _ZN5Cairo7Context6strokeEv
U _ZN5Cairo7Context7line_toEdd
U _ZN5Cairo7Context7move_toEdd
U _ZN5Cairo7Context9rectangleEdddd
0000000000006510 T _ZN8MyWidget10on_realizeEv
0000000000006000 T _ZN8MyWidget12on_unrealizeEv
00000000000068a0 T _ZN8MyWidget15on_expose_eventEP15_GdkEventExpose
0000000000005c80 T _ZN8MyWidget15on_size_requestEP15_GtkRequisition
0000000000005ce0 T _ZN8MyWidget16on_size_allocateERN3Gdk9RectangleE
0000000000005c90 T _ZN8MyWidget6on_mapEv
0000000000005ca0 T _ZN8MyWidget8on_unmapEv
0000000000006030 T _ZN8MyWidgetC1Ev
00000000000062f0 T _ZN8MyWidgetC2Ev
0000000000005dc0 T _ZN8MyWidgetD0Ev
0000000000005ec0 T _ZN8MyWidgetD1Ev
0000000000005f90 T _ZN8MyWidgetD2Ev
U _ZNK3Gdk9Rectangle10get_heightEv
U _ZNK3Gdk9Rectangle5get_xEv
U _ZNK3Gdk9Rectangle5get_yEv
U _ZNK3Gdk9Rectangle9get_widthEv
U _ZNK3Gtk5Style6get_bgENS_9StateTypeE
U _ZNK3Gtk5Style6get_fgENS_9StateTypeE
U _ZNK3Gtk6Widget10get_eventsEv
U _ZNK3Gtk6Widget14get_allocationEv
0000000000006dc0 W
_ZNK3Gtk6Widget18get_style_propertyIiEEvRKN4Glib7ustringERT_
U
_ZNK3Gtk6Widget24get_style_property_valueERKN4Glib7ustringERNS1_9ValueBaseE
U _ZNK4Glib10ObjectBase11unreferenceEv
U _ZNK4Glib10ObjectBase9referenceEv
U _ZNK4Glib5ValueIiE3getEv
U
U
0000000000208f48 b _ZStL8__ioinit
0000000000208680 V _ZTC8MyWidget0_N3Gtk6ObjectE
00000000002083a0 V _ZTC8MyWidget0_N3Gtk6WidgetE
0000000000208740 V _ZTC8MyWidget0_N4Glib6ObjectE
00000000002087e0 V _ZTC8MyWidget16_N3Atk11ImplementorE
00000000002088a0 V _ZTC8MyWidget16_N4Glib9InterfaceE
0000000000208940 V _ZTC8MyWidget40_N4Glib10ObjectBaseE
0000000000208990 V _ZTI8MyWidget
U _ZTIN3Atk11ImplementorE
U _ZTIN3Gtk6ObjectE
U _ZTIN3Gtk6WidgetE
U _ZTIN4Glib10ObjectBaseE
U _ZTIN4Glib6ObjectE
U _ZTIN4Glib9InterfaceE
0000000000006f68 V _ZTS8MyWidget
0000000000208320 V _ZTT8MyWidget
0000000000208040 V _ZTV8MyWidget
U _ZThn16_N3Gtk6WidgetD0Ev
U _ZThn16_N3Gtk6WidgetD1Ev
0000000000005db0 T _ZThn16_N8MyWidgetD0Ev
0000000000005eb0 T _ZThn16_N8MyWidgetD1Ev
U _ZTv0_n32_N3Atk11ImplementorD0Ev
U _ZTv0_n32_N3Atk11ImplementorD1Ev
U _ZTv0_n32_N3Gtk6ObjectD0Ev
U _ZTv0_n32_N3Gtk6ObjectD1Ev
U _ZTv0_n32_N3Gtk6WidgetD0Ev
U _ZTv0_n32_N3Gtk6WidgetD1Ev
U _ZTv0_n32_N4Glib6ObjectD0Ev
U _ZTv0_n32_N4Glib6ObjectD1Ev
U _ZTv0_n32_N4Glib9InterfaceD0Ev
U _ZTv0_n32_N4Glib9InterfaceD1Ev
0000000000005da0 T _ZTv0_n32_N8MyWidgetD0Ev
0000000000005ea0 T _ZTv0_n32_N8MyWidgetD1Ev
U _ZTv0_n56_N3Gtk6Object15destroy_notify_Ev
U _ZTv0_n64_N3Gtk6Object10set_manageEv
0000000000208010 d __CTOR_END__
0000000000208000 d __CTOR_LIST__
0000000000208020 d __DTOR_END__
0000000000208018 d __DTOR_LIST__
0000000000007340 r __FRAME_END__
0000000000208028 d __JCR_END__
0000000000208028 d __JCR_LIST__
0000000000208f38 A __bss_start
0000000000006e50 t __do_global_ctors_aux
0000000000005bd0 t __do_global_dtors_aux
0000000000208f28 d __dso_handle
w __gmon_start__
0000000000208f38 A _edata
0000000000208f50 A _end
0000000000006e88 T _fini
0000000000005710 T _init
0000000000005bb0 t call_gmon_start
0000000000208f38 b completed.6688
0000000000208f40 b dtor_idx.6690
0000000000005c50 t frame_dummy
U g_param_spec_int
U g_type_check_class_cast
U g_type_name
U gtk_rc_parse
U gtk_widget_class_install_style_property
U gtk_widget_get_type
0000000000005d90 T gtkmm___custom_object_mywidget_get_type
00000000000062a0 T gtkmm___custom_object_mywidget_new
Any thoughts on this Juan ?
Cheers,
-Tristan
On Sat, Sep 20, 2008 at 10:31 AM, Tristan Wibberley
Post by Tristan Wibberley
Post by Tristan Wibberley
Then I wrote a catalog xml file below which I copied
to /usr/share/glade3/catalogs and I copied the library libcustom.so
to /usr/lib/glad3/modules.
I meant /usr/lib/glade3/modules
It seems if I put libc.so.6 into modules as libc.so and change the
catalog file to library="c" then libc gets loaded. This is a bit odd
because I'm sure the libc authors didn't do anything special to make
libc loadable from glade.
--
Tristan Wibberley
_______________________________________________
http://lists.ximian.com/mailman/listinfo/glade-users
Tristan Wibberley
2008-09-20 16:49:09 UTC
Permalink
Post by Tristan Van Berkom
Please tell me that your widget already works and that your
not making your tests in an experimental glade environment :D
Just have to double check ;-)
It seems that an application using any gtkmm widgets (and thus libglade
if the implementation of a widget happens to be in gtkmm) must create a
Gtk::Main object from gtkmm and destroy it when exiting.

Is there any way to make that happen from the catalog (I see that there
is support for an init function - but this object must last from before
the first gtkmm widget is created until after the last is destroyed).
Post by Tristan Van Berkom
What does "/gtk/gtkwidget.c:7967):gtk_widget_real_realize()" have to
say about it, did you look at the source around the assertion ?
I'm just getting my feet wet with gtk at the moment, but it looks like
I've stepped in a very deep puddle.
--
Tristan Wibberley
Tristan Van Berkom
2008-09-20 19:45:02 UTC
Permalink
On Sat, Sep 20, 2008 at 12:49 PM, Tristan Wibberley
Post by Tristan Wibberley
Post by Tristan Van Berkom
Please tell me that your widget already works and that your
not making your tests in an experimental glade environment :D
Just have to double check ;-)
It seems that an application using any gtkmm widgets (and thus libglade
if the implementation of a widget happens to be in gtkmm) must create a
Gtk::Main object from gtkmm and destroy it when exiting.
Is there any way to make that happen from the catalog (I see that there
is support for an init function - but this object must last from before
the first gtkmm widget is created until after the last is destroyed).
Post by Tristan Van Berkom
What does "/gtk/gtkwidget.c:7967):gtk_widget_real_realize()" have to
say about it, did you look at the source around the assertion ?
I'm just getting my feet wet with gtk at the moment, but it looks like
I've stepped in a very deep puddle.
Lol it might work with a little effort :) please try ! haha

just create one that is static and global in your module :)

Im curious to see if it works, if it does, we can create a c++
plugin that c++ modules can depend on, which could create the Gtk::Main
on your behalf (to avoid problems with multiple c++ plugins loaded).

If it doesnt work, you can use the "parent" argument to fake the type
in glade, and provide extra properties virtually by way of the catalog
(but introspecting the type in an automatic way would be nice).

Cheers,
-Tristan
Tristan Wibberley
2008-09-20 22:47:39 UTC
Permalink
Post by Tristan Van Berkom
Im curious to see if it works, if it does, we can create a c++
plugin that c++ modules can depend on, which could create the Gtk::Main
on your behalf (to avoid problems with multiple c++ plugins loaded).
If it doesnt work, you can use the "parent" argument to fake the type
in glade, and provide extra properties virtually by way of the catalog
(but introspecting the type in an automatic way would be nice).
I would be interested in this kind of stuff directly supported in
glade. I also use gtkmm
and I find really difficult to add widgets to glade (I gave up).
Indeed, it will need some changes to gtkmm as it will double initialise
(Gtkmm wraps the initialisation of gtk up with the initialisation of its
static data).

If the glade requires="" attribute supports keeping gtkmm initialised
for as long as there is at least one library that uses it then splitting
gtk and glib initialisation out from the gtkmm initialisation should
work - I think. But I haven't yet mapped everything in my head.

It looks like the below would work except as in the comment - any
thoughts?

Pango::wrap_init();
Atk::wrap_init();
Gdk::wrap_init();
Gtk::wrap_init();
Glib::wrap_register_init(); // but without calling g_type_init()
Glib::Error::register_init();
--
Tristan
Tristan Van Berkom
2008-09-20 23:54:00 UTC
Permalink
On Sat, Sep 20, 2008 at 6:47 PM, Tristan Wibberley
<***@wibberley.org> wrote:
[...]
Post by Tristan Wibberley
If the glade requires="" attribute supports keeping gtkmm initialised
for as long as there is at least one library that uses it then splitting
gtk and glib initialisation out from the gtkmm initialisation should
work - I think. But I haven't yet mapped everything in my head.
As long as you can do your gtkmm initializations after weve initially
initialized gtk, then this will work fine, yes if we put the gtkmm init
code inside one C++ support module, then you will only have to
require it and it will be loaded once, until glade is shutdown.

Let me know if this works without doing an extra lib, try just
adding an init function and doing it in your own module, does it work ?

Cheers,
-Tristan
Tristan Wibberley
2008-09-21 00:37:20 UTC
Permalink
sure, looks like its worth a try, I wonder if its harmfull at all to
call gtk_init()
twice...
hmm. I think I've been barking up the wrong tree, my "init
function" (ie, my constructor) is not being called and nor is my
on_realize function.

Does glade-3 create an instance by using the
gtkmm___custom_object_mywidget_new() function? Because that is not being
called in my case and if it /were/ called then everything would work, I
think.
--
Tristan
Tristan Van Berkom
2008-09-21 01:14:35 UTC
Permalink
On Sat, Sep 20, 2008 at 8:37 PM, Tristan Wibberley
Post by Tristan Wibberley
sure, looks like its worth a try, I wonder if its harmfull at all to
call gtk_init()
twice...
hmm. I think I've been barking up the wrong tree, my "init
function" (ie, my constructor) is not being called and nor is my
on_realize function.
Does glade-3 create an instance by using the
gtkmm___custom_object_mywidget_new() function? Because that is not being
called in my case and if it /were/ called then everything would work, I
think.
In the xml catalog file that you supply to glade, you are allowed
to specify a "init-function" argument (the gnome catalog does that
to register its icons at startup, also the python support plugin to
initialize the interpretor).

I want you to try to assign the "init-function" and supply one in
your library, from that entry point call your Gtkmm initialization
routines.

Double check the api docs at http://glade.gnome.org/docs, do
you want your type to be written to the glade file as "gtkmm_MyObjectType" or
should it be written out as "MyObjectType" (not sure how this should
look from the GtkBuilder side of things..) ?

Remember we have an attribute for the name of the type, and another attribute
for the get-type-function that you must specify yourself if the type
name is something weird like gtkmm_MyObject.

Hope that gives you something to chew ;-)

Cheers,
-Tristan
Post by Tristan Wibberley
--
Tristan
Tristan Wibberley
2008-09-21 10:36:18 UTC
Permalink
Post by Tristan Van Berkom
On Sat, Sep 20, 2008 at 8:37 PM, Tristan Wibberley
Post by Tristan Wibberley
sure, looks like its worth a try, I wonder if its harmfull at all to
call gtk_init()
twice...
hmm. I think I've been barking up the wrong tree, my "init
function" (ie, my constructor) is not being called and nor is my
on_realize function.
Does glade-3 create an instance by using the
gtkmm___custom_object_mywidget_new() function? Because that is not being
called in my case and if it /were/ called then everything would work, I
think.
In the xml catalog file that you supply to glade, you are allowed
to specify a "init-function" argument (the gnome catalog does that
to register its icons at startup, also the python support plugin to
initialize the interpretor).
I've used that and successfully called the Gtkmm initialization routine.
Post by Tristan Van Berkom
Double check the api docs at http://glade.gnome.org/docs, do
you want your type to be written to the glade file as "gtkmm_MyObjectType" or
should it be written out as "MyObjectType" (not sure how this should
look from the GtkBuilder side of things..) ?
I have no idea. The object is apparently going to be of gtype
"gtkmm__CustomObject_mywidget" so the snakecase name will be
"gtkmm___custom_object_mywidget".

glade is calling my init-function and my tests show that double init
does not break in a simple case.

glade is calling gtkmm___custom_object_mywidget_get_type

glade is not calling gtkmm___custom_object_mywidget_new but instead it
seems to be making the object in some other way that doesn't call the
object's constructor so doesn't set the NO_WINDOW flag or any other
necessary part.

I've looked into this, and it looks like a gtkmm widget cannot be
created with gtk_type_new, so I'm going to try writing a real gtk widget
adhering to the requirements of a gtk widget including support for
gtk_type_new, then make that widget have-a gtkmm custom widget which it
will forward all signals to. Hopefully that will work. I'm not sure how
to indicate that all signals should be forwarded but I'm hoping it can
be done.
--
Tristan
Tristan Van Berkom
2008-09-21 14:42:01 UTC
Permalink
On Sun, Sep 21, 2008 at 6:36 AM, Tristan Wibberley
<***@wibberley.org> wrote:
[...]
Post by Tristan Wibberley
glade is calling my init-function and my tests show that double init
does not break in a simple case.
glade is calling gtkmm___custom_object_mywidget_get_type
glade is not calling gtkmm___custom_object_mywidget_new but instead it
seems to be making the object in some other way that doesn't call the
object's constructor so doesn't set the NO_WINDOW flag or any other
necessary part.
I've looked into this, and it looks like a gtkmm widget cannot be
created with gtk_type_new, so I'm going to try writing a real gtk widget
adhering to the requirements of a gtk widget including support for
gtk_type_new, then make that widget have-a gtkmm custom widget which it
will forward all signals to. Hopefully that will work. I'm not sure how
to indicate that all signals should be forwarded but I'm hoping it can
be done.
Ok,
sounds like the logical thing you might try from the app programmers pov,
but its not livable as a long term solution - I think what we need to do from
glade is add a glade_widget_adaptor_construct_object (adaptor, GType type)
to allow the plugin module to do the g_object_new() for us - this way we
can offer the same routine from a support c++ module - allowing us to
create the widgets as c++ objects and just returning the wrapped GObject.

One problem I can see might be if the c++ object is somehow owner of
the GObject - we need to create the c++ object in a way that it will
die when the GObject dies (bu refcount), and not when it goes out of
scope in the plugin (probably just a matter of adding an extra ref ?)

Can you checkout glade3 from trunk ? I can add a backend
object-constructor-function
for your testing purposes, this part would be a sinch for me...

Cheers,
-Tristan

Loading...