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
This commit is contained in:
Anwar Sadath
2016-03-14 17:40:22 -03:00
committed by Georges Basile Stavracas Neto
parent 32c5c824e3
commit 14dc32891b
4 changed files with 20 additions and 10 deletions
+14 -8
View File
@@ -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;
return g_object_new (GCAL_TYPE_EDIT_DIALOG, NULL);
}
dialog = g_object_new (GCAL_TYPE_EDIT_DIALOG, NULL);
void
gcal_edit_dialog_set_time_format (GcalEditDialog *dialog,
gboolean use_24h_format)
{
g_return_if_fail (GCAL_IS_EDIT_DIALOG (dialog));
dialog->format_24h = format_24h;
if (dialog->format_24h != use_24h_format)
{
dialog->format_24h = use_24h_format;
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);
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
+4 -1
View File
@@ -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);
-1
View File
@@ -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));
+2
View File
@@ -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);