aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/calendar-menu-item.c100
-rw-r--r--src/calendar-menu-item.h59
-rw-r--r--src/datetime-prefs.c3
-rw-r--r--src/indicator-datetime.c34
-rw-r--r--src/timezone-completion.c24
-rw-r--r--src/timezone-completion.h17
8 files changed, 45 insertions, 196 deletions
diff --git a/configure.ac b/configure.ac
index eaeb958..d557006 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,7 +69,7 @@ GNOME_DESKTOP_REQUIRED_VERSION=3.1.91
GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=3.1.4
CAIRO_REQUIRED_VERSION=1.10
GDK_REQUIRED_VERSION=2.22
-GLIB_REQUIRED_VERSION=2.26
+GLIB_REQUIRED_VERSION=2.29.19
GTK3_REQUIRED_VERSION=3.1.4
GCONF_REQUIRED_VERSION=2.31
diff --git a/src/Makefile.am b/src/Makefile.am
index 6ca07a8..254022e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,8 +8,6 @@ indicator_datetime_service_SOURCES = \
datetime-interface.c \
datetime-interface.h \
gen-datetime-service.xml.c \
- calendar-menu-item.c \
- calendar-menu-item.h \
datetime-service.c \
utils.c \
utils.h \
diff --git a/src/calendar-menu-item.c b/src/calendar-menu-item.c
deleted file mode 100644
index c2ceec3..0000000
--- a/src/calendar-menu-item.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-Calendar menu item dbusmenu "transport" for the corresponding IDO widget.
-
-Copyright 2010 Canonical Ltd.
-
-Authors:
- David Barth <david.barth@canonical.com>
-
-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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gdk/gdk.h>
-#include <glib/gi18n.h>
-#include "calendar-menu-item.h"
-
-#include "dbus-shared.h"
-
-#include <libdbusmenu-glib/client.h>
-#include <libdbusmenu-glib/server.h>
-#include <libdbusmenu-glib/menuitem.h>
-
-enum {
- LAST_SIGNAL
-};
-
-/* static guint signals[LAST_SIGNAL] = { }; */
-
-typedef struct _CalendarMenuItemPrivate CalendarMenuItemPrivate;
-struct _CalendarMenuItemPrivate
-{
- void * placeholder;
-};
-
-#define CALENDAR_MENU_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CALENDAR_MENU_ITEM_TYPE, CalendarMenuItemPrivate))
-
-/* Prototypes */
-static void calendar_menu_item_class_init (CalendarMenuItemClass *klass);
-static void calendar_menu_item_init (CalendarMenuItem *self);
-static void calendar_menu_item_dispose (GObject *object);
-static void calendar_menu_item_finalize (GObject *object);
-
-G_DEFINE_TYPE (CalendarMenuItem, calendar_menu_item, DBUSMENU_TYPE_MENUITEM);
-
-static void
-calendar_menu_item_class_init (CalendarMenuItemClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- g_type_class_add_private (klass, sizeof (CalendarMenuItemPrivate));
-
- object_class->dispose = calendar_menu_item_dispose;
- object_class->finalize = calendar_menu_item_finalize;
-
- return;
-}
-
-static void
-calendar_menu_item_init (CalendarMenuItem *self)
-{
- return;
-}
-
-static void
-calendar_menu_item_dispose (GObject *object)
-{
- G_OBJECT_CLASS (calendar_menu_item_parent_class)->dispose (object);
-}
-
-static void
-calendar_menu_item_finalize (GObject *object)
-{
- G_OBJECT_CLASS (calendar_menu_item_parent_class)->finalize (object);
-
- return;
-}
-
-CalendarMenuItem *
-calendar_menu_item_new ()
-{
- CalendarMenuItem * self = g_object_new(CALENDAR_MENU_ITEM_TYPE, NULL);
-
- dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CALENDAR_MENUITEM_TYPE);
-
- return self;
-}
-
diff --git a/src/calendar-menu-item.h b/src/calendar-menu-item.h
deleted file mode 100644
index 7a56f96..0000000
--- a/src/calendar-menu-item.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-Calendar menu item dbusmenu "transport" for the corresponding IDO widget.
-
-Copyright 2010 Canonical Ltd.
-
-Authors:
- David Barth <david.barth@canonical.com>
-
-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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __CALENDAR_MENU_ITEM_H__
-#define __CALENDAR_MENU_ITEM_H__
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <libdbusmenu-glib/menuitem.h>
-
-G_BEGIN_DECLS
-
-#define CALENDAR_MENU_ITEM_TYPE (calendar_menu_item_get_type ())
-#define CALENDAR_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALENDAR_MENU_ITEM_TYPE, CalendarMenuItem))
-#define CALENDAR_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALENDAR_MENU_ITEM_TYPE, CalendarMenuItemClass))
-#define IS_CALENDAR_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALENDAR_MENU_ITEM_TYPE))
-#define IS_CALENDAR_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALENDAR_MENU_ITEM_TYPE))
-#define CALENDAR_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALENDAR_MENU_ITEM_TYPE, CalendarMenuItemClass))
-
-#define CALENDAR_MENU_ITEM_SIGNAL_ACTIVATE "activate"
-#define CALENDAR_MENUITEM_PROP_TEXT "text"
-
-typedef struct _CalendarMenuItem CalendarMenuItem;
-typedef struct _CalendarMenuItemClass CalendarMenuItemClass;
-
-struct _CalendarMenuItemClass {
- DbusmenuMenuitemClass parent_class;
-};
-
-struct _CalendarMenuItem {
- DbusmenuMenuitem parent;
-};
-
-GType calendar_menu_item_get_type (void);
-CalendarMenuItem * calendar_menu_item_new ();
-
-G_END_DECLS
-
-#endif /* __CALENDAR_MENU_ITEM_H__ */
-
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c
index e7fef5d..5ace8c4 100644
--- a/src/datetime-prefs.c
+++ b/src/datetime-prefs.c
@@ -653,6 +653,7 @@ indicator_datetime_panel_init (IndicatorDatetimePanel * self)
GError * error = NULL;
self->priv->builder = gtk_builder_new ();
+ gtk_builder_set_translation_domain (self->priv->builder, GETTEXT_PACKAGE);
gtk_builder_add_from_file (self->priv->builder, DATETIME_DIALOG_UI_FILE, &error);
if (error != NULL) {
/* We have to abort, we can't continue without the ui file */
@@ -661,8 +662,6 @@ indicator_datetime_panel_init (IndicatorDatetimePanel * self)
return;
}
- gtk_builder_set_translation_domain (self->priv->builder, GETTEXT_PACKAGE);
-
GSettings * conf = g_settings_new (SETTINGS_INTERFACE);
#define WIG(name) GTK_WIDGET (gtk_builder_get_object (self->priv->builder, name))
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 16ad131..61cfc5f 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -144,9 +144,6 @@ struct _indicator_item_t {
#define PROP_SHOW_WEEK_NUMBERS_S "show-week-numbers"
#define PROP_SHOW_CALENDAR_S "show-calendar"
-#define INDICATOR_DATETIME_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATOR_DATETIME_TYPE, IndicatorDatetimePrivate))
-
enum {
STRFTIME_MASK_NONE = 0, /* Hours or minutes as we always test those */
STRFTIME_MASK_SECONDS = 1 << 0, /* Seconds count */
@@ -159,7 +156,7 @@ enum {
STRFTIME_MASK_ALL = (STRFTIME_MASK_SECONDS | STRFTIME_MASK_AMPM | STRFTIME_MASK_WEEK | STRFTIME_MASK_DAY | STRFTIME_MASK_MONTH | STRFTIME_MASK_YEAR)
};
-GType indicator_datetime_get_type (void);
+GType indicator_datetime_get_type (void) G_GNUC_CONST;
static void indicator_datetime_class_init (IndicatorDatetimeClass *klass);
static void indicator_datetime_init (IndicatorDatetime *self);
@@ -221,7 +218,7 @@ indicator_datetime_class_init (IndicatorDatetimeClass *klass)
PROP_TIME_FORMAT,
g_param_spec_int(PROP_TIME_FORMAT_S,
"A choice of which format should be used on the panel",
- "Chooses between letting the locale choose the time, 12-hour time, 24-time or using the custom string passed to strftime().",
+ "Chooses between letting the locale choose the time, 12-hour time, 24-time or using the custom string passed to g_date_time_format().",
SETTINGS_TIME_LOCALE, /* min */
SETTINGS_TIME_CUSTOM, /* max */
SETTINGS_TIME_LOCALE, /* default */
@@ -251,7 +248,7 @@ indicator_datetime_class_init (IndicatorDatetimeClass *klass)
PROP_CUSTOM_TIME_FORMAT,
g_param_spec_string(PROP_CUSTOM_TIME_FORMAT_S,
"The format that is used to show the time on the panel.",
- "A format string in the form used to pass to strftime to make a string for displaying on the panel.",
+ "A format string in the form used to pass to g_date_time_format() to make a string for displaying on the panel.",
DEFAULT_TIME_FORMAT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
@@ -297,7 +294,9 @@ menu_visible_notfy_cb(GtkWidget * menu, G_GNUC_UNUSED GParamSpec *pspec, gpointe
static void
indicator_datetime_init (IndicatorDatetime *self)
{
- self->priv = INDICATOR_DATETIME_GET_PRIVATE(self);
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ INDICATOR_DATETIME_TYPE,
+ IndicatorDatetimePrivate);
self->priv->label = NULL;
@@ -410,11 +409,10 @@ service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data)
IndicatorDatetime * self = INDICATOR_DATETIME(user_data);
g_return_if_fail(self != NULL);
+ IndicatorDatetimePrivate * priv = self->priv;
GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error);
- IndicatorDatetimePrivate * priv = INDICATOR_DATETIME_GET_PRIVATE(self);
-
if (priv->service_proxy_cancel != NULL) {
g_object_unref(priv->service_proxy_cancel);
priv->service_proxy_cancel = NULL;
@@ -547,7 +545,8 @@ bind_enum_get (GValue * value, GVariant * variant, gpointer user_data)
static void
timezone_update_all_labels (IndicatorDatetime * self)
{
- IndicatorDatetimePrivate *priv = INDICATOR_DATETIME_GET_PRIVATE(self);
+ IndicatorDatetimePrivate *priv = self->priv;
+
g_list_foreach(priv->timezone_items, (GFunc)timezone_update_labels, NULL);
}
@@ -791,6 +790,12 @@ set_label_to_time_in_zone (IndicatorDatetime * self, GtkLabel * label,
}
else {
timestr = g_date_time_format(datetime_now, format);
+ if (timestr == NULL) {
+ g_warning ("The custom date format is not valid, check the\n"
+ "g_date_time_format() documentation for the supported\n"
+ "format specifiers ");
+ timestr = g_strdup ("Date format not supported");
+ }
}
gboolean use_markup = FALSE;
@@ -1359,8 +1364,7 @@ new_calendar_item (DbusmenuMenuitem * newitem,
/* Note: not checking parent, it's reasonable for it to be NULL */
IndicatorDatetime *self = INDICATOR_DATETIME(user_data);
- self->priv = INDICATOR_DATETIME_GET_PRIVATE(self);
-
+
IdoCalendarMenuItem *ido = IDO_CALENDAR_MENU_ITEM (ido_calendar_menu_item_new ());
self->priv->ido_calendar = ido;
@@ -1404,7 +1408,9 @@ timezone_toggled_cb (GtkCheckMenuItem *checkmenuitem, DbusmenuMenuitem * dbusite
static void
timezone_destroyed_cb (indicator_item_t * mi_data, DbusmenuMenuitem * dbusitem)
{
- IndicatorDatetimePrivate *priv = INDICATOR_DATETIME_GET_PRIVATE(mi_data->self);
+ IndicatorDatetime *self = INDICATOR_DATETIME (mi_data->self);
+ IndicatorDatetimePrivate *priv = self->priv;
+
priv->timezone_items = g_list_remove(priv->timezone_items, mi_data);
g_signal_handlers_disconnect_by_func(G_OBJECT(mi_data->gmi), G_CALLBACK(timezone_toggled_cb), dbusitem);
g_free(mi_data);
@@ -1422,7 +1428,7 @@ new_timezone_item(DbusmenuMenuitem * newitem,
/* Note: not checking parent, it's reasonable for it to be NULL */
IndicatorDatetime * self = INDICATOR_DATETIME(user_data);
- IndicatorDatetimePrivate *priv = INDICATOR_DATETIME_GET_PRIVATE(self);
+ IndicatorDatetimePrivate *priv = self->priv;
// Menu item with a radio button and a right aligned time
indicator_item_t * mi_data = g_new0(indicator_item_t, 1);
diff --git a/src/timezone-completion.c b/src/timezone-completion.c
index d190035..f223bf4 100644
--- a/src/timezone-completion.c
+++ b/src/timezone-completion.c
@@ -35,7 +35,6 @@ enum {
/* static guint signals[LAST_SIGNAL] = { }; */
-typedef struct _TimezoneCompletionPrivate TimezoneCompletionPrivate;
struct _TimezoneCompletionPrivate
{
GtkTreeModel * initial_model;
@@ -48,8 +47,6 @@ struct _TimezoneCompletionPrivate
GHashTable * request_table;
};
-#define TIMEZONE_COMPLETION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), TIMEZONE_COMPLETION_TYPE, TimezoneCompletionPrivate))
-
#define GEONAME_URL "http://geoname-lookup.ubuntu.com/?query=%s&release=%s&lang=%s"
/* Prototypes */
@@ -71,7 +68,7 @@ match_func (GtkEntryCompletion *completion, const gchar *key,
static void
save_and_use_model (TimezoneCompletion * completion, GtkTreeModel * model)
{
- TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE(completion);
+ TimezoneCompletionPrivate * priv = completion->priv;
g_hash_table_insert (priv->request_table, g_strdup (priv->request_text), g_object_ref_sink (model));
@@ -129,7 +126,7 @@ static void
json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
{
TimezoneCompletion * completion = TIMEZONE_COMPLETION (user_data);
- TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE(completion);
+ TimezoneCompletionPrivate * priv = completion->priv;
GError * error = NULL;
const gchar * prev_name = NULL;
const gchar * prev_admin1 = NULL;
@@ -257,7 +254,7 @@ static void
geonames_data_ready (GObject *object, GAsyncResult *res, gpointer user_data)
{
TimezoneCompletion * completion = TIMEZONE_COMPLETION (user_data);
- TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion);
+ TimezoneCompletionPrivate * priv = completion->priv;
GError * error = NULL;
GFileInputStream * stream;
@@ -335,7 +332,7 @@ get_version (void)
static gboolean
request_zones (TimezoneCompletion * completion)
{
- TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion);
+ TimezoneCompletionPrivate * priv = completion->priv;
priv->queued_request = 0;
@@ -373,7 +370,7 @@ request_zones (TimezoneCompletion * completion)
static void
entry_changed (GtkEntry * entry, TimezoneCompletion * completion)
{
- TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion);
+ TimezoneCompletionPrivate * priv = completion->priv;
if (priv->queued_request) {
g_source_remove (priv->queued_request);
@@ -484,7 +481,7 @@ entry_keypress (GtkEntry * entry, GdkEventKey *event, TimezoneCompletion * comp
void
timezone_completion_watch_entry (TimezoneCompletion * completion, GtkEntry * entry)
{
- TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion);
+ TimezoneCompletionPrivate * priv = completion->priv;
if (priv->queued_request) {
g_source_remove (priv->queued_request);
@@ -604,7 +601,12 @@ timezone_completion_class_init (TimezoneCompletionClass *klass)
static void
timezone_completion_init (TimezoneCompletion * self)
{
- TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (self);
+ TimezoneCompletionPrivate *priv;
+
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ TIMEZONE_COMPLETION_TYPE,
+ TimezoneCompletionPrivate);
+ priv = self->priv;
priv->initial_model = GTK_TREE_MODEL (get_initial_model ());
@@ -630,7 +632,7 @@ timezone_completion_dispose (GObject * object)
G_OBJECT_CLASS (timezone_completion_parent_class)->dispose (object);
TimezoneCompletion * completion = TIMEZONE_COMPLETION (object);
- TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion);
+ TimezoneCompletionPrivate * priv = completion->priv;
if (priv->changed_id) {
if (priv->entry)
diff --git a/src/timezone-completion.h b/src/timezone-completion.h
index fdfb234..1592d79 100644
--- a/src/timezone-completion.h
+++ b/src/timezone-completion.h
@@ -34,15 +34,18 @@ G_BEGIN_DECLS
#define IS_TIMEZONE_COMPLETION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TIMEZONE_COMPLETION_TYPE))
#define TIMEZONE_COMPLETION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TIMEZONE_COMPLETION_TYPE, TimezoneCompletionClass))
-typedef struct _TimezoneCompletion TimezoneCompletion;
-typedef struct _TimezoneCompletionClass TimezoneCompletionClass;
-
-struct _TimezoneCompletionClass {
- GtkEntryCompletionClass parent_class;
-};
+typedef struct _TimezoneCompletion TimezoneCompletion;
+typedef struct _TimezoneCompletionPrivate TimezoneCompletionPrivate;
+typedef struct _TimezoneCompletionClass TimezoneCompletionClass;
struct _TimezoneCompletion {
GtkEntryCompletion parent;
+
+ TimezoneCompletionPrivate *priv;
+};
+
+struct _TimezoneCompletionClass {
+ GtkEntryCompletionClass parent_class;
};
#define TIMEZONE_COMPLETION_ZONE 0
@@ -53,7 +56,7 @@ struct _TimezoneCompletion {
#define TIMEZONE_COMPLETION_LATITUDE 5
#define TIMEZONE_COMPLETION_LAST 6
-GType timezone_completion_get_type (void);
+GType timezone_completion_get_type (void) G_GNUC_CONST;
TimezoneCompletion * timezone_completion_new ();
void timezone_completion_watch_entry (TimezoneCompletion * completion, GtkEntry * entry);