diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/datetime-service.c | 39 | ||||
-rw-r--r-- | src/indicator-datetime.c | 16 |
2 files changed, 42 insertions, 13 deletions
diff --git a/src/datetime-service.c b/src/datetime-service.c index 73a3361..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,6 +479,24 @@ 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 @@ -488,9 +506,7 @@ check_for_calendar (gpointer user_data) 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"); @@ -519,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); @@ -979,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); diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index 10c6dde..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, @@ -1262,7 +1264,7 @@ 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); + GtkWidget * hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); #else GtkWidget * hbox = gtk_hbox_new(FALSE, 4); #endif @@ -1477,7 +1479,7 @@ new_timezone_item(DbusmenuMenuitem * newitem, 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); + GtkWidget * hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4); #else GtkWidget * hbox = gtk_hbox_new(FALSE, 4); #endif @@ -1556,3 +1558,9 @@ get_accessible_desc (IndicatorObject * io) } return NULL; } + +static const gchar * +get_name_hint (IndicatorObject * io) +{ + return PACKAGE_NAME; +} |