[Gnucash-changes] r13020 - gnucash/trunk/src - Use the gtk2.6 secondary message text function now that there is a 2.4

David Hampton hampton at cvs.gnucash.org
Sun Jan 29 11:06:17 EST 2006


Author: hampton
Date: 2006-01-29 11:06:16 -0500 (Sun, 29 Jan 2006)
New Revision: 13020
Trac: http://svn.gnucash.org/trac/changeset/13020

Modified:
   gnucash/trunk/src/gnome-utils/gnc-main-window.c
   gnucash/trunk/src/gnome/dialog-commodities.c
   gnucash/trunk/src/gnome/dialog-price-edit-db.c
   gnucash/trunk/src/gnome/gnc-split-reg.c
Log:
Use the gtk2.6 secondary message text function now that there is a 2.4
emulation routine available.


Modified: gnucash/trunk/src/gnome/dialog-commodities.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-commodities.c	2006-01-29 14:53:19 UTC (rev 13019)
+++ gnucash/trunk/src/gnome/dialog-commodities.c	2006-01-29 16:06:16 UTC (rev 13020)
@@ -147,13 +147,13 @@
     warning = "delete_commodity";
   }
 
-  dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(cd->dialog),
-					      GTK_DIALOG_DESTROY_WITH_PARENT,
-					      GTK_MESSAGE_QUESTION,
-					      GTK_BUTTONS_NONE,
-					      "<b>%s</b>\n\n%s",
-					      _("Delete commodity?"),
-					      message);
+  dialog = gtk_message_dialog_new(GTK_WINDOW(cd->dialog),
+				  GTK_DIALOG_DESTROY_WITH_PARENT,
+				  GTK_MESSAGE_QUESTION,
+				  GTK_BUTTONS_NONE,
+				  "%s", _("Delete commodity?"));
+  gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+					   "%s", message);
   gtk_dialog_add_buttons(GTK_DIALOG(dialog),
 			 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 			 GTK_STOCK_DELETE, GTK_RESPONSE_OK,

Modified: gnucash/trunk/src/gnome/dialog-price-edit-db.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-price-edit-db.c	2006-01-29 14:53:19 UTC (rev 13019)
+++ gnucash/trunk/src/gnome/dialog-price-edit-db.c	2006-01-29 16:06:16 UTC (rev 13020)
@@ -168,14 +168,13 @@
 		"Are you sure you want to delete the %d selected prices?",
 		length),
        length);
-    dialog = gtk_message_dialog_new_with_markup
-      (GTK_WINDOW(pdb_dialog->dialog),
-       GTK_DIALOG_DESTROY_WITH_PARENT,
-       GTK_MESSAGE_QUESTION,
-       GTK_BUTTONS_NONE,
-       "<b>%s</b>\n\n%s",
-       _("Delete prices?"),
-       message);
+    dialog = gtk_message_dialog_new(GTK_WINDOW(pdb_dialog->dialog),
+				    GTK_DIALOG_DESTROY_WITH_PARENT,
+				    GTK_MESSAGE_QUESTION,
+				    GTK_BUTTONS_NONE,
+				    "%s", _("Delete prices?"));
+    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+					     "%s", message);
     g_free(message);
     gtk_dialog_add_buttons(GTK_DIALOG(dialog),
 			   GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,

Modified: gnucash/trunk/src/gnome/gnc-split-reg.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-split-reg.c	2006-01-29 14:53:19 UTC (rev 13019)
+++ gnucash/trunk/src/gnome/gnc-split-reg.c	2006-01-29 16:06:16 UTC (rev 13020)
@@ -950,9 +950,9 @@
 {
   GtkWidget *dialog;
   const gchar *reason;
-  const gchar *format =
-    _("Cannot modify or delete this transaction. This transaction is "
-      "marked read-only because:\n\n'%s'");
+  const gchar *title = _("Cannot modify or delete this transaction.");
+  const gchar *message =
+    _("This transaction is marked read-only with the comment: '%s'");
 
   if (!trans) return FALSE;
 
@@ -962,8 +962,9 @@
 				    0,
 				    GTK_MESSAGE_ERROR,
 				    GTK_BUTTONS_OK,
-				    format,
-				    reason);
+				    "%s", title);
+    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+					     message, reason);
     gtk_dialog_run(GTK_DIALOG(dialog));
     gtk_widget_destroy(dialog);
     return TRUE;
@@ -983,7 +984,7 @@
   gint response;
   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. "
                             "Modifying it is not a good idea because that will "
 			    "cause your reconciled balance to be off.");
@@ -993,24 +994,16 @@
   trans = gnc_split_register_get_current_trans (reg);
   if (xaccTransWarnReadOnly(trans))
     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)) {
-    dialog =
-      gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window),
-					 GTK_DIALOG_MODAL
-					 | GTK_DIALOG_DESTROY_WITH_PARENT,
-					 GTK_MESSAGE_WARNING,
-					 GTK_BUTTONS_NONE,
-					 "<b>%s</b>\n\n%s",
-					 message, recn_warn);
+    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+					     "%s", recn_warn);
     warning = "register_remove_all_splits2";
   } 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";
   }
 
