From 9177914543e3bd828cb6e88ec035a5f7648bcebe Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 5 Jan 2001 19:01:25 +0000 Subject: get categories button (init_widgets): listen for button click 2001-01-05 JP Rosevear * gui/event-editor.c (get_widgets): get categories button (init_widgets): listen for button click (fill_widgets): fill in the categories area (dialog_to_comp_object): set the cal component categories (categories_clicked): throw up the categories dialog and update when ok is clicked * gui/event-editor-dialog.glade: Add categories and contacts buttons and fields * gui/dialogs/task-editor-dialog.glade: Rename button svn path=/trunk/; revision=7270 --- calendar/ChangeLog | 14 +++++ calendar/gui/dialogs/task-editor-dialog.glade | 2 +- calendar/gui/dialogs/task-page.glade | 2 +- calendar/gui/event-editor-dialog.glade | 91 ++++++++++++++++++++++++++- calendar/gui/event-editor-dialog.glade.h | 76 ++++++++++++---------- calendar/gui/event-editor.c | 54 +++++++++++++++- 6 files changed, 198 insertions(+), 41 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 4e5aa6c068..ae3f5afda9 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,17 @@ +2001-01-05 JP Rosevear + + * gui/event-editor.c (get_widgets): get categories button + (init_widgets): listen for button click + (fill_widgets): fill in the categories area + (dialog_to_comp_object): set the cal component categories + (categories_clicked): throw up the categories dialog and update + when ok is clicked + + * gui/event-editor-dialog.glade: Add categories and contacts buttons + and fields + + * gui/dialogs/task-editor-dialog.glade: Rename button + 2001-01-05 JP Rosevear * gui/dialogs/task-editor.c (get_widgets): get categories button diff --git a/calendar/gui/dialogs/task-editor-dialog.glade b/calendar/gui/dialogs/task-editor-dialog.glade index e205b4c10d..272fa48e55 100644 --- a/calendar/gui/dialogs/task-editor-dialog.glade +++ b/calendar/gui/dialogs/task-editor-dialog.glade @@ -482,7 +482,7 @@ Confidential GtkButton - button3 + contacts-button True 0 diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade index e205b4c10d..272fa48e55 100644 --- a/calendar/gui/dialogs/task-page.glade +++ b/calendar/gui/dialogs/task-page.glade @@ -482,7 +482,7 @@ Confidential GtkButton - button3 + contacts-button True 0 diff --git a/calendar/gui/event-editor-dialog.glade b/calendar/gui/event-editor-dialog.glade index dea912be28..9304d425b1 100644 --- a/calendar/gui/event-editor-dialog.glade +++ b/calendar/gui/event-editor-dialog.glade @@ -362,6 +362,94 @@ + + + GtkHBox + hbox49 + False + 2 + + 0 + False + True + + + + GtkButton + categories-button + True + + 0 + False + False + + + + GtkLabel + label51 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 4 + 0 + + + + + GtkEntry + contacts + True + True + True + 0 + + + 0 + True + True + + + + + GtkButton + categories-button + True + + 0 + False + False + + + + GtkLabel + label52 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 4 + 0 + + + + + GtkEntry + categories + True + True + True + 0 + + + 0 + True + True + + + @@ -1258,7 +1346,6 @@ forever recurrence-exception-add True - GTK_RELIEF_NORMAL 0 False @@ -1271,7 +1358,6 @@ forever recurrence-exception-modify True - GTK_RELIEF_NORMAL 0 False @@ -1284,7 +1370,6 @@ forever recurrence-exception-delete True - GTK_RELIEF_NORMAL 0 False diff --git a/calendar/gui/event-editor-dialog.glade.h b/calendar/gui/event-editor-dialog.glade.h index f255687a6d..57c95fa0f6 100644 --- a/calendar/gui/event-editor-dialog.glade.h +++ b/calendar/gui/event-editor-dialog.glade.h @@ -1,52 +1,62 @@ /* - * Translatable strings file generated by extract-ui. - * Add this file to your project's POTFILES.in + * Translatable strings file generated by Glade. + * Add this file to your project's POTFILES.in. * DO NOT compile it as part of your application. */ +gchar *s = N_("event-editor-dialog"); +gchar *s = N_("Su_mmary:"); +gchar *s = N_("Time"); +gchar *s = N_("_Start time:"); +gchar *s = N_("_End time:"); gchar *s = N_("A_ll day event"); -gchar *s = N_("Add"); -gchar *s = N_("Appointment Basics"); gchar *s = N_("Classification"); -gchar *s = N_("Custom recurrence"); -gchar *s = N_("Delete"); -gchar *s = N_("Every"); -gchar *s = N_("Exceptions"); -gchar *s = N_("General"); -gchar *s = N_("Mail _to:"); -gchar *s = N_("Modify"); -gchar *s = N_("No recurrence"); -gchar *s = N_("Pri_vate"); gchar *s = N_("Pu_blic"); -gchar *s = N_("Recur on the"); -gchar *s = N_("Recurrence"); -gchar *s = N_("Recurrence Rule"); -gchar *s = N_("Reminder"); -gchar *s = N_("Simple recurrence"); -gchar *s = N_("Su_mmary:"); -gchar *s = N_("This appointment has custom recurrence rules that cannot be edited by Evolution."); - ""); - "However, the appointment will recur at the appropriate time and will be displayed properly in the calendar views."); -gchar *s = N_("Time"); -gchar *s = N_("_Audio"); +gchar *s = N_("Pri_vate"); gchar *s = N_("_Confidential"); +gchar *s = N_("_Contacts"); +gchar *s = N_("Ca_tegories..."); +gchar *s = N_("General"); +gchar *s = N_("Minutes\n" + "Hours\n" + "Days\n" + ""); +gchar *s = N_("Minutes\n" + "Hours\n" + "Days\n" + ""); +gchar *s = N_("Minutes\n" + "Hours\n" + "Days\n" + ""); +gchar *s = N_("Minutes\n" + "Hours\n" + "Days\n" + ""); gchar *s = N_("_Display"); -gchar *s = N_("_End time:"); -gchar *s = N_("_Mail"); gchar *s = N_("_Program"); +gchar *s = N_("_Mail"); +gchar *s = N_("Mail _to:"); gchar *s = N_("_Run program:"); gchar *s = N_("_Audio"); gchar *s = N_("Reminder"); gchar *s = N_("Appointment Basics"); gchar *s = N_("Su_mmary:"); gchar *s = N_("_Starting date:"); -gchar *s = N_("event-editor-dialog"); -gchar *s = N_("label21"); -gchar *s = N_("month(s)"); -gchar *s = N_("year(s)"); -gchar *s = N_("for"); -gchar *s = N_("until"); -gchar *s = N_("forever"); +gchar *s = N_("Recurrence Rule"); +gchar *s = N_("No recurrence"); +gchar *s = N_("Simple recurrence"); +gchar *s = N_("Custom recurrence"); +gchar *s = N_("Every"); +gchar *s = N_("day(s)\n" + "week(s)\n" + "month(s)\n" + "year(s)\n" + ""); +gchar *s = N_("for\n" + "until\n" + "forever\n" + ""); gchar *s = N_("Exceptions"); gchar *s = N_("Add"); gchar *s = N_("Modify"); diff --git a/calendar/gui/event-editor.c b/calendar/gui/event-editor.c index ea2f78ae10..f3adb24c91 100644 --- a/calendar/gui/event-editor.c +++ b/calendar/gui/event-editor.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "dialogs/delete-comp.h" #include "calendar-config.h" @@ -110,6 +111,9 @@ struct _EventEditorPrivate { GtkWidget *classification_private; GtkWidget *classification_confidential; + GtkWidget *categories; + GtkWidget *categories_btn; + GtkWidget *recurrence_summary; GtkWidget *recurrence_starting_date; @@ -188,6 +192,7 @@ static void field_changed (GtkWidget *widget, static void event_editor_set_changed (EventEditor *ee, gboolean changed); static gboolean prompt_to_save_changes (EventEditor *ee); +static void categories_clicked (GtkWidget *button, EventEditor *ee); @@ -941,6 +946,9 @@ get_widgets (EventEditor *ee) priv->classification_private = GW ("classification-private"); priv->classification_confidential = GW ("classification-confidential"); + priv->categories = GW ("categories"); + priv->categories_btn = GW ("categories-button"); + priv->recurrence_summary = GW ("recurrence-summary"); priv->recurrence_starting_date = GW ("recurrence-starting-date"); @@ -1091,6 +1099,10 @@ init_widgets (EventEditor *ee) gtk_signal_connect (GTK_OBJECT (priv->recurrence_summary), "changed", GTK_SIGNAL_FUNC (summary_changed_cb), priv->general_summary); + /* Categories button */ + gtk_signal_connect (GTK_OBJECT (priv->categories_btn), "clicked", + GTK_SIGNAL_FUNC (categories_clicked), ee); + /* Start dates in the main and recurrence pages */ gtk_signal_connect (GTK_OBJECT (priv->start_time), "changed", @@ -1860,7 +1872,8 @@ fill_widgets (EventEditor *ee) CalComponentDateTime d; GSList *l; time_t dtstart, dtend; - + const char *categories; + priv = ee->priv; clear_widgets (ee); @@ -1960,6 +1973,10 @@ fill_widgets (EventEditor *ee) */ } + /* Categories */ + cal_component_get_categories (priv->comp, &categories); + e_dialog_editable_set (priv->categories, categories); + /* Recurrences */ fill_recurrence_widgets (ee); @@ -2235,7 +2252,7 @@ dialog_to_comp_object (EventEditor *ee, CalComponent *comp) CalComponentDateTime date; time_t t; gboolean all_day_event; - char *str; + char *cat, *str; priv = ee->priv; @@ -2302,9 +2319,15 @@ dialog_to_comp_object (EventEditor *ee, CalComponent *comp) } else { /* FIXME: What do we do here? */ } - g_free (date.value); + /* Categories */ + cat = e_dialog_editable_get (priv->categories); + cal_component_set_categories (comp, cat); + + if (cat) + g_free (cat); + #if 0 ico->dalarm.enabled = e_dialog_toggle_get (priv->alarm_display); ico->aalarm.enabled = e_dialog_toggle_get (priv->alarm_program); @@ -3271,3 +3294,28 @@ prompt_to_save_changes (EventEditor *ee) break; } } + +static void +categories_clicked (GtkWidget *button, EventEditor *ee) +{ + char *categories; + GnomeDialog *dialog; + int result; + GtkWidget *entry; + + entry = ee->priv->categories; + categories = e_utf8_gtk_entry_get_text (GTK_ENTRY (entry)); + + dialog = GNOME_DIALOG (e_categories_new (categories)); + result = gnome_dialog_run (dialog); + g_free (categories); + + if (result == 0) { + gtk_object_get (GTK_OBJECT (dialog), + "categories", &categories, + NULL); + e_utf8_gtk_entry_set_text (GTK_ENTRY (entry), categories); + g_free (categories); + } + gtk_object_destroy (GTK_OBJECT (dialog)); +} -- cgit v1.2.3