diff options
author | JP Rosevear <jpr@ximian.com> | 2002-03-30 05:45:33 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2002-03-30 05:45:33 +0800 |
commit | a3aae682ce9911e451faae370ed4e88b2d6f4a2a (patch) | |
tree | 2f1fdfd7de8ec1d25d2891ac9497b283f2d30410 /calendar/gui/dialogs | |
parent | 5b8bbd736fce436933bbb1f6f02df36c1b86a5fc (diff) | |
download | gsoc2013-evolution-a3aae682ce9911e451faae370ed4e88b2d6f4a2a.tar.gz gsoc2013-evolution-a3aae682ce9911e451faae370ed4e88b2d6f4a2a.tar.zst gsoc2013-evolution-a3aae682ce9911e451faae370ed4e88b2d6f4a2a.zip |
implement new pop up menu items for "Save as", "Print", "Assign Task",
2002-03-29 JP Rosevear <jpr@ximian.com>
* gui/e-calendar-table.c: implement new pop up menu items for
"Save as", "Print", "Assign Task", "Forward as iCalendar"
* gui/e-day-view.c: similarly, also "Publish Free/Busy
Information" and "New Meeting" and "New Task"
* gui/e-week-view.c: ditto
* gui/dialogs/task-editor.c (show_assignment): move the assignment
page stuff here
(task_editor_show_assignment): use it
(assign_task_cmd): ditto
* gui/dialogs/task-editor.h: new proto
* gui/dialogs/comp-editor.c (save_as_cmd): use new e-util file
selector function
svn path=/trunk/; revision=16287
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 99 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 41 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.h | 4 |
3 files changed, 55 insertions, 89 deletions
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 7615e79589..cad55ebf08 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -38,6 +38,7 @@ #include <bonobo/bonobo-ui-container.h> #include <bonobo/bonobo-ui-util.h> #include <gal/widgets/e-unicode.h> +#include <e-util/e-dialog-utils.h> #include <evolution-shell-component-utils.h> #include "../print.h" #include "save-comp.h" @@ -1058,89 +1059,37 @@ save_close_cmd (GtkWidget *widget, gpointer data) } static void -save_as_ok (GtkWidget *widget, gpointer data) -{ - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - 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_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) { - g_warning ("Couldn't convert item to a string"); - gtk_main_quit (); - return; - } - - file = fopen (path, "w"); - if (file == NULL) { - g_warning ("Couldn't save item"); - gtk_main_quit (); - return; - } - - fprintf (file, ical_string); - g_free (ical_string); - fclose (file); - - gtk_main_quit (); - } -} - -static void save_as_cmd (GtkWidget *widget, gpointer data) { CompEditor *editor = COMP_EDITOR (data); CompEditorPrivate *priv; - GtkFileSelection *fs; - char *path; - + char *filename; + char *ical_string; + FILE *file; + priv = editor->priv; commit_all_fields (editor); - fs = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save As..."))); - path = g_strdup_printf ("%s/", g_get_home_dir ()); - gtk_file_selection_set_filename (fs, path); - g_free (path); - - 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_FUNC (gtk_main_quit), NULL); - - priv->filesel = GTK_WIDGET (fs); - gtk_widget_show (priv->filesel); - gtk_grab_add (priv->filesel); - gtk_main (); - - gtk_widget_destroy (priv->filesel); - priv->filesel = NULL; + filename = e_file_dialog_save (_("Save as...")); + if (filename == NULL) + return; + + ical_string = cal_client_get_component_as_string (priv->client, priv->comp); + if (ical_string == NULL) { + g_warning ("Couldn't convert item to a string"); + return; + } + + file = fopen (filename, "w"); + if (file == NULL) { + g_warning ("Couldn't save item"); + return; + } + + fprintf (file, ical_string); + g_free (ical_string); + fclose (file); } static void diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index c5c4d61826..1ede12fff3 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -42,7 +42,7 @@ struct _TaskEditorPrivate { EMeetingModel *model; - gboolean meeting_shown; + gboolean assignment_shown; gboolean existing_org; gboolean updating; }; @@ -134,7 +134,7 @@ set_menu_sens (TaskEditor *te) priv = te->priv; - sens = priv->meeting_shown; + sens = priv->assignment_shown; comp_editor_set_ui_prop (COMP_EDITOR (te), "/commands/ActionAssignTask", "sensitive", sens ? "0" : "1"); @@ -191,7 +191,7 @@ task_editor_init (TaskEditor *te) comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs); - priv->meeting_shown = TRUE; + priv->assignment_shown = TRUE; priv->existing_org = FALSE; priv->updating = FALSE; @@ -217,11 +217,11 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp) e_meeting_model_remove_all_attendees (priv->model); if (attendees == NULL) { comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page)); - priv->meeting_shown = FALSE; + priv->assignment_shown = FALSE; } else { GSList *l; - if (!priv->meeting_shown) + if (!priv->assignment_shown) comp_editor_append_page (COMP_EDITOR (te), COMP_EDITOR_PAGE (priv->meet_page), _("Assignment")); @@ -233,12 +233,12 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp) e_meeting_model_add_attendee (priv->model, ia); gtk_object_unref (GTK_OBJECT (ia)); } - priv->meeting_shown = TRUE; + priv->assignment_shown = TRUE; } cal_component_free_attendee_list (attendees); set_menu_sens (te); - comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown); + comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown); priv->updating = FALSE; @@ -312,27 +312,44 @@ task_editor_new (void) } static void -assign_task_cmd (GtkWidget *widget, gpointer data) +show_assignment (TaskEditor *te) { - TaskEditor *te = TASK_EDITOR (data); TaskEditorPrivate *priv; priv = te->priv; - if (!priv->meeting_shown) { + if (!priv->assignment_shown) { comp_editor_append_page (COMP_EDITOR (te), COMP_EDITOR_PAGE (priv->meet_page), _("Assignment")); - priv->meeting_shown = TRUE; + priv->assignment_shown = TRUE; set_menu_sens (te); - comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown); + comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown); + comp_editor_set_changed (COMP_EDITOR (te), TRUE); } comp_editor_show_page (COMP_EDITOR (te), COMP_EDITOR_PAGE (priv->meet_page)); } +void +task_editor_show_assignment (TaskEditor *te) +{ + g_return_if_fail (te != NULL); + g_return_if_fail (IS_TASK_EDITOR (te)); + + show_assignment (te); +} + +static void +assign_task_cmd (GtkWidget *widget, gpointer data) +{ + TaskEditor *te = TASK_EDITOR (data); + + show_assignment (te); +} + static void refresh_task_cmd (GtkWidget *widget, gpointer data) { diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h index 3f17b6e45f..e9888f446a 100644 --- a/calendar/gui/dialogs/task-editor.h +++ b/calendar/gui/dialogs/task-editor.h @@ -53,9 +53,9 @@ struct _TaskEditorClass { }; GtkType task_editor_get_type (void); -TaskEditor *task_editor_construct (TaskEditor *ee); +TaskEditor *task_editor_construct (TaskEditor *te); TaskEditor *task_editor_new (void); - +void task_editor_show_assignment(TaskEditor *te); #endif /* __TASK_EDITOR_H__ */ |