1 /* Generated by GOB (v2.0.12) on Sat Feb 7 18:47:28 2009
2 (do not edit directly) */
4 /* End world hunger, donate to the World Food Programme, http://www.wfp.org */
6 #define GOB_VERSION_MAJOR 2
7 #define GOB_VERSION_MINOR 0
8 #define GOB_VERSION_PATCHLEVEL 12
10 #define selfp (self->_priv)
12 #include <string.h> /* memset() */
14 #include "galan-compaction.h"
17 #define ___GOB_LIKELY(expr) G_LIKELY(expr)
18 #define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
19 #else /* ! G_LIKELY */
20 #define ___GOB_LIKELY(expr) (expr)
21 #define ___GOB_UNLIKELY(expr) (expr)
24 #line 21 "galan-compaction.gob"
26 static GtkTargetEntry targette
= { "galan/CompAction", 0, 234 };
28 #line 29 "galan-compaction.c"
29 /* self casting macros */
30 #define SELF(x) GALAN_COMPACTION(x)
31 #define SELF_CONST(x) GALAN_COMPACTION_CONST(x)
32 #define IS_SELF(x) GALAN_IS_COMPACTION(x)
33 #define TYPE_SELF GALAN_TYPE_COMPACTION
34 #define SELF_CLASS(x) GALAN_COMPACTION_CLASS(x)
36 #define SELF_GET_CLASS(x) GALAN_COMPACTION_GET_CLASS(x)
39 typedef GalanCompAction Self
;
40 typedef GalanCompActionClass SelfClass
;
42 /* here are local prototypes */
43 static void ___object_set_property (GObject
*object
, guint property_id
, const GValue
*value
, GParamSpec
*pspec
);
44 static void ___object_get_property (GObject
*object
, guint property_id
, GValue
*value
, GParamSpec
*pspec
);
45 static void galan_compaction_init (GalanCompAction
* o
) G_GNUC_UNUSED
;
46 static void galan_compaction_class_init (GalanCompActionClass
* c
) G_GNUC_UNUSED
;
47 static void galan_compaction_drag_data_get (GalanCompAction
* self
, GdkDragContext
* context
, GtkSelectionData
* data
, guint info
, guint time
, GtkWidget
* w
) G_GNUC_UNUSED
;
48 static void galan_compaction_drag_data_received (GalanCompAction
* self
, GdkDragContext
* context
, gint x
, gint y
, GtkSelectionData
* data
, guint info
, guint time
, GtkWidget
* w
) G_GNUC_UNUSED
;
49 static void galan_compaction_drag_begin (GalanCompAction
* self
, GdkDragContext
* context
, GtkWidget
* w
) G_GNUC_UNUSED
;
50 static void galan_compaction_drag_end (GalanCompAction
* self
, GdkDragContext
* context
, GtkWidget
* w
) G_GNUC_UNUSED
;
51 static void ___6_galan_compaction_activate (GtkAction
* self
) G_GNUC_UNUSED
;
52 static GtkWidget
* ___7_galan_compaction_create_menu_item (GtkAction
* self
) G_GNUC_UNUSED
;
53 static GtkWidget
* ___8_galan_compaction_create_tool_item (GtkAction
* self
) G_GNUC_UNUSED
;
61 /* pointer to the class of our parent */
62 static GtkActionClass
*parent_class
= NULL
;
64 /* Short form macros */
65 #define self_drag_data_get galan_compaction_drag_data_get
66 #define self_drag_data_received galan_compaction_drag_data_received
67 #define self_drag_begin galan_compaction_drag_begin
68 #define self_drag_end galan_compaction_drag_end
69 #define self_create_comp galan_compaction_create_comp
71 galan_compaction_get_type (void)
73 static GType type
= 0;
75 if ___GOB_UNLIKELY(type
== 0) {
76 static const GTypeInfo info
= {
77 sizeof (GalanCompActionClass
),
79 (GBaseFinalizeFunc
) NULL
,
80 (GClassInitFunc
) galan_compaction_class_init
,
81 (GClassFinalizeFunc
) NULL
,
82 NULL
/* class_data */,
83 sizeof (GalanCompAction
),
85 (GInstanceInitFunc
) galan_compaction_init
,
89 type
= g_type_register_static (GTK_TYPE_ACTION
, "GalanCompAction", &info
, (GTypeFlags
)0);
95 /* a macro for creating a new object of our type */
96 #define GET_NEW ((GalanCompAction *)g_object_new(galan_compaction_get_type(), NULL))
98 /* a function for creating a new object of our type */
100 static GalanCompAction
* GET_NEW_VARG (const char *first
, ...) G_GNUC_UNUSED
;
101 static GalanCompAction
*
102 GET_NEW_VARG (const char *first
, ...)
104 GalanCompAction
*ret
;
106 va_start (ap
, first
);
107 ret
= (GalanCompAction
*)g_object_new_valist (galan_compaction_get_type (), first
, ap
);
113 galan_compaction_init (GalanCompAction
* o G_GNUC_UNUSED
)
115 #define __GOB_FUNCTION__ "Galan:CompAction::init"
117 #undef __GOB_FUNCTION__
119 galan_compaction_class_init (GalanCompActionClass
* c G_GNUC_UNUSED
)
121 #define __GOB_FUNCTION__ "Galan:CompAction::class_init"
122 GObjectClass
*g_object_class G_GNUC_UNUSED
= (GObjectClass
*) c
;
123 GtkActionClass
*gtk_action_class
= (GtkActionClass
*)c
;
125 parent_class
= g_type_class_ref (GTK_TYPE_ACTION
);
127 #line 81 "galan-compaction.gob"
128 gtk_action_class
->activate
= ___6_galan_compaction_activate
;
129 #line 88 "galan-compaction.gob"
130 gtk_action_class
->create_menu_item
= ___7_galan_compaction_create_menu_item
;
131 #line 104 "galan-compaction.gob"
132 gtk_action_class
->create_tool_item
= ___8_galan_compaction_create_tool_item
;
133 #line 134 "galan-compaction.c"
134 g_object_class
->get_property
= ___object_get_property
;
135 g_object_class
->set_property
= ___object_set_property
;
137 GParamSpec
*param_spec
;
139 param_spec
= g_param_spec_pointer
142 "ComponentClass *" /* blurb */,
143 (GParamFlags
)(G_PARAM_READABLE
| G_PARAM_WRITABLE
| G_PARAM_CONSTRUCT_ONLY
));
144 g_object_class_install_property (g_object_class
,
147 param_spec
= g_param_spec_pointer
148 ("init_data" /* name */,
150 "InitData gpointer" /* blurb */,
151 (GParamFlags
)(G_PARAM_READABLE
| G_PARAM_WRITABLE
| G_PARAM_CONSTRUCT_ONLY
));
152 g_object_class_install_property (g_object_class
,
157 #undef __GOB_FUNCTION__
160 ___object_set_property (GObject
*object
,
162 const GValue
*VAL G_GNUC_UNUSED
,
163 GParamSpec
*pspec G_GNUC_UNUSED
)
164 #define __GOB_FUNCTION__ "Galan:CompAction::set_property"
166 GalanCompAction
*self G_GNUC_UNUSED
;
168 self
= GALAN_COMPACTION (object
);
170 switch (property_id
) {
173 #line 31 "galan-compaction.gob"
174 self
->klass
= g_value_get_pointer (VAL
);
175 #line 176 "galan-compaction.c"
180 #line 37 "galan-compaction.gob"
181 self
->init_data
= g_value_get_pointer (VAL
);
182 #line 183 "galan-compaction.c"
186 /* Apparently in g++ this is needed, glib is b0rk */
187 #ifndef __PRETTY_FUNCTION__
189 # define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__)
191 G_OBJECT_WARN_INVALID_PROPERTY_ID (object
, property_id
, pspec
);
195 #undef __GOB_FUNCTION__
198 ___object_get_property (GObject
*object
,
200 GValue
*VAL G_GNUC_UNUSED
,
201 GParamSpec
*pspec G_GNUC_UNUSED
)
202 #define __GOB_FUNCTION__ "Galan:CompAction::get_property"
204 GalanCompAction
*self G_GNUC_UNUSED
;
206 self
= GALAN_COMPACTION (object
);
208 switch (property_id
) {
211 #line 31 "galan-compaction.gob"
212 g_value_set_pointer (VAL
, self
->klass
);
213 #line 214 "galan-compaction.c"
218 #line 37 "galan-compaction.gob"
219 g_value_set_pointer (VAL
, self
->init_data
);
220 #line 221 "galan-compaction.c"
224 /* Apparently in g++ this is needed, glib is b0rk */
225 #ifndef __PRETTY_FUNCTION__
227 # define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__)
229 G_OBJECT_WARN_INVALID_PROPERTY_ID (object
, property_id
, pspec
);
233 #undef __GOB_FUNCTION__
237 #line 43 "galan-compaction.gob"
239 galan_compaction_drag_data_get (GalanCompAction
* self
, GdkDragContext
* context
, GtkSelectionData
* data
, guint info
, guint time
, GtkWidget
* w
)
240 #line 241 "galan-compaction.c"
242 #define __GOB_FUNCTION__ "Galan:CompAction::drag_data_get"
243 #line 43 "galan-compaction.gob"
244 g_return_if_fail (self
!= NULL
);
245 #line 43 "galan-compaction.gob"
246 g_return_if_fail (GALAN_IS_COMPACTION (self
));
247 #line 248 "galan-compaction.c"
249 #line 43 "galan-compaction.gob"
252 //gpointer format = g_list_nth_data( context->targets, 0 );
253 //GdkAtom format = gtk_drag_dest_find_target( w, context, NULL );
255 gtk_selection_data_set( data
, data
->target
, 8, (gpointer
) &s
, sizeof( Self
* ) );
257 #line 258 "galan-compaction.c"
258 #undef __GOB_FUNCTION__
260 #line 51 "galan-compaction.gob"
262 galan_compaction_drag_data_received (GalanCompAction
* self
, GdkDragContext
* context
, gint x
, gint y
, GtkSelectionData
* data
, guint info
, guint time
, GtkWidget
* w
)
263 #line 264 "galan-compaction.c"
265 #define __GOB_FUNCTION__ "Galan:CompAction::drag_data_received"
266 #line 51 "galan-compaction.gob"
267 g_return_if_fail (self
!= NULL
);
268 #line 51 "galan-compaction.gob"
269 g_return_if_fail (GALAN_IS_COMPACTION (self
));
270 #line 271 "galan-compaction.c"
272 #line 51 "galan-compaction.gob"
275 //Self *other = SELF( data->data );
278 #line 279 "galan-compaction.c"
279 #undef __GOB_FUNCTION__
281 #line 57 "galan-compaction.gob"
283 galan_compaction_drag_begin (GalanCompAction
* self
, GdkDragContext
* context
, GtkWidget
* w
)
284 #line 285 "galan-compaction.c"
286 #define __GOB_FUNCTION__ "Galan:CompAction::drag_begin"
287 #line 57 "galan-compaction.gob"
288 g_return_if_fail (self
!= NULL
);
289 #line 57 "galan-compaction.gob"
290 g_return_if_fail (GALAN_IS_COMPACTION (self
));
291 #line 292 "galan-compaction.c"
293 #line 57 "galan-compaction.gob"
295 self
->dragwidget
= g_object_new( GTK_TYPE_WINDOW
,
296 "accept-focus", FALSE
,
297 "focus-on-map", FALSE
,
299 "type", GTK_WINDOW_TOPLEVEL
,
301 "default-height", 30,
304 gtk_container_add( GTK_CONTAINER( self
->dragwidget
), gtk_label_new( "Drag" ) );
305 gtk_drag_set_icon_widget( context
, self
->dragwidget
, -10, -10 );
306 gtk_widget_show_all( self
->dragwidget
);
308 #line 309 "galan-compaction.c"
309 #undef __GOB_FUNCTION__
311 #line 71 "galan-compaction.gob"
313 galan_compaction_drag_end (GalanCompAction
* self
, GdkDragContext
* context
, GtkWidget
* w
)
314 #line 315 "galan-compaction.c"
316 #define __GOB_FUNCTION__ "Galan:CompAction::drag_end"
317 #line 71 "galan-compaction.gob"
318 g_return_if_fail (self
!= NULL
);
319 #line 71 "galan-compaction.gob"
320 g_return_if_fail (GALAN_IS_COMPACTION (self
));
321 #line 322 "galan-compaction.c"
323 #line 71 "galan-compaction.gob"
325 gtk_object_destroy( GTK_OBJECT(self
->dragwidget
) );
327 #line 328 "galan-compaction.c"
328 #undef __GOB_FUNCTION__
330 #line 75 "galan-compaction.gob"
332 galan_compaction_create_comp (GalanCompAction
* self
, Sheet
* s
, int x
, int y
)
333 #line 334 "galan-compaction.c"
335 #define __GOB_FUNCTION__ "Galan:CompAction::create_comp"
336 #line 75 "galan-compaction.gob"
337 g_return_if_fail (self
!= NULL
);
338 #line 75 "galan-compaction.gob"
339 g_return_if_fail (GALAN_IS_COMPACTION (self
));
340 #line 341 "galan-compaction.c"
342 #line 75 "galan-compaction.gob"
346 sheet_build_new_component( s
, self
->klass
, self
->init_data
);
348 #line 349 "galan-compaction.c"
349 #undef __GOB_FUNCTION__
351 #line 81 "galan-compaction.gob"
353 ___6_galan_compaction_activate (GtkAction
* self G_GNUC_UNUSED
)
354 #line 355 "galan-compaction.c"
355 #define PARENT_HANDLER(___self) \
356 { if(GTK_ACTION_CLASS(parent_class)->activate) \
357 (* GTK_ACTION_CLASS(parent_class)->activate)(___self); }
359 #define __GOB_FUNCTION__ "Galan:CompAction::activate"
361 #line 81 "galan-compaction.gob"
364 Self
*ich
= SELF( self
);
365 Sheet
*s
= gui_get_active_sheet();
366 sheet_build_new_component( s
, ich
->klass
, ich
->init_data
);
368 #line 369 "galan-compaction.c"
369 #undef __GOB_FUNCTION__
370 #undef PARENT_HANDLER
372 #line 88 "galan-compaction.gob"
374 ___7_galan_compaction_create_menu_item (GtkAction
* self G_GNUC_UNUSED
)
375 #line 376 "galan-compaction.c"
376 #define PARENT_HANDLER(___self) \
377 ((GTK_ACTION_CLASS(parent_class)->create_menu_item)? \
378 (* GTK_ACTION_CLASS(parent_class)->create_menu_item)(___self): \
381 #define __GOB_FUNCTION__ "Galan:CompAction::create_menu_item"
383 #line 88 "galan-compaction.gob"
386 Self
*ich
= SELF( self
);
387 GtkWidget
*ret
= PARENT_HANDLER( self
);
389 gtk_drag_source_set( ret
, GDK_BUTTON1_MASK
, &targette
, 1, GDK_ACTION_COPY
);
390 g_signal_connect_swapped( ret
, "drag_data_get", G_CALLBACK(self_drag_data_get
), ich
);
391 g_signal_connect_swapped( ret
, "drag_begin", G_CALLBACK(self_drag_begin
), ich
);
392 g_signal_connect_swapped( ret
, "drag_end", G_CALLBACK(self_drag_end
), ich
);
394 gtk_drag_dest_set( ret
, GTK_DEST_DEFAULT_DROP
, &targette
, 1, GDK_ACTION_COPY
);
395 g_signal_connect_swapped( ret
, "drag_data_received", G_CALLBACK(self_drag_data_received
), ich
);
399 #line 400 "galan-compaction.c"
400 #undef __GOB_FUNCTION__
401 #undef PARENT_HANDLER
403 #line 104 "galan-compaction.gob"
405 ___8_galan_compaction_create_tool_item (GtkAction
* self G_GNUC_UNUSED
)
406 #line 407 "galan-compaction.c"
407 #define PARENT_HANDLER(___self) \
408 ((GTK_ACTION_CLASS(parent_class)->create_tool_item)? \
409 (* GTK_ACTION_CLASS(parent_class)->create_tool_item)(___self): \
412 #define __GOB_FUNCTION__ "Galan:CompAction::create_tool_item"
414 #line 104 "galan-compaction.gob"
417 Self
*ich
= SELF(self
);
418 GtkWidget
*ret
= PARENT_HANDLER( self
);
420 gtk_drag_source_set( ret
, GDK_BUTTON1_MASK
, &targette
, 1, GDK_ACTION_COPY
);
421 g_signal_connect_swapped( ret
, "drag_data_get", G_CALLBACK(self_drag_data_get
), ich
);
423 gtk_drag_dest_set( ret
, GTK_DEST_DEFAULT_DROP
, &targette
, 1, GDK_ACTION_COPY
);
424 g_signal_connect_swapped( ret
, "drag_data_received", G_CALLBACK(self_drag_data_received
), ich
);
428 #line 429 "galan-compaction.c"
429 #undef __GOB_FUNCTION__
430 #undef PARENT_HANDLER