From 01bd6c3f35cdef3d9dae9241e7519a59c6d8139d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 14 May 2013 13:18:04 -0500 Subject: add a service boilerplate similar to the one in indicator-session. This doesn't do anything yet; the sections will be added in subsequent commits --- src/service.h | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/service.h (limited to 'src/service.h') diff --git a/src/service.h b/src/service.h new file mode 100644 index 0000000..594d7fe --- /dev/null +++ b/src/service.h @@ -0,0 +1,71 @@ +/* + * Copyright 2013 Canonical Ltd. + * + * Authors: + * Charles Kerr + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef __INDICATOR_DATETIME_SERVICE_H__ +#define __INDICATOR_DATETIME_SERVICE_H__ + +#include +#include + +G_BEGIN_DECLS + +/* standard GObject macros */ +#define INDICATOR_TYPE_DATETIME_SERVICE (indicator_datetime_service_get_type()) +#define INDICATOR_DATETIME_SERVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), INDICATOR_TYPE_DATETIME_SERVICE, IndicatorDatetimeService)) +#define INDICATOR_DATETIME_SERVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), INDICATOR_TYPE_DATETIME_SERVICE, IndicatorDatetimeServiceClass)) +#define INDICATOR_DATETIME_SERVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), INDICATOR_TYPE_DATETIME_SERVICE, IndicatorDatetimeServiceClass)) +#define INDICATOR_IS_DATETIME_SERVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), INDICATOR_TYPE_DATETIME_SERVICE)) + +typedef struct _IndicatorDatetimeService IndicatorDatetimeService; +typedef struct _IndicatorDatetimeServiceClass IndicatorDatetimeServiceClass; +typedef struct _IndicatorDatetimeServicePrivate IndicatorDatetimeServicePrivate; + +/* signal keys */ +#define INDICATOR_DATETIME_SERVICE_SIGNAL_NAME_LOST "name-lost" + +/** + * The Indicator Datetime Service. + */ +struct _IndicatorDatetimeService +{ + /*< private >*/ + GObject parent; + IndicatorDatetimeServicePrivate * priv; +}; + +struct _IndicatorDatetimeServiceClass +{ + GObjectClass parent_class; + + /* signals */ + + void (* name_lost)(IndicatorDatetimeService * self); +}; + +/*** +**** +***/ + +GType indicator_datetime_service_get_type (void); + +IndicatorDatetimeService * indicator_datetime_service_new (gboolean replace); + +G_END_DECLS + +#endif /* __INDICATOR_DATETIME_SERVICE_H__ */ -- cgit v1.2.3 From fd12257bf524c53b0bcfba1ce96c28ae612d206f Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 14 Jun 2013 16:07:20 -0500 Subject: land the service implementation --- src/service.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/service.h') diff --git a/src/service.h b/src/service.h index 594d7fe..47dd937 100644 --- a/src/service.h +++ b/src/service.h @@ -26,10 +26,8 @@ G_BEGIN_DECLS /* standard GObject macros */ -#define INDICATOR_TYPE_DATETIME_SERVICE (indicator_datetime_service_get_type()) #define INDICATOR_DATETIME_SERVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), INDICATOR_TYPE_DATETIME_SERVICE, IndicatorDatetimeService)) -#define INDICATOR_DATETIME_SERVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), INDICATOR_TYPE_DATETIME_SERVICE, IndicatorDatetimeServiceClass)) -#define INDICATOR_DATETIME_SERVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), INDICATOR_TYPE_DATETIME_SERVICE, IndicatorDatetimeServiceClass)) +#define INDICATOR_TYPE_DATETIME_SERVICE (indicator_datetime_service_get_type()) #define INDICATOR_IS_DATETIME_SERVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), INDICATOR_TYPE_DATETIME_SERVICE)) typedef struct _IndicatorDatetimeService IndicatorDatetimeService; -- cgit v1.2.3 From 72f23220db542cb8e41e9492528e79082c916804 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 17 Jun 2013 09:06:02 -0500 Subject: in service.c, replace all calls to time(NULL) and g_date_time_new_now_local() with a call to the new 'indicator_datetime_service_get_localtime()' func. This is currently a passthrough to _new_now_local(), but we'll need this control point to override the system time in unit testing --- src/service.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/service.h') diff --git a/src/service.h b/src/service.h index 47dd937..b8c9bcd 100644 --- a/src/service.h +++ b/src/service.h @@ -64,6 +64,8 @@ GType indicator_datetime_service_get_type (void); IndicatorDatetimeService * indicator_datetime_service_new (gboolean replace); +GDateTime * indicator_datetime_service_get_localtime (IndicatorDatetimeService * service); + G_END_DECLS #endif /* __INDICATOR_DATETIME_SERVICE_H__ */ -- cgit v1.2.3 From 1d015b51af186c0f71ff8164321feeef1cf63c19 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 17 Jun 2013 09:33:23 -0500 Subject: make indicator_datetime_service_set_calendar_date() public. This is another one we'll need for unit tests --- src/service.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/service.h') diff --git a/src/service.h b/src/service.h index b8c9bcd..53d4281 100644 --- a/src/service.h +++ b/src/service.h @@ -66,6 +66,10 @@ IndicatorDatetimeService * indicator_datetime_service_new (gboolean replace); GDateTime * indicator_datetime_service_get_localtime (IndicatorDatetimeService * service); +void indicator_datetime_service_set_calendar_date (IndicatorDatetimeService * self, + GDateTime * date); + + G_END_DECLS #endif /* __INDICATOR_DATETIME_SERVICE_H__ */ -- cgit v1.2.3 From 51bd7465ac148a34ec37cb8760daf3b282b5ed6a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 20 Jun 2013 13:44:21 -0500 Subject: remove the --replace command-line argument and property as we're using upstart for that --- src/service.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/service.h') diff --git a/src/service.h b/src/service.h index 53d4281..b142882 100644 --- a/src/service.h +++ b/src/service.h @@ -62,7 +62,7 @@ struct _IndicatorDatetimeServiceClass GType indicator_datetime_service_get_type (void); -IndicatorDatetimeService * indicator_datetime_service_new (gboolean replace); +IndicatorDatetimeService * indicator_datetime_service_new (void); GDateTime * indicator_datetime_service_get_localtime (IndicatorDatetimeService * service); -- cgit v1.2.3