aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--data/datetime-dialog.ui11
-rw-r--r--libmap/cc-timezone-map.c30
-rw-r--r--src/datetime-prefs-locations.c4
-rw-r--r--src/datetime-prefs-locations.h2
-rw-r--r--src/datetime-prefs.c20
-rw-r--r--src/datetime-service.c7
-rw-r--r--src/indicator-datetime.c16
-rw-r--r--src/timezone-completion.c10
9 files changed, 65 insertions, 39 deletions
diff --git a/configure.ac b/configure.ac
index b05f3f1..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
diff --git a/data/datetime-dialog.ui b/data/datetime-dialog.ui
index ead11d1..80b4fa6 100644
--- a/data/datetime-dialog.ui
+++ b/data/datetime-dialog.ui
@@ -10,7 +10,6 @@
<object class="GtkWindow" id="locationsDialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Locations</property>
- <property name="modal">True</property>
<property name="default_width">300</property>
<property name="default_height">200</property>
<property name="destroy_with_parent">True</property>
@@ -62,6 +61,11 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="addButton-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes">Add a Location…</property>
+ </object>
+ </child>
<child>
<object class="GtkImage" id="addImage">
<property name="visible">True</property>
@@ -82,6 +86,11 @@
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="removeButton-atkobject">
+ <property name="AtkObject::accessible-description" translatable="yes">Remove This Location</property>
+ </object>
+ </child>
<child>
<object class="GtkImage" id="removeImage">
<property name="visible">True</property>
diff --git a/libmap/cc-timezone-map.c b/libmap/cc-timezone-map.c
index 8e4a5b8..7b7d704 100644
--- a/libmap/cc-timezone-map.c
+++ b/libmap/cc-timezone-map.c
@@ -766,13 +766,23 @@ cc_timezone_map_draw (GtkWidget *widget,
gchar *file;
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)
+ alpha = 0.5;
+
/* paint background */
- gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0);
+ gdk_cairo_set_source_color (cr, &style->bg[gtk_widget_get_state (widget)]);
cairo_paint (cr);
+ gdk_cairo_set_source_pixbuf (cr, priv->background, 0, 0);
+ cairo_paint_with_alpha (cr, alpha);
/* paint watermark */
if (priv->watermark) {
@@ -788,13 +798,6 @@ cc_timezone_map_draw (GtkWidget *widget,
}
if (!priv->location) {
- /* Check if insensitive */
- if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) {
- cairo_set_source_rgba(cr, 1, 1, 1, 0.5);
- cairo_rectangle(cr, 0, 0, alloc.width, alloc.height);
- cairo_fill(cr);
- }
-
return TRUE;
}
@@ -820,7 +823,7 @@ cc_timezone_map_draw (GtkWidget *widget,
alloc.height, GDK_INTERP_BILINEAR);
gdk_cairo_set_source_pixbuf (cr, hilight, 0, 0);
- cairo_paint (cr);
+ cairo_paint_with_alpha (cr, alpha);
g_object_unref (hilight);
g_object_unref (orig_hilight);
}
@@ -843,17 +846,10 @@ cc_timezone_map_draw (GtkWidget *widget,
if (pin)
{
gdk_cairo_set_source_pixbuf (cr, pin, pointx - 8, pointy - 14);
- cairo_paint (cr);
+ cairo_paint_with_alpha (cr, alpha);
g_object_unref (pin);
}
- /* Check if insensitive */
- if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE) {
- cairo_set_source_rgba(cr, 1, 1, 1, 0.5);
- cairo_rectangle(cr, 0, 0, alloc.width, alloc.height);
- cairo_fill(cr);
- }
-
return TRUE;
}
diff --git a/src/datetime-prefs-locations.c b/src/datetime-prefs-locations.c
index 9d0a97a..6addac3 100644
--- a/src/datetime-prefs-locations.c
+++ b/src/datetime-prefs-locations.c
@@ -308,7 +308,7 @@ selection_changed (GtkTreeSelection * selection, GtkWidget * remove_button)
}
GtkWidget *
-datetime_setup_locations_dialog (GtkWindow * parent, CcTimezoneMap * map)
+datetime_setup_locations_dialog (CcTimezoneMap * map)
{
GError * error = NULL;
GtkBuilder * builder = gtk_builder_new ();
@@ -374,8 +374,6 @@ datetime_setup_locations_dialog (GtkWindow * parent, CcTimezoneMap * map)
g_object_set_data (G_OBJECT (dlg), "time-id", GINT_TO_POINTER(time_id));
update_times (dlg);
- gtk_window_set_transient_for (GTK_WINDOW (dlg), parent);
-
#undef WIG
g_object_unref (conf);
diff --git a/src/datetime-prefs-locations.h b/src/datetime-prefs-locations.h
index 1760567..e312894 100644
--- a/src/datetime-prefs-locations.h
+++ b/src/datetime-prefs-locations.h
@@ -28,7 +28,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
G_BEGIN_DECLS
-GtkWidget * datetime_setup_locations_dialog (GtkWindow * parent, CcTimezoneMap * map);
+GtkWidget * datetime_setup_locations_dialog (CcTimezoneMap * map);
G_END_DECLS
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c
index dfb94fe..4213ea9 100644
--- a/src/datetime-prefs.c
+++ b/src/datetime-prefs.c
@@ -53,6 +53,7 @@ GtkWidget * date_spin = NULL;
guint save_time_id = 0;
gboolean user_edited_time = FALSE;
gboolean changing_time = FALSE;
+GtkWidget * loc_dlg = NULL;
/* Turns the boolean property into a string gsettings */
static GVariant *
@@ -495,10 +496,25 @@ setup_time_spinners (GtkWidget * time, GtkWidget * date)
}
static void
+hide_locations ()
+{
+ if (loc_dlg != NULL)
+ gtk_widget_destroy (loc_dlg);
+}
+
+static void
show_locations (GtkWidget * button, GtkWidget * dlg)
{
- GtkWidget * locationsDlg = datetime_setup_locations_dialog (GTK_WINDOW (dlg), tzmap);
- gtk_widget_show_all (locationsDlg);
+ if (loc_dlg == NULL) {
+ loc_dlg = datetime_setup_locations_dialog (tzmap);
+ gtk_window_set_transient_for (GTK_WINDOW (loc_dlg), GTK_WINDOW (dlg));
+ g_signal_connect (loc_dlg, "destroy", G_CALLBACK (gtk_widget_destroyed), &loc_dlg);
+ g_signal_connect (dlg, "focus-in-event", G_CALLBACK (hide_locations), NULL);
+ gtk_widget_show_all (loc_dlg);
+ }
+ else {
+ gtk_window_present_with_time (GTK_WINDOW (loc_dlg), gtk_get_current_event_time ());
+ }
}
static gboolean
diff --git a/src/datetime-service.c b/src/datetime-service.c
index b166f3c..905128b 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -364,12 +364,13 @@ static gboolean
check_for_calendar (gpointer user_data)
{
g_return_val_if_fail (calendar != NULL, FALSE);
-
+ // Always enable the calendar even if it does nothing
+ dbusmenu_menuitem_property_set_bool(calendar, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
+ dbusmenu_menuitem_property_set_bool(calendar, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+
gchar *evo = g_find_program_in_path("evolution");
if (evo != NULL) {
g_debug("Found the calendar application: %s", evo);
- 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,
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 1cdcd3f..aed498d 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -525,7 +525,7 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec
}
break;
}
- case PROP_SHOW_SECONDS:
+ case PROP_SHOW_SECONDS: {
if (g_value_get_boolean(value) != self->priv->show_seconds) {
self->priv->show_seconds = !self->priv->show_seconds;
if (self->priv->time_mode != SETTINGS_TIME_CUSTOM) {
@@ -534,7 +534,8 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec
}
}
break;
- case PROP_SHOW_DAY:
+ }
+ case PROP_SHOW_DAY: {
if (g_value_get_boolean(value) != self->priv->show_day) {
self->priv->show_day = !self->priv->show_day;
if (self->priv->time_mode != SETTINGS_TIME_CUSTOM) {
@@ -542,7 +543,8 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec
}
}
break;
- case PROP_SHOW_DATE:
+ }
+ case PROP_SHOW_DATE: {
if (g_value_get_boolean(value) != self->priv->show_date) {
self->priv->show_date = !self->priv->show_date;
if (self->priv->time_mode != SETTINGS_TIME_CUSTOM) {
@@ -550,6 +552,7 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec
}
}
break;
+ }
case PROP_CUSTOM_TIME_FORMAT: {
const gchar * newstr = g_value_get_string(value);
if (g_strcmp0(newstr, self->priv->custom_string) != 0) {
@@ -585,11 +588,12 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec
gtk_widget_set_visible (GTK_WIDGET (self->priv->ido_calendar), self->priv->show_calendar);
}
break;
- }
- default:
+ }
+ default: {
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
return;
}
+ }
if (!update) {
return;
@@ -813,7 +817,7 @@ setup_timer (IndicatorDatetime * self, GDateTime * datetime)
if (self->priv->show_seconds ||
(self->priv->time_mode == SETTINGS_TIME_CUSTOM && self->priv->custom_show_seconds)) {
- self->priv->timer = g_timeout_add_full(G_PRIORITY_HIGH, 865, timer_func, self, NULL);
+ self->priv->timer = g_timeout_add_full(G_PRIORITY_HIGH, 999, timer_func, self, NULL);
} else {
if (datetime == NULL) {
datetime = g_date_time_new_now_local();
diff --git a/src/timezone-completion.c b/src/timezone-completion.c
index ab74219..ddeef29 100644
--- a/src/timezone-completion.c
+++ b/src/timezone-completion.c
@@ -134,14 +134,15 @@ json_parse_ready (GObject *object, GAsyncResult *res, gpointer user_data)
json_parser_load_from_stream_finish (JSON_PARSER (object), res, &error);
- if (priv->cancel && (error == NULL || error->code != G_IO_ERROR_CANCELLED)) {
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && priv->cancel) {
g_cancellable_reset (priv->cancel);
}
if (error != NULL) {
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ save_and_use_model (completion, priv->initial_model);
g_warning ("Could not parse geoname JSON data: %s", error->message);
g_error_free (error);
- save_and_use_model (completion, priv->initial_model);
return;
}
@@ -259,14 +260,15 @@ geonames_data_ready (GObject *object, GAsyncResult *res, gpointer user_data)
stream = g_file_read_finish (G_FILE (object), res, &error);
- if (priv->cancel && (error == NULL || error->code != G_IO_ERROR_CANCELLED)) {
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && priv->cancel) {
g_cancellable_reset (priv->cancel);
}
if (error != NULL) {
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ save_and_use_model (completion, priv->initial_model);
g_warning ("Could not connect to geoname lookup server: %s", error->message);
g_error_free (error);
- save_and_use_model (completion, priv->initial_model);
return;
}