aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--data/Makefile.am8
-rw-r--r--data/indicator-datetime-preferences.desktop.in14
-rw-r--r--po/POTFILES.in1
-rw-r--r--src/datetime-prefs.c43
-rw-r--r--src/datetime-service.c154
-rw-r--r--src/indicator-datetime.c76
7 files changed, 232 insertions, 68 deletions
diff --git a/configure.ac b/configure.ac
index 8764120..177c7e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,11 @@
-AC_INIT(indicator-datetime, 0.1.96, ted@canonical.com)
+AC_INIT(indicator-datetime, 0.1.97, ted@canonical.com)
AC_COPYRIGHT([Copyright 2009,2010 Canonical])
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-datetime, 0.1.96)
+AM_INIT_AUTOMAKE(indicator-datetime, 0.1.97)
AM_MAINTAINER_MODE
diff --git a/data/Makefile.am b/data/Makefile.am
index 669db77..b9a9532 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -12,9 +12,15 @@ dbus_services_DATA = indicator-datetime.service
pkgdata_DATA = datetime-dialog.ui
+@INTLTOOL_DESKTOP_RULE@
+desktopdir = $(datadir)/applications
+desktop_DATA = indicator-datetime-preferences.desktop
+
EXTRA_DIST = \
$(gsettings_SCHEMAS) \
datetime-dialog.ui \
+ indicator-datetime-preferences.desktop \
+ indicator-datetime-preferences.desktop.in \
indicator-datetime.service.in
-CLEANFILES = indicator-datetime.service
+CLEANFILES = indicator-datetime-preferences.desktop indicator-datetime.service
diff --git a/data/indicator-datetime-preferences.desktop.in b/data/indicator-datetime-preferences.desktop.in
new file mode 100644
index 0000000..f37765b
--- /dev/null
+++ b/data/indicator-datetime-preferences.desktop.in
@@ -0,0 +1,14 @@
+[Desktop Entry]
+Version=1.0
+
+_Name=Time & Date
+_Comment=Change your clock and date settings
+
+Icon=time-admin
+TryExec=indicator-datetime-preferences
+Exec=indicator-datetime-preferences
+
+StartupNotify=true
+
+Type=Application
+Categories=GNOME;GTK;Utility;DesktopSettings;Settings;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 84ce021..d22e5f9 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -5,3 +5,4 @@ src/datetime-prefs-locations.c
src/utils.c
src/settings-shared.h
[type: gettext/glade]data/datetime-dialog.ui
+data/indicator-datetime-preferences.desktop.in
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c
index 5248911..fbc88f2 100644
--- a/src/datetime-prefs.c
+++ b/src/datetime-prefs.c
@@ -35,6 +35,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <unique/unique.h>
#include <polkitgtk/polkitgtk.h>
+#include "dbus-shared.h"
#include "settings-shared.h"
#include "utils.h"
#include "datetime-prefs-locations.h"
@@ -225,7 +226,8 @@ tz_query_answered (GObject *object, GAsyncResult *res, gpointer user_data)
g_variant_unref (answers);
}
-void proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data)
+static void
+proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data)
{
GError * error = NULL;
@@ -244,6 +246,35 @@ void proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data)
NULL, tz_query_answered, NULL);
}
+static void
+service_name_owner_changed (GDBusProxy * proxy, GParamSpec *pspec, gpointer user_data)
+{
+ GtkWidget * widget = GTK_WIDGET (user_data);
+ gchar * owner = g_dbus_proxy_get_name_owner (proxy);
+
+ gtk_widget_set_sensitive (widget, (owner != NULL));
+
+ g_free (owner);
+}
+
+static void
+service_proxy_ready (GObject *object, GAsyncResult *res, gpointer user_data)
+{
+ GError * error = NULL;
+
+ proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+
+ if (error != NULL) {
+ g_critical("Could not grab DBus proxy for indicator-datetime-service: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+
+ /* And now, do initial proxy configuration */
+ g_signal_connect (proxy, "notify::g-name-owner", G_CALLBACK (service_name_owner_changed), user_data);
+ service_name_owner_changed (proxy, NULL, user_data);
+}
+
static gboolean
are_spinners_focused (void)
{
@@ -634,6 +665,15 @@ create_dialog (void)
"org.gnome.SettingsDaemon.DateTimeMechanism",
NULL, proxy_ready, NULL);
+ /* Grab proxy for datetime service, to see if it's running. It would
+ actually be more ideal to see if the indicator module itself is running,
+ but that doesn't yet claim a name on the bus. Presumably the service
+ would have been started by any such indicator, so this will at least tell
+ us if there *was* a datetime module run this session. */
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, NULL,
+ SERVICE_NAME, SERVICE_OBJ, SERVICE_IFACE,
+ NULL, service_proxy_ready, WIG ("showClockCheck"));
+
#undef WIG
g_object_unref (conf);
@@ -678,7 +718,6 @@ main (int argc, char ** argv)
unique_app_watch_window (app, GTK_WINDOW (dlg));
gtk_widget_show_all (dlg);
- g_signal_connect (dlg, "response", G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect (dlg, "destroy", G_CALLBACK(gtk_main_quit), NULL);
gtk_main ();
}
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 62fa435..18fa583 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -280,9 +280,6 @@ activate_cb (DbusmenuMenuitem * menuitem, guint timestamp, const gchar *command)
static gboolean
month_changed_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp)
{
- // BLOCKED: get type, then get type as string from the variant causes segfault in glib
- // TODO: * Set some globals so when we-re-run update appointment menu items it gets the right start date
- // * update appointment menu items
start_time_appointments = (time_t)g_variant_get_uint32(variant);
g_debug("Received month changed with timestamp: %d -> %s",(int)start_time_appointments, ctime(&start_time_appointments));
@@ -290,6 +287,37 @@ month_changed_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, g
return TRUE;
}
+static gboolean
+day_selected_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp)
+{
+ start_time_appointments = (time_t)g_variant_get_uint32(variant);
+
+ g_debug("Received day-selected with timestamp: %d -> %s",(int)start_time_appointments, ctime(&start_time_appointments));
+ update_appointment_menu_items(NULL);
+ return TRUE;
+}
+
+static gboolean
+day_selected_double_click_cb (DbusmenuMenuitem * menuitem, gchar *name, GVariant *variant, guint timestamp)
+{
+ time_t evotime = (time_t)g_variant_get_uint32(variant);
+
+ g_debug("Received day-selected-double-click with timestamp: %d -> %s",(int)evotime, ctime(&evotime));
+
+ gchar *ad = isodate_from_time_t(evotime);
+ gchar *cmd = g_strconcat("evolution calendar:///?startdate=", ad, NULL);
+
+ GError * error = NULL;
+
+ g_debug("Issuing command '%s'", cmd);
+ if (!g_spawn_command_line_async(cmd, &error)) {
+ g_warning("Unable to start %s: %s", (char *)cmd, error->message);
+ g_error_free(error);
+ }
+
+ return TRUE;
+}
+
static guint ecaltimer = 0;
static void
@@ -338,8 +366,6 @@ static gboolean
check_for_calendar (gpointer user_data)
{
g_return_val_if_fail (calendar != NULL, FALSE);
-
- if (!g_settings_get_boolean(conf, SETTINGS_SHOW_CALENDAR_S)) return FALSE;
gchar *evo = g_find_program_in_path("evolution");
if (evo != NULL) {
@@ -367,8 +393,10 @@ check_for_calendar (gpointer user_data)
stop_ecal_timer();
}
- // Connect to event::month-changed
+ // Connect to calendar events
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.");
@@ -545,7 +573,7 @@ update_appointment_menu_items (gpointer user_data)
if (updating_appointments) return TRUE;
updating_appointments = TRUE;
- time_t t1, t2;
+ time_t curtime = 0, t1 = 0, t2 = 0;
gchar *ad;
GList *l;
GSList *g;
@@ -553,19 +581,43 @@ update_appointment_menu_items (gpointer user_data)
gint i;
gint width = 0, height = 0;
ESourceList * sources = NULL;
+
+ // Get today & work out query times
+ time(&curtime);
+ struct tm *today = localtime(&curtime);
+ const int mday = today->tm_mday;
+ const int mon = today->tm_mon;
+ const int year = today->tm_year;
- if (start_time_appointments > 0)
- t1 = start_time_appointments;
- else
- time(&t1);
+ struct tm *start_tm = NULL;
+ int this_year = today->tm_year + 1900;
+ int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
+ if ((this_year % 400 == 0) || (this_year % 100 > 0 && this_year % 4 == 0)) days[1] = 29;
+
+ int highlightdays = days[mon] - mday + 1;
+ t1 = curtime; // By default the current time is the appointment start time.
+
+ if (start_time_appointments > 0) {
+ start_tm = localtime(&start_time_appointments);
+ int start_month = start_tm->tm_mon;
+ int start_year = start_tm->tm_year + 1900;
+ if ((start_month != mon) || (start_year != this_year)) {
+ // Set t1 to the start of that month.
+ struct tm month_start = {0};
+ month_start.tm_year = start_tm->tm_year;
+ month_start.tm_mon = start_tm->tm_mon;
+ month_start.tm_mday = 1;
+ t1 = mktime(&month_start);
+ highlightdays = days[mon];
+ }
+ }
+
+ g_debug("Will highlight %d days from %s", highlightdays, ctime(&t1));
- /* TODO: 7 days ahead of now, we actually need number_of_days_in_this_month
- * so we call "mark-day" for all remaining days in this month
- * N.B. Ideally we want any/all dates which are later than today to be marked.
- */
- t2 = t1 + (time_t) (7 * 24 * 60 * 60);
+ t2 = t1 + (time_t) (highlightdays * 24 * 60 * 60);
- // TODO Remove all highlights from the calendar widget
+ // Remove all highlights from the calendar widget
+ dbusmenu_menuitem_property_set (calendar, CALENDAR_MENUITEM_PROP_CLEAR_MARKS, NULL);
if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_EVENT, &gerror)) {
g_debug("Failed to get ecal sources\n");
@@ -590,7 +642,7 @@ update_appointment_menu_items (gpointer user_data)
for (s = e_source_group_peek_sources (group); s; s = s->next) {
ESource *source = E_SOURCE (s->data);
- //g_signal_connect (G_OBJECT(source), "changed", G_CALLBACK (update_appointment_menu_items), NULL);
+ g_signal_connect (G_OBJECT(source), "changed", G_CALLBACK (update_appointment_menu_items), NULL);
ECal *ecal = e_cal_new(source, E_CAL_SOURCE_TYPE_EVENT);
e_cal_set_auth_func (ecal, (ECalAuthFunc) auth_func, NULL);
@@ -607,7 +659,8 @@ update_appointment_menu_items (gpointer user_data)
g_debug("Number of ECalComponents returned: %d", g_list_length(comp_instances));
GList *sorted_comp_instances = g_list_sort(comp_instances, compare_comp_instances);
comp_instances = NULL;
-
+ g_debug("Components sorted");
+
/* Remove all of the previous appointments */
if (appointments != NULL) {
g_debug("Freeing old appointments");
@@ -646,13 +699,34 @@ update_appointment_menu_items (gpointer user_data)
char right[20];
//const gchar *uri;
DbusmenuMenuitem * item;
-
- g_debug("Start Object %p", ecalcomp);
- // TODO Mark days
+ ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp);
+ struct tm *due = NULL;
+ if (vtype == E_CAL_COMPONENT_EVENT) due = localtime(&ci->start);
+ else if (vtype == E_CAL_COMPONENT_TODO) due = localtime(&ci->end);
+ else continue;
+
+ const int dmday = due->tm_mday;
+ const int dmon = due->tm_mon;
+ const int dyear = due->tm_year;
+
+ // Mark day
+ g_debug("Marking date %s", ctime(&ci->start));
+ dbusmenu_menuitem_property_set_int (calendar, CALENDAR_MENUITEM_PROP_MARK, due->tm_mday);
+
+
+ // If the appointment time is less than the selected date,
+ // don't create an appointment item for it.
+ if (vtype == E_CAL_COMPONENT_EVENT) {
+ if (ci->start < start_time_appointments) continue;
+ } else if (vtype == E_CAL_COMPONENT_TODO) {
+ if (ci->end < start_time_appointments) continue;
+ }
if (i >= 5) continue;
i++;
+
+ g_debug("Create menu item");
item = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_TYPE, APPOINTMENT_MENUITEM_TYPE);
@@ -668,25 +742,6 @@ update_appointment_menu_items (gpointer user_data)
g_free (summary);
// Due text
- ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp);
-
- // Get today
- time_t curtime = time(NULL);
- struct tm *today = localtime(&curtime);
-
- int mday = today->tm_mday;
- int mon = today->tm_mon;
- int year = today->tm_year;
-
- struct tm *due;
- if (vtype == E_CAL_COMPONENT_EVENT) due = localtime(&ci->start);
- else if (vtype == E_CAL_COMPONENT_TODO) due = localtime(&ci->end);
- else continue;
-
- int dmday = due->tm_mday;
- int dmon = due->tm_mon;
- int dyear = due->tm_year;
-
if (apt_output == SETTINGS_TIME_12_HOUR) {
if ((mday == dmday) && (mon == dmon) && (year == dyear))
strftime(right, 20, _(DEFAULT_TIME_12_FORMAT), due);
@@ -703,7 +758,6 @@ update_appointment_menu_items (gpointer user_data)
else
strftime(right, 20, _(DEFAULT_TIME_FORMAT_WITH_DAY), due);
}
-
g_debug("Appointment time: %s, for date %s", right, asctime(due));
dbusmenu_menuitem_property_set (item, APPOINTMENT_MENUITEM_PROP_RIGHT, right);
@@ -723,10 +777,9 @@ 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) {
- // Fixme causes segfault, but we have colours now yay!
GdkColor color;
gdk_color_parse (color_spec, &color);
- g_debug("Creating a cairo surface\n size, %d by %d", width, height);
+ 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);
@@ -771,13 +824,13 @@ update_appointment_menu_items (gpointer user_data)
dbusmenu_menuitem_property_set_image (item, APPOINTMENT_MENUITEM_PROP_ICON, pixbuf);
} else {
- g_debug("Creating pixbuf from surface failed\n Couldn't create new pixbuf for size, %d by %d", width, height);
+ g_debug("Creating pixbuf from surface failed");
}
cairo_surface_destroy (surface);
cairo_destroy(cr);
}
dbusmenu_menuitem_child_add_position (root, item, 2+i);
- appointments = g_list_append (appointments, item); // Keep track of the items here to make them east to remove
+ appointments = g_list_append (appointments, item); // Keep track of the items here to make them easy to remove
g_debug("Adding appointment: %p", item);
}
@@ -785,8 +838,8 @@ update_appointment_menu_items (gpointer user_data)
for (l = sorted_comp_instances; l; l = l->next) {
const struct comp_instance *ci = l->data;
g_object_unref(ci->comp);
- g_list_free(sorted_comp_instances);
}
+ g_list_free(sorted_comp_instances);
updating_appointments = FALSE;
g_debug("End of objects");
@@ -820,6 +873,12 @@ show_locations_changed (void)
check_timezone_sync();
}
+static void
+time_format_changed (void)
+{
+ update_appointment_menu_items(NULL);
+}
+
/* Does the work to build the default menu, really calls out
to other functions but this is the core to clean up the
main function. */
@@ -872,6 +931,7 @@ build_menus (DbusmenuMenuitem * root)
g_signal_connect (conf, "changed::" SETTINGS_SHOW_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL);
g_signal_connect (conf, "changed::" SETTINGS_LOCATIONS_S, G_CALLBACK (show_locations_changed), NULL);
g_signal_connect (conf, "changed::" SETTINGS_SHOW_EVENTS_S, G_CALLBACK (show_events_changed), NULL);
+ g_signal_connect (conf, "changed::" SETTINGS_TIME_FORMAT_S, G_CALLBACK (time_format_changed), NULL);
DbusmenuMenuitem * separator = dbusmenu_menuitem_new();
dbusmenu_menuitem_property_set(separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 6f69dac..1cdcd3f 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -76,6 +76,7 @@ struct _IndicatorDatetimePrivate {
gchar * time_string;
+ gboolean show_clock;
gint time_mode;
gboolean show_seconds;
gboolean show_date;
@@ -84,6 +85,7 @@ struct _IndicatorDatetimePrivate {
gboolean custom_show_seconds;
gboolean show_week_numbers;
+ gboolean show_calendar;
gint week_start;
guint idle_measure;
@@ -105,12 +107,14 @@ struct _IndicatorDatetimePrivate {
found and looked up. */
enum {
PROP_0,
+ PROP_SHOW_CLOCK,
PROP_TIME_FORMAT,
PROP_SHOW_SECONDS,
PROP_SHOW_DAY,
PROP_SHOW_DATE,
PROP_CUSTOM_TIME_FORMAT,
- PROP_SHOW_WEEK_NUMBERS
+ PROP_SHOW_WEEK_NUMBERS,
+ PROP_SHOW_CALENDAR
};
typedef struct _indicator_item_t indicator_item_t;
@@ -123,12 +127,14 @@ struct _indicator_item_t {
GtkWidget * right;
};
+#define PROP_SHOW_CLOCK_S "show-clock"
#define PROP_TIME_FORMAT_S "time-format"
#define PROP_SHOW_SECONDS_S "show-seconds"
#define PROP_SHOW_DAY_S "show-day"
#define PROP_SHOW_DATE_S "show-date"
#define PROP_CUSTOM_TIME_FORMAT_S "custom-time-format"
#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))
@@ -196,6 +202,13 @@ indicator_datetime_class_init (IndicatorDatetimeClass *klass)
io_class->get_accessible_desc = get_accessible_desc;
g_object_class_install_property (object_class,
+ PROP_SHOW_CLOCK,
+ g_param_spec_boolean(PROP_SHOW_CLOCK_S,
+ "Whether to show the clock in the menu bar.",
+ "Shows indicator-datetime in the shell's menu bar.",
+ TRUE, /* default */
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class,
PROP_TIME_FORMAT,
g_param_spec_int(PROP_TIME_FORMAT_S,
"A choice of which format should be used on the panel",
@@ -240,6 +253,13 @@ indicator_datetime_class_init (IndicatorDatetimeClass *klass)
"Shows the week numbers in the monthly calendar in indicator-datetime's menu.",
FALSE, /* default */
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class,
+ PROP_SHOW_CALENDAR,
+ g_param_spec_boolean(PROP_SHOW_CALENDAR_S,
+ "Whether to show the calendar.",
+ "Shows the monthly calendar in indicator-datetime's menu.",
+ TRUE, /* default */
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
return;
}
@@ -254,6 +274,7 @@ indicator_datetime_init (IndicatorDatetime *self)
self->priv->idle_measure = 0;
self->priv->max_width = 0;
+ self->priv->show_clock = TRUE;
self->priv->time_mode = SETTINGS_TIME_LOCALE;
self->priv->show_seconds = FALSE;
self->priv->show_date = FALSE;
@@ -270,6 +291,11 @@ indicator_datetime_init (IndicatorDatetime *self)
self->priv->settings = g_settings_new(SETTINGS_INTERFACE);
if (self->priv->settings != NULL) {
+ g_settings_bind(self->priv->settings,
+ SETTINGS_SHOW_CLOCK_S,
+ self,
+ PROP_SHOW_CLOCK_S,
+ G_SETTINGS_BIND_DEFAULT);
g_settings_bind_with_mapping(self->priv->settings,
SETTINGS_TIME_FORMAT_S,
self,
@@ -303,6 +329,11 @@ indicator_datetime_init (IndicatorDatetime *self)
self,
PROP_SHOW_WEEK_NUMBERS_S,
G_SETTINGS_BIND_DEFAULT);
+ g_settings_bind(self->priv->settings,
+ SETTINGS_SHOW_CALENDAR_S,
+ self,
+ PROP_SHOW_CALENDAR_S,
+ G_SETTINGS_BIND_DEFAULT);
} else {
g_warning("Unable to get settings for '" SETTINGS_INTERFACE "'");
}
@@ -478,6 +509,13 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec
gboolean update = FALSE;
switch(prop_id) {
+ case PROP_SHOW_CLOCK: {
+ if (g_value_get_boolean(value) != self->priv->show_clock) {
+ self->priv->show_clock = g_value_get_boolean(value);
+ gtk_widget_set_visible (GTK_WIDGET (self->priv->label), self->priv->show_clock);
+ }
+ break;
+ }
case PROP_TIME_FORMAT: {
gint newval = g_value_get_int(value);
if (newval != self->priv->time_mode) {
@@ -541,6 +579,13 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec
}
break;
}
+ case PROP_SHOW_CALENDAR: {
+ if (g_value_get_boolean(value) != self->priv->show_calendar) {
+ self->priv->show_calendar = g_value_get_boolean(value);
+ gtk_widget_set_visible (GTK_WIDGET (self->priv->ido_calendar), self->priv->show_calendar);
+ }
+ break;
+ }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
return;
@@ -581,6 +626,9 @@ get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspe
IndicatorDatetime * self = INDICATOR_DATETIME(object);
switch(prop_id) {
+ case PROP_SHOW_CLOCK:
+ g_value_set_boolean(value, self->priv->show_clock);
+ break;
case PROP_TIME_FORMAT:
g_value_set_int(value, self->priv->time_mode);
break;
@@ -599,6 +647,9 @@ get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspe
case PROP_SHOW_WEEK_NUMBERS:
g_value_set_boolean(value, self->priv->show_week_numbers);
break;
+ case PROP_SHOW_CALENDAR:
+ g_value_set_boolean(value, self->priv->show_calendar);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
return;
@@ -1105,7 +1156,6 @@ indicator_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant *value,
} else if (!g_strcmp0(prop, CALENDAR_MENUITEM_PROP_SET_DATE)) {
gsize size = 3;
const gint * array = g_variant_get_fixed_array(value, &size, sizeof(gint));
- // TODO: Needs ido branch merged - lp:~karl-qdh/ido/select-activate-set-date
ido_calendar_menu_item_set_date (IDO_CALENDAR_MENU_ITEM (mi_data), array[0], array[1], array[2]);
} else {
g_warning("Indicator Item property '%s' unknown", prop);
@@ -1207,13 +1257,10 @@ month_changed_cb (IdoCalendarMenuItem *ido,
guint timestamp = (guint)time(NULL);
dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "month-changed", variant, timestamp);
}
-
-// TODO: Needs ido branch merged - lp:~karl-qdh/ido/select-activate-set-date
-/*
+
static void
day_selected_cb (IdoCalendarMenuItem *ido,
- guint day,
- gpointer user_data)
+ gpointer user_data)
{
guint d,m,y;
DbusmenuMenuitem * item = DBUSMENU_MENUITEM (user_data);
@@ -1231,7 +1278,6 @@ day_selected_cb (IdoCalendarMenuItem *ido,
static void
day_selected_double_click_cb (IdoCalendarMenuItem *ido,
- guint day,
gpointer user_data)
{
guint d,m,y;
@@ -1247,8 +1293,6 @@ day_selected_double_click_cb (IdoCalendarMenuItem *ido,
guint timestamp = (guint)time(NULL);
dbusmenu_menuitem_handle_event(DBUSMENU_MENUITEM(item), "day-selected-double-click", variant, timestamp);
}
-*/
-
static gboolean
new_calendar_item (DbusmenuMenuitem * newitem,
@@ -1278,13 +1322,13 @@ new_calendar_item (DbusmenuMenuitem * newitem,
else
flags &= ~GTK_CALENDAR_SHOW_WEEK_NUMBERS;
ido_calendar_menu_item_set_display_options (self->priv->ido_calendar, flags);
-
+
+ gtk_widget_set_visible (GTK_WIDGET (self->priv->ido_calendar), self->priv->show_calendar);
+
dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, GTK_MENU_ITEM(ido), parent);
g_signal_connect_after(ido, "month-changed", G_CALLBACK(month_changed_cb), (gpointer)newitem);
-
- // TODO: Needs ido branch merged - lp:~karl-qdh/ido/select-activate-set-date
- /*g_signal_connect_after(ido, "day-selected", G_CALLBACK(day_selected_cb), (gpointer)newitem);
- g_signal_connect_after(ido, "day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), (gpointer)newitem);*/
+ g_signal_connect_after(ido, "day-selected", G_CALLBACK(day_selected_cb), (gpointer)newitem);
+ g_signal_connect_after(ido, "day-selected-double-click", G_CALLBACK(day_selected_double_click_cb), (gpointer)newitem);
return TRUE;
}
@@ -1385,7 +1429,7 @@ get_label (IndicatorObject * io)
g_signal_connect(G_OBJECT(self->priv->label), "screen-changed", G_CALLBACK(update_text_gravity), self);
guess_label_size(self);
update_label(self, NULL);
- gtk_widget_show(GTK_WIDGET(self->priv->label));
+ gtk_widget_set_visible(GTK_WIDGET (self->priv->label), self->priv->show_clock);
}
if (self->priv->timer == 0) {