From e3d99cf9defeefcdfe25adfa6bcad98f2d16eac6 Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Mon, 3 Oct 2011 14:05:59 +0100 Subject: datetime-service.c: Only show "Add Event..." if we have an email account This is because a limitation of evolution the calendar application depends on a email account to work Fixes https://bugs.launchpad.net/indicator-datetime/+bug/836017 --- src/datetime-service.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/datetime-service.c') diff --git a/src/datetime-service.c b/src/datetime-service.c index 25572ee..670e4d0 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -484,6 +484,8 @@ show_events_changed (void) 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); @@ -494,16 +496,22 @@ check_for_calendar (gpointer user_data) 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 || accounts_list == NULL) { + g_debug("%s: No mail accounts, do not show the 'Add Event...' menu item", G_STRFUNC); + g_clear_error (&error); + accounts_list = NULL; + } else { + 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); -- cgit v1.2.3 From d17c6fcb5d136c85547bf587de8e44bdd35db06b Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Mon, 3 Oct 2011 18:04:41 +0100 Subject: datetime-service: Free accounts list in the correct place --- src/datetime-service.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/datetime-service.c') diff --git a/src/datetime-service.c b/src/datetime-service.c index 670e4d0..9d43a70 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -498,11 +498,12 @@ check_for_calendar (gpointer user_data) G_CALLBACK (activate_cb), "evolution -c calendar"); GSList *accounts_list = gconf_client_get_list (gconf, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, &error); - if (error != NULL || accounts_list == NULL) { - g_debug("%s: No mail accounts, do not show the 'Add Event...' menu item", G_STRFUNC); + if (error != NULL) { + g_debug("%s: Failed to get evolution mail accounts", G_STRFUNC); g_clear_error (&error); accounts_list = NULL; - } else { + } 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); -- cgit v1.2.3 From c6a2cec0b2c999bfb1461bb0080b9a10e3aa87d0 Mon Sep 17 00:00:00 2001 From: Javier Jardón Date: Tue, 4 Oct 2011 20:05:56 +0100 Subject: datetime-service: Be sure to free the returned list --- src/datetime-service.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/datetime-service.c') diff --git a/src/datetime-service.c b/src/datetime-service.c index 9d43a70..b81ac1a 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -501,7 +501,8 @@ check_for_calendar (gpointer user_data) if (error != NULL) { g_debug("%s: Failed to get evolution mail accounts", G_STRFUNC); g_clear_error (&error); - accounts_list = NULL; + if (accounts_list) + g_slist_free (accounts_list); } else if (accounts_list != NULL) { g_slist_free (accounts_list); events_separator = dbusmenu_menuitem_new(); -- cgit v1.2.3 From 59ea5c3b88d4a3df98fd12685b79d9cb945bbc2c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 23 Oct 2011 16:54:15 -0500 Subject: Fixing a bad check for GeoIP object validity. Adding an error check which is better anyway. --- src/datetime-service.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/datetime-service.c') diff --git a/src/datetime-service.c b/src/datetime-service.c index ed8c8e3..73a3361 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -1404,7 +1404,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; } -- cgit v1.2.3 From 78e082682d5d833fd271899b67d6a203acffa803 Mon Sep 17 00:00:00 2001 From: György Balló Date: Wed, 23 Nov 2011 07:59:47 +0100 Subject: Make Control Center panel optional --- Makefile.am | 6 +++++- configure.ac | 55 +++++++++++++++++++++++++++++++++++--------------- data/Makefile.am | 16 ++++++++++----- src/Makefile.am | 4 ++++ src/datetime-service.c | 4 ++++ 5 files changed, 63 insertions(+), 22 deletions(-) (limited to 'src/datetime-service.c') diff --git a/Makefile.am b/Makefile.am index feea4de..a5a6e27 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,11 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} +if BUILD_CCPANEL +LIBMAP_SUBDIR = libmap +endif + SUBDIRS = \ - libmap \ + $(LIBMAP_SUBDIR) \ src \ data \ tests \ diff --git a/configure.ac b/configure.ac index 07f52d7..1b5dbf5 100644 --- a/configure.ac +++ b/configure.ac @@ -103,14 +103,34 @@ PKG_CHECK_MODULES(SERVICE, indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION gdk-3.0 >= GDK_REQUIRED_VERSION gconf-2.0 >= GCONF_REQUIRED_VERSION) -PKG_CHECK_MODULES(PREF, gio-2.0 >= $GIO_REQUIRED_VERSION - gtk+-3.0 >= $GTK3_REQUIRED_VERSION - json-glib-1.0 - libgnome-control-center - polkit-gobject-1) - -PKG_CHECK_MODULES(LIBMAP, gio-2.0 >= $GIO_REQUIRED_VERSION - gtk+-3.0 >= $GTK3_REQUIRED_VERSION) +########################### +# Control Center panel +########################### + +AC_ARG_WITH([ccpanel], + AS_HELP_STRING([--with-ccpanel], [enable Control Center panel]),, + with_ccpanel=auto) + +if test x"$with_ccpanel" != x"no" ; then + PKG_CHECK_MODULES(PREF, gio-2.0 >= $GIO_REQUIRED_VERSION + gtk+-3.0 >= $GTK3_REQUIRED_VERSION + json-glib-1.0 + libgnome-control-center + polkit-gobject-1, + [have_ccpanel=yes], + [have_ccpanel=no]) + if test x${have_ccpanel} = xyes; then + AC_DEFINE(HAVE_CCPANEL, 1, [Define to 1 to enable Control Center panel]) + PKG_CHECK_MODULES(LIBMAP, gio-2.0 >= $GIO_REQUIRED_VERSION + gtk+-3.0 >= $GTK3_REQUIRED_VERSION) + fi + if test x${with_ccpanel} = xyes && test x${have_ccpanel} = xno; then + AC_MSG_ERROR([Control Center panel configured but not found]) + fi +else + have_ccpanel=no +fi +AM_CONDITIONAL(BUILD_CCPANEL, test x${have_ccpanel} = xyes) ########################### # Grab the GSettings Macros @@ -151,16 +171,18 @@ AC_SUBST(INDICATORICONSDIR) # Control Center Info ########################### -AS_IF([test "x$with_localinstall" = "xyes"], - [ - CCPANELDIR="${libdir}/control-center-1/panels/" - ], +AS_IF([test "x$have_ccpanel" = "xyes"], [ - CCPANELDIR=`$PKG_CONFIG --variable=extensiondir libgnome-control-center` - ]) - -AC_SUBST(CCPANELDIR) + AS_IF([test "x$with_localinstall" = "xyes"], + [ + CCPANELDIR="${libdir}/control-center-1/panels/" + ], + [ + CCPANELDIR=`$PKG_CONFIG --variable=extensiondir libgnome-control-center` + ]) + AC_SUBST(CCPANELDIR) + ]) ########################### # DBus Service Info ########################### @@ -224,5 +246,6 @@ Date and Time Indicator Configuration: Prefix: $prefix Indicator Dir: $INDICATORDIR + CC Panel: $have_ccpanel CC Panel Dir: $CCPANELDIR ]) diff --git a/data/Makefile.am b/data/Makefile.am index b9a9532..6b7fe0f 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -10,17 +10,23 @@ dbus_services_DATA = indicator-datetime.service %.service: %.service.in sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ +EXTRA_DIST = \ + $(gsettings_SCHEMAS) \ + indicator-datetime.service.in + +CLEANFILES = indicator-datetime.service + +if BUILD_CCPANEL pkgdata_DATA = datetime-dialog.ui @INTLTOOL_DESKTOP_RULE@ desktopdir = $(datadir)/applications desktop_DATA = indicator-datetime-preferences.desktop -EXTRA_DIST = \ - $(gsettings_SCHEMAS) \ +EXTRA_DIST += \ datetime-dialog.ui \ indicator-datetime-preferences.desktop \ - indicator-datetime-preferences.desktop.in \ - indicator-datetime.service.in + indicator-datetime-preferences.desktop.in -CLEANFILES = indicator-datetime-preferences.desktop indicator-datetime.service +CLEANFILES += indicator-datetime-preferences.desktop +endif diff --git a/src/Makefile.am b/src/Makefile.am index 254022e..aa04900 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,8 @@ +if BUILD_CCPANEL ccpaneldir = $(CCPANELDIR) ccpanel_LTLIBRARIES = libindicator-datetime.la +endif libexec_PROGRAMS = indicator-datetime-service @@ -42,6 +44,7 @@ libdatetime_la_LDFLAGS = \ -module \ -avoid-version +if BUILD_CCPANEL libindicator_datetime_la_SOURCES =\ datetime-prefs.c \ datetime-prefs-locations.c \ @@ -62,6 +65,7 @@ libindicator_datetime_la_LIBADD = \ $(top_builddir)/libmap/libmap.la \ $(PREF_LIBS) libindicator_datetime_la_LDFLAGS = -module -avoid-version +endif gen-%.xml.c: %.xml @echo "Building $@ from $<" diff --git a/src/datetime-service.c b/src/datetime-service.c index ed8c8e3..f004c4a 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -1146,7 +1146,11 @@ build_menus (DbusmenuMenuitem * root) dbusmenu_menuitem_property_set (settings, DBUSMENU_MENUITEM_PROP_LABEL, _("Time & Date Settings…")); /* insensitive until we check for available apps */ dbusmenu_menuitem_property_set_bool(settings, DBUSMENU_MENUITEM_PROP_ENABLED, FALSE); + #ifdef HAVE_CCPANEL g_signal_connect(G_OBJECT(settings), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "gnome-control-center indicator-datetime"); + #else + g_signal_connect(G_OBJECT(settings), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_cb), "gnome-control-center datetime"); + #endif /* HAVE_CCPANEL */ dbusmenu_menuitem_child_append(root, settings); g_idle_add(check_for_timeadmin, NULL); } -- cgit v1.2.3 From 460b479a9b22cbc35bd333080d501c53bb58ccae Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 31 Jan 2012 21:27:24 -0600 Subject: Fixing include paths --- src/datetime-service.c | 2 +- src/indicator-datetime.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/datetime-service.c') diff --git a/src/datetime-service.c b/src/datetime-service.c index 73a3361..8358a80 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -31,7 +31,7 @@ with this program. If not, see . #include #include -#include +#include #include #include #include diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 8e5f421..f7fb130 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -41,9 +41,9 @@ with this program. If not, see . #include /* DBusMenu */ -#include +#include #include -#include +#include #include "utils.h" #include "dbus-shared.h" -- cgit v1.2.3 From 895a0a2c7fcaa05bf4ea3415276af26bde90b769 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 14 Feb 2012 18:15:59 -0600 Subject: Fix FTB when deprecation warnings are enabled --- libmap/cc-timezone-map.c | 14 ++++++++++---- src/datetime-service.c | 14 ++++++++++---- src/indicator-datetime.c | 8 ++++++++ 3 files changed, 28 insertions(+), 8 deletions(-) (limited to 'src/datetime-service.c') 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-service.c b/src/datetime-service.c index 8358a80..227022f 100644 --- a/src/datetime-service.c +++ b/src/datetime-service.c @@ -979,13 +979,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); diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index f7fb130..38f178b 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -1261,7 +1261,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 +1476,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(""); -- cgit v1.2.3