aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-10 23:13:34 -0600
committerTed Gould <ted@gould.cx>2011-03-10 23:13:34 -0600
commitd5704c2079611bff30a3878443b2e47981095b2a (patch)
tree1b734b48c42cbf928050209305d1ed3f3fbebfa6
parent1177ae9dd0e27e41bed1e68b47019b89fb05831f (diff)
parent2fd5f32d9810dd1b7b7506d2fc1999d292cc33b3 (diff)
downloadayatana-indicator-datetime-d5704c2079611bff30a3878443b2e47981095b2a.tar.gz
ayatana-indicator-datetime-d5704c2079611bff30a3878443b2e47981095b2a.tar.bz2
ayatana-indicator-datetime-d5704c2079611bff30a3878443b2e47981095b2a.zip
* New upstream release.
* Fix handling of reoccruing events * Handle settings in the indicator * Allow for hiding the calendar and the clock
-rw-r--r--ChangeLog60
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac4
-rw-r--r--data/Makefile.am8
-rw-r--r--data/Makefile.in53
-rw-r--r--data/indicator-datetime-preferences.desktop14
-rw-r--r--data/indicator-datetime-preferences.desktop.in14
-rw-r--r--debian/changelog9
-rw-r--r--po/POTFILES.in1
-rw-r--r--src/datetime-prefs.c43
-rw-r--r--src/datetime-service.c95
-rw-r--r--src/indicator-datetime.c64
12 files changed, 279 insertions, 106 deletions
diff --git a/ChangeLog b/ChangeLog
index 7767504..c48a912 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,65 @@
# Generated by Makefile. Do not edit.
+2011-03-10 Ted Gould <ted@gould.cx>
+
+ 0.1.97
+
+2011-03-10 Ted Gould <ted@gould.cx>
+
+ Making it so the clock can be hidden entirely. Adding a desktop file to get to the preferences when it is hidden.
+
+2011-03-10 Michael Terry <mike@mterry.name>
+
+ make show-clock work
+
+2011-03-10 Ted Gould <ted@gould.cx>
+
+ Make showing the calendar into a property in the indicator
+
+2011-03-10 Michael Terry <mike@mterry.name>
+
+ make 'show monthly calendar' checkbox work
+
+2011-03-10 Ted Gould <ted@gould.cx>
+
+ Check to see if the service is running
+
+2011-03-10 Ted Gould <ted@gould.cx>
+
+ Use the shared header file for the service and interface names.
+
+2011-03-10 Michael Terry <mike@mterry.name>
+
+ prefs: only let user change clock prefs if the clock is running; don't connect to response signal, it's no longer a dialog
+
+2011-03-08 Ted Gould <ted@gould.cx>
+
+ Show the week numbers if configured to do so.
+
+2011-03-04 karl-qdh <karl@qdh.org.uk>
+
+ Fixed #729020 - Week numbers not respecting configuration on startup
+
+2011-03-07 Ted Gould <ted@gould.cx>
+
+ Fix the icon size lookup
+
+2011-03-04 karl-qdh <karl@qdh.org.uk>
+
+ Fix for gtk lookup icon size returning negative numbers
+
+2011-03-04 karl-qdh <karl@qdh.org.uk>
+
+ Few more minor cleanups
+
+2011-03-04 karl-qdh <karl@qdh.org.uk>
+
+ Merging back with trunk
+
+2011-03-04 karl-qdh <karl@qdh.org.uk>
+
+ Cleaning up a few dead comments and code
+
2011-03-03 Ted Gould <ted@gould.cx>
0.1.96
diff --git a/configure b/configure
index 9c58fb3..e600bc2 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for indicator-datetime 0.1.96.
+# Generated by GNU Autoconf 2.67 for indicator-datetime 0.1.97.
#
# Report bugs to <ted@canonical.com>.
#
@@ -703,8 +703,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='indicator-datetime'
PACKAGE_TARNAME='indicator-datetime'
-PACKAGE_VERSION='0.1.96'
-PACKAGE_STRING='indicator-datetime 0.1.96'
+PACKAGE_VERSION='0.1.97'
+PACKAGE_STRING='indicator-datetime 0.1.97'
PACKAGE_BUGREPORT='ted@canonical.com'
PACKAGE_URL=''
@@ -1502,7 +1502,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures indicator-datetime 0.1.96 to adapt to many kinds of systems.
+\`configure' configures indicator-datetime 0.1.97 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1573,7 +1573,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of indicator-datetime 0.1.96:";;
+ short | recursive ) echo "Configuration of indicator-datetime 0.1.97:";;
esac
cat <<\_ACEOF
@@ -1701,7 +1701,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-indicator-datetime configure 0.1.96
+indicator-datetime configure 0.1.97
generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -2072,7 +2072,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by indicator-datetime $as_me 0.1.96, which was
+It was created by indicator-datetime $as_me 0.1.97, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
@@ -2893,7 +2893,7 @@ fi
# Define the identity of the package.
PACKAGE=indicator-datetime
- VERSION=0.1.96
+ VERSION=0.1.97
cat >>confdefs.h <<_ACEOF
@@ -14964,7 +14964,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by indicator-datetime $as_me 0.1.96, which was
+This file was extended by indicator-datetime $as_me 0.1.97, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15030,7 +15030,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-indicator-datetime config.status 0.1.96
+indicator-datetime config.status 0.1.97
configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
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/Makefile.in b/data/Makefile.in
index 0b7b442..72f8311 100644
--- a/data/Makefile.in
+++ b/data/Makefile.in
@@ -76,8 +76,8 @@ am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(dbus_servicesdir)" \
- "$(DESTDIR)$(pkgdatadir)"
-DATA = $(dbus_services_DATA) $(pkgdata_DATA)
+ "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(pkgdatadir)"
+DATA = $(dbus_services_DATA) $(desktop_DATA) $(pkgdata_DATA)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALL_LINGUAS = @ALL_LINGUAS@
@@ -242,12 +242,16 @@ gsettings_SCHEMAS = \
dbus_servicesdir = $(DBUSSERVICEDIR)
dbus_services_DATA = indicator-datetime.service
pkgdata_DATA = datetime-dialog.ui
+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
all: all-am
.SUFFIXES:
@@ -307,6 +311,26 @@ uninstall-dbus_servicesDATA:
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(dbus_servicesdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(dbus_servicesdir)" && rm -f $$files
+install-desktopDATA: $(desktop_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(desktopdir)" || $(MKDIR_P) "$(DESTDIR)$(desktopdir)"
+ @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(desktopdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(desktopdir)" || exit $$?; \
+ done
+
+uninstall-desktopDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(desktop_DATA)'; test -n "$(desktopdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(desktopdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(desktopdir)" && rm -f $$files
install-pkgdataDATA: $(pkgdata_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)"
@@ -368,7 +392,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(DATA)
installdirs:
- for dir in "$(DESTDIR)$(dbus_servicesdir)" "$(DESTDIR)$(pkgdatadir)"; do \
+ for dir in "$(DESTDIR)$(dbus_servicesdir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(pkgdatadir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -417,7 +441,8 @@ info: info-am
info-am:
-install-data-am: install-dbus_servicesDATA install-pkgdataDATA
+install-data-am: install-dbus_servicesDATA install-desktopDATA \
+ install-pkgdataDATA
install-dvi: install-dvi-am
@@ -461,7 +486,8 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-dbus_servicesDATA uninstall-pkgdataDATA
+uninstall-am: uninstall-dbus_servicesDATA uninstall-desktopDATA \
+ uninstall-pkgdataDATA
.MAKE: install-am install-strip
@@ -469,20 +495,23 @@ uninstall-am: uninstall-dbus_servicesDATA uninstall-pkgdataDATA
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dbus_servicesDATA \
- install-dvi install-dvi-am install-exec install-exec-am \
- install-html install-html-am install-info install-info-am \
- install-man install-pdf install-pdf-am install-pkgdataDATA \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
+ install-desktopDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-pkgdataDATA install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
- uninstall-dbus_servicesDATA uninstall-pkgdataDATA
+ uninstall-dbus_servicesDATA uninstall-desktopDATA \
+ uninstall-pkgdataDATA
@GSETTINGS_RULES@
%.service: %.service.in
sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
+@INTLTOOL_DESKTOP_RULE@
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/data/indicator-datetime-preferences.desktop b/data/indicator-datetime-preferences.desktop
new file mode 100644
index 0000000..9871ecf
--- /dev/null
+++ b/data/indicator-datetime-preferences.desktop
@@ -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/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/debian/changelog b/debian/changelog
index 8dd94b7..d891caf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+indicator-datetime (0.1.97-0ubuntu1~ppa1) UNRELEASED; urgency=low
+
+ * New upstream release.
+ * Fix handling of reoccruing events
+ * Handle settings in the indicator
+ * Allow for hiding the calendar and the clock
+
+ -- Ted Gould <ted@ubuntu.com> Thu, 10 Mar 2011 23:10:55 -0600
+
indicator-datetime (0.1.96-0ubuntu1) natty; urgency=low
[ Ted Gould ]
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 3685c96..3a0a3f0 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -279,6 +279,7 @@ activate_cb (DbusmenuMenuitem * menuitem, guint timestamp, const gchar *command)
static gboolean
month_changed_cb (DbusmenuMenuitem * menuitem, GVariant *variant, guint timestamp)
{
+ // BLOCKED: We're not getting the signal from calendar the ido calendar menuitem
// TODO: * Decode the month/year from the string we received
// * Check what our current month/year are
// * Set some globals so when we-re-run update appointment menu items it gets the right start date
@@ -335,8 +336,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) {
@@ -404,8 +403,6 @@ update_timezone_menu_items(gpointer user_data) {
gboolean show = g_settings_get_boolean (conf, SETTINGS_SHOW_LOCATIONS_S);
- // TODO: Remove items from the dconflocations at the end of the iteration
- // Make sure if there are multiple locations, our current location is shown
if (len > 0) {
dbusmenu_menuitem_property_set_bool (locations_separator, DBUSMENU_MENUITEM_PROP_VISIBLE, show);
dbusmenu_menuitem_property_set_bool (current_location, DBUSMENU_MENUITEM_PROP_VISIBLE, show);
@@ -432,7 +429,6 @@ update_timezone_menu_items(gpointer user_data) {
}
}
g_strfreev (locations);
- // Get the evolution calendar timezone as a place and time and add it
return FALSE;
}
@@ -514,43 +510,16 @@ populate_appointment_instances (ECalComponent *comp,
// TODO: Convert the timezone into a 3 letter abbreviation if it's different to current_timezone
// TODO: Add the appointment timezone to the list if it's not already there.
-
- GSList *period_list = NULL, *l;
- if (e_cal_component_has_recurrences (comp)) {
- e_cal_component_get_rdate_list (comp, &period_list);
- g_debug("ECalComponent has recurrences");
- } else {
- g_debug("ECalComponent doesn't have recurrences");
- }
struct comp_instance *ci;
ci = g_new (struct comp_instance, 1);
- // Do we get rdate_list?
- if (period_list != NULL) {
- g_debug("Got recurring periods");
- for (l = period_list; l; l = l->next) {
- ECalComponentPeriod *period = l->data;
- struct tm tmp_tm = icaltimetype_to_tm_with_zone (&period->start, appointment_zone, current_zone);
- time_t start = mktime(&tmp_tm);
- g_debug("period time: %d", (int)start);
-
- tmp_tm = icaltimetype_to_tm_with_zone (&period->u.end, appointment_zone, current_zone);
- time_t end = mktime(&tmp_tm);
-
- if (start >= instance_start && end < instance_end) {
- ci->start = start;
- ci->end = end;
- }
- }
- } else {
- ci->start = instance_start;
- ci->end = instance_end;
- g_debug("Got no recurring periods set time to start %s, end %s", ctime(&instance_start), ctime(&instance_end));
- }
+ g_debug("Using times start %s, end %s", ctime(&instance_start), ctime(&instance_end));
ci->comp = comp;
ci->source = E_SOURCE(data);
+ ci->start = instance_start;
+ ci->end = instance_end;
comp_instances = g_list_append(comp_instances, ci);
return TRUE;
@@ -616,7 +585,7 @@ update_appointment_menu_items (gpointer user_data)
}
}
- // iterate the query for all sources
+ // Generate instances for all sources
for (g = e_source_list_peek_groups (sources); g; g = g->next) {
ESourceGroup *group = E_SOURCE_GROUP (g->data);
GSList *s;
@@ -634,23 +603,22 @@ update_appointment_menu_items (gpointer user_data)
continue;
}
- g_debug("Generating instances");
e_cal_generate_instances (ecal, t1, t2, (ECalRecurInstanceFn) populate_appointment_instances, (gpointer) source);
- g_debug("Number of objects returned: %d", g_list_length(comp_instances));
}
}
+ 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;
- i = 0;
gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, &width, &height);
- if (width == 0) width = 12;
- if (height == 0) height = 12;
+ if (width <= 0) width = 12;
+ if (height <= 0) height = 13;
+
+ i = 0;
for (l = sorted_comp_instances; l; l = l->next) {
struct comp_instance *ci = l->data;
ECalComponent *ecalcomp = ci->comp;
ECalComponentText valuetext;
- //ECalComponentDateTime datetime;
gchar *summary, *cmd;
char right[20];
//const gchar *uri;
@@ -675,19 +643,7 @@ update_appointment_menu_items (gpointer user_data)
dbusmenu_menuitem_property_set (item, APPOINTMENT_MENUITEM_PROP_LABEL, summary);
g_debug("Summary: %s", summary);
g_free (summary);
-
- //appointment_zone = icaltimezone_get_builtin_timezone_from_tzid(datetime.tzid);
- //current_zone = icaltimezone_get_builtin_timezone_from_tzid(current_timezone);
- //if (!appointment_zone || datetime.value->is_date) { // If it's today put in the current timezone?
- // appointment_zone = current_zone;
- //}
- // FIXME need to get the timezone of the above datetime,
- // and get the icaltimezone of the geoclue timezone/selected timezone (whichever is preferred)
- // TODO: Convert the timezone into a 3 letter abbreviation if it's different to current_timezone
- // TODO: Add the appointment timezone to the list if it's not already there.
-
- //tmp_tm = icaltimetype_to_tm_with_zone (datetime.value, appointment_zone, current_zone);
-
+
// Due text
ECalComponentVType vtype = e_cal_component_get_vtype (ecalcomp);
@@ -700,13 +656,9 @@ update_appointment_menu_items (gpointer user_data)
int year = today->tm_year;
struct tm *due;
- g_debug("Start time %s", ctime(&ci->start));
if (vtype == E_CAL_COMPONENT_EVENT) due = localtime(&ci->start);
else if (vtype == E_CAL_COMPONENT_TODO) due = localtime(&ci->end);
else continue;
-
- strftime(right, 20, "%a %l:%M %p", due);
- g_debug("Start time %s -> %s", asctime(due), right);
int dmday = due->tm_mday;
int dmon = due->tm_mon;
@@ -718,15 +670,8 @@ update_appointment_menu_items (gpointer user_data)
strftime(right, 20, "%a %l:%M %p", due);
g_debug("Appointment time: %s", right);
- //g_debug("Appointment timezone: %s", datetime.tzid);
- //g_debug("Appointment timezone: %s", icaltimezone_get_tzid(appointment_zone)); // These two should be the same
- //g_debug("Calendar timezone: %s", ecal_timezone);
-
dbusmenu_menuitem_property_set (item, APPOINTMENT_MENUITEM_PROP_RIGHT, right);
- //e_cal_component_free_datetime (&datetime);
-
-
// Now we pull out the URI for the calendar event and try to create a URI that'll work when we execute evolution
// FIXME Because the URI stuff is really broken, we're going to open the calendar at todays date instead
//e_cal_component_get_uid(ecalcomp, &uri);
@@ -746,11 +691,9 @@ update_appointment_menu_items (gpointer user_data)
// 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);
cairo_surface_t *surface = cairo_image_surface_create( CAIRO_FORMAT_ARGB32, width, height );
- // Width keeps becoming zero!!
- if (width == 0) width = 12;
- if (height == 0) height = 12;
+
cairo_t *cr = cairo_create(surface);
gdk_cairo_set_source_color(cr, &color);
cairo_paint(cr);
@@ -760,9 +703,6 @@ update_appointment_menu_items (gpointer user_data)
cairo_stroke(cr);
// Convert to pixbuf, in gtk3 this is done with gdk_pixbuf_get_from_surface
cairo_content_t content = cairo_surface_get_content (surface) | CAIRO_CONTENT_COLOR;
- // Width keeps becoming zero!!
- if (width == 0) width = 12;
- if (height == 0) height = 12;
GdkPixbuf *pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
!!(content & CAIRO_CONTENT_ALPHA),
8, width, height);
@@ -793,12 +733,13 @@ update_appointment_menu_items (gpointer user_data)
spixels += sstride;
dpixels += dstride;
}
-
- cairo_surface_destroy (surface);
- cairo_destroy(cr);
-
+
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);
}
+ 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
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 7659812..46ed0d9 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;
@@ -1221,6 +1272,15 @@ new_calendar_item (DbusmenuMenuitem * newitem,
IdoCalendarMenuItem *ido = IDO_CALENDAR_MENU_ITEM (ido_calendar_menu_item_new ());
self->priv->ido_calendar = ido;
+
+ GtkCalendarDisplayOptions flags = ido_calendar_menu_item_get_display_options (self->priv->ido_calendar);
+ if (self->priv->show_week_numbers == TRUE)
+ flags |= GTK_CALENDAR_SHOW_WEEK_NUMBERS;
+ 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);
@@ -1323,7 +1383,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) {