115 lines
5.1 KiB
Diff
115 lines
5.1 KiB
Diff
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
|
|
index 3544411..87d8fbd 100644
|
|
--- a/panels/datetime/cc-datetime-panel.c
|
|
+++ b/panels/datetime/cc-datetime-panel.c
|
|
@@ -229,6 +229,10 @@ clock_settings_changed_cb (CcDateTimePanel *self,
|
|
g_signal_handlers_unblock_by_func (self->timeformat_row, change_clock_settings, self);
|
|
}
|
|
|
|
+static void on_month_selection_changed_cb (CcDateTimePanel *self);
|
|
+
|
|
+static void time_changed_cb (CcDateTimePanel *self,
|
|
+ CcTimeEditor *editor);
|
|
|
|
/* Update the widgets based on the system time */
|
|
static void
|
|
@@ -242,9 +246,11 @@ update_time (CcDateTimePanel *self)
|
|
else
|
|
use_ampm = FALSE;
|
|
|
|
+ g_signal_handlers_block_by_func (self->time_editor, time_changed_cb, self);
|
|
cc_time_editor_set_time (self->time_editor,
|
|
g_date_time_get_hour (self->date),
|
|
g_date_time_get_minute (self->date));
|
|
+ g_signal_handlers_unblock_by_func (self->time_editor, time_changed_cb, self);
|
|
|
|
/* Update the time on the listbow row */
|
|
if (use_ampm)
|
|
@@ -259,7 +265,9 @@ update_time (CcDateTimePanel *self)
|
|
}
|
|
|
|
self->month = g_date_time_get_month (self->date);
|
|
+ g_signal_handlers_block_by_func (self->month_model, on_month_selection_changed_cb, self);
|
|
gtk_single_selection_set_selected (self->month_model, self->month - 1);
|
|
+ g_signal_handlers_unblock_by_func (self->month_model, on_month_selection_changed_cb, self);
|
|
gtk_label_set_text (self->datetime_label, label);
|
|
}
|
|
|
|
@@ -327,6 +335,10 @@ queue_set_datetime (CcDateTimePanel *self)
|
|
{
|
|
gint64 unixtime;
|
|
|
|
+ /* Don't set the time if we are using network time (NTP). */
|
|
+ if (gtk_switch_get_active (self->network_time_switch))
|
|
+ return;
|
|
+
|
|
/* timedated expects number of microseconds since 1 Jan 1970 UTC */
|
|
unixtime = g_date_time_to_unix (self->date);
|
|
|
|
@@ -381,9 +393,11 @@ change_date (CcDateTimePanel *self)
|
|
g_date_time_get_hour (old_date),
|
|
g_date_time_get_minute (old_date),
|
|
g_date_time_get_second (old_date));
|
|
+ g_signal_handlers_block_by_func (self->time_editor, time_changed_cb, self);
|
|
cc_time_editor_set_time (self->time_editor,
|
|
g_date_time_get_hour (self->date),
|
|
g_date_time_get_minute (self->date));
|
|
+ g_signal_handlers_unblock_by_func (self->time_editor, time_changed_cb, self);
|
|
|
|
queue_set_datetime (self);
|
|
}
|
|
@@ -765,7 +779,9 @@ setup_datetime_dialog (CcDateTimePanel *self)
|
|
|
|
/* Month */
|
|
self->month = g_date_time_get_month (self->date);
|
|
+ g_signal_handlers_block_by_func (self->month_model, on_month_selection_changed_cb, self);
|
|
gtk_single_selection_set_selected (self->month_model, self->month - 1);
|
|
+ g_signal_handlers_unblock_by_func (self->month_model, on_month_selection_changed_cb, self);
|
|
}
|
|
|
|
static int
|
|
@@ -859,11 +875,9 @@ cc_date_time_panel_class_init (CcDateTimePanelClass *klass)
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, panel_tz_selection_changed_cb);
|
|
gtk_widget_class_bind_template_callback (widget_class, list_box_row_activated);
|
|
- gtk_widget_class_bind_template_callback (widget_class, time_changed_cb);
|
|
gtk_widget_class_bind_template_callback (widget_class, change_clock_settings);
|
|
gtk_widget_class_bind_template_callback (widget_class, format_clock_name_cb);
|
|
gtk_widget_class_bind_template_callback (widget_class, on_date_box_row_activated_cb);
|
|
- gtk_widget_class_bind_template_callback (widget_class, on_month_selection_changed_cb);
|
|
|
|
bind_textdomain_codeset (GETTEXT_PACKAGE_TIMEZONES, "UTF-8");
|
|
|
|
@@ -988,6 +1002,11 @@ cc_date_time_panel_init (CcDateTimePanel *self)
|
|
* the model is filled up */
|
|
get_initial_timezone (self);
|
|
|
|
+ g_signal_connect_object (self->time_editor, "time-changed",
|
|
+ G_CALLBACK (time_changed_cb), self, G_CONNECT_SWAPPED);
|
|
+ g_signal_connect_object (self->month_model, "selection-changed",
|
|
+ G_CALLBACK (on_month_selection_changed_cb), self, G_CONNECT_SWAPPED);
|
|
+
|
|
/* Watch changes of timedated remote service properties */
|
|
g_signal_connect_object (self->dtm, "g-properties-changed",
|
|
G_CALLBACK (on_timedated_properties_changed), self, G_CONNECT_SWAPPED);
|
|
diff --git a/panels/datetime/cc-datetime-panel.ui b/panels/datetime/cc-datetime-panel.ui
|
|
index ebdb078..1fbb52c 100644
|
|
--- a/panels/datetime/cc-datetime-panel.ui
|
|
+++ b/panels/datetime/cc-datetime-panel.ui
|
|
@@ -37,7 +37,6 @@
|
|
<child>
|
|
<object class="CcTimeEditor" id="time_editor">
|
|
<property name="halign">center</property>
|
|
- <signal name="time-changed" handler="time_changed_cb" swapped="yes"/>
|
|
</object>
|
|
</child>
|
|
|
|
@@ -312,7 +311,6 @@
|
|
<property name="model">
|
|
<object class="GtkSingleSelection" id="month_model">
|
|
<property name="autoselect">False</property>
|
|
- <signal name="selection-changed" handler="on_month_selection_changed_cb" swapped="yes"/>
|
|
<property name="model">
|
|
<object class="GtkStringList">
|
|
<items>
|