@@ -1109,13 +1102,14 @@
     char recn;
 
     if (split == gnc_split_register_get_current_trans_split (reg, NULL)) {
-      dialog =
-	gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window),
-					   GTK_DIALOG_DESTROY_WITH_PARENT,
-					   GTK_MESSAGE_ERROR,
-					   GTK_BUTTONS_OK,
-					   "<b>%s</b>\n\n%s",
-					   anchor_error, anchor_split);
+      dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
+				      GTK_DIALOG_MODAL
+				      | GTK_DIALOG_DESTROY_WITH_PARENT,
+				      GTK_MESSAGE_ERROR,
+				      GTK_BUTTONS_OK,
+				      "%s", anchor_error);
+      gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+					       "%s", anchor_split);
       gtk_dialog_run(GTK_DIALOG(dialog));
       gtk_widget_destroy (dialog);
       return;
@@ -1129,29 +1123,22 @@
 
     /* ask for user confirmation before performing permanent damage */
     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);
     if (recn == YREC || recn == FREC)
     {
-      dialog =
-	gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window),
-					   GTK_DIALOG_MODAL
-					   | GTK_DIALOG_DESTROY_WITH_PARENT,
-					   GTK_MESSAGE_WARNING,
-					   GTK_BUTTONS_NONE,
-					   "<b>%s</b>\n\n%s", buf, recn_warn);
+      gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+					       "%s", recn_warn);
       warning = "register_delete_split2";
     } 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";
     }
-    g_free(buf);
 
     gtk_dialog_add_button(GTK_DIALOG(dialog),
 			  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
@@ -1171,29 +1158,23 @@
   /* On a transaction cursor with 2 or fewer splits in single or double
    * 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 "
                               "with reconciled splits! "
                               "This is not a good idea as it will cause your "
                               "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)) {
-      dialog =
-	gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window),
-					   GTK_DIALOG_MODAL |
-					   GTK_DIALOG_DESTROY_WITH_PARENT,
-					   GTK_MESSAGE_WARNING,
-					   GTK_BUTTONS_NONE,
-					   "<b>%s</b>\n\n%s", message, recn_warn);
+      gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+					       "%s", recn_warn);
       warning = "register_delete_trans2";
     } 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";
     }
     gtk_dialog_add_button(GTK_DIALOG(dialog),
@@ -1935,13 +1916,13 @@
   const gchar *read_only = "This account register is read-only.";
   GtkWidget *dialog;
 
-  dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(args->gsr->window),
-					      GTK_DIALOG_DESTROY_WITH_PARENT,
-					      GTK_MESSAGE_WARNING,
-					      GTK_BUTTONS_CLOSE,
-					      "<b>%s</b>\n\n%s",
-					      read_only,
-					      args->string);
+  dialog = gtk_message_dialog_new(GTK_WINDOW(args->gsr->window),
+				  GTK_DIALOG_DESTROY_WITH_PARENT,
+				  GTK_MESSAGE_WARNING,
+				  GTK_BUTTONS_CLOSE,
+				  "%s", read_only);
+  gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+					   "%s", args->string);
   gnc_dialog_run(GTK_DIALOG(dialog), "register_read_only");
   gtk_widget_destroy(dialog);
   g_free(args);

Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c	2006-01-29 14:53:19 UTC (rev 13019)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c	2006-01-29 16:06:16 UTC (rev 13020)
@@ -793,8 +793,15 @@
   GtkWidget *dialog;
   gint response;
   const gchar *filename, *tmp;
+  const gchar *title = _("Save changes to file %s before closing?");
 #ifdef HIG_COMPLIANT
   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
 
   session = qof_session_get_current_session();
@@ -819,32 +826,20 @@
    * case scenario would be if QOF could provide a timestamp of the
    * 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
   oldest_change = qof_book_time_changed(book);
   minutes = (time() - oldest_change) / 60 + 1;
-  dialog =
-    gtk_message_dialog_new_with_markup (GTK_WINDOW(window),
-					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);
+  gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+					   message, minutes);
 #else
-  dialog =
-    gtk_message_dialog_new_with_markup (GTK_WINDOW(window),
-					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);
+  gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+					   message);
 #endif
 
   gtk_dialog_add_buttons(GTK_DIALOG(dialog),
@@ -879,6 +874,11 @@
   QofSession *session;
   GtkWidget *dialog;
   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)
     return FALSE;
@@ -893,17 +893,13 @@
     return TRUE;
   }
 
-  dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW(window),
-				   GTK_DIALOG_MODAL,
-				   GTK_MESSAGE_WARNING,
-				   GTK_BUTTONS_NONE,
-					       "<b>%s</b>\n\n%s",
-					       _("Quit Gnucash?"),
-					       _("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?"));
-
+  dialog = gtk_message_dialog_new(GTK_WINDOW(window),
+				  GTK_DIALOG_MODAL,
+				  GTK_MESSAGE_WARNING,
+				  GTK_BUTTONS_NONE,
+				  "%s", title);
+  gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+					   "%s", message);
   gtk_dialog_add_buttons(GTK_DIALOG(dialog),
 			 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
 			 GTK_STOCK_QUIT, GTK_RESPONSE_OK,



More information about the gnucash-changes mailing list