diff options
-rw-r--r-- | calendar/ChangeLog | 15 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 281 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 4 |
4 files changed, 153 insertions, 151 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index fca6213ec1..f66e527185 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,20 @@ 2001-10-30 Federico Mena Quintero <federico@ximian.com> + Fix bug #10016. + + * gui/dialogs/comp-editor.c (comp_editor_merge_ui): Use + bonobo_ui_util_set_ui() instead of doing things by hand. Hmmm, if + only that function had a way of telling us whether it failed so + that we could avoid setting the verb list... + + * gui/dialogs/event-editor.c (event_editor_init): Do not pass the + filename with the full path so that Bonobo can find it in a smart + way. + + * gui/dialogs/task-editor.c (task_editor_init): Likewise. + +2001-10-30 Federico Mena Quintero <federico@ximian.com> + * gui/dialogs/delete-comp.c (delete_component_dialog): Use an EMessageBox instead of a gnome_dialog_question so that the label gets line breaking. Fixes bug #11260. diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 4f83b02dc4..77d0efaf22 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -59,12 +59,12 @@ struct _CompEditorPrivate { /* Toplevel window for the dialog */ GtkWidget *window; BonoboUIComponent *uic; - + /* Notebook to hold the pages */ GtkNotebook *notebook; GtkWidget *filesel; - + gboolean changed; gboolean needs_send; gboolean updating; @@ -120,15 +120,15 @@ static EPixmap pixmaps [] = }; static BonoboUIVerb verbs [] = { - BONOBO_UI_UNSAFE_VERB ("FileSave", save_cmd), - BONOBO_UI_UNSAFE_VERB ("FileSaveAndClose", save_close_cmd), + BONOBO_UI_UNSAFE_VERB ("FileSave", save_cmd), + BONOBO_UI_UNSAFE_VERB ("FileSaveAndClose", save_close_cmd), BONOBO_UI_UNSAFE_VERB ("FileSaveAs", save_as_cmd), - BONOBO_UI_UNSAFE_VERB ("FileDelete", delete_cmd), + BONOBO_UI_UNSAFE_VERB ("FileDelete", delete_cmd), BONOBO_UI_UNSAFE_VERB ("FilePrint", print_cmd), BONOBO_UI_UNSAFE_VERB ("FilePrintPreview", print_preview_cmd), BONOBO_UI_UNSAFE_VERB ("FilePrintSetup", print_setup_cmd), - BONOBO_UI_UNSAFE_VERB ("FileClose", close_cmd), - + BONOBO_UI_UNSAFE_VERB ("FileClose", close_cmd), + BONOBO_UI_VERB_END }; @@ -156,7 +156,7 @@ comp_editor_get_type (void) }; comp_editor_type = gtk_type_unique (GTK_TYPE_OBJECT, - &comp_editor_info); + &comp_editor_info); } return comp_editor_type; @@ -202,8 +202,8 @@ setup_widgets (CompEditor *editor) "/evolution/UIConf/kvps"); bonobo_ui_component_add_verb_list_with_data (priv->uic, verbs, editor); - bonobo_ui_util_set_ui (priv->uic, EVOLUTION_DATADIR, - "evolution-comp-editor.xml", + bonobo_ui_util_set_ui (priv->uic, EVOLUTION_DATADIR, + "evolution-comp-editor.xml", "evolution-calendar"); e_pixmaps_update (priv->uic, pixmaps); @@ -266,24 +266,24 @@ comp_editor_destroy (GtkObject *object) g_free (priv); editor->priv = NULL; - + if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } static gboolean -save_comp (CompEditor *editor) +save_comp (CompEditor *editor) { CompEditorPrivate *priv; CalComponent *clone; GList *l; - + priv = editor->priv; if (!priv->changed) return TRUE; - + clone = cal_component_clone (priv->comp); for (l = priv->pages; l != NULL; l = l->next) { if (!comp_editor_page_fill_component (l->data, clone)) { @@ -294,7 +294,7 @@ save_comp (CompEditor *editor) cal_component_commit_sequence (clone); gtk_object_unref (GTK_OBJECT (priv->comp)); priv->comp = clone; - + priv->updating = TRUE; if (!cal_client_update_object (priv->client, priv->comp)) { @@ -314,7 +314,7 @@ save_comp (CompEditor *editor) } static gboolean -save_comp_with_send (CompEditor *editor) +save_comp_with_send (CompEditor *editor) { CompEditorPrivate *priv; gboolean send; @@ -322,10 +322,10 @@ save_comp_with_send (CompEditor *editor) priv = editor->priv; send = priv->changed && priv->needs_send; - + if (!save_comp (editor)) return FALSE; - + if (send && send_component_dialog (priv->comp)) comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST); @@ -351,7 +351,7 @@ static gboolean prompt_to_save_changes (CompEditor *editor, gboolean send) { CompEditorPrivate *priv; - + priv = editor->priv; if (!priv->changed) @@ -378,7 +378,7 @@ static void close_dialog (CompEditor *editor) { CompEditorPrivate *priv; - + priv = editor->priv; g_assert (priv->window != NULL); @@ -392,25 +392,25 @@ close_dialog (CompEditor *editor) * comp_editor_set_changed: * @editor: A component editor * @changed: Value to set the changed state to - * + * * Set the dialog changed state to the given value **/ void comp_editor_set_changed (CompEditor *editor, gboolean changed) { CompEditorPrivate *priv; - + priv = editor->priv; - - priv->changed = changed; + + priv->changed = changed; } /** * comp_editor_get_changed: * @editor: A component editor - * + * * Gets the changed state of the dialog - * + * * Return value: A boolean indicating if the dialog is in a changed * state **/ @@ -418,35 +418,35 @@ gboolean comp_editor_get_changed (CompEditor *editor) { CompEditorPrivate *priv; - + priv = editor->priv; - - return priv->changed; + + return priv->changed; } /** * comp_editor_set_needs_send: * @editor: A component editor * @needs_send: Value to set the needs send state to - * + * * Set the dialog needs send state to the given value **/ void comp_editor_set_needs_send (CompEditor *editor, gboolean needs_send) { CompEditorPrivate *priv; - + priv = editor->priv; - + priv->needs_send = needs_send; } /** * comp_editor_get_needs_send: * @editor: A component editor - * + * * Gets the needs send state of the dialog - * + * * Return value: A boolean indicating if the dialog is in a needs send * state **/ @@ -454,9 +454,9 @@ gboolean comp_editor_get_needs_send (CompEditor *editor) { CompEditorPrivate *priv; - + priv = editor->priv; - + return priv->needs_send; } @@ -495,7 +495,7 @@ static void page_unmapped_cb (GtkWidget *page_widget, * @editor: A component editor * @page: A component editor page * @label: Label of the page - * + * * Appends a page to the editor notebook with the given label **/ void @@ -507,7 +507,7 @@ comp_editor_append_page (CompEditor *editor, GtkWidget *page_widget; GtkWidget *label_widget; gboolean is_first_page; - + g_return_if_fail (editor != NULL); g_return_if_fail (IS_COMP_EDITOR (editor)); g_return_if_fail (page != NULL); @@ -517,19 +517,19 @@ comp_editor_append_page (CompEditor *editor, priv = editor->priv; gtk_object_ref (GTK_OBJECT (page)); - + /* If we are editing something, fill the widgets with current info */ if (priv->comp != NULL) { CalComponent *comp; - + comp = comp_editor_get_current_comp (editor); comp_editor_page_fill_widgets (page, comp); gtk_object_unref (GTK_OBJECT (comp)); } - + page_widget = comp_editor_page_get_widget (page); g_assert (page_widget != NULL); - + label_widget = gtk_label_new (label); is_first_page = (priv->pages == NULL); @@ -565,7 +565,7 @@ comp_editor_append_page (CompEditor *editor, * comp_editor_remove_page: * @editor: A component editor * @page: A component editor page - * + * * Removes the page from the component editor **/ void @@ -574,14 +574,14 @@ comp_editor_remove_page (CompEditor *editor, CompEditorPage *page) CompEditorPrivate *priv; GtkWidget *page_widget; gint page_num; - + g_return_if_fail (editor != NULL); g_return_if_fail (IS_COMP_EDITOR (editor)); g_return_if_fail (page != NULL); g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); priv = editor->priv; - + page_widget = comp_editor_page_get_widget (page); page_num = gtk_notebook_page_num (priv->notebook, page_widget); gtk_notebook_remove_page (priv->notebook, page_num); @@ -592,10 +592,10 @@ comp_editor_remove_page (CompEditor *editor, CompEditorPage *page) /** * comp_editor_show_page: - * @editor: - * @page: - * - * + * @editor: + * @page: + * + * **/ void comp_editor_show_page (CompEditor *editor, CompEditorPage *page) @@ -603,14 +603,14 @@ comp_editor_show_page (CompEditor *editor, CompEditorPage *page) CompEditorPrivate *priv; GtkWidget *page_widget; gint page_num; - + g_return_if_fail (editor != NULL); g_return_if_fail (IS_COMP_EDITOR (editor)); g_return_if_fail (page != NULL); g_return_if_fail (IS_COMP_EDITOR_PAGE (page)); priv = editor->priv; - + page_widget = comp_editor_page_get_widget (page); page_num = gtk_notebook_page_num (priv->notebook, page_widget); gtk_notebook_set_page (priv->notebook, page_num); @@ -620,19 +620,19 @@ comp_editor_show_page (CompEditor *editor, CompEditorPage *page) * comp_editor_set_cal_client: * @editor: A component editor * @client: The calendar client to use - * + * * Sets the calendar client used by the editor to update components **/ void comp_editor_set_cal_client (CompEditor *editor, CalClient *client) { CompEditorClass *klass; - + g_return_if_fail (editor != NULL); g_return_if_fail (IS_COMP_EDITOR (editor)); klass = COMP_EDITOR_CLASS (GTK_OBJECT (editor)->klass); - + if (klass->set_cal_client) klass->set_cal_client (editor, client); } @@ -640,9 +640,9 @@ comp_editor_set_cal_client (CompEditor *editor, CalClient *client) /** * comp_editor_get_cal_client: * @editor: A component editor - * + * * Returns the calendar client of the editor - * + * * Return value: The calendar client of the editor **/ CalClient * @@ -702,7 +702,7 @@ static const char * make_icon_from_comp (CalComponent *comp) { CalComponentVType type; - + if (!comp) return EVOLUTION_ICONSDIR "/evolution-calendar-mini.png"; @@ -712,9 +712,9 @@ make_icon_from_comp (CalComponent *comp) return EVOLUTION_ICONSDIR "/buttons/new_appointment.png"; break; case CAL_COMPONENT_TODO: - return EVOLUTION_ICONSDIR "/buttons/new_task.png"; + return EVOLUTION_ICONSDIR "/buttons/new_task.png"; break; - default: + default: return EVOLUTION_ICONSDIR "/evolution-calendar-mini.png"; } } @@ -744,17 +744,17 @@ set_icon_from_comp (CompEditor *editor) } static void -fill_widgets (CompEditor *editor) +fill_widgets (CompEditor *editor) { CompEditorPrivate *priv; GList *l; - + priv = editor->priv; - + for (l = priv->pages; l != NULL; l = l->next) comp_editor_page_fill_widgets (l->data, priv->comp); -} - +} + static void real_set_cal_client (CompEditor *editor, CalClient *client) { @@ -775,9 +775,9 @@ real_set_cal_client (CompEditor *editor, CalClient *client) CAL_CLIENT_LOAD_LOADED); gtk_object_ref (GTK_OBJECT (client)); } - + if (priv->client) { - gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), + gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), editor); gtk_object_unref (GTK_OBJECT (priv->client)); } @@ -796,7 +796,7 @@ real_set_cal_client (CompEditor *editor, CalClient *client) } static void -real_edit_comp (CompEditor *editor, CalComponent *comp) +real_edit_comp (CompEditor *editor, CalComponent *comp) { CompEditorPrivate *priv; @@ -815,12 +815,12 @@ real_edit_comp (CompEditor *editor, CalComponent *comp) set_title_from_comp (editor); set_icon_from_comp (editor); - fill_widgets (editor); + fill_widgets (editor); } static void -real_send_comp (CompEditor *editor, CalComponentItipMethod method) +real_send_comp (CompEditor *editor, CalComponentItipMethod method) { CompEditorPrivate *priv; @@ -832,33 +832,33 @@ real_send_comp (CompEditor *editor, CalComponentItipMethod method) itip_send_comp (method, priv->comp); } - + /** * comp_editor_edit_comp: * @editor: A component editor * @comp: A calendar component - * + * * Starts the editor editing the given component **/ void comp_editor_edit_comp (CompEditor *editor, CalComponent *comp) { CompEditorClass *klass; - + g_return_if_fail (editor != NULL); g_return_if_fail (IS_COMP_EDITOR (editor)); g_return_if_fail (comp != NULL); g_return_if_fail (IS_CAL_COMPONENT (comp)); klass = COMP_EDITOR_CLASS (GTK_OBJECT (editor)->klass); - + if (klass->edit_comp) klass->edit_comp (editor, comp); } CalComponent * comp_editor_get_current_comp (CompEditor *editor) -{ +{ CompEditorPrivate *priv; CalComponent *comp; GList *l; @@ -879,9 +879,9 @@ comp_editor_get_current_comp (CompEditor *editor) /** * comp_editor_save_comp: - * @editor: - * - * + * @editor: + * + * **/ gboolean comp_editor_save_comp (CompEditor *editor, gboolean send) @@ -891,9 +891,9 @@ comp_editor_save_comp (CompEditor *editor, gboolean send) /** * comp_editor_delete_comp: - * @editor: - * - * + * @editor: + * + * **/ void comp_editor_delete_comp (CompEditor *editor) @@ -903,79 +903,70 @@ comp_editor_delete_comp (CompEditor *editor) /** * comp_editor_send_comp: - * @editor: - * @method: - * - * + * @editor: + * @method: + * + * **/ void comp_editor_send_comp (CompEditor *editor, CalComponentItipMethod method) { CompEditorClass *klass; - + g_return_if_fail (editor != NULL); g_return_if_fail (IS_COMP_EDITOR (editor)); klass = COMP_EDITOR_CLASS (GTK_OBJECT (editor)->klass); - + if (klass->send_comp) klass->send_comp (editor, method); } /** * comp_editor_merge_ui: - * @editor: - * @filename: - * @verbs: - * - * + * @editor: + * @filename: + * @verbs: + * + * **/ void comp_editor_merge_ui (CompEditor *editor, const char *filename, BonoboUIVerb *verbs) { CompEditorPrivate *priv; - BonoboUIEngine *engine; - BonoboUINode *node; - const char *name; - + g_return_if_fail (editor != NULL); g_return_if_fail (IS_COMP_EDITOR (editor)); - - priv = editor->priv; - engine = bonobo_window_get_ui_engine (BONOBO_WINDOW (priv->window)); - node = bonobo_ui_util_new_ui (priv->uic, filename, "", - "evolution-calendar"); - g_assert (node != NULL); + priv = editor->priv; - name = bonobo_ui_component_get_name (priv->uic); - bonobo_ui_engine_xml_merge_tree (engine, "/", node, name); + bonobo_ui_util_set_ui (priv->uic, EVOLUTION_DATADIR, filename, "evolution-calendar"); bonobo_ui_component_add_verb_list_with_data (priv->uic, verbs, editor); } /** * comp_editor_set_ui_prop: - * @editor: - * @path: - * @attr: - * @val: - * - * + * @editor: + * @path: + * @attr: + * @val: + * + * **/ void -comp_editor_set_ui_prop (CompEditor *editor, +comp_editor_set_ui_prop (CompEditor *editor, const char *path, const char *attr, const char *val) { CompEditorPrivate *priv; - + g_return_if_fail (editor != NULL); g_return_if_fail (IS_COMP_EDITOR (editor)); - + priv = editor->priv; - bonobo_ui_component_set_prop (priv->uic, path, attr, val, NULL); + bonobo_ui_component_set_prop (priv->uic, path, attr, val, NULL); } @@ -991,7 +982,7 @@ raise_and_focus (GtkWidget *widget) /** * comp_editor_focus: * @editor: A component editor - * + * * Brings the editor window to the front and gives it focus **/ void @@ -1051,45 +1042,45 @@ save_as_ok (GtkWidget *widget, gpointer data) struct stat s; char *path; int ret = 0; - + priv = editor->priv; - + path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (priv->filesel)); - + if (stat (path, &s) == 0) { GtkWidget *dlg; GtkWidget *text; - + dlg = gnome_dialog_new (_("Overwrite file?"), - GNOME_STOCK_BUTTON_YES, + GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL); text = gtk_label_new (_("A file by that name already exists.\nOverwrite it?")); gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), text, TRUE, TRUE, 4); gtk_window_set_policy (GTK_WINDOW (dlg), FALSE, TRUE, FALSE); gtk_widget_show (text); - + ret = gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); } - + if (ret == 0) { FILE *file; gchar *ical_string; ical_string = cal_client_get_component_as_string (priv->client, priv->comp); - if (ical_string == NULL) { + if (ical_string == NULL) { g_warning ("Couldn't convert item to a string"); gtk_main_quit (); return; } file = fopen (path, "w"); - if (file == NULL) { + if (file == NULL) { g_warning ("Couldn't save item"); gtk_main_quit (); return; } - + fprintf (file, ical_string); g_free (ical_string); fclose (file); @@ -1105,9 +1096,9 @@ save_as_cmd (GtkWidget *widget, gpointer data) CompEditorPrivate *priv; GtkFileSelection *fs; char *path; - + priv = editor->priv; - + commit_all_fields (editor); fs = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save As..."))); @@ -1115,11 +1106,11 @@ save_as_cmd (GtkWidget *widget, gpointer data) gtk_file_selection_set_filename (fs, path); g_free (path); - gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked", + gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked", GTK_SIGNAL_FUNC (save_as_ok), editor); - gtk_signal_connect (GTK_OBJECT (fs->cancel_button), "clicked", + gtk_signal_connect (GTK_OBJECT (fs->cancel_button), "clicked", GTK_SIGNAL_FUNC (gtk_main_quit), NULL); - + priv->filesel = GTK_WIDGET (fs); gtk_widget_show (priv->filesel); gtk_grab_add (priv->filesel); @@ -1137,7 +1128,7 @@ delete_cmd (GtkWidget *widget, gpointer data) CalComponentVType vtype; priv = editor->priv; - + vtype = cal_component_get_vtype (priv->comp); if (delete_component_dialog (priv->comp, FALSE, 1, vtype, priv->window)) @@ -1149,7 +1140,7 @@ print_cmd (GtkWidget *widget, gpointer data) { CompEditor *editor = COMP_EDITOR (data); CalComponent *comp; - + commit_all_fields (editor); comp = comp_editor_get_current_comp (editor); @@ -1162,7 +1153,7 @@ print_preview_cmd (GtkWidget *widget, gpointer data) { CompEditor *editor = COMP_EDITOR (data); CalComponent *comp; - + commit_all_fields (editor); comp = comp_editor_get_current_comp (editor); @@ -1197,9 +1188,9 @@ page_changed_cb (GtkObject *obj, gpointer data) { CompEditor *editor = COMP_EDITOR (data); CompEditorPrivate *priv; - + priv = editor->priv; - + priv->changed = TRUE; } @@ -1208,10 +1199,10 @@ page_needs_send_cb (GtkObject *obj, gpointer data) { CompEditor *editor = COMP_EDITOR (data); CompEditorPrivate *priv; - + priv = editor->priv; - - priv->needs_send = TRUE; + + priv->needs_send = TRUE; } /* Page signal callbacks */ @@ -1221,13 +1212,13 @@ page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data) CompEditor *editor = COMP_EDITOR (data); CompEditorPrivate *priv; GList *l; - + priv = editor->priv; - + for (l = priv->pages; l != NULL; l = l->next) if (obj != l->data) comp_editor_page_set_summary (l->data, summary); - + priv->changed = TRUE; } @@ -1239,7 +1230,7 @@ page_dates_changed_cb (GtkObject *obj, CompEditor *editor = COMP_EDITOR (data); CompEditorPrivate *priv; GList *l; - + priv = editor->priv; for (l = priv->pages; l != NULL; l = l->next) @@ -1270,12 +1261,12 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data) gtk_object_unref (GTK_OBJECT (comp)); } else { GtkWidget *dlg; - + dlg = gnome_error_dialog (_("Unable to obtain current version!")); gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); } } - } + } } static void @@ -1284,11 +1275,11 @@ obj_removed_cb (CalClient *client, const char *uid, gpointer data) CompEditor *editor = COMP_EDITOR (data); CompEditorPrivate *priv; const char *edit_uid; - + priv = editor->priv; cal_component_get_uid (priv->comp, &edit_uid); - + if (!strcmp (uid, edit_uid) && !priv->updating) { if (changed_component_dialog (priv->comp, TRUE, priv->changed)) close_dialog (editor); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 574829209c..b592606dec 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -206,9 +206,7 @@ event_editor_init (EventEditor *ee) COMP_EDITOR_PAGE (priv->meet_page), _("Meeting")); - comp_editor_merge_ui (COMP_EDITOR (ee), EVOLUTION_DATADIR - "/gnome/ui/evolution-event-editor.xml", - verbs); + comp_editor_merge_ui (COMP_EDITOR (ee), "evolution-event-editor.xml", verbs); priv->meeting_shown = TRUE; priv->existing_org = FALSE; diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 44d1bfdef4..9956137c4c 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -189,9 +189,7 @@ task_editor_init (TaskEditor *te) COMP_EDITOR_PAGE (priv->meet_page), _("Assignment")); - comp_editor_merge_ui (COMP_EDITOR (te), EVOLUTION_DATADIR - "/gnome/ui/evolution-task-editor.xml", - verbs); + comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs); priv->meeting_shown = TRUE; priv->existing_org = FALSE; |