aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-23 16:15:23 -0500
committerTed Gould <ted@gould.cx>2011-03-23 16:15:23 -0500
commit34527b0979874d373160f4a002e375456f0b7af2 (patch)
tree8e53c4213adf78b3a70a43e4536ecb024662661e
parent5df5bfccdadeeceb31d8e13244e02bc01af557d5 (diff)
parent1daab282087696f4e83dd0da5ffd794d94e3622a (diff)
downloadayatana-indicator-datetime-34527b0979874d373160f4a002e375456f0b7af2.tar.gz
ayatana-indicator-datetime-34527b0979874d373160f4a002e375456f0b7af2.tar.bz2
ayatana-indicator-datetime-34527b0979874d373160f4a002e375456f0b7af2.zip
Import upstream version 0.2.0
-rw-r--r--AUTHORS2
-rw-r--r--ChangeLog94
-rwxr-xr-xconfigure39
-rw-r--r--configure.ac7
-rw-r--r--data/datetime-dialog.ui2
-rw-r--r--src/datetime-service.c23
-rw-r--r--src/settings-shared.h8
-rw-r--r--src/timezone-completion.c103
-rw-r--r--src/utils.c6
9 files changed, 198 insertions, 86 deletions
diff --git a/AUTHORS b/AUTHORS
index b7081a3..f85aeeb 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,6 +1,8 @@
# Generated by Makefile. Do not edit.
David Barth
+ David Planella
+ Gabor Kelemen
karl-qdh
Ken VanDine
Kyle Nitzsche
diff --git a/ChangeLog b/ChangeLog
index 8448b10..f985eff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,99 @@
# Generated by Makefile. Do not edit.
+2011-03-23 Ted Gould <ted@gould.cx>
+
+ 0.2.0
+
+2011-03-23 Ted Gould <ted@gould.cx>
+
+ Make completion more robust
+
+2011-03-23 Michael Terry <mike@mterry.name>
+
+ make location completions a bit more robust in terms of when the popup is shown or not
+
+2011-03-23 Ted Gould <ted@gould.cx>
+
+ Ensure no duplicate entries
+
+2011-03-23 Michael Terry <mike@mterry.name>
+
+ avoid duplicates in geonames data
+
+2011-03-23 Ted Gould <ted@gould.cx>
+
+ Properly free'ing memory allocated in JSON structures
+
+2011-03-23 Michael Terry <mike@mterry.name>
+
+ one more free
+
+2011-03-23 Michael Terry <mike@mterry.name>
+
+ free json memory and sink model ref
+
+2011-03-23 Ted Gould <ted@gould.cx>
+
+ Strings and sniffle fixes for the best Canonical designer from New Zealand!
+
+2011-03-23 karl-qdh <karl@qdh.org.uk>
+
+ Removed comma from date time indicator
+
+2011-03-23 karl-qdh <karl@qdh.org.uk>
+
+ Date and time -> Date and month *sniffles*
+
+2011-03-23 karl-qdh <karl@qdh.org.uk>
+
+ String change and small behaviour change mpt tagged "sniffles"
+
+2011-03-23 Ted Gould <ted@gould.cx>
+
+ Handle cases of not being online, so we shouldn't complete
+
+2011-03-23 Michael Terry <mike@mterry.name>
+
+ use default matching algorithm when using initial_model (i.e. no internet)
+
+2011-03-22 Ted Gould <ted@gould.cx>
+
+ Removing the password dialog
+
+2011-03-17 karl-qdh <karl@qdh.org.uk>
+
+ Unused variable
+
+2011-03-17 karl-qdh <karl@qdh.org.uk>
+
+ Never prompt for password, causes segfault
+
+2011-03-22 Ted Gould <ted@gould.cx>
+
+ Translator comments and making the string translatable
+
+2011-03-21 Gabor Kelemen <kelemeng@gnome.hu>
+
+ Mark date format string as translatable, and add translator comment.
+
+ Fixes: LP:737326
+
+2011-03-22 Ted Gould <ted@gould.cx>
+
+ Adding additional translator comments
+
+2011-03-21 David Planella <david.planella@ubuntu.com>
+
+ Added translator comments to strftime strings
+
+2011-03-20 Ted Gould <ted@gould.cx>
+
+ Translator comment from answers
+
+2011-03-16 Ted Gould <ted@gould.cx>
+
+ Sadly, no more oobs for us.
+
2011-03-16 Ted Gould <ted@gould.cx>
0.1.98
diff --git a/configure b/configure
index 577ed72..bd49efa 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.98.
+# Generated by GNU Autoconf 2.67 for indicator-datetime 0.2.0.
#
# 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.98'
-PACKAGE_STRING='indicator-datetime 0.1.98'
+PACKAGE_VERSION='0.2.0'
+PACKAGE_STRING='indicator-datetime 0.2.0'
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.98 to adapt to many kinds of systems.
+\`configure' configures indicator-datetime 0.2.0 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.98:";;
+ short | recursive ) echo "Configuration of indicator-datetime 0.2.0:";;
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.98
+indicator-datetime configure 0.2.0
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.98, which was
+It was created by indicator-datetime $as_me 0.2.0, 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.98
+ VERSION=0.2.0
cat >>confdefs.h <<_ACEOF
@@ -12223,7 +12223,6 @@ GIO_REQUIRED_VERSION=2.25.11
# Note: the GIO check below also ensures the proper glib with gsettings support is present
INDICATOR_DISPLAY_OBJECTS=0.2.2
GEOCLUE_REQUIRED_VERSION=0.12.0
-OOBS_REQUIRED_VERSION=2.31.0
ECAL_REQUIRED_VERSION=2.30
EDS_REQUIRED_VERSION=2.30
ICAL_REQUIRED_VERSION=0.44
@@ -12512,7 +12511,6 @@ if test -n "$SERVICE_CFLAGS"; then
libido-0.1 >= \$INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= \$GIO_REQUIRED_VERSION
geoclue >= \$GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= \$OOBS_REQUIRED_VERSION
libecal-1.2 >= \$ECAL_REQUIRED_VERSION
libical >= \$ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12526,7 +12524,6 @@ if test -n "$SERVICE_CFLAGS"; then
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12543,7 +12540,6 @@ if test -n "$SERVICE_CFLAGS"; then
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12567,7 +12563,6 @@ if test -n "$SERVICE_LIBS"; then
libido-0.1 >= \$INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= \$GIO_REQUIRED_VERSION
geoclue >= \$GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= \$OOBS_REQUIRED_VERSION
libecal-1.2 >= \$ECAL_REQUIRED_VERSION
libical >= \$ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12581,7 +12576,6 @@ if test -n "$SERVICE_LIBS"; then
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12598,7 +12592,6 @@ if test -n "$SERVICE_LIBS"; then
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12631,7 +12624,6 @@ fi
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12646,7 +12638,6 @@ fi
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12664,7 +12655,6 @@ fi
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12720,7 +12710,6 @@ if test -n "$SERVICE_CFLAGS"; then
libido-0.1 >= \$INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= \$GIO_REQUIRED_VERSION
geoclue >= \$GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= \$OOBS_REQUIRED_VERSION
libecal-1.2 >= \$ECAL_REQUIRED_VERSION
libical >= \$ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12734,7 +12723,6 @@ if test -n "$SERVICE_CFLAGS"; then
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12751,7 +12739,6 @@ if test -n "$SERVICE_CFLAGS"; then
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12775,7 +12762,6 @@ if test -n "$SERVICE_LIBS"; then
libido-0.1 >= \$INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= \$GIO_REQUIRED_VERSION
geoclue >= \$GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= \$OOBS_REQUIRED_VERSION
libecal-1.2 >= \$ECAL_REQUIRED_VERSION
libical >= \$ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12789,7 +12775,6 @@ if test -n "$SERVICE_LIBS"; then
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12806,7 +12791,6 @@ if test -n "$SERVICE_LIBS"; then
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12839,7 +12823,6 @@ fi
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12854,7 +12837,6 @@ fi
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -12872,7 +12854,6 @@ fi
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -14964,7 +14945,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.98, which was
+This file was extended by indicator-datetime $as_me 0.2.0, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15030,7 +15011,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.98
+indicator-datetime config.status 0.2.0
configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 88c7b20..ef49e53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,11 @@
-AC_INIT(indicator-datetime, 0.1.98, ted@canonical.com)
+AC_INIT(indicator-datetime, 0.2.0, 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.98)
+AM_INIT_AUTOMAKE(indicator-datetime, 0.2.0)
AM_MAINTAINER_MODE
@@ -58,7 +58,6 @@ GIO_REQUIRED_VERSION=2.25.11
# Note: the GIO check below also ensures the proper glib with gsettings support is present
INDICATOR_DISPLAY_OBJECTS=0.2.2
GEOCLUE_REQUIRED_VERSION=0.12.0
-OOBS_REQUIRED_VERSION=2.31.0
ECAL_REQUIRED_VERSION=2.30
EDS_REQUIRED_VERSION=2.30
ICAL_REQUIRED_VERSION=0.44
@@ -93,7 +92,6 @@ AS_IF([test "x$with_gtk" = x3],
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
@@ -109,7 +107,6 @@ AS_IF([test "x$with_gtk" = x3],
libido-0.1 >= $INDICATOR_DISPLAY_OBJECTS
gio-2.0 >= $GIO_REQUIRED_VERSION
geoclue >= $GEOCLUE_REQUIRED_VERSION
- liboobs-1 >= $OOBS_REQUIRED_VERSION
libecal-1.2 >= $ECAL_REQUIRED_VERSION
libical >= $ICAL_REQUIRED_VERSION
libedataserver-1.2 >= EDS_REQUIRED_VERSION
diff --git a/data/datetime-dialog.ui b/data/datetime-dialog.ui
index 7ec485f..7545227 100644
--- a/data/datetime-dialog.ui
+++ b/data/datetime-dialog.ui
@@ -474,7 +474,7 @@
</child>
<child>
<object class="GtkCheckButton" id="showDateTimeCheck">
- <property name="label" translatable="yes">_Date and time</property>
+ <property name="label" translatable="yes">_Date and month</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
diff --git a/src/datetime-service.c b/src/datetime-service.c
index 18fa583..65df77e 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -47,8 +47,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libical/icaltime.h>
#include <cairo/cairo.h>
-#include <oobs/oobs-timeconfig.h>
-
#include "datetime-interface.h"
#include "dbus-shared.h"
#include "settings-shared.h"
@@ -254,8 +252,8 @@ update_datetime (gpointer user_data)
return FALSE;
}
- /* Note: may require some localization tweaks */
- strftime(longstr, 128, "%A, %e %B %Y", ltime);
+ /* Translators: strftime(3) style date format on top of the menu when you click on the clock */
+ strftime(longstr, 128, _("%A, %e %B %Y"), ltime);
gchar * utf8 = g_locale_to_utf8(longstr, -1, NULL, NULL, NULL);
dbusmenu_menuitem_property_set(date, DBUSMENU_MENUITEM_PROP_LABEL, utf8);
@@ -373,11 +371,15 @@ check_for_calendar (gpointer user_data)
dbusmenu_menuitem_property_set_bool(calendar, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
dbusmenu_menuitem_property_set_bool(calendar, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+ dbusmenu_menuitem_property_set_bool(date, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
+ 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 Appointment"));
+ 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);
@@ -471,7 +473,6 @@ auth_func (ECal *ecal,
const gchar *key,
gpointer user_data)
{
- gboolean remember; // TODO: Is this useful? Should we be storing it somewhere?
ESource *source = e_cal_get_source (ecal);
gchar *auth_domain = e_source_get_duped_property (source, "auth-domain");
@@ -481,16 +482,6 @@ auth_func (ECal *ecal,
gchar *password = e_passwords_get_password (component_name, key);
- if (password == NULL) {
- password = e_passwords_ask_password (
- _("Enter password"),
- component_name, key, prompt,
- E_PASSWORDS_REMEMBER_FOREVER |
- E_PASSWORDS_SECRET |
- E_PASSWORDS_ONLINE,
- &remember, NULL);
- }
-
g_free (auth_domain);
return password;
diff --git a/src/settings-shared.h b/src/settings-shared.h
index ef1183c..cdbb063 100644
--- a/src/settings-shared.h
+++ b/src/settings-shared.h
@@ -53,7 +53,15 @@ enum {
#define DEFAULT_TIME_FORMAT DEFAULT_TIME_12_FORMAT
#define DEFAULT_TIME_FORMAT_WITH_DAY DEFAULT_TIME_12_FORMAT
+/* TRANSLATORS: A format string for the strftime function for
+ a clock showing the day of the week and the time in 12-hour format without
+ seconds. */
#define DEFAULT_TIME_12_FORMAT_WITH_DAY N_("%a %l:%M %p")
+
+/* TRANSLATORS: A format string for the strftime function for
+ a clock showing the day of the week and the time in 24-hour format without
+ seconds. Information is available in this Launchpad answer:
+ https://answers.launchpad.net/ubuntu/+source/indicator-datetime/+question/149752 */
#define DEFAULT_TIME_24_FORMAT_WITH_DAY N_("%a %H:%M")
#endif
diff --git a/src/timezone-completion.c b/src/timezone-completion.c
index f570c33..aaf6bdc 100644
--- a/src/timezone-completion.c
+++ b/src/timezone-completion.c
@@ -58,14 +58,33 @@ static void timezone_completion_finalize (GObject *object);
G_DEFINE_TYPE (TimezoneCompletion, timezone_completion, GTK_TYPE_ENTRY_COMPLETION);
+static gboolean
+match_func (GtkEntryCompletion *completion, const gchar *key,
+ GtkTreeIter *iter, gpointer user_data)
+{
+ // geonames does the work for us
+ return TRUE;
+}
+
static void
save_and_use_model (TimezoneCompletion * completion, GtkTreeModel * model)
{
TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE(completion);
- g_hash_table_insert (priv->request_table, g_strdup (priv->request_text), g_object_ref (model));
+ g_hash_table_insert (priv->request_table, g_strdup (priv->request_text), g_object_ref_sink (model));
+
+ if (model == priv->initial_model)
+ gtk_entry_completion_set_match_func (GTK_ENTRY_COMPLETION (completion), NULL, NULL, NULL);
+ else
+ gtk_entry_completion_set_match_func (GTK_ENTRY_COMPLETION (completion), match_func, NULL, NULL);
+
gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion), model);
gtk_entry_completion_complete (GTK_ENTRY_COMPLETION (completion));
+
+ /* By this time, the changed signal has come and gone. We didn't give a
+ model to use, so no popup appeared for user. Poke the entry again to show
+ popup in 300ms. */
+ g_signal_emit_by_name (priv->entry, "changed");
}
static void
@@ -74,6 +93,9 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
TimezoneCompletion * completion = TIMEZONE_COMPLETION (user_data);
TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE(completion);
GError * error = NULL;
+ const gchar * prev_name = NULL;
+ const gchar * prev_admin1 = NULL;
+ const gchar * prev_country = NULL;
json_parser_load_from_stream_finish (JSON_PARSER (object), res, &error);
@@ -98,8 +120,12 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
JsonReader * reader = json_reader_new (json_parser_get_root (JSON_PARSER (object)));
- if (!json_reader_is_array (reader))
+ if (!json_reader_is_array (reader)) {
+ g_warning ("Could not parse geoname JSON data");
+ save_and_use_model (completion, priv->initial_model);
+ g_object_unref (G_OBJECT (reader));
return;
+ }
gint i, count = json_reader_count_elements (reader);
for (i = 0; i < count; ++i) {
@@ -112,6 +138,7 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
const gchar * country = NULL;
const gchar * longitude = NULL;
const gchar * latitude = NULL;
+ gboolean skip = FALSE;
if (json_reader_read_member (reader, "name")) {
name = json_reader_get_string_value (reader);
json_reader_end_member (reader);
@@ -133,23 +160,37 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
json_reader_end_member (reader);
}
- GtkTreeIter iter;
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter,
- TIMEZONE_COMPLETION_ZONE, NULL,
- TIMEZONE_COMPLETION_NAME, name,
- TIMEZONE_COMPLETION_ADMIN1, admin1,
- TIMEZONE_COMPLETION_COUNTRY, country,
- TIMEZONE_COMPLETION_LONGITUDE, longitude,
- TIMEZONE_COMPLETION_LATITUDE, latitude,
- -1);
+ if (g_strcmp0(name, prev_name) == 0 &&
+ g_strcmp0(admin1, prev_admin1) == 0 &&
+ g_strcmp0(country, prev_country) == 0) {
+ // Sometimes the data will have duplicate entries that only differ
+ // in longitude and latitude. e.g. "rio de janeiro", "wellington"
+ skip = TRUE;
+ }
+
+ if (!skip) {
+ GtkTreeIter iter;
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ TIMEZONE_COMPLETION_ZONE, NULL,
+ TIMEZONE_COMPLETION_NAME, name,
+ TIMEZONE_COMPLETION_ADMIN1, admin1,
+ TIMEZONE_COMPLETION_COUNTRY, country,
+ TIMEZONE_COMPLETION_LONGITUDE, longitude,
+ TIMEZONE_COMPLETION_LATITUDE, latitude,
+ -1);
+ }
+
+ prev_name = name;
+ prev_admin1 = admin1;
+ prev_country = country;
}
json_reader_end_element (reader);
}
save_and_use_model (completion, GTK_TREE_MODEL (store));
- g_object_unref (G_OBJECT (store));
+ g_object_unref (G_OBJECT (reader));
}
static void
@@ -189,15 +230,6 @@ request_zones (TimezoneCompletion * completion)
return FALSE;
}
- const gchar * text = gtk_entry_get_text (priv->entry);
-
- gpointer data;
- if (g_hash_table_lookup_extended (priv->request_table, text, NULL, &data)) {
- gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion), GTK_TREE_MODEL (data));
- gtk_entry_completion_complete (GTK_ENTRY_COMPLETION (completion));
- return FALSE;
- }
-
/* Cancel any ongoing request */
if (priv->cancel) {
g_cancellable_cancel (priv->cancel);
@@ -205,6 +237,7 @@ request_zones (TimezoneCompletion * completion)
}
g_free (priv->request_text);
+ const gchar * text = gtk_entry_get_text (priv->entry);
priv->request_text = g_strdup (text);
gchar * escaped = g_uri_escape_string (text, NULL, FALSE);
@@ -225,7 +258,18 @@ entry_changed (GtkEntry * entry, TimezoneCompletion * completion)
if (priv->queued_request) {
g_source_remove (priv->queued_request);
}
- priv->queued_request = g_timeout_add (300, (GSourceFunc)request_zones, completion);
+
+ /* See if we've already got this one */
+ const gchar * text = gtk_entry_get_text (priv->entry);
+ gpointer data;
+ if (g_hash_table_lookup_extended (priv->request_table, text, NULL, &data)) {
+ gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion), GTK_TREE_MODEL (data));
+ }
+ else {
+ priv->queued_request = g_timeout_add (300, (GSourceFunc)request_zones, completion);
+ gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion), NULL);
+ }
+ gtk_entry_completion_complete (GTK_ENTRY_COMPLETION (completion));
}
void
@@ -233,6 +277,10 @@ timezone_completion_watch_entry (TimezoneCompletion * completion, GtkEntry * ent
{
TimezoneCompletionPrivate * priv = TIMEZONE_COMPLETION_GET_PRIVATE (completion);
+ if (priv->queued_request) {
+ g_source_remove (priv->queued_request);
+ priv->queued_request = 0;
+ }
if (priv->entry) {
g_source_remove (priv->changed_id);
g_object_remove_weak_pointer (G_OBJECT (priv->entry), (gpointer *)&priv->entry);
@@ -317,14 +365,6 @@ data_func (GtkCellLayout *cell_layout, GtkCellRenderer *cell,
g_value_unset (&country_val);
}
-static gboolean
-match_func (GtkEntryCompletion *completion, const gchar *key,
- GtkTreeIter *iter, gpointer user_data)
-{
- // geonames does the work for us
- return TRUE;
-}
-
static void
timezone_completion_class_init (TimezoneCompletionClass *klass)
{
@@ -345,7 +385,6 @@ timezone_completion_init (TimezoneCompletion * self)
priv->initial_model = GTK_TREE_MODEL (get_initial_model ());
- gtk_entry_completion_set_match_func (GTK_ENTRY_COMPLETION (self), match_func, NULL, NULL);
g_object_set (G_OBJECT (self),
"text-column", TIMEZONE_COMPLETION_NAME,
"popup-set-width", FALSE,
diff --git a/src/utils.c b/src/utils.c
index 7471926..537495b 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -181,9 +181,9 @@ generate_format_string_full (gboolean show_day, gboolean show_date)
g_return_val_if_fail(date_string != NULL, g_strdup(time_string));
/* TRANSLATORS: This is a format string passed to strftime to combine the
- date and the time. The value of "%s, %s" would result in a string like
- this in US English 12-hour time: 'Fri Jul 16, 11:50 AM' */
- return g_strdup_printf(T_("%s, %s"), date_string, time_string);
+ date and the time. The value of "%s %s" would result in a string like
+ this in US English 12-hour time: 'Fri Jul 16 11:50 AM' */
+ return g_strdup_printf(T_("%s %s"), date_string, time_string);
}
gchar *