aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
6 files changed, 40 insertions, 19 deletions
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;
}