From 6aa1c3cfcd9fb7e4558d35dcb619ea7a1d1f6176 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sat, 29 Jan 2011 23:46:34 +0000 Subject: [PATCH] Also displaying the time (not setting it yet) --- po/fr.po | 15 ++++++++++----- src/todo.c | 42 +++++++++++++++++++++++++++++++++++------- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/po/fr.po b/po/fr.po index b325406..c25e08b 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Todo 0.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-01-30 00:24+0100\n" +"POT-Creation-Date: 2011-01-30 00:45+0100\n" "PO-Revision-Date: 2010-04-23 14:35+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: French\n" @@ -176,9 +176,14 @@ msgstr "Erreur" msgid "Are you sure you want to delete the selected task(s)?" msgstr "Voulez-vous vraiment supprimer la sélection?" -#: ../src/todo.c:890 ../src/todo.c:895 +#: ../src/todo.c:635 +msgid "Time: " +msgstr "Heure: " + +#: ../src/todo.c:640 ../src/todo.c:645 +msgid ":" +msgstr ":" + +#: ../src/todo.c:918 ../src/todo.c:923 msgid "Question" msgstr "Question" - -#~ msgid "_Select all" -#~ msgstr "Tout sélectionner" diff --git a/src/todo.c b/src/todo.c index a25a00e..74eb383 100644 --- a/src/todo.c +++ b/src/todo.c @@ -602,9 +602,12 @@ void todo_task_cursor_changed(Todo * todo) GdkRectangle rect; GtkWidget * popup; GtkWidget * vbox; + GtkWidget * hbox; time_t tim; struct tm t; GtkWidget * button; + GtkWidget * label; + GtkWidget * image; GtkWidget * calendar; gtk_tree_view_get_cursor(GTK_TREE_VIEW(todo->view), &path, &column); @@ -616,19 +619,45 @@ void todo_task_cursor_changed(Todo * todo) id = gtk_tree_view_column_get_sort_column_id(column); if(id == TD_COL_END || id == TD_COL_START) { - gtk_tree_view_get_cell_area(GTK_TREE_VIEW(todo->view), path, - column, &rect); + /* window */ popup = gtk_window_new(GTK_WINDOW_POPUP); + gtk_container_set_border_width(GTK_CONTAINER(popup), 4); + gtk_window_set_modal(GTK_WINDOW(popup), TRUE); + gtk_window_set_transient_for(GTK_WINDOW(popup), GTK_WINDOW( + todo->window)); vbox = gtk_vbox_new(FALSE, 4); + hbox = gtk_hbox_new(FALSE, 4); if((tim = (id == TD_COL_START) ? task_get_start(task) : task_get_end(task)) == 0) tim = time(NULL); localtime_r(&tim, &t); - button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); + /* time */ + label = gtk_label_new(_("Time: ")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); + button = gtk_spin_button_new_with_range(0.0, 23.0, 1.0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(button), t.tm_hour); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 0); + label = gtk_label_new(_(":")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); + button = gtk_spin_button_new_with_range(0.0, 59.0, 1.0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(button), t.tm_min); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 0); + label = gtk_label_new(_(":")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); + button = gtk_spin_button_new_with_range(0.0, 59.0, 1.0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(button), t.tm_sec); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, TRUE, 0); + /* close button */ + button = gtk_button_new(); + image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, + GTK_ICON_SIZE_MENU); + gtk_button_set_image(GTK_BUTTON(button), image); gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); g_signal_connect_swapped(G_OBJECT(button), "clicked", G_CALLBACK(gtk_widget_destroy), popup); - gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, TRUE, 0); + gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); + /* date */ calendar = gtk_calendar_new(); gtk_calendar_select_day(GTK_CALENDAR(calendar), t.tm_mday); gtk_calendar_select_month(GTK_CALENDAR(calendar), t.tm_mon, @@ -639,10 +668,9 @@ void todo_task_cursor_changed(Todo * todo) ? _task_cursor_changed_date_start : _task_cursor_changed_date_end), task); gtk_box_pack_start(GTK_BOX(vbox), calendar, FALSE, TRUE, 0); - gtk_window_set_modal(GTK_WINDOW(popup), TRUE); - gtk_window_set_transient_for(GTK_WINDOW(popup), GTK_WINDOW( - todo->window)); gtk_container_add(GTK_CONTAINER(popup), vbox); + gtk_tree_view_get_cell_area(GTK_TREE_VIEW(todo->view), path, + column, &rect); gtk_window_get_position(GTK_WINDOW(todo->window), &rect.width, &rect.height); gtk_window_move(GTK_WINDOW(popup), rect.width + rect.x,