2
/* File: eggzeitgeistindex.c
4
* Generated by eggdbus-binding-tool 0.6. Do not edit.
11
#include <eggdbus/eggdbus.h>
12
#include "eggzeitgeistbindingstypes.h"
13
#include "eggzeitgeistbindings.h"
14
#include "eggzeitgeistbindingsmarshal.h"
15
#include "eggzeitgeistindex.h"
18
* SECTION:eggzeitgeistindex
19
* @title: EggZeitgeistIndex
20
* @short_description: FIXME: not documented.
22
* Do a full text search against the Zeitgeist FTS Extension. The time range and event templates are only used to filter the reulsts and will not affect the relevancy ranking.
25
#define _EGG_ZEITGEIST_TYPE_INDEX_PROXY (_egg_zeitgeist_index_proxy_get_type())
26
#define _EGG_ZEITGEIST_INDEX_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), _EGG_ZEITGEIST_TYPE_INDEX_PROXY, _EggZeitgeistIndexProxy))
27
#define _EGG_ZEITGEIST_INDEX_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), _EGG_ZEITGEIST_TYPE_INDEX_PROXY, _EggZeitgeistIndexProxy))
28
#define _EGG_ZEITGEIST_INDEX_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), _EGG_ZEITGEIST_TYPE_INDEX_PROXY, _EggZeitgeistIndexProxy))
29
#define _EGG_ZEITGEIST_IS_INDEX_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), _EGG_ZEITGEIST_TYPE_INDEX_PROXY))
30
#define _EGG_ZEITGEIST_IS_INDEX_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), _EGG_ZEITGEIST_TYPE_INDEX_PROXY))
32
typedef struct _EggZeitgeistIndexProxy _EggZeitgeistIndexProxy;
33
typedef struct _EggZeitgeistIndexProxyClass _EggZeitgeistIndexProxyClass;
35
struct _EggZeitgeistIndexProxy
37
EggDBusInterfaceProxy parent_instance;
39
EggDBusObjectProxy *object_proxy;
42
struct _EggZeitgeistIndexProxyClass
44
EggDBusInterfaceProxyClass parent_class;
47
GType _egg_zeitgeist_index_proxy_get_type (void) G_GNUC_CONST;
50
_proxy_interface_init (EggZeitgeistIndexIface *iface)
54
G_DEFINE_TYPE_WITH_CODE (_EggZeitgeistIndexProxy, _egg_zeitgeist_index_proxy, EGG_DBUS_TYPE_INTERFACE_PROXY,
55
G_IMPLEMENT_INTERFACE (EGG_ZEITGEIST_TYPE_INDEX, _proxy_interface_init));
58
_egg_zeitgeist_index_proxy_init (_EggZeitgeistIndexProxy *interface_proxy)
63
_egg_zeitgeist_index_proxy_object_proxy_finalized (gpointer data,
64
GObject *where_the_object_was)
66
_EggZeitgeistIndexProxy *interface_proxy;
68
interface_proxy = _EGG_ZEITGEIST_INDEX_PROXY (data);
70
g_warning ("object_proxy for _EggZeitgeistIndexProxy finalized but interface proxy still alive; you are not supposed to be reffing instances derived from EggDBusInterfaceProxy");
72
interface_proxy->object_proxy = NULL;
76
_egg_zeitgeist_index_proxy_finalize (GObject *object)
78
_EggZeitgeistIndexProxy *interface_proxy;
80
interface_proxy = _EGG_ZEITGEIST_INDEX_PROXY (object);
82
if (interface_proxy->object_proxy != NULL)
83
g_object_weak_unref (G_OBJECT (interface_proxy->object_proxy), _egg_zeitgeist_index_proxy_object_proxy_finalized, interface_proxy);
85
G_OBJECT_CLASS (_egg_zeitgeist_index_proxy_parent_class)->finalize (object);
88
static EggDBusObjectProxy *
89
_egg_zeitgeist_index_proxy_get_object_proxy (EggDBusInterfaceProxy *proxy)
91
_EggZeitgeistIndexProxy *interface_proxy;
93
interface_proxy = _EGG_ZEITGEIST_INDEX_PROXY (proxy);
95
return interface_proxy->object_proxy;
98
static EggDBusInterfaceIface *
99
_egg_zeitgeist_index_proxy_get_interface_iface (EggDBusInterfaceProxy *proxy)
101
return (EggDBusInterfaceIface *) (EGG_ZEITGEIST_INDEX_GET_IFACE (proxy));
105
_egg_zeitgeist_index_proxy_class_init (_EggZeitgeistIndexProxyClass *klass)
107
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
108
EggDBusInterfaceProxyClass *interface_proxy_class = EGG_DBUS_INTERFACE_PROXY_CLASS (klass);
110
gobject_class->get_property = G_OBJECT_CLASS(g_type_class_peek_parent (klass))->get_property;
111
gobject_class->set_property = G_OBJECT_CLASS(g_type_class_peek_parent (klass))->set_property;
112
gobject_class->finalize = _egg_zeitgeist_index_proxy_finalize;
114
interface_proxy_class->get_object_proxy = _egg_zeitgeist_index_proxy_get_object_proxy;
115
interface_proxy_class->get_interface_iface = _egg_zeitgeist_index_proxy_get_interface_iface;
119
static EggDBusInterfaceProxy *
120
_egg_zeitgeist_index_proxy_new (EggDBusObjectProxy *object_proxy)
122
_EggZeitgeistIndexProxy *interface_proxy;
124
interface_proxy = _EGG_ZEITGEIST_INDEX_PROXY (g_object_new (_EGG_ZEITGEIST_TYPE_INDEX_PROXY, NULL));
126
interface_proxy->object_proxy = object_proxy;
127
g_object_weak_ref (G_OBJECT (object_proxy), _egg_zeitgeist_index_proxy_object_proxy_finalized, interface_proxy);
129
return EGG_DBUS_INTERFACE_PROXY (interface_proxy);
132
static const EggDBusInterfaceArgInfo arg_info_method_in_search[] =
166
static const EggDBusInterfaceArgInfo arg_info_method_out_search[] =
180
static const EggDBusInterfaceMethodInfo method_info[] =
184
"s(xx)a(asaasay)uuu",
186
arg_info_method_in_search,
189
arg_info_method_out_search,
194
static const EggDBusInterfaceInfo interface_info =
196
"org.gnome.zeitgeist.Index",
206
static const EggDBusInterfaceInfo *
207
get_interface_info (void)
209
return &interface_info;
212
static void handle_message (EggDBusInterface *interface,
213
EggDBusMessage *message);
216
base_init (gpointer g_iface)
218
static gboolean is_initialized = FALSE;
222
EggDBusInterfaceIface *gdbus_iface_vtable = (EggDBusInterfaceIface *) g_iface;
224
egg_zeitgeist_bindings_get_error_domain_types ();
226
gdbus_iface_vtable->get_interface_info = get_interface_info;
227
gdbus_iface_vtable->handle_message = handle_message;
228
gdbus_iface_vtable->get_interface_proxy = _egg_zeitgeist_index_proxy_new;
232
is_initialized = TRUE;
237
egg_zeitgeist_index_get_type (void)
239
static GType iface_type = 0;
243
static const GTypeInfo info =
245
sizeof (EggZeitgeistIndexIface),
246
base_init, /* base_init */
247
NULL, /* base_finalize */
248
NULL, /* class_init */
249
NULL, /* class_finalize */
250
NULL, /* class_data */
251
0, /* instance_size */
253
NULL, /* instance_init */
254
NULL /* value_table */
257
iface_type = g_type_register_static (G_TYPE_INTERFACE, "EggZeitgeistIndex", &info, 0);
259
g_type_interface_add_prerequisite (iface_type, G_TYPE_OBJECT);
266
generic_async_callback (GObject *source_object,
270
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
271
EggDBusMessage *reply;
275
reply = egg_dbus_connection_send_message_with_reply_finish (EGG_DBUS_CONNECTION (source_object),
280
g_simple_async_result_set_from_error (simple, error);
281
g_error_free (error);
285
g_simple_async_result_set_op_res_gpointer (simple, reply, (GDestroyNotify) g_object_unref);
288
g_simple_async_result_complete (simple);
289
g_object_unref (simple);
293
* egg_zeitgeist_index_search:
294
* @instance: A #EggZeitgeistIndex.
295
* @call_flags: Flags from #EggDBusCallFlags detailing how the method should be invoked.
296
* @query: FIXME: not documented.
297
* @time_range: FIXME: not documented.
298
* @event_templates: FIXME: not documented.
299
* @offset: FIXME: not documented.
300
* @num_events: FIXME: not documented.
301
* @result_type: FIXME: not documented.
302
* @cancellable: A #GCancellable or %NULL.
303
* @callback: Callback to invoke when the reply is ready.
304
* @user_data: User data to pass to @callback.
306
* FIXME: not documented.
308
* This function asynchronously invokes the <link linkend="eggdbus-method-org.gnome.zeitgeist.Index.Search">Search<!-- -->()</link> method
309
* on the <link linkend="eggdbus-interface-org.gnome.zeitgeist.Index">org.gnome.zeitgeist.Index</link> interface
310
* on the object represented by @instance.
311
* When the reply is ready, @callback will be called (on the main thread).
312
* You can then call egg_zeitgeist_index_search_finish() to get the result.
313
* See egg_zeitgeist_index_search_sync() for the synchronous version of this function.
315
* Returns: A pending call id (never zero) that can be used with egg_dbus_connection_pending_call_cancel() or egg_dbus_connection_pending_call_block().
318
egg_zeitgeist_index_search (
319
EggZeitgeistIndex *instance,
320
EggDBusCallFlags call_flags,
322
EggZeitgeistTimeRange *_time_range,
323
EggDBusArraySeq *_event_templates,
326
EggZeitgeistResultType _result_type,
327
GCancellable *cancellable,
328
GAsyncReadyCallback callback,
331
EggDBusObjectProxy *object_proxy;
332
EggDBusMessage *message;
333
GSimpleAsyncResult *simple;
335
guint pending_call_id;
337
g_return_val_if_fail (EGG_ZEITGEIST_IS_INDEX (instance) && EGG_DBUS_IS_INTERFACE_PROXY (instance), 0);
339
simple = g_simple_async_result_new (G_OBJECT (instance),
342
egg_zeitgeist_index_search);
344
object_proxy = egg_dbus_interface_proxy_get_object_proxy (EGG_DBUS_INTERFACE_PROXY (instance));
346
message = egg_dbus_connection_new_message_for_method_call (egg_dbus_object_proxy_get_connection (object_proxy),
348
egg_dbus_object_proxy_get_name (object_proxy),
349
egg_dbus_object_proxy_get_object_path (object_proxy),
350
"org.gnome.zeitgeist.Index",
355
if (!egg_dbus_message_append_string (message, _query, &error))
357
if (!egg_dbus_message_append_structure (message, EGG_DBUS_STRUCTURE (_time_range), &error))
359
if (!egg_dbus_message_append_seq (message, _event_templates, "(asaasay)", &error))
361
if (!egg_dbus_message_append_uint (message, _offset, &error))
363
if (!egg_dbus_message_append_uint (message, _num_events, &error))
365
if (!egg_dbus_message_append_uint (message, (EggZeitgeistResultType ) _result_type, &error))
368
pending_call_id = egg_dbus_connection_send_message_with_reply (egg_dbus_object_proxy_get_connection (object_proxy), call_flags, message, egg_zeitgeist_bindings_get_error_domain_types (), cancellable, generic_async_callback, simple);
370
g_object_unref (message);
371
return pending_call_id;
373
g_simple_async_result_set_from_error (simple, error);
374
g_simple_async_result_complete (simple);
375
g_object_unref (simple);
376
g_error_free (error);
377
g_object_unref (message);
382
* egg_zeitgeist_index_search_finish:
383
* @instance: A #EggZeitgeistIndex.
384
* @out_events: FIXME: not documented. Free with g_object_unref().
385
* @out_hit_count: FIXME: not documented.
386
* @res: A #GAsyncResult obtained from the #GAsyncReadyCallback function passed to egg_zeitgeist_index_search().
387
* @error: Return location for error.
389
* Finishes an asynchronous method invocation started with egg_zeitgeist_index_search().
391
* Returns: %TRUE if the method call succeeded, %FALSE if @error is set.
394
egg_zeitgeist_index_search_finish (
395
EggZeitgeistIndex *instance,
396
EggDBusArraySeq **_out_events,
397
guint *_out_hit_count,
401
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
402
EggDBusMessage *reply;
405
g_return_val_if_fail (EGG_ZEITGEIST_IS_INDEX (instance) && EGG_DBUS_IS_INTERFACE_PROXY (instance), FALSE);
407
g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == egg_zeitgeist_index_search);
412
if (g_simple_async_result_propagate_error (simple, error))
415
reply = EGG_DBUS_MESSAGE (g_object_ref (g_simple_async_result_get_op_res_gpointer (simple)));
419
g_simple_async_result_propagate_error (simple, error);
423
if (!egg_dbus_message_extract_seq (reply, _out_events, error))
425
if (!egg_dbus_message_extract_uint (reply, _out_hit_count, error))
432
g_object_unref (reply);
437
* egg_zeitgeist_index_search_sync:
438
* @instance: A #EggZeitgeistIndex.
439
* @call_flags: Flags from #EggDBusCallFlags detailing how the method should be invoked.
440
* @query: FIXME: not documented.
441
* @time_range: FIXME: not documented.
442
* @event_templates: FIXME: not documented.
443
* @offset: FIXME: not documented.
444
* @num_events: FIXME: not documented.
445
* @result_type: FIXME: not documented.
446
* @out_events: FIXME: not documented. Free with g_object_unref().
447
* @out_hit_count: FIXME: not documented.
448
* @cancellable: A #GCancellable or %NULL.
449
* @error: Return location for error.
451
* FIXME: not documented.
453
* This function synchronously invokes the <link linkend="eggdbus-method-org.gnome.zeitgeist.Index.Search">Search<!-- -->()</link> method on the <link linkend="eggdbus-interface-org.gnome.zeitgeist.Index">org.gnome.zeitgeist.Index</link> interface on the object represented by @instance.
454
* See egg_zeitgeist_index_search() for the asynchronous version of this function.
456
* Returns: %TRUE if the method call succeeded, %FALSE if @error is set.
459
egg_zeitgeist_index_search_sync (
460
EggZeitgeistIndex *instance,
461
EggDBusCallFlags call_flags,
463
EggZeitgeistTimeRange *_time_range,
464
EggDBusArraySeq *_event_templates,
467
EggZeitgeistResultType _result_type,
468
EggDBusArraySeq **_out_events,
469
guint *_out_hit_count,
470
GCancellable *cancellable,
473
EggDBusObjectProxy *object_proxy;
474
EggDBusMessage *message;
475
EggDBusMessage *reply;
478
g_return_val_if_fail (EGG_ZEITGEIST_IS_INDEX (instance) && EGG_DBUS_IS_INTERFACE_PROXY (instance), FALSE);
480
ret = FALSE; reply = NULL;
481
object_proxy = egg_dbus_interface_proxy_get_object_proxy (EGG_DBUS_INTERFACE_PROXY (instance));
483
message = egg_dbus_connection_new_message_for_method_call (egg_dbus_object_proxy_get_connection (object_proxy),
485
egg_dbus_object_proxy_get_name (object_proxy),
486
egg_dbus_object_proxy_get_object_path (object_proxy),
487
"org.gnome.zeitgeist.Index",
490
if (!egg_dbus_message_append_string (message, _query, error))
492
if (!egg_dbus_message_append_structure (message, EGG_DBUS_STRUCTURE (_time_range), error))
494
if (!egg_dbus_message_append_seq (message, _event_templates, "(asaasay)", error))
496
if (!egg_dbus_message_append_uint (message, _offset, error))
498
if (!egg_dbus_message_append_uint (message, _num_events, error))
500
if (!egg_dbus_message_append_uint (message, (EggZeitgeistResultType ) _result_type, error))
503
reply = egg_dbus_connection_send_message_with_reply_sync (egg_dbus_object_proxy_get_connection (object_proxy), call_flags, message, egg_zeitgeist_bindings_get_error_domain_types (), cancellable, error);
507
if (!egg_dbus_message_extract_seq (reply, _out_events, error))
509
if (!egg_dbus_message_extract_uint (reply, _out_hit_count, error))
516
g_object_unref (message);
518
g_object_unref (reply);
523
handle_signal (EggDBusInterface *interface,
524
EggDBusMessage *message)
526
g_warning ("%s: Ignoring unknown signal '%s' on interface '%s' with signature '%s'", G_STRFUNC, egg_dbus_message_get_signal_name (message), interface_info.name, egg_dbus_message_get_signature (message));
530
handle_method_call (EggDBusInterface *interface,
531
EggDBusMessage *message)
534
const gchar *signature;
535
const gchar *method_name;
536
const gchar *expected_signature;
537
EggZeitgeistIndexIface *iface;
538
EggDBusMethodInvocation *method_invocation;
542
signature = egg_dbus_message_get_signature (message);
543
method_name = egg_dbus_message_get_method_name (message);
544
iface = EGG_ZEITGEIST_INDEX_GET_IFACE (interface);
546
if (strcmp (method_name, "Search") == 0)
549
EggZeitgeistTimeRange *_time_range;
550
EggDBusArraySeq *_event_templates;
553
EggZeitgeistResultType _result_type;
555
expected_signature = "s(xx)a(asaasay)uuu";
556
if (strcmp (signature, expected_signature) != 0)
557
goto wrong_signature;
559
if (iface->handle_search == NULL)
560
goto not_implemented;
562
if (!egg_dbus_message_extract_string (message, &_query, &error))
563
goto extraction_error;
564
if (!egg_dbus_message_extract_structure (message, (EggDBusStructure **) &_time_range, &error))
565
goto extraction_error;
566
if (!egg_dbus_message_extract_seq (message, &_event_templates, &error))
567
goto extraction_error;
568
if (!egg_dbus_message_extract_uint (message, &_offset, &error))
569
goto extraction_error;
570
if (!egg_dbus_message_extract_uint (message, &_num_events, &error))
571
goto extraction_error;
573
EggZeitgeistResultType temp_value;
574
if (!egg_dbus_message_extract_uint (message, &temp_value, &error))
575
goto extraction_error;
576
_result_type = (EggZeitgeistResultType ) temp_value;
579
method_invocation = egg_dbus_method_invocation_new (message,
580
egg_zeitgeist_index_handle_search_finish);
582
egg_dbus_method_invocation_add_destroy_notify (method_invocation,
584
(GDestroyNotify) g_free);
585
egg_dbus_method_invocation_add_destroy_notify (method_invocation,
587
(GDestroyNotify) g_object_unref);
588
egg_dbus_method_invocation_add_destroy_notify (method_invocation,
590
(GDestroyNotify) g_object_unref);
592
iface->handle_search (EGG_ZEITGEIST_INDEX (interface), _query, _time_range, _event_templates, _offset, _num_events, _result_type, method_invocation);
597
g_warning ("%s: Ignoring unknown method call '%s' on interface '%s' with signature '%s'", G_STRFUNC, method_name, interface_info.name, signature);
603
g_warning ("%s: Method call '%s' on interface '%s' with signature '%s' is not implemented on GObject class %s", G_STRFUNC, method_name, interface_info.name, signature, g_type_name (G_TYPE_FROM_INSTANCE (interface)));
607
g_warning ("%s: Ignoring method call '%s' on interface '%s' with malformed signature '%s', expected signature '%s'", G_STRFUNC, method_name, interface_info.name, signature, expected_signature);
611
g_warning ("%s: Error extracting arguments for method call '%s' on interface '%s' with signature '%s': %s", G_STRFUNC, method_name, interface_info.name, signature, error->message);
612
g_error_free (error);
616
* egg_zeitgeist_index_handle_search_finish:
617
* @events: FIXME: not documented.
618
* @hit_count: FIXME: not documented.
619
* @method_invocation: A #EggDBusMethodInvocation.
621
* Function to be called by implementers of the
622
* <link linkend="eggdbus-interface-org.gnome.zeitgeist.Index">org.gnome.zeitgeist.Index</link>
623
* D-Bus interface to finish handling the
624
* <link linkend="eggdbus-method-org.gnome.zeitgeist.Index.Search">Search<!-- -->()</link> method.
628
egg_zeitgeist_index_handle_search_finish (
629
EggDBusMethodInvocation *method_invocation,
630
EggDBusArraySeq *_out_events,
631
guint _out_hit_count)
634
EggDBusMessage *reply;
638
g_warn_if_fail (egg_dbus_method_invocation_get_source_tag (method_invocation) ==
639
egg_zeitgeist_index_handle_search_finish);
641
reply = egg_dbus_method_invocation_create_reply_message (method_invocation);
643
if (!egg_dbus_message_append_seq (reply, _out_events, "(asaasay)", &error))
645
if (!egg_dbus_message_append_uint (reply, _out_hit_count, &error))
648
egg_dbus_connection_send_message (egg_dbus_message_get_connection (reply), reply);
650
g_object_unref (reply);
651
g_object_unref (method_invocation);
656
g_warning ("%s: Malformed data passed: %s", G_STRFUNC, error->message);
657
g_error_free (error);
661
handle_message (EggDBusInterface *interface,
662
EggDBusMessage *message)
665
switch (egg_dbus_message_get_message_type (message))
667
case EGG_DBUS_MESSAGE_TYPE_SIGNAL:
668
handle_signal (interface, message);
671
case EGG_DBUS_MESSAGE_TYPE_METHOD_CALL:
672
handle_method_call (interface, message);
676
g_assert_not_reached ();