Merge lp:~charlesk/indicator-datetime/timezone-class-privacy into lp:indicator-datetime/13.10

Proposed by Charles Kerr
Status: Merged
Approved by: Ted Gould
Approved revision: 378
Merged at revision: 379
Proposed branch: lp:~charlesk/indicator-datetime/timezone-class-privacy
Merge into: lp:indicator-datetime/13.10
Diff against target: 798 lines (+368/-319)
6 files modified
include/datetime/clock.h (+0/-2)
include/datetime/timezone-file.h (+5/-14)
include/datetime/timezone-geoclue.h (+4/-20)
src/timezone-file.cpp (+110/-77)
src/timezone-geoclue.cpp (+247/-206)
src/wakeup-timer-powerd.cpp (+2/-0)
To merge this branch: bzr merge lp:~charlesk/indicator-datetime/timezone-class-privacy
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Ted Gould (community) Approve
Review via email: mp+234896@code.launchpad.net

Commit message

Move timezone code behind a private Impl class

Description of the change

Simple cleanup done while working on other bugfixes.

This doesn't change the behavior of any code; just moves the implementation details of GeoclueTimezone and FileTimezone into private Impl classes.

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) :
review: Approve
Revision history for this message
Ted Gould (ted) wrote :

The camelcase to underscores I think were the final straw for meld. It didn't do as good of a job as I would have expected.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/datetime/clock.h'
2--- include/datetime/clock.h 2014-09-13 18:12:04 +0000
3+++ include/datetime/clock.h 2014-09-16 22:48:45 +0000
4@@ -25,8 +25,6 @@
5 #include <core/property.h>
6 #include <core/signal.h>
7
8-#include <gio/gio.h> // GDBusConnection
9-
10 #include <memory> // std::shared_ptr, std::unique_ptr
11
12 namespace unity {
13
14=== modified file 'include/datetime/timezone-file.h'
15--- include/datetime/timezone-file.h 2014-02-02 21:28:52 +0000
16+++ include/datetime/timezone-file.h 2014-09-16 22:48:45 +0000
17@@ -24,9 +24,6 @@
18
19 #include <string> // std::string
20
21-#include <glib.h>
22-#include <gio/gio.h>
23-
24 namespace unity {
25 namespace indicator {
26 namespace datetime {
27@@ -37,21 +34,15 @@
28 class FileTimezone: public Timezone
29 {
30 public:
31- FileTimezone();
32 FileTimezone(const std::string& filename);
33 ~FileTimezone();
34
35 private:
36- void set_filename(const std::string& filename);
37- static void on_file_changed(gpointer gself);
38- void clear();
39- void reload();
40-
41- std::string m_filename;
42- GFileMonitor * m_monitor = nullptr;
43- unsigned long m_monitor_handler_id = 0;
44-
45- // we have raw pointers and glib tags in here, so disable copying
46+ class Impl;
47+ friend Impl;
48+ std::unique_ptr<Impl> impl;
49+
50+ // we have pointers in here, so disable copying
51 FileTimezone(const FileTimezone&) =delete;
52 FileTimezone& operator=(const FileTimezone&) =delete;
53 };
54
55=== modified file 'include/datetime/timezone-geoclue.h'
56--- include/datetime/timezone-geoclue.h 2014-01-15 05:07:10 +0000
57+++ include/datetime/timezone-geoclue.h 2014-09-16 22:48:45 +0000
58@@ -22,11 +22,6 @@
59
60 #include <datetime/timezone.h> // base class
61
62-#include <string>
63-
64-#include <glib.h>
65-#include <gio/gio.h>
66-
67 namespace unity {
68 namespace indicator {
69 namespace datetime {
70@@ -41,21 +36,10 @@
71 ~GeoclueTimezone();
72
73 private:
74- static void on_bus_got (GObject*, GAsyncResult*, gpointer);
75- static void on_client_created (GObject*, GAsyncResult*, gpointer);
76- static void on_address_changed (GDBusConnection*, const gchar*, const gchar*, const gchar*, const gchar*, GVariant*, gpointer);
77- static void on_requirements_set (GObject*, GAsyncResult*, gpointer);
78- static void on_address_started (GObject*, GAsyncResult*, gpointer);
79- static void on_address_got (GObject*, GAsyncResult*, gpointer);
80- void setTimezoneFromAddressVariant (GVariant*);
81- static GVariant * call_finish (GObject*, GAsyncResult*);
82-
83- GCancellable * m_cancellable = nullptr;
84- GDBusConnection * m_connection = nullptr;
85- std::string m_client_object_path;
86- guint m_signal_subscription = 0;
87-
88- // we've got pointers and gsignal tags in here, so don't allow copying
89+ struct Impl;
90+ std::unique_ptr<Impl> impl;
91+
92+ // we've got pointers in here, so don't allow copying
93 GeoclueTimezone(const GeoclueTimezone&) =delete;
94 GeoclueTimezone& operator=(const GeoclueTimezone&) =delete;
95 };
96
97=== modified file 'src/timezone-file.cpp'
98--- src/timezone-file.cpp 2014-05-05 15:06:34 +0000
99+++ src/timezone-file.cpp 2014-09-16 22:48:45 +0000
100@@ -19,11 +19,97 @@
101
102 #include <datetime/timezone-file.h>
103
104+#include <gio/gio.h>
105+
106 #include <cerrno>
107 #include <cstdlib>
108
109-namespace
110+namespace unity {
111+namespace indicator {
112+namespace datetime {
113+
114+/***
115+****
116+***/
117+
118+class FileTimezone::Impl
119 {
120+public:
121+
122+ Impl(FileTimezone& owner, const std::string& filename):
123+ m_owner(owner)
124+ {
125+ set_filename(filename);
126+ }
127+
128+ ~Impl()
129+ {
130+ clear();
131+ }
132+
133+private:
134+
135+ void clear()
136+ {
137+ if (m_monitor_handler_id)
138+ g_signal_handler_disconnect(m_monitor, m_monitor_handler_id);
139+
140+ g_clear_object (&m_monitor);
141+
142+ m_filename.clear();
143+ }
144+
145+ void set_filename(const std::string& filename)
146+ {
147+ clear();
148+
149+ auto tmp = realpath(filename.c_str(), nullptr);
150+ if(tmp != nullptr)
151+ {
152+ m_filename = tmp;
153+ free(tmp);
154+ }
155+ else
156+ {
157+ g_warning("Unable to resolve path '%s': %s", filename.c_str(), g_strerror(errno));
158+ m_filename = filename; // better than nothing?
159+ }
160+
161+ auto file = g_file_new_for_path(m_filename.c_str());
162+ GError * err = nullptr;
163+ m_monitor = g_file_monitor_file(file, G_FILE_MONITOR_NONE, nullptr, &err);
164+ g_object_unref(file);
165+ if (err)
166+ {
167+ g_warning("%s Unable to monitor timezone file '%s': %s", G_STRLOC, TIMEZONE_FILE, err->message);
168+ g_error_free(err);
169+ }
170+ else
171+ {
172+ m_monitor_handler_id = g_signal_connect_swapped(m_monitor, "changed", G_CALLBACK(on_file_changed), this);
173+ g_debug("%s Monitoring timezone file '%s'", G_STRLOC, m_filename.c_str());
174+ }
175+
176+ reload();
177+ }
178+
179+ static void on_file_changed(gpointer gself)
180+ {
181+ static_cast<Impl*>(gself)->reload();
182+ }
183+
184+ void reload()
185+ {
186+ const auto new_timezone = get_timezone_from_file(m_filename);
187+
188+ if (!new_timezone.empty())
189+ m_owner.timezone.set(new_timezone);
190+ }
191+
192+ /***
193+ ****
194+ ***/
195+
196 std::string get_timezone_from_file(const std::string& filename)
197 {
198 GError * error;
199@@ -73,86 +159,33 @@
200
201 return ret;
202 }
203-}
204-
205-namespace unity {
206-namespace indicator {
207-namespace datetime {
208-
209-FileTimezone::FileTimezone()
210-{
211-}
212-
213-FileTimezone::FileTimezone(const std::string& filename)
214-{
215- set_filename(filename);
216+
217+ /***
218+ ****
219+ ***/
220+
221+ FileTimezone & m_owner;
222+ std::string m_filename;
223+ GFileMonitor * m_monitor = nullptr;
224+ unsigned long m_monitor_handler_id = 0;
225+};
226+
227+/***
228+****
229+***/
230+
231+FileTimezone::FileTimezone(const std::string& filename):
232+ impl(new Impl{*this, filename})
233+{
234 }
235
236 FileTimezone::~FileTimezone()
237 {
238- clear();
239-}
240-
241-void
242-FileTimezone::clear()
243-{
244- if (m_monitor_handler_id)
245- g_signal_handler_disconnect(m_monitor, m_monitor_handler_id);
246-
247- g_clear_object (&m_monitor);
248-
249- m_filename.clear();
250-}
251-
252-void
253-FileTimezone::set_filename(const std::string& filename)
254-{
255- clear();
256-
257- auto tmp = realpath(filename.c_str(), nullptr);
258- if(tmp != nullptr)
259- {
260- m_filename = tmp;
261- free(tmp);
262- }
263- else
264- {
265- g_warning("Unable to resolve path '%s': %s", filename.c_str(), g_strerror(errno));
266- m_filename = filename; // better than nothing?
267- }
268-
269- auto file = g_file_new_for_path(m_filename.c_str());
270- GError * err = nullptr;
271- m_monitor = g_file_monitor_file(file, G_FILE_MONITOR_NONE, nullptr, &err);
272- g_object_unref(file);
273- if (err)
274- {
275- g_warning("%s Unable to monitor timezone file '%s': %s", G_STRLOC, TIMEZONE_FILE, err->message);
276- g_error_free(err);
277- }
278- else
279- {
280- m_monitor_handler_id = g_signal_connect_swapped(m_monitor, "changed", G_CALLBACK(on_file_changed), this);
281- g_debug("%s Monitoring timezone file '%s'", G_STRLOC, m_filename.c_str());
282- }
283-
284- reload();
285-}
286-
287-void
288-FileTimezone::on_file_changed(gpointer gself)
289-{
290- static_cast<FileTimezone*>(gself)->reload();
291-}
292-
293-void
294-FileTimezone::reload()
295-{
296- const auto new_timezone = get_timezone_from_file(m_filename);
297-
298- if (!new_timezone.empty())
299- timezone.set(new_timezone);
300-}
301+}
302+
303+/***
304+****
305+***/
306
307 } // namespace datetime
308 } // namespace indicator
309
310=== modified file 'src/timezone-geoclue.cpp'
311--- src/timezone-geoclue.cpp 2014-01-15 05:07:10 +0000
312+++ src/timezone-geoclue.cpp 2014-09-16 22:48:45 +0000
313@@ -19,225 +19,266 @@
314
315 #include <datetime/timezone-geoclue.h>
316
317+#include <gio/gio.h>
318+
319+#include <memory>
320+#include <string>
321+#include <vector>
322+
323 #define GEOCLUE_BUS_NAME "org.freedesktop.Geoclue.Master"
324
325 namespace unity {
326 namespace indicator {
327 namespace datetime {
328
329+class GeoclueTimezone::Impl
330+{
331+
332+public:
333+
334+ Impl(GeoclueTimezone& owner):
335+ m_owner(owner),
336+ m_cancellable(g_cancellable_new())
337+ {
338+ g_bus_get(G_BUS_TYPE_SESSION, m_cancellable, on_bus_got, this);
339+ }
340+
341+ ~Impl()
342+ {
343+ g_cancellable_cancel(m_cancellable);
344+ g_object_unref(m_cancellable);
345+ g_object_unref(m_bus);
346+ }
347+
348+private:
349+
350+ void remember_subscription(GDBusConnection * bus,
351+ guint tag)
352+ {
353+ g_object_ref(bus);
354+
355+ auto deleter = [tag](GDBusConnection* bus){
356+ g_dbus_connection_signal_unsubscribe(bus, tag);
357+ g_object_unref(G_OBJECT(bus));
358+ };
359+
360+ m_subscriptions.push_back(std::shared_ptr<GDBusConnection>(bus, deleter));
361+ }
362+
363+ static void on_bus_got(GObject * /*source*/,
364+ GAsyncResult * res,
365+ gpointer gself)
366+ {
367+ GError * error;
368+ GDBusConnection * connection;
369+
370+ error = nullptr;
371+ connection = g_bus_get_finish(res, &error);
372+ if (error)
373+ {
374+ if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
375+ g_warning("Couldn't get bus: %s", error->message);
376+
377+ g_error_free(error);
378+ }
379+ else
380+ {
381+ auto self = static_cast<Impl*>(gself);
382+
383+ self->m_bus = connection;
384+
385+ g_dbus_connection_call(self->m_bus,
386+ GEOCLUE_BUS_NAME,
387+ "/org/freedesktop/Geoclue/Master",
388+ "org.freedesktop.Geoclue.Master",
389+ "Create",
390+ nullptr, // parameters
391+ G_VARIANT_TYPE("(o)"),
392+ G_DBUS_CALL_FLAGS_NONE,
393+ -1,
394+ self->m_cancellable,
395+ on_client_created,
396+ self);
397+ }
398+ }
399+
400+ static void on_client_created(GObject* source, GAsyncResult* res, gpointer gself)
401+ {
402+ GVariant * result;
403+
404+ if ((result = call_finish(G_STRFUNC, source, res)))
405+ {
406+ auto self = static_cast<Impl*>(gself);
407+
408+ GVariant * child = g_variant_get_child_value(result, 0);
409+ self->m_client_object_path = g_variant_get_string(child, nullptr);
410+ g_variant_unref(child);
411+ g_variant_unref(result);
412+
413+ auto tag = g_dbus_connection_signal_subscribe(self->m_bus,
414+ GEOCLUE_BUS_NAME,
415+ "org.freedesktop.Geoclue.Address", // interface
416+ "AddressChanged", // signal name
417+ self->m_client_object_path.c_str(), // object path
418+ nullptr, // arg0
419+ G_DBUS_SIGNAL_FLAGS_NONE,
420+ on_address_changed,
421+ self,
422+ nullptr);
423+ self->remember_subscription(self->m_bus, tag);
424+
425+ g_dbus_connection_call(self->m_bus,
426+ GEOCLUE_BUS_NAME,
427+ self->m_client_object_path.c_str(),
428+ "org.freedesktop.Geoclue.MasterClient",
429+ "SetRequirements",
430+ g_variant_new("(iibi)", 2, 0, FALSE, 1023),
431+ nullptr,
432+ G_DBUS_CALL_FLAGS_NONE,
433+ -1,
434+ self->m_cancellable,
435+ on_requirements_set,
436+ self);
437+ }
438+ }
439+
440+ static void on_address_changed(GDBusConnection* /*connection*/,
441+ const gchar* /*sender_name*/,
442+ const gchar* /*object_path*/,
443+ const gchar* /*interface_name*/,
444+ const gchar* /*signal_name*/,
445+ GVariant* parameters,
446+ gpointer gself)
447+ {
448+ static_cast<Impl*>(gself)->set_timezone_from_address_variant(parameters);
449+ }
450+
451+ static void on_requirements_set(GObject* source, GAsyncResult* res, gpointer gself)
452+ {
453+ GVariant * result;
454+
455+ if ((result = call_finish(G_STRFUNC, source, res)))
456+ {
457+ auto self = static_cast<Impl*>(gself);
458+
459+ g_dbus_connection_call(self->m_bus,
460+ GEOCLUE_BUS_NAME,
461+ self->m_client_object_path.c_str(),
462+ "org.freedesktop.Geoclue.MasterClient",
463+ "AddressStart",
464+ nullptr,
465+ nullptr,
466+ G_DBUS_CALL_FLAGS_NONE,
467+ -1,
468+ self->m_cancellable,
469+ on_address_started,
470+ self);
471+
472+ g_variant_unref(result);
473+ }
474+ }
475+
476+ static void on_address_started(GObject* source, GAsyncResult* res, gpointer gself)
477+ {
478+ GVariant * result;
479+
480+ if ((result = call_finish(G_STRFUNC, source, res)))
481+ {
482+ auto self = static_cast<Impl*>(gself);
483+
484+ g_dbus_connection_call(self->m_bus,
485+ GEOCLUE_BUS_NAME,
486+ self->m_client_object_path.c_str(),
487+ "org.freedesktop.Geoclue.Address",
488+ "GetAddress",
489+ nullptr,
490+ G_VARIANT_TYPE("(ia{ss}(idd))"),
491+ G_DBUS_CALL_FLAGS_NONE,
492+ -1,
493+ self->m_cancellable,
494+ on_address_got,
495+ self);
496+
497+ g_variant_unref(result);
498+ }
499+ }
500+
501+ static void on_address_got(GObject* source, GAsyncResult* res, gpointer gself)
502+ {
503+ GVariant * result;
504+
505+ if ((result = call_finish(G_STRFUNC, source, res)))
506+ {
507+ static_cast<Impl*>(gself)->set_timezone_from_address_variant(result);
508+ g_variant_unref(result);
509+ }
510+ }
511+
512+ /***
513+ ****
514+ ***/
515+
516+ void set_timezone_from_address_variant(GVariant * variant)
517+ {
518+ g_return_if_fail(g_variant_is_of_type(variant, G_VARIANT_TYPE("(ia{ss}(idd))")));
519+
520+ const gchar * timezone_string = nullptr;
521+ GVariant * dict = g_variant_get_child_value(variant, 1);
522+ if (dict)
523+ {
524+ if (g_variant_lookup(dict, "timezone", "&s", &timezone_string))
525+ {
526+ g_debug("from geoclue, setting timezone to '%s'", timezone_string);
527+ m_owner.timezone.set(timezone_string);
528+ }
529+
530+ g_variant_unref(dict);
531+ }
532+ }
533+
534+ static GVariant* call_finish(const char * funcname, GObject * source, GAsyncResult * res)
535+ {
536+ GError * error;
537+ GVariant * result;
538+
539+ error = nullptr;
540+ result = g_dbus_connection_call_finish(G_DBUS_CONNECTION(source), res, &error);
541+
542+ if (error)
543+ {
544+ if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
545+ g_warning("%s failed: %s", funcname, error->message);
546+
547+ g_error_free(error);
548+
549+ g_clear_pointer(&result, g_variant_unref);
550+ }
551+
552+ return result;
553+ }
554+
555+ /***
556+ ****
557+ ***/
558+
559+ GeoclueTimezone & m_owner;
560+ GDBusConnection * m_bus = nullptr;
561+ GCancellable * m_cancellable = nullptr;
562+ std::string m_client_object_path;
563+ std::vector<std::shared_ptr<GDBusConnection>> m_subscriptions;
564+};
565+
566+/****
567+*****
568+****/
569
570 GeoclueTimezone::GeoclueTimezone():
571- m_cancellable(g_cancellable_new())
572+ impl(new Impl{*this})
573 {
574- g_bus_get(G_BUS_TYPE_SESSION, m_cancellable, on_bus_got, this);
575 }
576
577 GeoclueTimezone::~GeoclueTimezone()
578 {
579- g_cancellable_cancel(m_cancellable);
580- g_object_unref(m_cancellable);
581-
582- if (m_signal_subscription)
583- g_dbus_connection_signal_unsubscribe(m_connection, m_signal_subscription);
584-
585- g_object_unref(m_connection);
586-}
587-
588-/***
589-****
590-***/
591-
592-void
593-GeoclueTimezone::on_bus_got(GObject* /*source*/,
594- GAsyncResult* res,
595- gpointer gself)
596-{
597- GError * error;
598- GDBusConnection * connection;
599-
600- error = nullptr;
601- connection = g_bus_get_finish(res, &error);
602- if (error)
603- {
604- if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
605- g_warning("Couldn't get bus: %s", error->message);
606-
607- g_error_free(error);
608- }
609- else
610- {
611- auto self = static_cast<GeoclueTimezone*>(gself);
612-
613- self->m_connection = connection;
614-
615- g_dbus_connection_call(self->m_connection,
616- GEOCLUE_BUS_NAME,
617- "/org/freedesktop/Geoclue/Master",
618- "org.freedesktop.Geoclue.Master",
619- "Create",
620- nullptr, // parameters
621- G_VARIANT_TYPE("(o)"),
622- G_DBUS_CALL_FLAGS_NONE,
623- -1,
624- self->m_cancellable,
625- on_client_created,
626- self);
627- }
628-}
629-
630-void
631-GeoclueTimezone::on_client_created(GObject * source, GAsyncResult * res, gpointer gself)
632-{
633- GVariant * result;
634-
635- if ((result = call_finish(source, res)))
636- {
637- auto self = static_cast<GeoclueTimezone*>(gself);
638-
639- GVariant * child = g_variant_get_child_value(result, 0);
640- self->m_client_object_path = g_variant_get_string(child, nullptr);
641- g_variant_unref(child);
642- g_variant_unref(result);
643-
644- self->m_signal_subscription = g_dbus_connection_signal_subscribe(
645- self->m_connection,
646- GEOCLUE_BUS_NAME,
647- "org.freedesktop.Geoclue.Address", // inteface
648- "AddressChanged", // signal name
649- self->m_client_object_path.c_str(), // object path
650- nullptr, // arg0
651- G_DBUS_SIGNAL_FLAGS_NONE,
652- on_address_changed,
653- self,
654- nullptr);
655-
656- g_dbus_connection_call(self->m_connection,
657- GEOCLUE_BUS_NAME,
658- self->m_client_object_path.c_str(),
659- "org.freedesktop.Geoclue.MasterClient",
660- "SetRequirements",
661- g_variant_new("(iibi)", 2, 0, FALSE, 1023),
662- nullptr,
663- G_DBUS_CALL_FLAGS_NONE,
664- -1,
665- self->m_cancellable,
666- on_requirements_set,
667- self);
668- }
669-}
670-
671-void
672-GeoclueTimezone::on_address_changed(GDBusConnection* /*connection*/,
673- const gchar* /*sender_name*/,
674- const gchar* /*object_path*/,
675- const gchar* /*interface_name*/,
676- const gchar* /*signal_name*/,
677- GVariant* parameters,
678- gpointer gself)
679-{
680- static_cast<GeoclueTimezone*>(gself)->setTimezoneFromAddressVariant(parameters);
681-}
682-
683-void
684-GeoclueTimezone::on_requirements_set(GObject* source, GAsyncResult* res, gpointer gself)
685-{
686- GVariant * result;
687-
688- if ((result = call_finish(source, res)))
689- {
690- auto self = static_cast<GeoclueTimezone*>(gself);
691-
692- g_dbus_connection_call(self->m_connection,
693- GEOCLUE_BUS_NAME,
694- self->m_client_object_path.c_str(),
695- "org.freedesktop.Geoclue.MasterClient",
696- "AddressStart",
697- nullptr,
698- nullptr,
699- G_DBUS_CALL_FLAGS_NONE,
700- -1,
701- self->m_cancellable,
702- on_address_started,
703- self);
704-
705- g_variant_unref(result);
706- }
707-}
708-
709-void
710-GeoclueTimezone::on_address_started(GObject * source, GAsyncResult * res, gpointer gself)
711-{
712- GVariant * result;
713-
714- if ((result = call_finish(source, res)))
715- {
716- auto self = static_cast<GeoclueTimezone*>(gself);
717-
718- g_dbus_connection_call(self->m_connection,
719- GEOCLUE_BUS_NAME,
720- self->m_client_object_path.c_str(),
721- "org.freedesktop.Geoclue.Address",
722- "GetAddress",
723- nullptr,
724- G_VARIANT_TYPE("(ia{ss}(idd))"),
725- G_DBUS_CALL_FLAGS_NONE,
726- -1,
727- self->m_cancellable,
728- on_address_got,
729- self);
730-
731- g_variant_unref(result);
732- }
733-}
734-
735-void
736-GeoclueTimezone::on_address_got(GObject * source, GAsyncResult * res, gpointer gself)
737-{
738- GVariant * result;
739-
740- if ((result = call_finish(source, res)))
741- {
742- static_cast<GeoclueTimezone*>(gself)->setTimezoneFromAddressVariant(result);
743- g_variant_unref(result);
744- }
745-}
746-
747-void
748-GeoclueTimezone::setTimezoneFromAddressVariant(GVariant * variant)
749-{
750- g_return_if_fail(g_variant_is_of_type(variant, G_VARIANT_TYPE("(ia{ss}(idd))")));
751-
752- const gchar * timezone_string = nullptr;
753- GVariant * dict = g_variant_get_child_value(variant, 1);
754- if (dict)
755- {
756- if (g_variant_lookup(dict, "timezone", "&s", &timezone_string))
757- timezone.set(timezone_string);
758-
759- g_variant_unref(dict);
760- }
761-}
762-
763-GVariant*
764-GeoclueTimezone::call_finish(GObject * source, GAsyncResult * res)
765-{
766- GError * error;
767- GVariant * result;
768-
769- error = nullptr;
770- result = g_dbus_connection_call_finish(G_DBUS_CONNECTION(source), res, &error);
771-
772- if (error)
773- {
774- if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
775- g_warning("AddressStart() failed: %s", error->message);
776-
777- g_error_free(error);
778-
779- g_clear_pointer(&result, g_variant_unref);
780- }
781-
782- return result;
783 }
784
785 /****
786
787=== modified file 'src/wakeup-timer-powerd.cpp'
788--- src/wakeup-timer-powerd.cpp 2014-08-19 04:08:38 +0000
789+++ src/wakeup-timer-powerd.cpp 2014-09-16 22:48:45 +0000
790@@ -22,6 +22,8 @@
791
792 #include <notifications/dbus-shared.h> // BUS_POWERD_NAME
793
794+#include <gio/gio.h>
795+
796 #include <memory> // std::shared_ptr
797
798 namespace unity {

Subscribers

People subscribed via source and target branches