[gnome-calendar] edit-dialog: Respecting GNOME's 12/24 hour format
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] edit-dialog: Respecting GNOME's 12/24 hour format
- Date: Mon, 14 Mar 2016 20:40:48 +0000 (UTC)
commit 14dc32891bb21734afdb27ebf550e5e7d52fee95
Author: Anwar Sadath <sadath anwar17 gmail com>
Date: Tue Mar 15 01:58:20 2016 +0530
edit-dialog: Respecting GNOME's 12/24 hour format
The edit dialog time picker didnt take into account GNOME's hour format.
The edit dialog time picker didnt take into account GNOME's hour format because the desktop settings
clock-format from gcal-window was not passed to gcal-edit-dialog.
Now the data is passed through the function gcal_edit_dialog_time_format and everything works as required.
https://bugzilla.gnome.org/show_bug.cgi?id=703321
src/gcal-edit-dialog.c | 22 ++++++++++++++--------
src/gcal-edit-dialog.h | 5 ++++-
src/gcal-time-selector.c | 1 -
src/gcal-window.c | 2 ++
4 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 603bf92..41cc0e5 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -545,18 +545,24 @@ gcal_edit_dialog_all_day_changed (GtkWidget *widget,
/* Public API */
GtkWidget*
-gcal_edit_dialog_new (gboolean format_24h)
+gcal_edit_dialog_new (void)
{
- GcalEditDialog *dialog;
-
- dialog = g_object_new (GCAL_TYPE_EDIT_DIALOG, NULL);
+ return g_object_new (GCAL_TYPE_EDIT_DIALOG, NULL);
+}
- dialog->format_24h = format_24h;
+void
+gcal_edit_dialog_set_time_format (GcalEditDialog *dialog,
+ gboolean use_24h_format)
+{
+ g_return_if_fail (GCAL_IS_EDIT_DIALOG (dialog));
- gcal_time_selector_set_time_format (GCAL_TIME_SELECTOR (dialog->start_time_selector), format_24h);
- gcal_time_selector_set_time_format (GCAL_TIME_SELECTOR (dialog->end_time_selector), format_24h);
+ if (dialog->format_24h != use_24h_format)
+ {
+ dialog->format_24h = use_24h_format;
- return GTK_WIDGET (dialog);
+ gcal_time_selector_set_time_format (GCAL_TIME_SELECTOR (dialog->start_time_selector),
dialog->format_24h);
+ gcal_time_selector_set_time_format (GCAL_TIME_SELECTOR (dialog->end_time_selector), dialog->format_24h);
+ }
}
void
diff --git a/src/gcal-edit-dialog.h b/src/gcal-edit-dialog.h
index bd19258..1dff9a1 100644
--- a/src/gcal-edit-dialog.h
+++ b/src/gcal-edit-dialog.h
@@ -35,7 +35,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GcalEditDialog, gcal_edit_dialog, GCAL, EDIT_DIALOG, GtkDialog);
-GtkWidget* gcal_edit_dialog_new (gboolean format_24h);
+GtkWidget* gcal_edit_dialog_new (void);
void gcal_edit_dialog_set_event_is_new (GcalEditDialog *dialog,
gboolean event_is_new);
@@ -48,6 +48,9 @@ void gcal_edit_dialog_set_event (GcalEditDialog *d
void gcal_edit_dialog_set_manager (GcalEditDialog *dialog,
GcalManager *manager);
+void gcal_edit_dialog_set_time_format (GcalEditDialog *dialog,
+ gboolean use_24h_format);
+
GDateTime* gcal_edit_dialog_get_date_end (GcalEditDialog *dialog);
GDateTime* gcal_edit_dialog_get_date_start (GcalEditDialog *dialog);
diff --git a/src/gcal-time-selector.c b/src/gcal-time-selector.c
index 7eb9bfc..c9711e8 100644
--- a/src/gcal-time-selector.c
+++ b/src/gcal-time-selector.c
@@ -235,7 +235,6 @@ gcal_time_selector_class_init (GcalTimeSelectorClass *klass)
static void
gcal_time_selector_init (GcalTimeSelector *self)
{
- self->format_24h = TRUE;
self->time = g_date_time_new_now_local ();
gtk_widget_init_template (GTK_WIDGET (self));
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 7bcadbd..869bf11 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -1351,6 +1351,8 @@ gcal_window_constructed (GObject *object)
window->views[GCAL_WINDOW_VIEW_MONTH] = window->month_view;
window->views[GCAL_WINDOW_VIEW_YEAR] = window->year_view;
+ gcal_edit_dialog_set_time_format (GCAL_EDIT_DIALOG (window->edit_dialog), use_24h_format);
+
gcal_month_view_set_first_weekday (GCAL_MONTH_VIEW (window->views[GCAL_WINDOW_VIEW_MONTH]),
get_first_weekday ());
gcal_month_view_set_use_24h_format (GCAL_MONTH_VIEW (window->views[GCAL_WINDOW_VIEW_MONTH]),
use_24h_format);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]