From 59b1e25cfdb4253a94df4392d1e2fb69a6901515 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 2 Jan 2001 18:16:45 +0000 Subject: Do not compose strings so that they can be localized correctly. Also, 2001-01-02 Federico Mena Quintero * gui/dialogs/delete-comp.c (delete_component_dialog): Do not compose strings so that they can be localized correctly. Also, convert from UTF8 into the font's encoding. Fixes bug #1030. * gui/e-calendar-table.c (delete_component): Pass the widget argument to delete_component_dialog(). * gui/e-day-view.c (e_day_view_on_delete_appointment): Likewise. * gui/e-week-view.c (e_week_view_on_delete_appointment): Likewise. * gui/event-editor.c (file_delete_cb): Likewise. * gui/calendar-commands.c: Use BONOBO_UI_VERB() instead of BONOBO_UI_UNSAFE_VERB(). Guess what, all of our handler signatures were wrong. * gui/event-editor.c: Likewise. * gui/dialogs/task-editor.c: Likewise. * gui/goto-dialog.glade: Added some spacing between the month/year widgets and the calendar widget. svn path=/trunk/; revision=7211 --- calendar/gui/dialogs/delete-comp.c | 52 +++++++++++++++++++++++++++----------- calendar/gui/dialogs/delete-comp.h | 2 +- calendar/gui/dialogs/task-editor.c | 32 +++++++++++------------ 3 files changed, 54 insertions(+), 32 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index 6133e0d908..97e1b69cd6 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -24,6 +24,7 @@ #endif #include +#include #include "delete-comp.h" @@ -31,6 +32,8 @@ /** * delete_component_dialog: * @comp: A calendar component. + * @widget: A widget to use as a basis for conversion from UTF8 into font + * encoding. * * Pops up a dialog box asking the user whether he wants to delete a particular * calendar component. @@ -38,31 +41,47 @@ * Return value: TRUE if the user clicked Yes, FALSE otherwise. **/ gboolean -delete_component_dialog (CalComponent *comp) +delete_component_dialog (CalComponent *comp, GtkWidget *widget) { CalComponentText summary; CalComponentVType vtype; - char *str; - char *type; + char *str, *tmp; GtkWidget *dialog; g_return_val_if_fail (comp != NULL, FALSE); g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); + g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); vtype = cal_component_get_vtype (comp); cal_component_get_summary (comp, &summary); switch (vtype) { case CAL_COMPONENT_EVENT: - type = _("Are you sure you want to delete the appointment"); + if (summary.value) + str = g_strdup_printf (_("Are you sure you want to delete the appointment " + "`%s'?"), summary.value); + else + str = g_strdup (_("Are you sure you want to delete this " + "untitled appointment?")); break; case CAL_COMPONENT_TODO: - type = _("Are you sure you want to delete the task"); + if (summary.value) + str = g_strdup_printf (_("Are you sure you want to delete the task " + "`%s'?"), summary.value); + else + str = g_strdup (_("Are you sure you want to delete this " + "untitled task?")); break; case CAL_COMPONENT_JOURNAL: - type = _("Are you sure you want to delete the journal entry"); + if (summary.value) + str = g_strdup_printf (_("Are you sure you want to delete the journal entry " + "`%s'?"), summary.value); + else + str = g_strdup (_("Are you sure want to delete this " + "untitled journal entry?")); break; default: @@ -70,16 +89,19 @@ delete_component_dialog (CalComponent *comp) return FALSE; } - if (summary.value) - str = g_strdup_printf ("%s `%s'?", type, summary.value); - else - str = g_strdup_printf ("%s?", type); - - dialog = gnome_question_dialog_modal (str, NULL, NULL); + tmp = e_utf8_to_gtk_string (widget, str); g_free (str); - if (gnome_dialog_run (GNOME_DIALOG (dialog)) == GNOME_YES) - return TRUE; - else + if (tmp) { + dialog = gnome_question_dialog_modal (tmp, NULL, NULL); + g_free (tmp); + + if (gnome_dialog_run (GNOME_DIALOG (dialog)) == GNOME_YES) + return TRUE; + else + return FALSE; + } else { + g_message ("delete_component_dialog(): Could not convert the string from UTF8"); return FALSE; + } } diff --git a/calendar/gui/dialogs/delete-comp.h b/calendar/gui/dialogs/delete-comp.h index 6747787fac..cae8531981 100644 --- a/calendar/gui/dialogs/delete-comp.h +++ b/calendar/gui/dialogs/delete-comp.h @@ -24,6 +24,6 @@ #include -gboolean delete_component_dialog (CalComponent *comp); +gboolean delete_component_dialog (CalComponent *comp, GtkWidget *widget); #endif diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 6cf73a3a72..ceac6c933d 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -138,12 +138,12 @@ static void set_title_from_comp (TaskEditor *tedit, CalComponent *comp); static void clear_widgets (TaskEditor *tedit); static void fill_widgets (TaskEditor *tedit); -static void file_save_cb (GtkWidget *widget, gpointer data); -static void file_save_and_close_cb (GtkWidget *widget, gpointer data); -static void file_delete_cb (GtkWidget *widget, gpointer data); -static void file_close_cb (GtkWidget *widget, gpointer data); +static void file_save_cb (BonoboUIComponent *uic, gpointer data, const char *path); +static void file_save_and_close_cb (BonoboUIComponent *uic, gpointer data, const char *path); +static void file_delete_cb (BonoboUIComponent *uic, gpointer data, const char *path); +static void file_close_cb (BonoboUIComponent *uic, gpointer data, const char *path); -static void debug_xml_cb (GtkWidget *widget, gpointer data); +static void debug_xml_cb (BonoboUIComponent *uic, gpointer data, const char *path); static void save_todo_object (TaskEditor *tedit); static void dialog_to_comp_object (TaskEditor *tedit); @@ -220,12 +220,12 @@ task_editor_new (void) static BonoboUIVerb verbs [] = { - BONOBO_UI_UNSAFE_VERB ("FileSave", file_save_cb), - BONOBO_UI_UNSAFE_VERB ("FileDelete", file_delete_cb), - BONOBO_UI_UNSAFE_VERB ("FileClose", file_close_cb), - BONOBO_UI_UNSAFE_VERB ("FileSaveAndClose", file_save_and_close_cb), - - BONOBO_UI_UNSAFE_VERB ("DebugDumpXml", debug_xml_cb), + BONOBO_UI_VERB ("FileSave", file_save_cb), + BONOBO_UI_VERB ("FileDelete", file_delete_cb), + BONOBO_UI_VERB ("FileClose", file_close_cb), + BONOBO_UI_VERB ("FileSaveAndClose", file_save_and_close_cb), + + BONOBO_UI_VERB ("DebugDumpXml", debug_xml_cb), BONOBO_UI_VERB_END }; @@ -999,7 +999,7 @@ dialog_to_comp_object (TaskEditor *tedit) } static void -debug_xml_cb (GtkWidget *widget, gpointer data) +debug_xml_cb (BonoboUIComponent *uic, gpointer data, const char *path) { TaskEditor *tedit = TASK_EDITOR (data); TaskEditorPrivate *priv = tedit->priv; @@ -1009,7 +1009,7 @@ debug_xml_cb (GtkWidget *widget, gpointer data) /* File/Save callback */ static void -file_save_cb (GtkWidget *widget, gpointer data) +file_save_cb (BonoboUIComponent *uic, gpointer data, const char *path) { TaskEditor *tedit; @@ -1019,7 +1019,7 @@ file_save_cb (GtkWidget *widget, gpointer data) /* File/Save and Close callback */ static void -file_save_and_close_cb (GtkWidget *widget, gpointer data) +file_save_and_close_cb (BonoboUIComponent *uic, gpointer data, const char *path) { TaskEditor *tedit; @@ -1030,7 +1030,7 @@ file_save_and_close_cb (GtkWidget *widget, gpointer data) /* File/Delete callback */ static void -file_delete_cb (GtkWidget *widget, gpointer data) +file_delete_cb (BonoboUIComponent *uic, gpointer data, const char *path) { TaskEditor *tedit; TaskEditorPrivate *priv; @@ -1056,7 +1056,7 @@ file_delete_cb (GtkWidget *widget, gpointer data) /* File/Close callback */ static void -file_close_cb (GtkWidget *widget, gpointer data) +file_close_cb (BonoboUIComponent *uic, gpointer data, const char *path) { TaskEditor *tedit; -- cgit v1.2.3