aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac5
-rw-r--r--data/datetime-dialog.ui1
-rw-r--r--libmap/cc-timezone-map.c14
-rw-r--r--src/datetime-prefs.c1
-rw-r--r--src/datetime-service.c78
-rw-r--r--src/indicator-datetime.c20
6 files changed, 77 insertions, 42 deletions
diff --git a/configure.ac b/configure.ac
index 144672f..32be68e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_INIT([indicator-datetime],
- [0.3.0],
+ [0.3.1],
[http://bugs.launchpad.net/indicator-datetime],
[indicator-datetime],
[http://launchpad.net/indicator-datetime])
@@ -58,7 +58,7 @@ AC_ARG_WITH([gtk],
INDICATOR_REQUIRED_VERSION=0.3.19
DBUSMENUGLIB_REQUIRED_VERSION=0.1.1
-DBUSMENUGTK_REQUIRED_VERSION=0.3.94
+DBUSMENUGTK_REQUIRED_VERSION=0.5.90
GIO_REQUIRED_VERSION=2.25.11
INDICATOR_DISPLAY_OBJECTS=0.2.2
GEOCLUE_REQUIRED_VERSION=0.12.0
@@ -105,7 +105,6 @@ PKG_CHECK_MODULES(SERVICE, indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION
PKG_CHECK_MODULES(PREF, gio-2.0 >= $GIO_REQUIRED_VERSION
gtk+-3.0 >= $GTK3_REQUIRED_VERSION
- unique-3.0
json-glib-1.0
libgnome-control-center
polkit-gobject-1)
diff --git a/data/datetime-dialog.ui b/data/datetime-dialog.ui
index 59d6753..f3110ec 100644
--- a/data/datetime-dialog.ui
+++ b/data/datetime-dialog.ui
@@ -13,7 +13,6 @@
<property name="default_width">300</property>
<property name="default_height">200</property>
<property name="destroy_with_parent">True</property>
- <property name="icon_name">time-admin</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
diff --git a/libmap/cc-timezone-map.c b/libmap/cc-timezone-map.c
index aeac9a0..ff6eee8 100644
--- a/libmap/cc-timezone-map.c
+++ b/libmap/cc-timezone-map.c
@@ -743,19 +743,25 @@ cc_timezone_map_draw (GtkWidget *widget,
GError *err = NULL;
gdouble pointx, pointy;
gdouble alpha = 1.0;
- GtkStyle *style;
char buf[16];
gtk_widget_get_allocation (widget, &alloc);
- style = gtk_widget_get_style (widget);
-
/* Check if insensitive */
- if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE)
+ if (gtk_widget_get_sensitive (widget))
alpha = 0.5;
/* paint background */
+#if GTK_CHECK_VERSION(3,0,0)
+ GdkRGBA rgba;
+ gtk_style_context_get_background_color (gtk_widget_get_style_context (widget),
+ gtk_widget_get_state_flags (widget),
+ &rgba);
+ gdk_cairo_set_source_rgba (cr, &rgba);
+#else
+ GtkStyle * style = gtk_widget_get_style (widget);
gdk_cairo_set_source_color (cr, &style->bg[gtk_widget_get_state (widget)]);
+#endif
cairo_paint (cr);
gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0);
cairo_paint_with_alpha (cr, alpha);
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c
index 5ace8c4..1b7ddd2 100644
--- a/src/datetime-prefs.c
+++ b/src/datetime-prefs.c
@@ -32,7 +32,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib/gi18n-lib.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
-#include <unique/unique.h>
#include <polkit/polkit.h>
#include <libgnome-control-center/cc-panel.h>
diff --git a/src/datetime-service.c b/src/datetime-service.c
index b81ac1a..dfce637 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -31,7 +31,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <math.h>
#include <gconf/gconf-client.h>
-#include <libdbusmenu-gtk3/menuitem.h>
+#include <libdbusmenu-gtk/menuitem.h>
#include <libdbusmenu-glib/server.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/menuitem.h>
@@ -479,41 +479,47 @@ show_events_changed (void)
}
}
+static gboolean
+calendar_app_is_usable (void)
+{
+ /* confirm that it's installed... */
+ gchar *evo = g_find_program_in_path("evolution");
+ if (evo == NULL)
+ return FALSE;
+ g_debug ("found calendar app: '%s'", evo);
+ g_free (evo);
+
+ /* confirm that it's got an account set up... */
+ GSList *accounts_list = gconf_client_get_list (gconf, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL);
+ const guint n = g_slist_length (accounts_list);
+ g_debug ("found %u evolution accounts", n);
+ g_slist_free (accounts_list);
+ return n > 0;
+}
+
/* Looks for the calendar application and enables the item if
we have one, starts ecal timer if events are turned on */
static gboolean
check_for_calendar (gpointer user_data)
{
- GError *error = NULL;
-
g_return_val_if_fail (calendar != NULL, FALSE);
dbusmenu_menuitem_property_set_bool(date, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
- gchar *evo = g_find_program_in_path("evolution");
- if (!get_greeter_mode () && evo != NULL) {
- g_debug("Found the calendar application: %s", evo);
+ if (!get_greeter_mode () && calendar_app_is_usable()) {
g_signal_connect (G_OBJECT(date), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
G_CALLBACK (activate_cb), "evolution -c calendar");
+
+ events_separator = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(events_separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
+ dbusmenu_menuitem_child_add_position(root, events_separator, 2);
+ add_appointment = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set (add_appointment, DBUSMENU_MENUITEM_PROP_LABEL, _("Add Event…"));
+ dbusmenu_menuitem_property_set_bool(add_appointment, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
+ g_signal_connect(G_OBJECT(add_appointment), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "evolution -c calendar");
+ dbusmenu_menuitem_child_add_position (root, add_appointment, 3);
- GSList *accounts_list = gconf_client_get_list (gconf, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, &error);
- if (error != NULL) {
- g_debug("%s: Failed to get evolution mail accounts", G_STRFUNC);
- g_clear_error (&error);
- if (accounts_list)
- g_slist_free (accounts_list);
- } else if (accounts_list != NULL) {
- g_slist_free (accounts_list);
- events_separator = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set(events_separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
- dbusmenu_menuitem_child_add_position(root, events_separator, 2);
- add_appointment = dbusmenu_menuitem_new();
- dbusmenu_menuitem_property_set (add_appointment, DBUSMENU_MENUITEM_PROP_LABEL, _("Add Event…"));
- dbusmenu_menuitem_property_set_bool(add_appointment, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
- g_signal_connect(G_OBJECT(add_appointment), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "evolution -c calendar");
- dbusmenu_menuitem_child_add_position (root, add_appointment, 3);
- }
if (g_settings_get_boolean(conf, SETTINGS_SHOW_EVENTS_S)) {
dbusmenu_menuitem_property_set_bool(add_appointment, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
@@ -529,7 +535,6 @@ check_for_calendar (gpointer user_data)
g_signal_connect(calendar, "event::month-changed", G_CALLBACK(month_changed_cb), NULL);
g_signal_connect(calendar, "event::day-selected", G_CALLBACK(day_selected_cb), NULL);
g_signal_connect(calendar, "event::day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), NULL);
- g_free(evo);
} else {
g_debug("Unable to find calendar app.");
dbusmenu_menuitem_property_set_bool(add_appointment, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
@@ -591,8 +596,8 @@ update_timezone_menu_items(gpointer user_data) {
offset = dbusmenu_menuitem_get_position (current_location, root)+1;
for (i = 0; i < len; i++) {
// Iterate over configured places and add any which aren't already listed
- if (g_strcmp0(locations[i], current_timezone) != 0 &&
- g_strcmp0(locations[i], geo_timezone) != 0) {
+ if ((current_timezone == NULL || !g_str_has_prefix(locations[i], current_timezone)) &&
+ (geo_timezone == NULL || !g_str_has_prefix(locations[i], geo_timezone))) {
g_debug("Adding timezone in update_timezones %s", locations[i]);
item = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_TYPE, TIMEZONE_MENUITEM_TYPE);
@@ -989,13 +994,19 @@ update_appointment_menu_items (gpointer user_data)
// Draw the correct icon for the appointment type and then tint it using mask fill.
// For now we'll create a circle
if (color_spec != NULL) {
- GdkColor color;
- gdk_color_parse (color_spec, &color);
g_debug("Creating a cairo surface: size, %d by %d", width, height);
cairo_surface_t *surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, width, height );
- cairo_t *cr = cairo_create(surface);
- gdk_cairo_set_source_color(cr, &color);
+ cairo_t *cr = cairo_create(surface);
+#if GTK_CHECK_VERSION(3,0,0)
+ GdkRGBA rgba;
+ if (gdk_rgba_parse (&rgba, color_spec))
+ gdk_cairo_set_source_rgba (cr, &rgba);
+#else
+ GdkColor color;
+ if (gdk_color_parse (color_spec, &color))
+ gdk_cairo_set_source_color (cr, &color);
+#endif
cairo_paint(cr);
cairo_set_source_rgba(cr, 0,0,0,0.5);
cairo_set_line_width(cr, 1);
@@ -1414,7 +1425,12 @@ geo_create_client (GeoclueMaster * master, GeoclueMasterClient * client, gchar *
geo_master = client;
- if (geo_master != NULL) {
+ if (error != NULL) {
+ g_warning("Unable to get a GeoClue client! '%s' Geolocation based timezone support will not be available.", error->message);
+ return;
+ }
+
+ if (geo_master == NULL) {
g_warning(_("Unable to get a GeoClue client! Geolocation based timezone support will not be available."));
return;
}
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 8e5f421..c847d47 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -41,9 +41,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libindicator/indicator-service-manager.h>
/* DBusMenu */
-#include <libdbusmenu-gtk3/menu.h>
+#include <libdbusmenu-gtk/menu.h>
#include <libido/libido.h>
-#include <libdbusmenu-gtk3/menuitem.h>
+#include <libdbusmenu-gtk/menuitem.h>
#include "utils.h"
#include "dbus-shared.h"
@@ -161,6 +161,7 @@ static void indicator_datetime_finalize (GObject *object);
static GtkLabel * get_label (IndicatorObject * io);
static GtkMenu * get_menu (IndicatorObject * io);
static const gchar * get_accessible_desc (IndicatorObject * io);
+static const gchar * get_name_hint (IndicatorObject * io);
static GVariant * bind_enum_set (const GValue * value, const GVariantType * type, gpointer user_data);
static gboolean bind_enum_get (GValue * value, GVariant * variant, gpointer user_data);
static gchar * generate_format_string_now (IndicatorDatetime * self);
@@ -200,6 +201,7 @@ indicator_datetime_class_init (IndicatorDatetimeClass *klass)
io_class->get_label = get_label;
io_class->get_menu = get_menu;
io_class->get_accessible_desc = get_accessible_desc;
+ io_class->get_name_hint = get_name_hint;
g_object_class_install_property (object_class,
PROP_SHOW_CLOCK,
@@ -1261,7 +1263,11 @@ new_appointment_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbu
mi_data->gmi = gtk_menu_item_new();
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkWidget * hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+#else
GtkWidget * hbox = gtk_hbox_new(FALSE, 4);
+#endif
/* Icon, probably someone's face or avatar on an IM */
mi_data->icon = gtk_image_new();
@@ -1472,7 +1478,11 @@ new_timezone_item(DbusmenuMenuitem * newitem,
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mi_data->gmi),
dbusmenu_menuitem_property_get_bool(newitem, TIMEZONE_MENUITEM_PROP_RADIO));
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkWidget * hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+#else
GtkWidget * hbox = gtk_hbox_new(FALSE, 4);
+#endif
/* Label, probably a username, chat room or mailbox name */
mi_data->label = gtk_label_new("");
@@ -1548,3 +1558,9 @@ get_accessible_desc (IndicatorObject * io)
}
return NULL;
}
+
+static const gchar *
+get_name_hint (IndicatorObject * io)
+{
+ return PACKAGE_NAME;
+}