Merge lp:~mhr3/libzeitgeist/various-fixes into lp:libzeitgeist
- various-fixes
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Mikkel Kamstrup Erlandsen |
Approved revision: | no longer in the revision history of the source branch. |
Merged at revision: | 148 |
Proposed branch: | lp:~mhr3/libzeitgeist/various-fixes |
Merge into: | lp:libzeitgeist |
Diff against target: |
254 lines (+80/-26) 5 files modified
bindings/generate_vapi (+4/-0) bindings/zeitgeist-1.0.gi (+19/-6) bindings/zeitgeist-1.0.vapi (+7/-16) src/zeitgeist-log.c (+48/-4) src/zeitgeist-log.h (+2/-0) |
To merge this branch: | bzr merge lp:~mhr3/libzeitgeist/various-fixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mikkel Kamstrup Erlandsen | Approve | ||
Review via email: mp+30529@code.launchpad.net |
Commit message
Description of the change
Implements ZeitgeistLog:
Mikkel Kamstrup Erlandsen (kamstrup) wrote : | # |
Michal Hruby (mhr3) wrote : | # |
At first I wanted to call it "is-connected", but I looked on Gtk+ API, they don't do is-sensitive / is-enabled... not to mention zeitgeist_
Mikkel Kamstrup Erlandsen (kamstrup) wrote : | # |
Oh - You misunderstood me :-)
The method is zeitgeist_
Michal Hruby (mhr3) wrote : | # |
Changed to zeitgeist_
Mikkel Kamstrup Erlandsen (kamstrup) wrote : | # |
Mmmmm.... sorry to be picky... :-) But did you read my second comment?
I meant that the method is called zeitgeist_
Michal Hruby (mhr3) wrote : | # |
Oh, guess I'm blind, sorry about that...
Mikkel Kamstrup Erlandsen (kamstrup) wrote : | # |
Super. Approved!
- 148. By Mikkel Kamstrup Erlandsen <kamstrup@hardback>
-
Merge branch lp:~mhr3/libzeitgeist/various-fixes from Michal Hruby:
* Adds a "connected" property to ZeitgeistLog telling you whether or not the Zeitgeist daemon is running
* Clean up some of the VAPI and GI stuff
* Remove _finish() functions from VAPI
Preview Diff
1 | === modified file 'bindings/generate_vapi' | |||
2 | --- bindings/generate_vapi 2010-04-22 12:33:05 +0000 | |||
3 | +++ bindings/generate_vapi 2010-07-22 17:11:00 +0000 | |||
4 | @@ -8,3 +8,7 @@ | |||
5 | 8 | cd $(dirname $0) | 8 | cd $(dirname $0) |
6 | 9 | vala-gen-introspect zeitgeist-1.0 . | 9 | vala-gen-introspect zeitgeist-1.0 . |
7 | 10 | vapigen --pkg gobject-2.0 --pkg glib-2.0 --pkg gio-2.0 --library zeitgeist-1.0 zeitgeist-1.0.gi zeitgeist-1.0-custom.vala | 10 | vapigen --pkg gobject-2.0 --pkg glib-2.0 --pkg gio-2.0 --library zeitgeist-1.0 zeitgeist-1.0.gi zeitgeist-1.0-custom.vala |
8 | 11 | # nasty hack to force usage of PtrArray in recent versions of vapigen | ||
9 | 12 | sed -i 's/GenericArray/PtrArray/g' zeitgeist-1.0.vapi | ||
10 | 13 | # workaround a bug introduced in vapigen 0.9.3 | ||
11 | 14 | sed -i 's/void \(insert_events_from_ptrarray\)\(.*\);/GLib.Array \1\2 throws GLib.Error;/' zeitgeist-1.0.vapi | ||
12 | 11 | 15 | ||
13 | === modified file 'bindings/zeitgeist-1.0.gi' | |||
14 | --- bindings/zeitgeist-1.0.gi 2010-06-17 14:11:59 +0000 | |||
15 | +++ bindings/zeitgeist-1.0.gi 2010-07-22 17:11:00 +0000 | |||
16 | @@ -63,6 +63,18 @@ | |||
17 | 63 | <parameter name="tv" type="GTimeVal*"/> | 63 | <parameter name="tv" type="GTimeVal*"/> |
18 | 64 | </parameters> | 64 | </parameters> |
19 | 65 | </function> | 65 | </function> |
20 | 66 | <function name="timestamp_next_midnight" symbol="zeitgeist_timestamp_next_midnight"> | ||
21 | 67 | <return-type type="gint64"/> | ||
22 | 68 | <parameters> | ||
23 | 69 | <parameter name="timestamp" type="gint64"/> | ||
24 | 70 | </parameters> | ||
25 | 71 | </function> | ||
26 | 72 | <function name="timestamp_prev_midnight" symbol="zeitgeist_timestamp_prev_midnight"> | ||
27 | 73 | <return-type type="gint64"/> | ||
28 | 74 | <parameters> | ||
29 | 75 | <parameter name="timestamp" type="gint64"/> | ||
30 | 76 | </parameters> | ||
31 | 77 | </function> | ||
32 | 66 | <function name="timestamp_to_date" symbol="zeitgeist_timestamp_to_date"> | 78 | <function name="timestamp_to_date" symbol="zeitgeist_timestamp_to_date"> |
33 | 67 | <return-type type="void"/> | 79 | <return-type type="void"/> |
34 | 68 | <parameters> | 80 | <parameters> |
35 | @@ -438,6 +450,12 @@ | |||
36 | 438 | <parameter name="error" type="GError**"/> | 450 | <parameter name="error" type="GError**"/> |
37 | 439 | </parameters> | 451 | </parameters> |
38 | 440 | </method> | 452 | </method> |
39 | 453 | <method name="is_connected" symbol="zeitgeist_log_is_connected"> | ||
40 | 454 | <return-type type="gboolean"/> | ||
41 | 455 | <parameters> | ||
42 | 456 | <parameter name="self" type="ZeitgeistLog*"/> | ||
43 | 457 | </parameters> | ||
44 | 458 | </method> | ||
45 | 441 | <constructor name="new" symbol="zeitgeist_log_new"> | 459 | <constructor name="new" symbol="zeitgeist_log_new"> |
46 | 442 | <return-type type="ZeitgeistLog*"/> | 460 | <return-type type="ZeitgeistLog*"/> |
47 | 443 | </constructor> | 461 | </constructor> |
48 | @@ -476,6 +494,7 @@ | |||
49 | 476 | <parameter name="error" type="GError**"/> | 494 | <parameter name="error" type="GError**"/> |
50 | 477 | </parameters> | 495 | </parameters> |
51 | 478 | </method> | 496 | </method> |
52 | 497 | <property name="connected" type="gboolean" readable="1" writable="0" construct="0" construct-only="0"/> | ||
53 | 479 | </object> | 498 | </object> |
54 | 480 | <object name="ZeitgeistMonitor" parent="GObject" type-name="ZeitgeistMonitor" get-type="zeitgeist_monitor_get_type"> | 499 | <object name="ZeitgeistMonitor" parent="GObject" type-name="ZeitgeistMonitor" get-type="zeitgeist_monitor_get_type"> |
55 | 481 | <implements> | 500 | <implements> |
56 | @@ -830,12 +849,6 @@ | |||
57 | 830 | <constant name="ZEITGEIST_NMO_MAILBOX_DATA_OBJECT" type="char*" value="http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#MailboxDataObject"/> | 849 | <constant name="ZEITGEIST_NMO_MAILBOX_DATA_OBJECT" type="char*" value="http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#MailboxDataObject"/> |
58 | 831 | <constant name="ZEITGEIST_NMO_MESSAGE" type="char*" value="http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#Message"/> | 850 | <constant name="ZEITGEIST_NMO_MESSAGE" type="char*" value="http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#Message"/> |
59 | 832 | <constant name="ZEITGEIST_NMO_MIME_ENTITY" type="char*" value="http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#MimeEntity"/> | 851 | <constant name="ZEITGEIST_NMO_MIME_ENTITY" type="char*" value="http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#MimeEntity"/> |
60 | 833 | <constant name="ZEITGEIST_TIMESTAMP_DAY" type="int" value="86400000"/> | ||
61 | 834 | <constant name="ZEITGEIST_TIMESTAMP_HOUR" type="int" value="3600000"/> | ||
62 | 835 | <constant name="ZEITGEIST_TIMESTAMP_MINUTE" type="int" value="60000"/> | ||
63 | 836 | <constant name="ZEITGEIST_TIMESTAMP_SECOND" type="int" value="1000"/> | ||
64 | 837 | <constant name="ZEITGEIST_TIMESTAMP_WEEK" type="int" value="604800000"/> | ||
65 | 838 | <constant name="ZEITGEIST_TIMESTAMP_YEAR" type="int" value="2147483647"/> | ||
66 | 839 | <constant name="ZEITGEIST_ZG_ACCESS_EVENT" type="char*" value="http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#AccessEvent"/> | 852 | <constant name="ZEITGEIST_ZG_ACCESS_EVENT" type="char*" value="http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#AccessEvent"/> |
67 | 840 | <constant name="ZEITGEIST_ZG_CREATE_EVENT" type="char*" value="http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#CreateEvent"/> | 853 | <constant name="ZEITGEIST_ZG_CREATE_EVENT" type="char*" value="http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#CreateEvent"/> |
68 | 841 | <constant name="ZEITGEIST_ZG_DELETE_EVENT" type="char*" value="http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#DeleteEvent"/> | 854 | <constant name="ZEITGEIST_ZG_DELETE_EVENT" type="char*" value="http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#DeleteEvent"/> |
69 | 842 | 855 | ||
70 | === modified file 'bindings/zeitgeist-1.0.vapi' | |||
71 | --- bindings/zeitgeist-1.0.vapi 2010-06-23 09:43:18 +0000 | |||
72 | +++ bindings/zeitgeist-1.0.vapi 2010-07-22 17:11:00 +0000 | |||
73 | @@ -24,18 +24,18 @@ | |||
74 | 24 | public static int64 from_iso8601 (string datetime); | 24 | public static int64 from_iso8601 (string datetime); |
75 | 25 | [CCode (cheader_filename = "zeitgeist.h")] | 25 | [CCode (cheader_filename = "zeitgeist.h")] |
76 | 26 | public static int64 from_timeval (GLib.TimeVal tv); | 26 | public static int64 from_timeval (GLib.TimeVal tv); |
77 | 27 | [CCode (cheader_filename = "zeitgeist.h")] | ||
78 | 28 | public static int64 next_midnight (int64 timestamp); | ||
79 | 27 | [CCode (cname = "zeitgeist_timestamp_for_now", cheader_filename = "zeitgeist.h")] | 29 | [CCode (cname = "zeitgeist_timestamp_for_now", cheader_filename = "zeitgeist.h")] |
80 | 28 | public static int64 now (); | 30 | public static int64 now (); |
81 | 29 | [CCode (cheader_filename = "zeitgeist.h")] | 31 | [CCode (cheader_filename = "zeitgeist.h")] |
82 | 32 | public static int64 prev_midnight (int64 timestamp); | ||
83 | 33 | [CCode (cheader_filename = "zeitgeist.h")] | ||
84 | 30 | public static int64 to_date (int64 timestamp, out GLib.Date date); | 34 | public static int64 to_date (int64 timestamp, out GLib.Date date); |
85 | 31 | [CCode (cheader_filename = "zeitgeist.h")] | 35 | [CCode (cheader_filename = "zeitgeist.h")] |
86 | 32 | public static string to_iso8601 (int64 timestamp); | 36 | public static string to_iso8601 (int64 timestamp); |
87 | 33 | [CCode (cheader_filename = "zeitgeist.h")] | 37 | [CCode (cheader_filename = "zeitgeist.h")] |
88 | 34 | public static int64 to_timeval (int64 timestamp, out GLib.TimeVal tv); | 38 | public static int64 to_timeval (int64 timestamp, out GLib.TimeVal tv); |
89 | 35 | [CCode (cheader_filename = "zeitgeist.h")] | ||
90 | 36 | public static int64 next_midnight (int64 timestamp); | ||
91 | 37 | [CCode (cheader_filename = "zeitgeist.h")] | ||
92 | 38 | public static int64 prev_midnight (int64 timestamp); | ||
93 | 39 | } | 39 | } |
94 | 40 | [CCode (cheader_filename = "zeitgeist.h")] | 40 | [CCode (cheader_filename = "zeitgeist.h")] |
95 | 41 | public class Event : GLib.InitiallyUnowned { | 41 | public class Event : GLib.InitiallyUnowned { |
96 | @@ -67,37 +67,28 @@ | |||
97 | 67 | [CCode (has_construct_function = false)] | 67 | [CCode (has_construct_function = false)] |
98 | 68 | public Index (); | 68 | public Index (); |
99 | 69 | public async Zeitgeist.ResultSet search (string query, Zeitgeist.TimeRange time_range, owned GLib.PtrArray event_templates, uint32 offset, uint32 num_events, Zeitgeist.ResultType result_type, GLib.Cancellable? cancellable) throws GLib.Error; | 69 | public async Zeitgeist.ResultSet search (string query, Zeitgeist.TimeRange time_range, owned GLib.PtrArray event_templates, uint32 offset, uint32 num_events, Zeitgeist.ResultType result_type, GLib.Cancellable? cancellable) throws GLib.Error; |
100 | 70 | public Zeitgeist.ResultSet search_finish (GLib.AsyncResult res) throws GLib.Error; | ||
101 | 71 | } | 70 | } |
102 | 72 | [CCode (cheader_filename = "zeitgeist.h")] | 71 | [CCode (cheader_filename = "zeitgeist.h")] |
103 | 73 | public class Log : GLib.Object { | 72 | public class Log : GLib.Object { |
104 | 74 | [CCode (has_construct_function = false)] | 73 | [CCode (has_construct_function = false)] |
105 | 75 | public Log (); | 74 | public Log (); |
106 | 76 | public async bool delete_events (owned GLib.Array event_ids, GLib.Cancellable? cancellable) throws GLib.Error; | 75 | public async bool delete_events (owned GLib.Array event_ids, GLib.Cancellable? cancellable) throws GLib.Error; |
107 | 77 | public bool delete_events_finish (GLib.AsyncResult res) throws GLib.Error; | ||
108 | 78 | public async bool delete_log (GLib.Cancellable? cancellable) throws GLib.Error; | 76 | public async bool delete_log (GLib.Cancellable? cancellable) throws GLib.Error; |
109 | 79 | public bool delete_log_finish (GLib.AsyncResult res) throws GLib.Error; | ||
110 | 80 | public async GLib.Array find_event_ids (Zeitgeist.TimeRange time_range, owned GLib.PtrArray event_templates, Zeitgeist.StorageState storage_state, uint32 num_events, Zeitgeist.ResultType result_type, GLib.Cancellable? cancellable) throws GLib.Error; | 77 | public async GLib.Array find_event_ids (Zeitgeist.TimeRange time_range, owned GLib.PtrArray event_templates, Zeitgeist.StorageState storage_state, uint32 num_events, Zeitgeist.ResultType result_type, GLib.Cancellable? cancellable) throws GLib.Error; |
111 | 81 | public GLib.Array find_event_ids_finish (GLib.AsyncResult res) throws GLib.Error; | ||
112 | 82 | public async Zeitgeist.ResultSet find_events (Zeitgeist.TimeRange time_range, owned GLib.PtrArray event_templates, Zeitgeist.StorageState storage_state, uint32 num_events, Zeitgeist.ResultType result_type, GLib.Cancellable? cancellable) throws GLib.Error; | 78 | public async Zeitgeist.ResultSet find_events (Zeitgeist.TimeRange time_range, owned GLib.PtrArray event_templates, Zeitgeist.StorageState storage_state, uint32 num_events, Zeitgeist.ResultType result_type, GLib.Cancellable? cancellable) throws GLib.Error; |
113 | 83 | public Zeitgeist.ResultSet find_events_finish (GLib.AsyncResult res) throws GLib.Error; | ||
114 | 84 | [CCode (array_length = false, array_null_terminated = true)] | 79 | [CCode (array_length = false, array_null_terminated = true)] |
115 | 85 | public async string[] find_related_uris (Zeitgeist.TimeRange time_range, owned GLib.PtrArray event_templates, owned GLib.PtrArray result_event_templates, Zeitgeist.StorageState storage_state, uint32 num_events, Zeitgeist.ResultType result_type, GLib.Cancellable? cancellable) throws GLib.Error; | 80 | public async string[] find_related_uris (Zeitgeist.TimeRange time_range, owned GLib.PtrArray event_templates, owned GLib.PtrArray result_event_templates, Zeitgeist.StorageState storage_state, uint32 num_events, Zeitgeist.ResultType result_type, GLib.Cancellable? cancellable) throws GLib.Error; |
116 | 86 | [CCode (array_length = false, array_null_terminated = true)] | ||
117 | 87 | public string[] find_related_uris_finish (GLib.AsyncResult res) throws GLib.Error; | ||
118 | 88 | public async Zeitgeist.ResultSet get_events (owned GLib.Array event_ids, GLib.Cancellable? cancellable) throws GLib.Error; | 81 | public async Zeitgeist.ResultSet get_events (owned GLib.Array event_ids, GLib.Cancellable? cancellable) throws GLib.Error; |
119 | 89 | public Zeitgeist.ResultSet get_events_finish (GLib.AsyncResult res) throws GLib.Error; | ||
120 | 90 | public async GLib.Array insert_events (GLib.Cancellable? cancellable, ...) throws GLib.Error; | 82 | public async GLib.Array insert_events (GLib.Cancellable? cancellable, ...) throws GLib.Error; |
121 | 91 | public GLib.Array insert_events_finish (GLib.AsyncResult res) throws GLib.Error; | ||
122 | 92 | [CCode (finish_name = "zeitgeist_log_insert_events_finish")] | 83 | [CCode (finish_name = "zeitgeist_log_insert_events_finish")] |
123 | 93 | public async GLib.Array insert_events_from_ptrarray (owned GLib.PtrArray events, GLib.Cancellable? cancellable) throws GLib.Error; | 84 | public async GLib.Array insert_events_from_ptrarray (owned GLib.PtrArray events, GLib.Cancellable? cancellable) throws GLib.Error; |
124 | 94 | public void insert_events_no_reply (...); | 85 | public void insert_events_no_reply (...); |
125 | 95 | public async bool install_monitor (Zeitgeist.Monitor monitor, GLib.Cancellable? cancellable) throws GLib.Error; | 86 | public async bool install_monitor (Zeitgeist.Monitor monitor, GLib.Cancellable? cancellable) throws GLib.Error; |
127 | 96 | public bool install_monitor_finish (GLib.AsyncResult res) throws GLib.Error; | 87 | public bool is_connected (); |
128 | 97 | public async bool quit (GLib.Cancellable? cancellable) throws GLib.Error; | 88 | public async bool quit (GLib.Cancellable? cancellable) throws GLib.Error; |
129 | 98 | public bool quit_finish (GLib.AsyncResult res) throws GLib.Error; | ||
130 | 99 | public async bool remove_monitor (Zeitgeist.Monitor monitor, GLib.Cancellable? cancellable) throws GLib.Error; | 89 | public async bool remove_monitor (Zeitgeist.Monitor monitor, GLib.Cancellable? cancellable) throws GLib.Error; |
132 | 100 | public bool remove_monitor_finish (GLib.AsyncResult res) throws GLib.Error; | 90 | [NoAccessorMethod] |
133 | 91 | public bool connected { get; } | ||
134 | 101 | } | 92 | } |
135 | 102 | [CCode (cheader_filename = "zeitgeist.h")] | 93 | [CCode (cheader_filename = "zeitgeist.h")] |
136 | 103 | public class Monitor : GLib.Object, Zeitgeist.EggZeitgeistMonitor { | 94 | public class Monitor : GLib.Object, Zeitgeist.EggZeitgeistMonitor { |
137 | 104 | 95 | ||
138 | === modified file 'src/zeitgeist-log.c' | |||
139 | --- src/zeitgeist-log.c 2010-06-26 12:46:27 +0000 | |||
140 | +++ src/zeitgeist-log.c 2010-07-22 17:11:00 +0000 | |||
141 | @@ -54,6 +54,8 @@ | |||
142 | 54 | EggDBusObjectProxy *log_proxy; | 54 | EggDBusObjectProxy *log_proxy; |
143 | 55 | EggZeitgeistLog *log; | 55 | EggZeitgeistLog *log; |
144 | 56 | 56 | ||
145 | 57 | gboolean connected; | ||
146 | 58 | |||
147 | 57 | /* Hash set of ZeitgeistMonitors we've installed. We actually store | 59 | /* Hash set of ZeitgeistMonitors we've installed. We actually store |
148 | 58 | * a map of (monitor, log) because this is most convenient for use with | 60 | * a map of (monitor, log) because this is most convenient for use with |
149 | 59 | * _zeitgeist_monitor_weak_unref() casted to a GHFunc */ | 61 | * _zeitgeist_monitor_weak_unref() casted to a GHFunc */ |
150 | @@ -65,6 +67,8 @@ | |||
151 | 65 | { | 67 | { |
152 | 66 | PROP_0, | 68 | PROP_0, |
153 | 67 | 69 | ||
154 | 70 | PROP_CONNECTED, | ||
155 | 71 | |||
156 | 68 | LAST_PROPERTY | 72 | LAST_PROPERTY |
157 | 69 | }; | 73 | }; |
158 | 70 | 74 | ||
159 | @@ -122,6 +126,7 @@ | |||
160 | 122 | { | 126 | { |
161 | 123 | ZeitgeistLogPrivate *priv; | 127 | ZeitgeistLogPrivate *priv; |
162 | 124 | EggDBusConnection *conn; | 128 | EggDBusConnection *conn; |
163 | 129 | gchar *name_owner; | ||
164 | 125 | 130 | ||
165 | 126 | priv = ZEITGEIST_LOG_GET_PRIVATE (self); | 131 | priv = ZEITGEIST_LOG_GET_PRIVATE (self); |
166 | 127 | 132 | ||
167 | @@ -138,6 +143,13 @@ | |||
168 | 138 | priv->log = EGG_ZEITGEIST_QUERY_INTERFACE_LOG (priv->log_proxy); | 143 | priv->log = EGG_ZEITGEIST_QUERY_INTERFACE_LOG (priv->log_proxy); |
169 | 139 | g_object_unref (conn); | 144 | g_object_unref (conn); |
170 | 140 | 145 | ||
171 | 146 | name_owner = egg_dbus_object_proxy_get_name_owner (priv->log_proxy); | ||
172 | 147 | priv->connected = name_owner != NULL; | ||
173 | 148 | if (name_owner) | ||
174 | 149 | { | ||
175 | 150 | g_free (name_owner); | ||
176 | 151 | } | ||
177 | 152 | |||
178 | 141 | /* We need to detect if the Zeitgeist daemon leaves/enters the bus */ | 153 | /* We need to detect if the Zeitgeist daemon leaves/enters the bus */ |
179 | 142 | g_signal_connect_swapped (priv->log_proxy, "notify::name-owner", | 154 | g_signal_connect_swapped (priv->log_proxy, "notify::name-owner", |
180 | 143 | G_CALLBACK (_zeitgeist_log_on_name_owner_changed), | 155 | G_CALLBACK (_zeitgeist_log_on_name_owner_changed), |
181 | @@ -214,7 +226,20 @@ | |||
182 | 214 | object_class->finalize = zeitgeist_log_finalize; | 226 | object_class->finalize = zeitgeist_log_finalize; |
183 | 215 | object_class->get_property = zeitgeist_log_get_property; | 227 | object_class->get_property = zeitgeist_log_get_property; |
184 | 216 | object_class->set_property = zeitgeist_log_set_property; | 228 | object_class->set_property = zeitgeist_log_set_property; |
186 | 217 | 229 | ||
187 | 230 | /** | ||
188 | 231 | * ZeitgeistLog:connected: | ||
189 | 232 | * | ||
190 | 233 | * Determines if this Log instance is currently connected to Zeitgeist | ||
191 | 234 | * daemon. | ||
192 | 235 | */ | ||
193 | 236 | pspec = g_param_spec_boolean ("connected", | ||
194 | 237 | "Connected", | ||
195 | 238 | "Whether this instance is connected to Zeitgeist", | ||
196 | 239 | FALSE, | ||
197 | 240 | G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); | ||
198 | 241 | g_object_class_install_property (object_class, PROP_CONNECTED, pspec); | ||
199 | 242 | |||
200 | 218 | g_type_class_add_private (object_class, sizeof (ZeitgeistLogPrivate)); | 243 | g_type_class_add_private (object_class, sizeof (ZeitgeistLogPrivate)); |
201 | 219 | } | 244 | } |
202 | 220 | 245 | ||
203 | @@ -1060,10 +1085,13 @@ | |||
204 | 1060 | { | 1085 | { |
205 | 1061 | ZeitgeistLogPrivate *priv; | 1086 | ZeitgeistLogPrivate *priv; |
206 | 1062 | gchar *name_owner; | 1087 | gchar *name_owner; |
207 | 1088 | gboolean has_owner; | ||
208 | 1063 | 1089 | ||
209 | 1064 | priv = ZEITGEIST_LOG_GET_PRIVATE (self); | 1090 | priv = ZEITGEIST_LOG_GET_PRIVATE (self); |
210 | 1065 | g_object_get (priv->log_proxy, "name-owner", &name_owner, NULL); | 1091 | g_object_get (priv->log_proxy, "name-owner", &name_owner, NULL); |
212 | 1066 | 1092 | ||
213 | 1093 | has_owner = name_owner != NULL; | ||
214 | 1094 | |||
215 | 1067 | if (name_owner == NULL) | 1095 | if (name_owner == NULL) |
216 | 1068 | { | 1096 | { |
217 | 1069 | /* The Zeitgeist daemon disconnected. Do nothing */ | 1097 | /* The Zeitgeist daemon disconnected. Do nothing */ |
218 | @@ -1081,5 +1109,21 @@ | |||
219 | 1081 | NULL, NULL, NULL); | 1109 | NULL, NULL, NULL); |
220 | 1082 | } | 1110 | } |
221 | 1083 | g_free (name_owner); | 1111 | g_free (name_owner); |
224 | 1084 | } | 1112 | } |
225 | 1085 | } | 1113 | |
226 | 1114 | if (has_owner != priv->connected) | ||
227 | 1115 | { | ||
228 | 1116 | priv->connected = has_owner; | ||
229 | 1117 | g_object_notify (G_OBJECT (self), "connected"); | ||
230 | 1118 | } | ||
231 | 1119 | } | ||
232 | 1120 | |||
233 | 1121 | gboolean | ||
234 | 1122 | zeitgeist_log_is_connected (ZeitgeistLog *self) | ||
235 | 1123 | { | ||
236 | 1124 | ZeitgeistLogPrivate *priv; | ||
237 | 1125 | |||
238 | 1126 | priv = ZEITGEIST_LOG_GET_PRIVATE (self); | ||
239 | 1127 | return priv->connected; | ||
240 | 1128 | } | ||
241 | 1129 | |||
242 | 1086 | 1130 | ||
243 | === modified file 'src/zeitgeist-log.h' | |||
244 | --- src/zeitgeist-log.h 2010-06-10 08:07:41 +0000 | |||
245 | +++ src/zeitgeist-log.h 2010-07-22 17:11:00 +0000 | |||
246 | @@ -189,6 +189,8 @@ | |||
247 | 189 | GAsyncResult *res, | 189 | GAsyncResult *res, |
248 | 190 | GError **error); | 190 | GError **error); |
249 | 191 | 191 | ||
250 | 192 | gboolean zeitgeist_log_is_connected (ZeitgeistLog *self); | ||
251 | 193 | |||
252 | 192 | G_END_DECLS | 194 | G_END_DECLS |
253 | 193 | 195 | ||
254 | 194 | #endif /* _ZEITGEIST_LOG_H_ */ | 196 | #endif /* _ZEITGEIST_LOG_H_ */ |
Looks good - can you rename the getter method to is_connected () in stead? That seems more natural, with that change I'll approve this.