Use the gtk2.6 secondary message text function now that there is a 2.4

emulation routine available.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13020 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton
2006-01-29 16:06:16 +00:00
parent 1bd014def0
commit 20752a73a5
4 changed files with 90 additions and 114 deletions

View File

@@ -793,8 +793,15 @@ gnc_main_window_prompt_for_save (GtkWidget *window)
GtkWidget *dialog; GtkWidget *dialog;
gint response; gint response;
const gchar *filename, *tmp; const gchar *filename, *tmp;
const gchar *title = _("Save changes to file %s before closing?");
#ifdef HIG_COMPLIANT #ifdef HIG_COMPLIANT
gint oldest_change, minutes; gint oldest_change, minutes;
const gchar *message =
_("If you don't save, changes from the past %d minutes will be discarded.");
#else
const gchar *message =
_("Changes have been made since the last time it was saved. If you "
"continue without saving these changes will be discarded.");
#endif #endif
session = qof_session_get_current_session(); session = qof_session_get_current_session();
@@ -819,32 +826,20 @@ gnc_main_window_prompt_for_save (GtkWidget *window)
* case scenario would be if QOF could provide a timestamp of the * case scenario would be if QOF could provide a timestamp of the
* oldest unsaved change. * oldest unsaved change.
*/ */
dialog = gtk_message_dialog_new(GTK_WINDOW(window),
GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
title,
filename);
#ifdef HIG_COMPLIANT #ifdef HIG_COMPLIANT
oldest_change = qof_book_time_changed(book); oldest_change = qof_book_time_changed(book);
minutes = (time() - oldest_change) / 60 + 1; minutes = (time() - oldest_change) / 60 + 1;
dialog = gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
gtk_message_dialog_new_with_markup (GTK_WINDOW(window), message, minutes);
GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
_("<b>Save changes to file %s before "
"closing?</b>\n\nIf you don't save, "
"changes from the past %d minutes "
"will be discarded."),
filename, minutes);
#else #else
dialog = gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
gtk_message_dialog_new_with_markup (GTK_WINDOW(window), message);
GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
_("<b>Save changes to file %s before "
"closing?</b>\n\nChanges have been "
"made since the last time it was "
"saved. If you continue without "
"saving these changes will be "
"discarded."),
filename);
#endif #endif
gtk_dialog_add_buttons(GTK_DIALOG(dialog), gtk_dialog_add_buttons(GTK_DIALOG(dialog),
@@ -879,6 +874,11 @@ gnc_main_window_delete_event (GtkWidget *window,
QofSession *session; QofSession *session;
GtkWidget *dialog; GtkWidget *dialog;
gint response; gint response;
const gchar *title = _("Quit Gnucash?");
const gchar *message =_("You are attempting to close the last "
"Gnucash window. Doing so will quit the "
"application. Are you sure that this is "
"what you want to do?");
if (g_list_length(active_windows) > 1) if (g_list_length(active_windows) > 1)
return FALSE; return FALSE;
@@ -893,17 +893,13 @@ gnc_main_window_delete_event (GtkWidget *window,
return TRUE; return TRUE;
} }
dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW(window), dialog = gtk_message_dialog_new(GTK_WINDOW(window),
GTK_DIALOG_MODAL, GTK_DIALOG_MODAL,
GTK_MESSAGE_WARNING, GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE, GTK_BUTTONS_NONE,
"<b>%s</b>\n\n%s", "%s", title);
_("Quit Gnucash?"), gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
_("You are attempting to close the last " "%s", message);
"Gnucash window. Doing so will quit the "
"application. Are you sure that this is "
"what you want to do?"));
gtk_dialog_add_buttons(GTK_DIALOG(dialog), gtk_dialog_add_buttons(GTK_DIALOG(dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_QUIT, GTK_RESPONSE_OK, GTK_STOCK_QUIT, GTK_RESPONSE_OK,

View File

@@ -147,13 +147,13 @@ remove_clicked (CommoditiesDialog *cd)
warning = "delete_commodity"; warning = "delete_commodity";
} }
dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(cd->dialog), dialog = gtk_message_dialog_new(GTK_WINDOW(cd->dialog),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION, GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE, GTK_BUTTONS_NONE,
"<b>%s</b>\n\n%s", "%s", _("Delete commodity?"));
_("Delete commodity?"), gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
message); "%s", message);
gtk_dialog_add_buttons(GTK_DIALOG(dialog), gtk_dialog_add_buttons(GTK_DIALOG(dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_DELETE, GTK_RESPONSE_OK, GTK_STOCK_DELETE, GTK_RESPONSE_OK,

View File

@@ -168,14 +168,13 @@ gnc_prices_dialog_remove_clicked (GtkWidget *widget, gpointer data)
"Are you sure you want to delete the %d selected prices?", "Are you sure you want to delete the %d selected prices?",
length), length),
length); length);
dialog = gtk_message_dialog_new_with_markup dialog = gtk_message_dialog_new(GTK_WINDOW(pdb_dialog->dialog),
(GTK_WINDOW(pdb_dialog->dialog), GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
GTK_BUTTONS_NONE, "%s", _("Delete prices?"));
"<b>%s</b>\n\n%s", gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
_("Delete prices?"), "%s", message);
message);
g_free(message); g_free(message);
gtk_dialog_add_buttons(GTK_DIALOG(dialog), gtk_dialog_add_buttons(GTK_DIALOG(dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,

View File

@@ -950,9 +950,9 @@ xaccTransWarnReadOnly (const Transaction *trans)
{ {
GtkWidget *dialog; GtkWidget *dialog;
const gchar *reason; const gchar *reason;
const gchar *format = const gchar *title = _("Cannot modify or delete this transaction.");
_("Cannot modify or delete this transaction. This transaction is " const gchar *message =
"marked read-only because:\n\n'%s'"); _("This transaction is marked read-only with the comment: '%s'");
if (!trans) return FALSE; if (!trans) return FALSE;
@@ -962,8 +962,9 @@ xaccTransWarnReadOnly (const Transaction *trans)
0, 0,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, GTK_BUTTONS_OK,
format, "%s", title);
reason); gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
message, reason);
gtk_dialog_run(GTK_DIALOG(dialog)); gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
return TRUE; return TRUE;
@@ -983,7 +984,7 @@ gsr_default_reinit_handler( GNCSplitReg *gsr, gpointer data )
gint response; gint response;
const gchar *warning; const gchar *warning;
const char *message = _("Remove the splits from this transaction?"); const char *title = _("Remove the splits from this transaction?");
const char *recn_warn = _("This transaction contains reconciled splits. " const char *recn_warn = _("This transaction contains reconciled splits. "
"Modifying it is not a good idea because that will " "Modifying it is not a good idea because that will "
"cause your reconciled balance to be off."); "cause your reconciled balance to be off.");
@@ -993,24 +994,16 @@ gsr_default_reinit_handler( GNCSplitReg *gsr, gpointer data )
trans = gnc_split_register_get_current_trans (reg); trans = gnc_split_register_get_current_trans (reg);
if (xaccTransWarnReadOnly(trans)) if (xaccTransWarnReadOnly(trans))
return; return;
dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
"%s", title);
if (xaccTransHasReconciledSplits (trans)) { if (xaccTransHasReconciledSplits (trans)) {
dialog = gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window), "%s", recn_warn);
GTK_DIALOG_MODAL
| GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
"<b>%s</b>\n\n%s",
message, recn_warn);
warning = "register_remove_all_splits2"; warning = "register_remove_all_splits2";
} else { } else {
dialog =
gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window),
GTK_DIALOG_MODAL
| GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
"<b>%s</b>", message);
warning = "register_remove_all_splits"; warning = "register_remove_all_splits";
} }
@@ -1109,13 +1102,14 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
char recn; char recn;
if (split == gnc_split_register_get_current_trans_split (reg, NULL)) { if (split == gnc_split_register_get_current_trans_split (reg, NULL)) {
dialog = dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window), GTK_DIALOG_MODAL
GTK_DIALOG_DESTROY_WITH_PARENT, | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK, GTK_BUTTONS_OK,
"<b>%s</b>\n\n%s", "%s", anchor_error);
anchor_error, anchor_split); gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
"%s", anchor_split);
gtk_dialog_run(GTK_DIALOG(dialog)); gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
return; return;
@@ -1129,29 +1123,22 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
/* ask for user confirmation before performing permanent damage */ /* ask for user confirmation before performing permanent damage */
buf = g_strdup_printf (format, memo, desc); buf = g_strdup_printf (format, memo, desc);
dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
GTK_DIALOG_MODAL
| GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
buf);
g_free(buf);
recn = xaccSplitGetReconcile (split); recn = xaccSplitGetReconcile (split);
if (recn == YREC || recn == FREC) if (recn == YREC || recn == FREC)
{ {
dialog = gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window), "%s", recn_warn);
GTK_DIALOG_MODAL
| GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
"<b>%s</b>\n\n%s", buf, recn_warn);
warning = "register_delete_split2"; warning = "register_delete_split2";
} else { } else {
dialog =
gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window),
GTK_DIALOG_MODAL
| GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
"<b>%s</b>", buf);
warning = "register_delete_split"; warning = "register_delete_split";
} }
g_free(buf);
gtk_dialog_add_button(GTK_DIALOG(dialog), gtk_dialog_add_button(GTK_DIALOG(dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
@@ -1171,29 +1158,23 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
/* On a transaction cursor with 2 or fewer splits in single or double /* On a transaction cursor with 2 or fewer splits in single or double
* mode, we just delete the whole transaction, kerblooie */ * mode, we just delete the whole transaction, kerblooie */
{ {
const char *message = _("Delete the current transaction?"); const char *title = _("Delete the current transaction?");
const char *recn_warn = _("You would be deleting a transaction " const char *recn_warn = _("You would be deleting a transaction "
"with reconciled splits! " "with reconciled splits! "
"This is not a good idea as it will cause your " "This is not a good idea as it will cause your "
"reconciled balance to be off."); "reconciled balance to be off.");
dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
GTK_DIALOG_MODAL
| GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
"%s", title);
if (xaccTransHasReconciledSplits (trans)) { if (xaccTransHasReconciledSplits (trans)) {
dialog = gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window), "%s", recn_warn);
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
"<b>%s</b>\n\n%s", message, recn_warn);
warning = "register_delete_trans2"; warning = "register_delete_trans2";
} else { } else {
dialog =
gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window),
GTK_DIALOG_MODAL
| GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
"<b>%s</b>", message);
warning = "register_delete_trans"; warning = "register_delete_trans";
} }
gtk_dialog_add_button(GTK_DIALOG(dialog), gtk_dialog_add_button(GTK_DIALOG(dialog),
@@ -1935,13 +1916,13 @@ gtk_callback_bug_workaround (gpointer argp)
const gchar *read_only = "This account register is read-only."; const gchar *read_only = "This account register is read-only.";
GtkWidget *dialog; GtkWidget *dialog;
dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(args->gsr->window), dialog = gtk_message_dialog_new(GTK_WINDOW(args->gsr->window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING, GTK_MESSAGE_WARNING,
GTK_BUTTONS_CLOSE, GTK_BUTTONS_CLOSE,
"<b>%s</b>\n\n%s", "%s", read_only);
read_only, gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
args->string); "%s", args->string);
gnc_dialog_run(GTK_DIALOG(dialog), "register_read_only"); gnc_dialog_run(GTK_DIALOG(dialog), "register_read_only");
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
g_free(args); g_free(args);