mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
HIG rework. Remove newlines from dialog message strings. Give some
dialogs more descriptive button labels. Clean up the code around the file save query dialog. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13019 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
3cbcbd6e86
commit
1bd014def0
30
ChangeLog
30
ChangeLog
@ -1,3 +1,33 @@
|
||||
2006-01-28 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/gnome-utils/gncmod-gnome-utils.c:
|
||||
* src/app-utils/gnc-err-popup.[ch]:
|
||||
* src/app-utils/Makefile.am: Remove deprecated files
|
||||
|
||||
* src/register/ledger-core/split-register-model.c:
|
||||
* src/register/ledger-core/split-register.c:
|
||||
* src/register/ledger-core/split-register-control.c:
|
||||
* src/import-export/hbci/dialog-pass.c:
|
||||
* src/business/business-ledger/gncEntryLedger.c:
|
||||
* src/business/business-ledger/gncEntryLedgerControl.c:
|
||||
* src/business/business-gnome/gnc-plugin-business.c:
|
||||
* src/gnome-utils/gnc-gnome-utils.c:
|
||||
* src/gnome-utils/gw-gnome-utils-spec.scm:
|
||||
* src/gnome-utils/gnc-file.[ch]:
|
||||
* src/gnome-utils/gnc-main-window.c:
|
||||
* src/gnome-utils/dialog-utils.[ch]:
|
||||
* src/gnome-utils/gnc-gui-query.[ch]:
|
||||
* src/gnome/gnc-split-reg.c:
|
||||
* src/gnome/dialog-chart-export.c:
|
||||
* src/gnome/schemas/apps_gnucash_warnings.schemas.in:
|
||||
* src/gnome/dialog-commodities.c:
|
||||
* src/gnome/dialog-price-edit-db.c:
|
||||
* src/gnc-ui.h:
|
||||
* src/app-utils/option-util.c: HIG rework. Remove newlines from
|
||||
dialog message strings. Give some dialogs more descriptive button
|
||||
labels. Clean up the code around the file save query dialog.
|
||||
|
||||
|
||||
2006-01-28 Joshua Sled <jsled@asynchronous.org>
|
||||
|
||||
* src/report/report-system/html-style-sheet.scm
|
||||
|
@ -30,7 +30,6 @@ libgncmod_app_utils_la_SOURCES = \
|
||||
gnc-druid-provider-desc-file.c \
|
||||
gnc-druid-provider-desc-multifile.c \
|
||||
gnc-druid-provider-file-cb.c \
|
||||
gnc-err-popup.c \
|
||||
gnc-euro.c \
|
||||
gnc-exp-parser.c \
|
||||
gnc-gettext-util.c \
|
||||
@ -56,7 +55,6 @@ gncinclude_HEADERS = \
|
||||
gnc-druid-provider-desc-file.h \
|
||||
gnc-druid-provider-desc-multifile.h \
|
||||
gnc-druid-provider-file-cb.h \
|
||||
gnc-err-popup.h \
|
||||
gnc-euro.h \
|
||||
gnc-exp-parser.h \
|
||||
gnc-gettext-util.h \
|
||||
|
@ -1,79 +0,0 @@
|
||||
/********************************************************************\
|
||||
* gnc-err-popup.c -- GnuCash error GUI popups *
|
||||
* Copyright (c) 2001 Linux Developers Group, Inc. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gnc-err-popup.h"
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
Callbacks so that app can display gui messages.
|
||||
\********************************************************************/
|
||||
|
||||
static GNCGuiMessage gnc_gui_warning_func = NULL;
|
||||
static GNCGuiMessage gnc_gui_error_func = NULL;
|
||||
|
||||
void
|
||||
gnc_set_warning_message (GNCGuiMessage func)
|
||||
{
|
||||
gnc_gui_warning_func = func;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_set_error_message (GNCGuiMessage func)
|
||||
{
|
||||
gnc_gui_error_func = func;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_send_gui_warning(const gchar *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
if (!gnc_gui_warning_func) return FALSE;
|
||||
|
||||
va_start (args, format);
|
||||
gnc_gui_warning_func(format, args);
|
||||
va_end(args);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_send_gui_error(const gchar *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
if (!gnc_gui_error_func) return(FALSE);
|
||||
|
||||
va_start (args, format);
|
||||
gnc_gui_error_func(format, args);
|
||||
va_end(args);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/************************* END OF FILE ******************************\
|
||||
\********************************************************************/
|
@ -1,50 +0,0 @@
|
||||
/********************************************************************\
|
||||
* gnc-err-popup.h -- GnuCash GUI Error Popup *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, contact: *
|
||||
* *
|
||||
* Free Software Foundation Voice: +1-617-542-5942 *
|
||||
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
|
||||
* Boston, MA 02110-1301, USA gnu@gnu.org *
|
||||
\********************************************************************/
|
||||
|
||||
/** @file gnc-err-popup.h @brief GnuCash GUI error loging facility
|
||||
* Copyright (c) 2001 Linux Developers Group, Inc.
|
||||
*/
|
||||
|
||||
#ifndef GNC_ERR_POPUP_H
|
||||
#define GNC_ERR_POPUP_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* -------------------------------------------------------- */
|
||||
/* Infrastructure to send messages go to GUI popups, not to stderr!
|
||||
* Incompletely implemented, needs work.
|
||||
* XXX This probably duplicates some popup code elswwhere in the
|
||||
* code and should be trashed at earliest convenience.
|
||||
*/
|
||||
typedef void (*GNCGuiMessage) (const char *format, va_list args);
|
||||
void gnc_set_warning_message (GNCGuiMessage func);
|
||||
void gnc_set_error_message (GNCGuiMessage func);
|
||||
|
||||
gboolean gnc_send_gui_warning (const char *format, ...) G_GNUC_PRINTF(1,2);
|
||||
gboolean gnc_send_gui_error (const char *format, ...) G_GNUC_PRINTF(1,2);
|
||||
|
||||
#define PWARN_GUI(format, args...) { \
|
||||
gnc_send_gui_error(format, ## args); \
|
||||
}
|
||||
|
||||
#endif /* GNC_ERR_POPUP_H */
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
@ -32,7 +32,6 @@
|
||||
#include "glib-helpers.h"
|
||||
#include "guile-util.h"
|
||||
#include "qof.h"
|
||||
#include "gnc-err-popup.h"
|
||||
#include "guile-mappings.h"
|
||||
|
||||
#include <g-wrap-wct.h>
|
||||
@ -1730,7 +1729,9 @@ gnc_commit_option(GNCOption *option)
|
||||
{
|
||||
SCM oops;
|
||||
char *section, *name;
|
||||
GtkWidget *dialog;
|
||||
const gchar *message;
|
||||
const gchar *format = _("There is a problem with option %s:%s.\n%s");
|
||||
|
||||
/* Second element is error message */
|
||||
oops = SCM_CADR(result);
|
||||
@ -1744,10 +1745,16 @@ gnc_commit_option(GNCOption *option)
|
||||
name = gnc_option_name(option);
|
||||
section = gnc_option_section(option);
|
||||
|
||||
gnc_send_gui_error(_("There is a problem with option %s:%s.\n%s"),
|
||||
section ? section : "(null)",
|
||||
name ? name : "(null)",
|
||||
message ? message : "(null)");
|
||||
dialog = gtk_message_dialog_new(NULL,
|
||||
0,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
format,
|
||||
section ? section : "(null)",
|
||||
name ? name : "(null)",
|
||||
message ? message : "(null)");
|
||||
gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
gtk_widget_destroy(dialog);
|
||||
|
||||
if (name != NULL)
|
||||
free(name);
|
||||
|
@ -735,7 +735,8 @@ gnc_plugin_business_cmd_export_invoice (GtkAction *action, GncMainWindowActionDa
|
||||
qof_session_save(chart_session, NULL);
|
||||
}
|
||||
}
|
||||
show_session_error(qof_session_get_error(chart_session), filename);
|
||||
show_session_error(qof_session_get_error(chart_session), filename,
|
||||
GNC_FILE_DIALOG_EXPORT);
|
||||
g_free(filename);
|
||||
qof_session_end(chart_session);
|
||||
qof_session_set_current_session(current_session);
|
||||
@ -766,7 +767,8 @@ gnc_plugin_business_cmd_export_customer (GtkAction *action, GncMainWindowActionD
|
||||
qof_session_save(chart_session, NULL);
|
||||
}
|
||||
}
|
||||
show_session_error(qof_session_get_error(chart_session), filename);
|
||||
show_session_error(qof_session_get_error(chart_session), filename,
|
||||
GNC_FILE_DIALOG_EXPORT);
|
||||
qof_session_end(chart_session);
|
||||
g_free(filename);
|
||||
qof_session_set_current_session(current_session);
|
||||
@ -797,7 +799,8 @@ gnc_plugin_business_cmd_export_vendor (GtkAction *action, GncMainWindowActionDat
|
||||
qof_session_save(chart_session, NULL);
|
||||
}
|
||||
}
|
||||
show_session_error(qof_session_get_error(chart_session), filename);
|
||||
show_session_error(qof_session_get_error(chart_session), filename,
|
||||
GNC_FILE_DIALOG_EXPORT);
|
||||
qof_session_end(chart_session);
|
||||
g_free(filename);
|
||||
qof_session_set_current_session(current_session);
|
||||
@ -828,7 +831,8 @@ gnc_plugin_business_cmd_export_employee (GtkAction *action, GncMainWindowActionD
|
||||
qof_session_save(chart_session, NULL);
|
||||
}
|
||||
}
|
||||
show_session_error(qof_session_get_error(chart_session), filename);
|
||||
show_session_error(qof_session_get_error(chart_session), filename,
|
||||
GNC_FILE_DIALOG_EXPORT);
|
||||
qof_session_end(chart_session);
|
||||
g_free(filename);
|
||||
qof_session_set_current_session(current_session);
|
||||
|
@ -25,11 +25,12 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "Account.h"
|
||||
#include "dialog-account.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-ui-util.h"
|
||||
#include "combocell.h"
|
||||
#include "pricecell.h"
|
||||
@ -801,13 +802,29 @@ gnc_entry_ledger_duplicate_current_entry (GncEntryLedger *ledger)
|
||||
/* If the cursor has been edited, we are going to have to commit
|
||||
* it before we can duplicate. Make sure the user wants to do that. */
|
||||
if (changed) {
|
||||
const char *message = _("The current entry has been changed.\n"
|
||||
"Would you like to save it?");
|
||||
gint result;
|
||||
const char *title = _("Save the current entry?");
|
||||
const char *message =
|
||||
_("The current transaction has been changed. Would you like to "
|
||||
"record the changes before duplicating this entry, or "
|
||||
"cancel the duplication?");
|
||||
GtkWidget *dialog;
|
||||
gint response;
|
||||
|
||||
result = gnc_ok_cancel_dialog (ledger->parent, GTK_RESPONSE_OK, message);
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(ledger->parent),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
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,
|
||||
_("_Record"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
response = gnc_dialog_run(GTK_DIALOG(dialog), "invoice_entry_duplicated");
|
||||
gtk_widget_destroy(dialog);
|
||||
|
||||
if (result != GTK_RESPONSE_OK) {
|
||||
if (response != GTK_RESPONSE_ACCEPT) {
|
||||
gnc_resume_gui_refresh ();
|
||||
return;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "Account.h"
|
||||
#include "combocell.h"
|
||||
#include "dialog-account.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-component-manager.h"
|
||||
#include "gnc-ui.h"
|
||||
#include "gnc-ui-util.h"
|
||||
@ -272,7 +273,7 @@ static gboolean gnc_entry_ledger_traverse (VirtualLocation *p_new_virt_loc,
|
||||
{
|
||||
GncEntryLedger *ledger = user_data;
|
||||
GncEntry *entry, *new_entry;
|
||||
gint result;
|
||||
gint response;
|
||||
VirtualLocation virt_loc;
|
||||
int changed;
|
||||
char const *cell_name;
|
||||
@ -482,35 +483,46 @@ static gboolean gnc_entry_ledger_traverse (VirtualLocation *p_new_virt_loc,
|
||||
* limited cases -- usually just let the change go through.
|
||||
*/
|
||||
{
|
||||
const char *message;
|
||||
GtkWidget *dialog;
|
||||
const char *title = _("Save the current entry?");
|
||||
const char *message =
|
||||
_("The current entry has been changed. However, this entry is "
|
||||
"part of an existing order. Would you like to record the change "
|
||||
"and effectively change your order?");
|
||||
|
||||
switch (ledger->type) {
|
||||
case GNCENTRY_INVOICE_ENTRY:
|
||||
if (gncEntryGetOrder (entry) != NULL) {
|
||||
message = _("The current entry has been changed.\n"
|
||||
"However, this entry is part of an existing order.\n"
|
||||
"Would you like to record the change and\n"
|
||||
"effectively change your order?");
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(ledger->parent),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_NONE,
|
||||
"%s", title);
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
|
||||
"%s", message);
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
|
||||
_("_Don't Record"), GTK_RESPONSE_REJECT,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
_("_Record"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
response = gnc_dialog_run(GTK_DIALOG(dialog), "invoice_entry_changed");
|
||||
gtk_widget_destroy(dialog);
|
||||
break;
|
||||
}
|
||||
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
result = GTK_RESPONSE_YES;
|
||||
goto dontask;
|
||||
response = GTK_RESPONSE_ACCEPT;
|
||||
break;
|
||||
}
|
||||
|
||||
result = gnc_verify_cancel_dialog(ledger->parent, GTK_RESPONSE_YES, message);
|
||||
}
|
||||
|
||||
dontask:
|
||||
|
||||
switch (result)
|
||||
switch (response)
|
||||
{
|
||||
case GTK_RESPONSE_YES:
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_NO:
|
||||
case GTK_RESPONSE_REJECT:
|
||||
{
|
||||
VirtualCellLocation vcell_loc;
|
||||
GncEntry *new_entry;
|
||||
@ -531,10 +543,8 @@ dontask:
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
break;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
19
src/gnc-ui.h
19
src/gnc-ui.h
@ -63,24 +63,11 @@
|
||||
|
||||
/* Dialog windows ***************************************************/
|
||||
|
||||
extern gint
|
||||
gnc_verify_cancel_dialog(gncUIWidget parent,
|
||||
gint default_result,
|
||||
const char *format, ...) G_GNUC_PRINTF (3,4);
|
||||
|
||||
|
||||
|
||||
extern gboolean
|
||||
gnc_verify_dialog(gncUIWidget parent,
|
||||
gboolean yes_is_default,
|
||||
const char *format, ...) G_GNUC_PRINTF (3, 4);
|
||||
|
||||
gint
|
||||
gnc_verify_remember_dialog(gncUIWidget parent, const gchar *gconf_key,
|
||||
const gchar *yes_label, const gchar *no_label,
|
||||
const gchar *format, ...) G_GNUC_PRINTF (5,6);
|
||||
|
||||
|
||||
extern gint
|
||||
gnc_ok_cancel_dialog(gncUIWidget parent,
|
||||
gint default_result,
|
||||
@ -94,12 +81,6 @@ gnc_warning_dialog(gncUIWidget parent,
|
||||
|
||||
|
||||
|
||||
gint
|
||||
gnc_warning_remember_dialog(gncUIWidget parent, const gchar *gconf_key,
|
||||
const gchar *yes_label, const gchar *no_label,
|
||||
const gchar *format, ...) G_GNUC_PRINTF (5,6);
|
||||
|
||||
|
||||
extern void
|
||||
gnc_error_dialog(GtkWidget *parent,
|
||||
const char *forrmat, ...) G_GNUC_PRINTF (2, 3);
|
||||
|
@ -944,3 +944,126 @@ gnc_gtk_dialog_add_button (GtkWidget *dialog, const gchar *label, const gchar *s
|
||||
gtk_widget_show_all(button);
|
||||
gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, response);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_perm_button_cb (GtkButton *perm, gpointer user_data)
|
||||
{
|
||||
gboolean perm_active;
|
||||
|
||||
perm_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(perm));
|
||||
gtk_widget_set_sensitive(user_data, !perm_active);
|
||||
}
|
||||
|
||||
gint
|
||||
gnc_dialog_run (GtkDialog *dialog, const gchar *gconf_key)
|
||||
{
|
||||
GtkWidget *perm, *temp;
|
||||
gboolean ask = TRUE;
|
||||
gint response;
|
||||
|
||||
/* Does the user want to see this question? If not, return the
|
||||
* previous answer. */
|
||||
response = gnc_gconf_get_int(GCONF_WARNINGS_PERM, gconf_key, NULL);
|
||||
if (response != 0)
|
||||
return response;
|
||||
response = gnc_gconf_get_int(GCONF_WARNINGS_TEMP, gconf_key, NULL);
|
||||
if (response != 0)
|
||||
return response;
|
||||
|
||||
/* Add in the checkboxes to find out if the answer should be remembered. */
|
||||
#if 0
|
||||
if (GTK_IS_MESSAGE_DIALOG(dialog)) {
|
||||
GtkMessageType type;
|
||||
g_object_get(dialog, "message-type", &type, (gchar*)NULL);
|
||||
ask = (type == GTK_MESSAGE_QUESTION);
|
||||
} else {
|
||||
ask = FALSE;
|
||||
}
|
||||
#endif
|
||||
perm = gtk_check_button_new_with_mnemonic
|
||||
(ask
|
||||
? _("Remember and don't _ask me again.")
|
||||
: _("Don't _tell me again."));
|
||||
temp = gtk_check_button_new_with_mnemonic
|
||||
(ask
|
||||
? _("Remember and don't ask me again this _session.")
|
||||
: _("Don't tell me again this _session."));
|
||||
gtk_widget_show(perm);
|
||||
gtk_widget_show(temp);
|
||||
gtk_box_pack_start_defaults(GTK_BOX(dialog->vbox), perm);
|
||||
gtk_box_pack_start_defaults(GTK_BOX(dialog->vbox), temp);
|
||||
g_signal_connect(perm, "clicked", G_CALLBACK(gnc_perm_button_cb), temp);
|
||||
|
||||
/* OK. Present the dialog. */
|
||||
response = gtk_dialog_run(dialog);
|
||||
if ((response == GTK_RESPONSE_NONE) || (response == GTK_RESPONSE_DELETE_EVENT)) {
|
||||
return GTK_RESPONSE_NO;
|
||||
}
|
||||
|
||||
/* Save the answer? */
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(perm))) {
|
||||
gnc_gconf_set_int(GCONF_WARNINGS_PERM, gconf_key, response, NULL);
|
||||
} else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(temp))) {
|
||||
gnc_gconf_set_int(GCONF_WARNINGS_TEMP, gconf_key, response, NULL);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
#ifndef HAVE_GLIB26
|
||||
|
||||
/** Find the first GtkLabel in a container. When called on a gtk2.4
|
||||
* message dialog, there is only one label in the dialog so theis
|
||||
* should return it. */
|
||||
static void
|
||||
find_label (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
GtkWidget **label = data;
|
||||
|
||||
if (*label)
|
||||
return;
|
||||
|
||||
if (GTK_IS_LABEL(widget)) {
|
||||
*label = widget;
|
||||
return;
|
||||
}
|
||||
|
||||
if (GTK_IS_CONTAINER(widget)) {
|
||||
gtk_container_foreach(GTK_CONTAINER(widget), find_label, data);
|
||||
}
|
||||
}
|
||||
|
||||
/** Mimic the gtk2.6 function to add secondary information to a
|
||||
* message dialog. */
|
||||
void
|
||||
gtk_message_dialog_format_secondary_text(GtkMessageDialog *dialog,
|
||||
const gchar *format,
|
||||
...)
|
||||
{
|
||||
GtkWidget *label = NULL;
|
||||
const gchar *current;
|
||||
gchar *primary, *secondary;
|
||||
va_list args;
|
||||
|
||||
gtk_container_foreach(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox),
|
||||
find_label, &label);
|
||||
if (!label)
|
||||
return;
|
||||
|
||||
/* Get the current markup. */
|
||||
current = gtk_label_get_label(GTK_LABEL(label));
|
||||
|
||||
/* Format the text to be added. */
|
||||
va_start(args, format);
|
||||
secondary = g_strdup_vprintf(format, args);
|
||||
va_end(args);
|
||||
|
||||
/* Append the two strings, making the first one bold. */
|
||||
primary = g_strdup_printf("<b>%s</b>\n\n%s", current, secondary);
|
||||
gtk_label_set_markup(GTK_LABEL(label), primary);
|
||||
|
||||
g_free(primary);
|
||||
g_free(secondary);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -150,4 +150,17 @@ void gnc_gtk_dialog_add_button (GtkWidget *dialog,
|
||||
const gchar *stock_id,
|
||||
guint response);
|
||||
|
||||
|
||||
/** Note: This dialog is modal! (It calls gtk_dialog_run() which is modal.)
|
||||
*/
|
||||
gint
|
||||
gnc_dialog_run(GtkDialog *dialog, const gchar *gconf_key);
|
||||
|
||||
#ifndef HAVE_GLIB26
|
||||
void
|
||||
gtk_message_dialog_format_secondary_text(GtkMessageDialog *dialog,
|
||||
const gchar *message_format,
|
||||
...) G_GNUC_PRINTF (2, 3);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -52,7 +52,6 @@
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
static QofLogModule log_module = GNC_MOD_GUI;
|
||||
|
||||
static GNCCanCancelSaveCB can_cancel_cb = NULL;
|
||||
static GNCShutdownCB shutdown_cb = NULL;
|
||||
|
||||
|
||||
@ -181,11 +180,15 @@ gnc_file_dialog (const char * title,
|
||||
|
||||
|
||||
gboolean
|
||||
show_session_error (QofBackendError io_error, const char *newfile)
|
||||
show_session_error (QofBackendError io_error,
|
||||
const char *newfile,
|
||||
GNCFileDialogType type)
|
||||
{
|
||||
GtkWidget *parent = gnc_ui_get_toplevel();
|
||||
GtkWidget *dialog;
|
||||
gboolean uh_oh = TRUE;
|
||||
const char *fmt;
|
||||
const char *fmt, *label;
|
||||
gint response;
|
||||
|
||||
gnc_destroy_splash_screen(); /* Just in case */
|
||||
if (NULL == newfile) { newfile = _("(null)"); }
|
||||
@ -197,206 +200,244 @@ show_session_error (QofBackendError io_error, const char *newfile)
|
||||
break;
|
||||
|
||||
case ERR_BACKEND_NO_HANDLER: {
|
||||
fmt = _("No suitable backend was found for\n%s.");
|
||||
fmt = _("No suitable backend was found for %s.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
}
|
||||
case ERR_BACKEND_NO_BACKEND:
|
||||
fmt = _("The URL \n %s\n"
|
||||
"is not supported by this version of GnuCash.");
|
||||
fmt = _("The URL %s is not supported by this version of GnuCash.");
|
||||
gnc_error_dialog (parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_BACKEND_BAD_URL:
|
||||
fmt = _("Can't parse the URL\n %s\n");
|
||||
fmt = _("Can't parse the URL %s.");
|
||||
gnc_error_dialog (parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_BACKEND_CANT_CONNECT:
|
||||
fmt = _("Can't connect to\n %s\n"
|
||||
fmt = _("Can't connect to %s. "
|
||||
"The host, username or password were incorrect.");
|
||||
gnc_error_dialog (parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_BACKEND_CONN_LOST:
|
||||
fmt = _("Can't connect to\n %s\n"
|
||||
fmt = _("Can't connect to %s. "
|
||||
"Connection was lost, unable to send data.");
|
||||
gnc_error_dialog (parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_BACKEND_TOO_NEW:
|
||||
fmt = _("This file/URL appears to be from a newer version\n"
|
||||
"of GnuCash. You must upgrade your version of GnuCash\n"
|
||||
fmt = _("This file/URL appears to be from a newer version "
|
||||
"of GnuCash. You must upgrade your version of GnuCash "
|
||||
"to work with this data.");
|
||||
gnc_error_dialog (parent, fmt);
|
||||
break;
|
||||
|
||||
case ERR_BACKEND_NO_SUCH_DB:
|
||||
fmt = _("The database\n"
|
||||
" %s\n"
|
||||
"doesn't seem to exist. Do you want to create it?\n");
|
||||
fmt = _("The database %s doesn't seem to exist. "
|
||||
"Do you want to create it?");
|
||||
if (gnc_verify_dialog (parent, TRUE, fmt, newfile)) { uh_oh = FALSE; }
|
||||
break;
|
||||
|
||||
case ERR_BACKEND_LOCKED:
|
||||
fmt = _("GnuCash could not obtain the lock for\n"
|
||||
" %s.\n"
|
||||
"That database may be in use by another user,\n"
|
||||
"in which case you should not open the database.\n"
|
||||
"\nDo you want to proceed with opening the database?");
|
||||
if (gnc_verify_dialog (parent, TRUE, fmt, newfile)) { uh_oh = FALSE; }
|
||||
switch (type){
|
||||
case GNC_FILE_DIALOG_OPEN:
|
||||
default:
|
||||
label = GTK_STOCK_OPEN;
|
||||
fmt = _("GnuCash could not obtain the lock for %s."
|
||||
"That database may be in use by another user, "
|
||||
"in which case you should not open the database. "
|
||||
"Do you want to proceed with opening the database?");
|
||||
break;
|
||||
|
||||
case GNC_FILE_DIALOG_IMPORT:
|
||||
label = _("Import");
|
||||
fmt = _("GnuCash could not obtain the lock for %s."
|
||||
"That database may be in use by another user, "
|
||||
"in which case you should not import the database. "
|
||||
"Do you want to proceed with importing the database?");
|
||||
break;
|
||||
|
||||
case GNC_FILE_DIALOG_SAVE:
|
||||
label = GTK_STOCK_SAVE;
|
||||
fmt = _("GnuCash could not obtain the lock for %s."
|
||||
"That database may be in use by another user, "
|
||||
"in which case you should not save the database. "
|
||||
"Do you want to proceed with saving the database?");
|
||||
break;
|
||||
|
||||
case GNC_FILE_DIALOG_EXPORT:
|
||||
label = _("Export");
|
||||
fmt = _("GnuCash could not obtain the lock for %s."
|
||||
"That database may be in use by another user, "
|
||||
"in which case you should not export the database. "
|
||||
"Do you want to proceed with exporting the database?");
|
||||
break;
|
||||
}
|
||||
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_NONE,
|
||||
fmt,
|
||||
newfile);
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
label, GTK_RESPONSE_YES,
|
||||
NULL);
|
||||
response = gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
gtk_widget_destroy(dialog);
|
||||
uh_oh = (response != GTK_RESPONSE_YES);
|
||||
break;
|
||||
|
||||
case ERR_BACKEND_READONLY:
|
||||
fmt = _("GnuCash could not write to\n"
|
||||
" %s.\n"
|
||||
"That database may be on a read-only file system,\n"
|
||||
"or you may not have write permission for the directory.\n");
|
||||
fmt = _("GnuCash could not write to %s. "
|
||||
"That database may be on a read-only file system, "
|
||||
"or you may not have write permission for the directory.");
|
||||
gnc_error_dialog (parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_BACKEND_DATA_CORRUPT:
|
||||
fmt = _("The file/URL \n %s\n"
|
||||
fmt = _("The file/URL %s"
|
||||
"does not contain GnuCash data or the data is corrupt.");
|
||||
gnc_error_dialog (parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_BACKEND_SERVER_ERR:
|
||||
fmt = _("The server at URL \n %s\n"
|
||||
fmt = _("The server at URL %s "
|
||||
"experienced an error or encountered bad or corrupt data.");
|
||||
gnc_error_dialog (parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_BACKEND_PERM:
|
||||
fmt = _("You do not have permission to access\n %s\n");
|
||||
fmt = _("You do not have permission to access %s.");
|
||||
gnc_error_dialog (parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_BACKEND_MISC:
|
||||
fmt = _("An error occurred while processing\n %s\n");
|
||||
fmt = _("An error occurred while processing %s.");
|
||||
gnc_error_dialog (parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
/* QSF additions */
|
||||
case ERR_QSF_INVALID_OBJ: {
|
||||
fmt = _("Invalid QSF Object file!\n"
|
||||
"The QSF object file\n%s\n failed to validate"
|
||||
" against the QSF object schema.\nThe XML structure of the file"
|
||||
" is either not well-formed or contains illegal data.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
}
|
||||
case ERR_QSF_INVALID_MAP: {
|
||||
fmt = _("Invalid QSF Map file!\n"
|
||||
"The QSF map file\n%s\n failed to validate "
|
||||
" against the QSF map schema.\nThe XML structure of the file"
|
||||
" is either not well-formed or contains illegal data.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
}
|
||||
case ERR_QSF_BAD_QOF_VERSION: {
|
||||
fmt = _("The QSF Map file\n%s\nwas written for a different version of QOF.\n"
|
||||
"It may need to be modified to work with your current QOF installation.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
}
|
||||
case ERR_QSF_BAD_MAP: {
|
||||
fmt = _("The selected QSF map\n%s\ncontains unusable data. "
|
||||
"This is usually because not all the required parameters for "
|
||||
"the defined objects have calculations described in the map.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
}
|
||||
case ERR_QSF_BAD_OBJ_GUID: {
|
||||
fmt = _("The selected QSF object file\n%s\n contains one or more invalid GUIDs. "
|
||||
"The file cannot be processed - please check the source of the file "
|
||||
"and try again.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
}
|
||||
case ERR_QSF_NO_MAP: {
|
||||
fmt = _("The selected QSF Object file\n%s\nrequires a map but it was not provided.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
}
|
||||
case ERR_QSF_WRONG_MAP: {
|
||||
fmt = _("Wrong QSF map selected.\n"
|
||||
"The selected map,\n%s\n validates but was written "
|
||||
"for different QOF objects.\n The list of objects defined in "
|
||||
"this map does not include all the objects described in "
|
||||
"the current QSF object file.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
}
|
||||
case ERR_QSF_MAP_NOT_OBJ: {
|
||||
fmt = _("The selected file \n %s\n is a QSF map and cannot be "
|
||||
"opened as a QSF object.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
}
|
||||
case ERR_QSF_OVERFLOW : {
|
||||
fmt = _("When converting XML strings into numbers, an overflow "
|
||||
"has been detected. The QSF object file\n %s\ncontains invalid "
|
||||
"data in a field that is meant to hold a number.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
}
|
||||
case ERR_QSF_OPEN_NOT_MERGE : {
|
||||
fmt = _("The QSF object file\n %s\nis valid and contains GnuCash "
|
||||
"objects. However, GnuCash cannot open the file directly because "
|
||||
"the data needs to be merged into an existing GnuCash data book. "
|
||||
"Please open a GnuCash file or create a new one, then import "
|
||||
"this QSF object file so that the data can be merged into the "
|
||||
"main data book.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
}
|
||||
/* QSF additions */
|
||||
case ERR_QSF_INVALID_OBJ:
|
||||
fmt = _("Invalid QSF Object file! The QSF object file %s failed to"
|
||||
" validate against the QSF object schema. The XML structure of"
|
||||
" the file is either not well-formed or contains illegal data.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_QSF_INVALID_MAP:
|
||||
fmt = _("Invalid QSF Map file! The QSF map file %s failed to validate"
|
||||
" against the QSF map schema. The XML structure of the file"
|
||||
" is either not well-formed or contains illegal data.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_QSF_BAD_QOF_VERSION:
|
||||
fmt = _("The QSF Map file %s was written for a different version of"
|
||||
" QOF. It may need to be modified to work with your current"
|
||||
" QOF installation.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_QSF_BAD_MAP:
|
||||
fmt = _("The selected QSF map %s contains unusable data. "
|
||||
"This is usually because not all the required parameters for "
|
||||
"the defined objects have calculations described in the map.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_QSF_BAD_OBJ_GUID:
|
||||
fmt = _("The selected QSF object file %s contains one or more invalid "
|
||||
"GUIDs. The file cannot be processed - please check the source "
|
||||
"of the file and try again.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_QSF_NO_MAP:
|
||||
fmt = _("The selected QSF Object file %s requires a map but it was "
|
||||
"not provided.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_QSF_WRONG_MAP:
|
||||
fmt = _("Wrong QSF map selected. The selected map %s validates but was "
|
||||
"written for different QOF objects. The list of objects defined "
|
||||
"in this map does not include all the objects described in "
|
||||
"the current QSF object file.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_QSF_MAP_NOT_OBJ:
|
||||
fmt = _("The selected file %s is a QSF map and cannot be "
|
||||
"opened as a QSF object.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_QSF_OVERFLOW:
|
||||
fmt = _("When converting XML strings into numbers, an overflow "
|
||||
"has been detected. The QSF object file %s contains invalid "
|
||||
"data in a field that is meant to hold a number.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_QSF_OPEN_NOT_MERGE:
|
||||
fmt = _("The QSF object file %s is valid and contains GnuCash "
|
||||
"objects. However, GnuCash cannot open the file directly because "
|
||||
"the data needs to be merged into an existing GnuCash data book. "
|
||||
"Please open a GnuCash file or create a new one, then import "
|
||||
"this QSF object file so that the data can be merged into the "
|
||||
"main data book.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_FILEIO_FILE_BAD_READ:
|
||||
fmt = _("There was an error reading the file.\n"
|
||||
fmt = _("There was an error reading the file. "
|
||||
"Do you want to continue?");
|
||||
if (gnc_verify_dialog (parent, TRUE, fmt)) { uh_oh = FALSE; }
|
||||
break;
|
||||
|
||||
case ERR_FILEIO_PARSE_ERROR:
|
||||
fmt = _("There was an error parsing the file\n %s");
|
||||
fmt = _("There was an error parsing the file %s.");
|
||||
gnc_error_dialog (parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_FILEIO_FILE_EMPTY:
|
||||
fmt = _("The file \n %s\nis empty.");
|
||||
fmt = _("The file %s is empty.");
|
||||
gnc_error_dialog (parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_FILEIO_FILE_NOT_FOUND:
|
||||
fmt = _("The file \n %s\ncould not be found.");
|
||||
fmt = _("The file %s could not be found.");
|
||||
gnc_error_dialog (parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_FILEIO_FILE_TOO_OLD:
|
||||
fmt = _("This file is from an older version of GnuCash.\n"
|
||||
fmt = _("This file is from an older version of GnuCash. "
|
||||
"Do you want to continue?");
|
||||
if (gnc_verify_dialog (parent, TRUE, fmt)) { uh_oh = FALSE; }
|
||||
break;
|
||||
|
||||
case ERR_FILEIO_UNKNOWN_FILE_TYPE:
|
||||
fmt = _("The file type of file\n %s\nis unknown.");
|
||||
fmt = _("The file type of file %s is unknown.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_FILEIO_BACKUP_ERROR:
|
||||
fmt = _("Could not make a backup of the file\n %s");
|
||||
fmt = _("Could not make a backup of the file %s");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_FILEIO_WRITE_ERROR:
|
||||
fmt = _("Could not write to file\n %s\nCheck that you have "
|
||||
fmt = _("Could not write to file %s Check that you have "
|
||||
"permission to write to this file and that "
|
||||
"there is sufficient space to create it.");
|
||||
gnc_error_dialog(parent, fmt, newfile);
|
||||
break;
|
||||
|
||||
case ERR_SQL_DB_TOO_OLD:
|
||||
fmt = _("This database is from an older version of GnuCash.\n"
|
||||
fmt = _("This database is from an older version of GnuCash. "
|
||||
"Do you want to want to upgrade the database "
|
||||
"to the current version?");
|
||||
if (gnc_verify_dialog (parent, TRUE, fmt)) { uh_oh = FALSE; }
|
||||
@ -404,17 +445,17 @@ show_session_error (QofBackendError io_error, const char *newfile)
|
||||
|
||||
case ERR_SQL_DB_BUSY:
|
||||
fmt = _("The SQL database is in use by other users, "
|
||||
"and the upgrade cannot be performed until they logoff.\n"
|
||||
"If there are currently no other users, consult the \n"
|
||||
"documentation to learn how to clear out dangling login\n"
|
||||
"and the upgrade cannot be performed until they logoff. "
|
||||
"If there are currently no other users, consult the "
|
||||
"documentation to learn how to clear out dangling login "
|
||||
"sessions.");
|
||||
gnc_error_dialog (parent, fmt);
|
||||
break;
|
||||
|
||||
default:
|
||||
PERR("FIXME: Unhandled error %d", io_error);
|
||||
fmt = _("An unknown I/O error occurred.");
|
||||
gnc_error_dialog (parent, fmt);
|
||||
fmt = _("An unknown I/O error (%d) occurred.");
|
||||
gnc_error_dialog (parent, fmt, io_error);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -456,7 +497,7 @@ gnc_file_new (void)
|
||||
|
||||
/* If user attempts to start a new session before saving results of
|
||||
* the last one, prompt them to clean up their act. */
|
||||
if (!gnc_file_query_save ())
|
||||
if (!gnc_file_query_save (TRUE))
|
||||
return;
|
||||
|
||||
session = qof_session_get_current_session ();
|
||||
@ -485,7 +526,7 @@ gnc_file_new (void)
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnc_file_query_save (void)
|
||||
gnc_file_query_save (gboolean can_cancel)
|
||||
{
|
||||
GtkWidget *parent = gnc_ui_get_toplevel();
|
||||
|
||||
@ -497,26 +538,46 @@ gnc_file_query_save (void)
|
||||
*/
|
||||
while (qof_book_not_saved(qof_session_get_book (qof_session_get_current_session ())))
|
||||
{
|
||||
gint result;
|
||||
const char *message = _("Changes have been made since the last "
|
||||
"Save. Save the data to file?");
|
||||
GtkWidget *dialog;
|
||||
gint response;
|
||||
const char *title = _("Save changes to the file?");
|
||||
const char *message =
|
||||
_("Changes have been made since the last time it was saved. If "
|
||||
"you continue without saving these changes will be discarded.");
|
||||
|
||||
if (can_cancel_cb && can_cancel_cb ())
|
||||
result = gnc_verify_cancel_dialog (parent, GTK_RESPONSE_YES, message);
|
||||
else
|
||||
{
|
||||
gboolean do_save = gnc_verify_dialog (parent, TRUE, message);
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_NONE,
|
||||
"%s", title);
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
|
||||
"%s", message);
|
||||
gtk_dialog_add_button(GTK_DIALOG(dialog),
|
||||
_("Continue _Without Saving"), GTK_RESPONSE_OK);
|
||||
|
||||
result = do_save ? GTK_RESPONSE_YES : GTK_RESPONSE_NO;
|
||||
if (can_cancel)
|
||||
gtk_dialog_add_button(GTK_DIALOG(dialog),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
||||
gtk_dialog_add_button(GTK_DIALOG(dialog),
|
||||
GTK_STOCK_SAVE, GTK_RESPONSE_YES);
|
||||
response = gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
gtk_widget_destroy(dialog);
|
||||
|
||||
switch (response) {
|
||||
case GTK_RESPONSE_YES:
|
||||
gnc_file_save ();
|
||||
/* Go check the loop condition. */
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
default:
|
||||
if (can_cancel)
|
||||
return FALSE;
|
||||
/* No cancel function available. Fall through. */
|
||||
|
||||
case GTK_RESPONSE_OK:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (result == GTK_RESPONSE_CANCEL)
|
||||
return FALSE;
|
||||
|
||||
if (result == GTK_RESPONSE_NO)
|
||||
return TRUE;
|
||||
|
||||
gnc_file_save ();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -541,7 +602,8 @@ gnc_post_file_open (const char * filename)
|
||||
newfile = xaccResolveURL (filename);
|
||||
if (!newfile)
|
||||
{
|
||||
show_session_error (ERR_FILEIO_FILE_NOT_FOUND, filename);
|
||||
show_session_error (ERR_FILEIO_FILE_NOT_FOUND, filename,
|
||||
GNC_FILE_DIALOG_OPEN);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -586,26 +648,12 @@ gnc_post_file_open (const char * filename)
|
||||
|
||||
gnc_destroy_splash_screen(); /* Just in case */
|
||||
|
||||
#ifdef HAVE_GLIB26
|
||||
dialog = gtk_message_dialog_new(NULL,
|
||||
0,
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_NONE,
|
||||
fmt1, newfile);
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), fmt2);
|
||||
#else
|
||||
{
|
||||
gchar *tmp;
|
||||
|
||||
tmp = g_strdup_printf("<b>%s</b>\n\n%s", fmt1, fmt2);
|
||||
dialog = gtk_message_dialog_new_with_markup(NULL,
|
||||
0,
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_NONE,
|
||||
tmp, newfile);
|
||||
g_free(tmp);
|
||||
}
|
||||
#endif
|
||||
|
||||
gnc_gtk_dialog_add_button(dialog, _("_Open Anyway"),
|
||||
GTK_STOCK_OPEN, RESPONSE_OPEN);
|
||||
@ -649,7 +697,7 @@ gnc_post_file_open (const char * filename)
|
||||
else if ((ERR_BACKEND_NO_SUCH_DB == io_err) ||
|
||||
(ERR_SQL_DB_TOO_OLD == io_err))
|
||||
{
|
||||
if (FALSE == show_session_error (io_err, newfile))
|
||||
if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_OPEN))
|
||||
{
|
||||
/* user told us to create a new database. Do it. */
|
||||
qof_session_begin (new_session, newfile, FALSE, TRUE);
|
||||
@ -669,7 +717,7 @@ gnc_post_file_open (const char * filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
uh_oh = show_session_error (io_err, newfile);
|
||||
uh_oh = show_session_error (io_err, newfile, GNC_FILE_DIALOG_OPEN);
|
||||
}
|
||||
|
||||
if (!uh_oh)
|
||||
@ -688,7 +736,7 @@ gnc_post_file_open (const char * filename)
|
||||
|
||||
/* check for i/o error, put up appropriate error dialog */
|
||||
io_err = qof_session_get_error (new_session);
|
||||
uh_oh = show_session_error (io_err, newfile);
|
||||
uh_oh = show_session_error (io_err, newfile, GNC_FILE_DIALOG_OPEN);
|
||||
|
||||
new_group = gnc_book_get_group (qof_session_get_book (new_session));
|
||||
if (uh_oh) new_group = NULL;
|
||||
@ -697,7 +745,8 @@ gnc_post_file_open (const char * filename)
|
||||
* The backend forgot to set an error. So make one up. */
|
||||
if (!uh_oh && !new_group)
|
||||
{
|
||||
uh_oh = show_session_error (ERR_BACKEND_MISC, newfile);
|
||||
uh_oh = show_session_error (ERR_BACKEND_MISC, newfile,
|
||||
GNC_FILE_DIALOG_OPEN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -754,7 +803,7 @@ gnc_file_open (void)
|
||||
char *lastfile;
|
||||
gboolean result;
|
||||
|
||||
if (!gnc_file_query_save ())
|
||||
if (!gnc_file_query_save (TRUE))
|
||||
return FALSE;
|
||||
|
||||
lastfile = gnc_history_get_last();
|
||||
@ -777,7 +826,7 @@ gnc_file_open_file (const char * newfile)
|
||||
{
|
||||
if (!newfile) return FALSE;
|
||||
|
||||
if (!gnc_file_query_save ())
|
||||
if (!gnc_file_query_save (TRUE))
|
||||
return FALSE;
|
||||
|
||||
return gnc_post_file_open (newfile);
|
||||
@ -820,7 +869,7 @@ gnc_file_export_file(const char * newfile)
|
||||
/* if file appears to be locked, ask the user ... */
|
||||
if (ERR_BACKEND_LOCKED == io_err || ERR_BACKEND_READONLY == io_err)
|
||||
{
|
||||
if (FALSE == show_session_error (io_err, newfile))
|
||||
if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_EXPORT))
|
||||
{
|
||||
/* user told us to ignore locks. So ignore them. */
|
||||
qof_session_begin (new_session, newfile, TRUE, FALSE);
|
||||
@ -901,7 +950,7 @@ gnc_file_save (void)
|
||||
io_err = qof_session_get_error (session);
|
||||
if (ERR_BACKEND_NO_ERR != io_err)
|
||||
{
|
||||
show_session_error (io_err, newfile);
|
||||
show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE);
|
||||
|
||||
if (been_here_before) return;
|
||||
been_here_before = TRUE;
|
||||
@ -947,7 +996,8 @@ gnc_file_save_as (void)
|
||||
newfile = xaccResolveURL (filename);
|
||||
if (!newfile)
|
||||
{
|
||||
show_session_error (ERR_FILEIO_FILE_NOT_FOUND, filename);
|
||||
show_session_error (ERR_FILEIO_FILE_NOT_FOUND, filename,
|
||||
GNC_FILE_DIALOG_SAVE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -970,7 +1020,7 @@ gnc_file_save_as (void)
|
||||
/* if file appears to be locked, ask the user ... */
|
||||
if (ERR_BACKEND_LOCKED == io_err || ERR_BACKEND_READONLY == io_err)
|
||||
{
|
||||
if (FALSE == show_session_error (io_err, newfile))
|
||||
if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE))
|
||||
{
|
||||
/* user told us to ignore locks. So ignore them. */
|
||||
qof_session_begin (new_session, newfile, TRUE, FALSE);
|
||||
@ -981,7 +1031,7 @@ gnc_file_save_as (void)
|
||||
else if ((ERR_BACKEND_NO_SUCH_DB == io_err) ||
|
||||
(ERR_SQL_DB_TOO_OLD == io_err))
|
||||
{
|
||||
if (FALSE == show_session_error (io_err, newfile))
|
||||
if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE))
|
||||
{
|
||||
/* user told us to create a new database. Do it. */
|
||||
qof_session_begin (new_session, newfile, FALSE, TRUE);
|
||||
@ -995,7 +1045,7 @@ gnc_file_save_as (void)
|
||||
io_err = qof_session_get_error (new_session);
|
||||
if (ERR_BACKEND_NO_ERR != io_err)
|
||||
{
|
||||
show_session_error (io_err, newfile);
|
||||
show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE);
|
||||
xaccLogDisable();
|
||||
qof_session_destroy (new_session);
|
||||
xaccLogEnable();
|
||||
@ -1066,12 +1116,6 @@ gnc_file_quit (void)
|
||||
gnc_unset_busy_cursor (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_file_set_can_cancel_callback (GNCCanCancelSaveCB cb)
|
||||
{
|
||||
can_cancel_cb = cb;
|
||||
}
|
||||
|
||||
void
|
||||
gnc_file_set_shutdown_callback (GNCShutdownCB cb)
|
||||
{
|
||||
|
@ -132,7 +132,9 @@ void gnc_file_save_as (void);
|
||||
/** Tell the user about errors in the backends
|
||||
|
||||
*/
|
||||
gboolean show_session_error (QofBackendError io_error, const char *newfile);
|
||||
gboolean show_session_error (QofBackendError io_error,
|
||||
const char *newfile,
|
||||
GNCFileDialogType type);
|
||||
|
||||
char * gnc_file_dialog (const char * title,
|
||||
const char * filter,
|
||||
@ -142,13 +144,10 @@ char * gnc_file_dialog (const char * title,
|
||||
gboolean gnc_file_open_file (const char *filename);
|
||||
void gnc_file_export_file(const char * filename);
|
||||
|
||||
gboolean gnc_file_query_save (void);
|
||||
gboolean gnc_file_query_save (gboolean can_cancel);
|
||||
|
||||
void gnc_file_quit (void);
|
||||
|
||||
typedef gboolean (*GNCCanCancelSaveCB) (void);
|
||||
void gnc_file_set_can_cancel_callback (GNCCanCancelSaveCB cb);
|
||||
|
||||
typedef void (*GNCShutdownCB) (int);
|
||||
void gnc_file_set_shutdown_callback (GNCShutdownCB cb);
|
||||
|
||||
|
@ -449,7 +449,7 @@ gnc_shutdown (int exit_status)
|
||||
{
|
||||
if (gnucash_ui_is_running()) {
|
||||
if (!gnome_is_terminating) {
|
||||
if (gnc_file_query_save()) {
|
||||
if (gnc_file_query_save(FALSE)) {
|
||||
gnc_hook_run(HOOK_UI_SHUTDOWN, NULL);
|
||||
gnc_gui_shutdown();
|
||||
}
|
||||
|
@ -36,96 +36,6 @@
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
/* static short module = MOD_GUI; */
|
||||
|
||||
void gnc_remember_all_toggled (GtkToggleButton *togglebutton, gpointer user_data);
|
||||
|
||||
|
||||
void
|
||||
gnc_remember_all_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *other_button;
|
||||
gboolean active;
|
||||
|
||||
active = gtk_toggle_button_get_active(togglebutton);
|
||||
other_button = gnc_glade_lookup_widget(GTK_WIDGET(togglebutton),
|
||||
"remember_one");
|
||||
gtk_widget_set_sensitive(other_button, !active);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(other_button), FALSE);
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
gnc_remember_common(gncUIWidget parent, const gchar *dialog_name,
|
||||
const gchar *message, const gchar *gconf_key,
|
||||
const gchar *first_button_text, ...)
|
||||
{
|
||||
GladeXML *xml;
|
||||
GtkWidget *dialog, *label, *box, *checkbox;
|
||||
gint response;
|
||||
const gchar *text;
|
||||
va_list args;
|
||||
|
||||
/* Does the user want to see this question? If not, return the
|
||||
* previous answer. */
|
||||
response = gnc_gconf_get_int(GCONF_WARNINGS_PERM, gconf_key, NULL);
|
||||
if (response != 0)
|
||||
return response;
|
||||
response = gnc_gconf_get_int(GCONF_WARNINGS_TEMP, gconf_key, NULL);
|
||||
if (response != 0)
|
||||
return response;
|
||||
|
||||
/* Find the glade page layout */
|
||||
xml = gnc_glade_xml_new ("gnc-gui-query.glade", dialog_name);
|
||||
dialog = glade_xml_get_widget (xml, dialog_name);
|
||||
glade_xml_signal_autoconnect_full(xml, gnc_glade_autoconnect_full_func,
|
||||
dialog);
|
||||
|
||||
/* Insert the message. */
|
||||
label = glade_xml_get_widget (xml, "label");
|
||||
gtk_label_set_markup(GTK_LABEL(label), message);
|
||||
|
||||
/* Hide the checkboxes if there's no key */
|
||||
box = glade_xml_get_widget (xml, "remember_vbox");
|
||||
if (gconf_key == NULL)
|
||||
gtk_widget_hide(box);
|
||||
|
||||
/* Set the buttons */
|
||||
va_start(args, first_button_text);
|
||||
for (text = first_button_text; text != NULL; ) {
|
||||
response = va_arg(args, gint);
|
||||
gtk_dialog_add_button(GTK_DIALOG(dialog), text, response);
|
||||
text = va_arg(args, gchar *);
|
||||
}
|
||||
va_end(args);
|
||||
// gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
|
||||
|
||||
/* Tell the window manager if there's a parent window. */
|
||||
if (parent)
|
||||
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW (parent));
|
||||
|
||||
/* Get a response */
|
||||
response = gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
if ((response == GTK_RESPONSE_NONE) || (response == GTK_RESPONSE_DELETE_EVENT)) {
|
||||
gtk_widget_destroy(GTK_WIDGET(dialog));
|
||||
return GTK_RESPONSE_NO;
|
||||
}
|
||||
|
||||
/* Save the answer? */
|
||||
checkbox = glade_xml_get_widget (xml, "remember_all");
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox))) {
|
||||
gnc_gconf_set_int(GCONF_WARNINGS_PERM, gconf_key, response, NULL);
|
||||
} else {
|
||||
checkbox = glade_xml_get_widget (xml, "remember_one");
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox))) {
|
||||
gnc_gconf_set_int(GCONF_WARNINGS_TEMP, gconf_key, response, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_destroy(GTK_WIDGET(dialog));
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_ok_cancel_dialog *
|
||||
* display a message, and asks the user to press "Ok" or "Cancel" *
|
||||
@ -173,59 +83,6 @@ gnc_ok_cancel_dialog(gncUIWidget parent,
|
||||
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_verify_cancel_dialog *
|
||||
* display a message, and asks the user to press "Yes", "No", or *
|
||||
* "Cancel" *
|
||||
* *
|
||||
* NOTE: This function does not return until the dialog is closed *
|
||||
* *
|
||||
* Args: parent - the parent window *
|
||||
* default - the button that will be the default *
|
||||
* format - the format string for the message to display *
|
||||
* This is a standard 'printf' style string. *
|
||||
* args - a pointer to the first argument for the format *
|
||||
* string. *
|
||||
* Return: the result the user selected *
|
||||
\********************************************************************/
|
||||
|
||||
gint
|
||||
gnc_verify_cancel_dialog(GtkWidget *parent,
|
||||
gint default_result,
|
||||
const gchar *format, ...)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
gint result;
|
||||
gchar *buffer;
|
||||
va_list args;
|
||||
|
||||
if (parent == NULL)
|
||||
parent = gnc_ui_get_toplevel();
|
||||
|
||||
va_start(args, format);
|
||||
buffer = g_strdup_vprintf(format, args);
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
|
||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_NONE,
|
||||
"%s",
|
||||
buffer);
|
||||
g_free(buffer);
|
||||
va_end(args);
|
||||
|
||||
gtk_dialog_add_buttons (GTK_DIALOG(dialog),
|
||||
GTK_STOCK_YES, GTK_RESPONSE_YES,
|
||||
GTK_STOCK_NO, GTK_RESPONSE_NO,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_default_response(GTK_DIALOG(dialog), default_result);
|
||||
result = gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_verify_dialog *
|
||||
* display a message, and asks the user to press "Yes" or "No" *
|
||||
@ -271,27 +128,6 @@ gnc_verify_dialog(gncUIWidget parent, gboolean yes_is_default,
|
||||
}
|
||||
|
||||
|
||||
gint
|
||||
gnc_verify_remember_dialog(gncUIWidget parent, const gchar *gconf_key,
|
||||
const gchar *yes_label, const gchar *no_label,
|
||||
const gchar *format, ...)
|
||||
{
|
||||
gchar *buffer;
|
||||
gint response;
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
buffer = g_strdup_vprintf(format, args);
|
||||
response = gnc_remember_common(parent, "Question Dialog", buffer, gconf_key,
|
||||
yes_label, GTK_RESPONSE_YES,
|
||||
no_label, GTK_RESPONSE_NO,
|
||||
NULL);
|
||||
g_free(buffer);
|
||||
va_end(args);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_info_dialog *
|
||||
* displays an information dialog box *
|
||||
@ -362,12 +198,6 @@ gnc_warning_dialog_common(GtkWidget *parent, const gchar *format, va_list args)
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_warning_dialog_va(const gchar *format, va_list args)
|
||||
{
|
||||
gnc_warning_dialog_common(NULL, format, args);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_warning_dialog(GtkWidget *parent, const gchar *format, ...)
|
||||
{
|
||||
@ -379,28 +209,6 @@ gnc_warning_dialog(GtkWidget *parent, const gchar *format, ...)
|
||||
}
|
||||
|
||||
|
||||
gint
|
||||
gnc_warning_remember_dialog(gncUIWidget parent, const gchar *gconf_key,
|
||||
const gchar *yes_label, const gchar *no_label,
|
||||
const gchar *format, ...)
|
||||
{
|
||||
gchar *buffer;
|
||||
gint response;
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
buffer = g_strdup_vprintf(format, args);
|
||||
response = gnc_remember_common(parent, "Warning Dialog", buffer, gconf_key,
|
||||
yes_label, GTK_RESPONSE_YES,
|
||||
no_label, GTK_RESPONSE_NO,
|
||||
NULL);
|
||||
g_free(buffer);
|
||||
va_end(args);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* gnc_error_dialog_common *
|
||||
* displays an error dialog box *
|
||||
@ -434,12 +242,6 @@ gnc_error_dialog_common(GtkWidget *parent, const gchar *format, va_list args)
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_error_dialog_va(const gchar *format, va_list args)
|
||||
{
|
||||
gnc_error_dialog_common(NULL, format, args);
|
||||
}
|
||||
|
||||
void
|
||||
gnc_error_dialog(GtkWidget *parent, const gchar *format, ...)
|
||||
{
|
||||
|
@ -28,13 +28,6 @@ gnc_info_dialog(GtkWidget *parent,
|
||||
const char *format, ...) G_GNUC_PRINTF (2, 3);
|
||||
|
||||
|
||||
extern void
|
||||
gnc_warning_dialog_va(const char *format, va_list args);
|
||||
|
||||
|
||||
extern void
|
||||
gnc_error_dialog_va(const char *format, va_list args);
|
||||
|
||||
extern void
|
||||
gnc_error_dialog(GtkWidget *parent,
|
||||
const char *format, ...) G_GNUC_PRINTF (2, 3);
|
||||
|
@ -839,13 +839,16 @@ gnc_main_window_prompt_for_save (GtkWidget *window)
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_NONE,
|
||||
_("<b>Save changes to file %s before "
|
||||
"closing?</b>\n\nIf you don't save, "
|
||||
"changes will be discarded."),
|
||||
"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
|
||||
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
|
||||
_("Close _without Saving"), GTK_RESPONSE_CLOSE,
|
||||
_("Close _Without Saving"), GTK_RESPONSE_CLOSE,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_SAVE, GTK_RESPONSE_APPLY,
|
||||
NULL);
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "dialog-options.h"
|
||||
#include "gnc-html.h"
|
||||
#include "qof.h"
|
||||
#include "gnc-err-popup.h"
|
||||
#include "gnc-gui-query.h"
|
||||
|
||||
#include "gnc-druid-gnome.h"
|
||||
@ -96,15 +95,11 @@ libgncmod_gnome_utils_LTX_gnc_module_init(int refcount) {
|
||||
gnc_druid_provider_multifile_gnome_register();
|
||||
}
|
||||
|
||||
gnc_set_warning_message(gnc_warning_dialog_va);
|
||||
gnc_set_error_message(gnc_error_dialog_va);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
libgncmod_gnome_utils_LTX_gnc_module_end(int refcount)
|
||||
{
|
||||
gnc_set_warning_message(NULL);
|
||||
gnc_set_error_message(NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -429,15 +429,6 @@ be left empty")
|
||||
((<gw:mchars> caller-owned) name))
|
||||
"Get a boolean value from gconf.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:file-query-save
|
||||
'<gw:bool>
|
||||
"gnc_file_query_save"
|
||||
'()
|
||||
"Query the user whether to save the current file, and save
|
||||
if they say 'Yes'. The return is false if the user says 'Cancel'.")
|
||||
|
||||
(gw:wrap-function
|
||||
ws
|
||||
'gnc:file-quit
|
||||
|
@ -256,7 +256,8 @@ on_dateok_clicked (chart_data *data)
|
||||
qof_object_foreach(GNC_ID_SPLIT, book, chart_reference_cb, data);
|
||||
g_list_free(data->param_ref_list);
|
||||
qof_session_save(chart_session, NULL);
|
||||
show_session_error(qof_session_get_error(chart_session), filename);
|
||||
show_session_error(qof_session_get_error(chart_session),
|
||||
filename, GNC_FILE_DIALOG_EXPORT);
|
||||
gnc_engine_resume_events();
|
||||
gnc_unset_busy_cursor(NULL);
|
||||
}
|
||||
|
@ -96,6 +96,9 @@ remove_clicked (CommoditiesDialog *cd)
|
||||
gboolean do_delete;
|
||||
gboolean can_delete;
|
||||
gnc_commodity *commodity;
|
||||
GtkWidget *dialog;
|
||||
const gchar *message, *warning;
|
||||
gint response;
|
||||
|
||||
commodity = gnc_tree_view_commodity_get_selected_commodity (cd->commodity_tree);
|
||||
if (commodity == NULL)
|
||||
@ -134,21 +137,31 @@ remove_clicked (CommoditiesDialog *cd)
|
||||
prices = gnc_pricedb_get_prices(pdb, commodity, NULL);
|
||||
if (prices)
|
||||
{
|
||||
const char *message = _("This commodity has price quotes. Are\n"
|
||||
"you sure you want to delete the selected\n"
|
||||
"commodity and its price quotes?");
|
||||
|
||||
do_delete = gnc_verify_dialog (cd->dialog, TRUE, message);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *message = _("Are you sure you want to delete the\n"
|
||||
"selected commodity?");
|
||||
|
||||
do_delete = gnc_verify_dialog (cd->dialog, TRUE, message);
|
||||
message = _("This commodity has price quotes. Are "
|
||||
"you sure you want to delete the selected "
|
||||
"commodity and its price quotes?");
|
||||
warning = "delete_commodity2";
|
||||
} else {
|
||||
message = _("Are you sure you want to delete the "
|
||||
"selected commodity?");
|
||||
warning = "delete_commodity";
|
||||
}
|
||||
|
||||
if (do_delete)
|
||||
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);
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_DELETE, GTK_RESPONSE_OK,
|
||||
(gchar *)NULL);
|
||||
response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
|
||||
gtk_widget_destroy(dialog);
|
||||
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
{
|
||||
gnc_commodity_table *ct;
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "gnc-currency-edit.h"
|
||||
#include "gnc-date-edit.h"
|
||||
#include "gnc-engine.h"
|
||||
#include "gnc-gui-query.h"
|
||||
#include "gnc-pricedb.h"
|
||||
#include "gnc-tree-view-price.h"
|
||||
#include "gnc-ui.h"
|
||||
@ -146,7 +147,8 @@ gnc_prices_dialog_remove_clicked (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
PricesDialog *pdb_dialog = data;
|
||||
GList *price_list;
|
||||
gint length;
|
||||
gint length, response;
|
||||
GtkWidget *dialog;
|
||||
|
||||
ENTER(" ");
|
||||
price_list = gnc_tree_view_price_get_selected_prices(pdb_dialog->price_tree);
|
||||
@ -156,15 +158,37 @@ gnc_prices_dialog_remove_clicked (GtkWidget *widget, gpointer data)
|
||||
}
|
||||
|
||||
length = g_list_length(price_list);
|
||||
if (gnc_verify_dialog (pdb_dialog->dialog, TRUE,
|
||||
/* Translators: %d is the number of prices. This is a
|
||||
ngettext(3) message. */
|
||||
ngettext("Are you sure you want to delete the %d "
|
||||
"selected price?",
|
||||
"Are you sure you want to delete the %d "
|
||||
"selected prices?", length),
|
||||
length))
|
||||
{
|
||||
if (length > 1) {
|
||||
gchar *message;
|
||||
|
||||
message = g_strdup_printf
|
||||
(/* Translators: %d is the number of prices. This
|
||||
is a ngettext(3) message. */
|
||||
ngettext("Are you sure you want to delete the selected price?",
|
||||
"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);
|
||||
g_free(message);
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_DELETE, GTK_RESPONSE_YES,
|
||||
(gchar *)NULL);
|
||||
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
|
||||
response = gnc_dialog_run(GTK_DIALOG(dialog), "pricedb_remove_multiple");
|
||||
gtk_widget_destroy(dialog);
|
||||
} else {
|
||||
response = GTK_RESPONSE_YES;
|
||||
}
|
||||
|
||||
if (response == GTK_RESPONSE_YES) {
|
||||
GNCBook *book = gnc_get_current_book ();
|
||||
GNCPriceDB *pdb = gnc_book_get_pricedb (book);
|
||||
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "gnc-component-manager.h"
|
||||
#include "gnc-date-edit.h"
|
||||
#include "gnc-engine.h"
|
||||
#include "gnc-err-popup.h"
|
||||
#include "gnc-euro.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include "gnc-gui-query.h"
|
||||
@ -702,30 +701,48 @@ gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger )
|
||||
gboolean
|
||||
gnc_split_reg_check_close( GNCSplitReg *gsr )
|
||||
{
|
||||
gint result;
|
||||
GtkWidget *dialog;
|
||||
gint response;
|
||||
gboolean pending_changes;
|
||||
SplitRegister *reg;
|
||||
const char *message = _("The current transaction has been changed.\n"
|
||||
"Would you like to record it?");
|
||||
const char *title = _("Save transaction before closing?");
|
||||
const char *message =
|
||||
_("The current transaction has been changed. Would you like to "
|
||||
"record the changes before closing this page, close the page "
|
||||
"without recording the changes, or cancel the close?");
|
||||
|
||||
reg = gnc_ledger_display_get_split_register( gsr->ledger );
|
||||
pending_changes = gnc_split_register_changed( reg );
|
||||
if ( !pending_changes )
|
||||
return TRUE;
|
||||
|
||||
result = gnc_verify_cancel_dialog(gsr->window, GTK_RESPONSE_YES, message);
|
||||
switch (result)
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(gsr->window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_NONE,
|
||||
"%s", title);
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
|
||||
"%s", message);
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
|
||||
_("_Don't Record"), GTK_RESPONSE_REJECT,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
_("_Record"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
response = gnc_dialog_run(GTK_DIALOG(dialog), "transaction_changed");
|
||||
gtk_widget_destroy(dialog);
|
||||
|
||||
switch (response)
|
||||
{
|
||||
case GTK_RESPONSE_YES:
|
||||
case GTK_RESPONSE_OK:
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
gnc_split_reg_record_trans_cb( gsr->window, gsr );
|
||||
return TRUE;
|
||||
|
||||
case GTK_RESPONSE_NO:
|
||||
case GTK_RESPONSE_REJECT:
|
||||
gnc_split_register_cancel_cursor_trans_changes( reg );
|
||||
return TRUE;
|
||||
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
@ -931,15 +948,24 @@ gnc_split_reg_reverse_trans_cb (GtkWidget *w, gpointer data)
|
||||
static gboolean
|
||||
xaccTransWarnReadOnly (const Transaction *trans)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
const gchar *reason;
|
||||
const gchar *format =
|
||||
_("Cannot modify or delete this transaction. This transaction is "
|
||||
"marked read-only because:\n\n'%s'");
|
||||
|
||||
if (!trans) return FALSE;
|
||||
|
||||
reason = xaccTransGetReadOnly (trans);
|
||||
if (reason) {
|
||||
gnc_send_gui_error(_("Cannot modify or delete this transaction.\n"
|
||||
"This transaction is marked read-only because:\n\n'%s'"),
|
||||
reason);
|
||||
dialog = gtk_message_dialog_new(NULL,
|
||||
0,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
format,
|
||||
reason);
|
||||
gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
gtk_widget_destroy(dialog);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -954,7 +980,8 @@ gsr_default_reinit_handler( GNCSplitReg *gsr, gpointer data )
|
||||
Transaction *trans;
|
||||
Split *split;
|
||||
GtkWidget *dialog;
|
||||
gint result;
|
||||
gint response;
|
||||
const gchar *warning;
|
||||
|
||||
const char *message = _("Remove the splits from this transaction?");
|
||||
const char *recn_warn = _("This transaction contains reconciled splits. "
|
||||
@ -975,6 +1002,7 @@ gsr_default_reinit_handler( GNCSplitReg *gsr, gpointer data )
|
||||
GTK_BUTTONS_NONE,
|
||||
"<b>%s</b>\n\n%s",
|
||||
message, recn_warn);
|
||||
warning = "register_remove_all_splits2";
|
||||
} else {
|
||||
dialog =
|
||||
gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window),
|
||||
@ -983,15 +1011,16 @@ gsr_default_reinit_handler( GNCSplitReg *gsr, gpointer data )
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_NONE,
|
||||
"<b>%s</b>", message);
|
||||
warning = "register_remove_all_splits";
|
||||
}
|
||||
|
||||
gtk_dialog_add_button(GTK_DIALOG(dialog),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
||||
gnc_gtk_dialog_add_button(dialog, N_("_Remove Splits"),
|
||||
GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
|
||||
result = gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
|
||||
gtk_widget_destroy (dialog);
|
||||
if (result != GTK_RESPONSE_ACCEPT)
|
||||
if (response != GTK_RESPONSE_ACCEPT)
|
||||
return;
|
||||
|
||||
/*
|
||||
@ -1025,7 +1054,8 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
|
||||
Transaction *trans;
|
||||
Split *split;
|
||||
GtkWidget *dialog;
|
||||
gint result;
|
||||
gint response;
|
||||
const gchar *warning;
|
||||
|
||||
reg = gnc_ledger_display_get_split_register( gsr->ledger );
|
||||
|
||||
@ -1110,6 +1140,7 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_NONE,
|
||||
"<b>%s</b>\n\n%s", buf, recn_warn);
|
||||
warning = "register_delete_split2";
|
||||
} else {
|
||||
dialog =
|
||||
gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window),
|
||||
@ -1118,6 +1149,7 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_NONE,
|
||||
"<b>%s</b>", buf);
|
||||
warning = "register_delete_split";
|
||||
}
|
||||
g_free(buf);
|
||||
|
||||
@ -1125,9 +1157,9 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
||||
gnc_gtk_dialog_add_button(dialog, _("_Delete Split"),
|
||||
GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
|
||||
result = gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
|
||||
gtk_widget_destroy (dialog);
|
||||
if (result != GTK_RESPONSE_ACCEPT)
|
||||
if (response != GTK_RESPONSE_ACCEPT)
|
||||
return;
|
||||
|
||||
gnc_split_register_delete_current_split (reg);
|
||||
@ -1153,6 +1185,7 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_NONE,
|
||||
"<b>%s</b>\n\n%s", message, recn_warn);
|
||||
warning = "register_delete_trans2";
|
||||
} else {
|
||||
dialog =
|
||||
gtk_message_dialog_new_with_markup(GTK_WINDOW(gsr->window),
|
||||
@ -1161,14 +1194,15 @@ gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data )
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_NONE,
|
||||
"<b>%s</b>", message);
|
||||
warning = "register_delete_trans";
|
||||
}
|
||||
gtk_dialog_add_button(GTK_DIALOG(dialog),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
||||
gnc_gtk_dialog_add_button(dialog, _("_Delete Transaction"),
|
||||
GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
|
||||
result = gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
response = gnc_dialog_run(GTK_DIALOG(dialog), warning);
|
||||
gtk_widget_destroy (dialog);
|
||||
if (result != GTK_RESPONSE_ACCEPT)
|
||||
if (response != GTK_RESPONSE_ACCEPT)
|
||||
return;
|
||||
|
||||
gnc_split_register_delete_current_trans (reg);
|
||||
@ -1908,7 +1942,7 @@ gtk_callback_bug_workaround (gpointer argp)
|
||||
"<b>%s</b>\n\n%s",
|
||||
read_only,
|
||||
args->string);
|
||||
gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
gnc_dialog_run(GTK_DIALOG(dialog), "register_read_only");
|
||||
gtk_widget_destroy(dialog);
|
||||
g_free(args);
|
||||
return FALSE;
|
||||
|
@ -37,5 +37,233 @@
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/register_read_only</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/register_read_only</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/register_read_only</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Read only register.</short>
|
||||
<long>
|
||||
This dialog is presented when a read-only register is opened.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/register_delete_trans</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/register_delete_trans</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/register_delete_trans</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Delete a transaction.</short>
|
||||
<long>
|
||||
This dialog is presented before allowing you to delete a transaction.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/register_delete_trans2</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/register_delete_trans2</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/register_delete_trans2</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Delete a transaction.</short>
|
||||
<long>
|
||||
This dialog is presented before allowing you to delete a
|
||||
transaction that contains reconciled splits. Doing so will
|
||||
throw off the reconciled value of the register and can make
|
||||
it hard to perform future reconciliations.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/register_delete_split</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/register_delete_split</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/register_delete_split</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Remove a splits from a transaction.</short>
|
||||
<long>
|
||||
This dialog is presented before allowing you to remove a
|
||||
splits from a transaction.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/register_delete_split2</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/register_delete_split2</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/register_delete_split2</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Remove a splits from a transaction.</short>
|
||||
<long>
|
||||
This dialog is presented before allowing you to remove a
|
||||
reconciled splits from a transaction. Doing so will throw
|
||||
off the reconciled value of the register and can make it
|
||||
hard to perform future reconciliations.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/register_remove_all_splits</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/register_remove_all_splits</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/register_remove_all_splits</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Remove all the splits from a transaction.</short>
|
||||
<long>
|
||||
This dialog is presented before allowing you to remove all
|
||||
splits from a transaction.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/register_remove_all_splits2</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/register_remove_all_splits2</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/register_remove_all_splits2</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Remove all the splits from a transaction.</short>
|
||||
<long>
|
||||
This dialog is presented before allowing you to remove all
|
||||
splits (including some reconciled splits) from a transaction.
|
||||
Doing so will throw off the reconciled value of the register
|
||||
and can make it hard to perform future reconciliations.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/transaction_changed</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/transaction_changed</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/transaction_changed</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Commit changes to a transaction.</short>
|
||||
<long>
|
||||
This dialog is presented when you attempt to move out of a modified
|
||||
transaction. The changed data must be either saved or discarded.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/transaction_duplicated</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/transaction_duplicated</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/transaction_duplicated</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Duplicating a changed transaction.</short>
|
||||
<long>
|
||||
This dialog is presented when you attempt to duplicate a modified
|
||||
transaction. The changed data must be saved or the duplication canceled.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/invoice_entry_changed</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/invoice_entry_changed</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/invoice_entry_changed</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Commit changes to a invoice_entry.</short>
|
||||
<long>
|
||||
This dialog is presented when you attempt to move out of a modified
|
||||
invoice entry. The changed data must be either saved or discarded.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/invoice_entry_duplicated</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/invoice_entry_duplicated</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/invoice_entry_duplicated</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Duplicating a changed invoice_entry.</short>
|
||||
<long>
|
||||
This dialog is presented when you attempt to duplicate a modified
|
||||
invoice entry. The changed data must be saved or the duplication canceled.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/delete_commodity</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/delete_commodity</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/delete_commodity</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Delete a commodity.</short>
|
||||
<long>
|
||||
This dialog is presented before allowing you to delete a commodity.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/delete_commodity2</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/delete_commodity2</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/delete_commodity2</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Delete a commodity and prices.</short>
|
||||
<long>
|
||||
This dialog is presented before allowing you to delete a commodity
|
||||
that has price quotes attached. Deleting the commodity will delete
|
||||
the quotes as well.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gnucash/general/warnings/pricedb_remove_multiple</key>
|
||||
<applyto>/apps/gnucash/general/warnings/permanent/pricedb_remove_multiple</applyto>
|
||||
<applyto>/apps/gnucash/general/warnings/temporary/pricedb_remove_multiple</applyto>
|
||||
<owner>gnucash</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Delete multiple price quotes.</short>
|
||||
<long>
|
||||
This dialog is presented before allowing you to delete multiple price
|
||||
quotes at one time.
|
||||
</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
</schemalist>
|
||||
</gconfschemafile>
|
||||
|
@ -142,7 +142,7 @@ gnc_hbci_get_initial_password (GtkWidget *parent,
|
||||
|
||||
/* strings didn't match */
|
||||
if (gnc_ok_cancel_dialog (parent, GTK_RESPONSE_OK,
|
||||
_("The two passwords didn't match. \n"
|
||||
_("The two passwords didn't match. "
|
||||
"Please try again."))
|
||||
!= GTK_RESPONSE_OK)
|
||||
break;
|
||||
|
@ -32,11 +32,12 @@
|
||||
#include "gnc-ui.h"
|
||||
#include "pricecell.h"
|
||||
#include "datecell.h"
|
||||
#include "dialog-transfer.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "split-register-control.h"
|
||||
#include "split-register-model-save.h"
|
||||
#include "split-register-p.h"
|
||||
#include "table-allgui.h"
|
||||
#include "dialog-transfer.h"
|
||||
|
||||
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
@ -1252,7 +1253,7 @@ gnc_split_register_traverse (VirtualLocation *p_new_virt_loc,
|
||||
Transaction *pending_trans;
|
||||
VirtualLocation virt_loc;
|
||||
Transaction *trans, *new_trans;
|
||||
gint result;
|
||||
gint response;
|
||||
gboolean changed;
|
||||
SRInfo *info;
|
||||
Split *split;
|
||||
@ -1468,22 +1469,36 @@ gnc_split_register_traverse (VirtualLocation *p_new_virt_loc,
|
||||
/* Ok, we are changing transactions and the current transaction has
|
||||
* changed. See what the user wants to do. */
|
||||
{
|
||||
const char *message;
|
||||
GtkWidget *dialog, *window;
|
||||
const char *title = _("Save the current transaction?");
|
||||
const char *message =
|
||||
_("The current transaction has been changed. Would you like to "
|
||||
"record the changes before moving to a new transaction, move "
|
||||
"without recording the changes, or cancel the move?");
|
||||
|
||||
message = _("The current transaction has been changed.\n"
|
||||
"Would you like to record it?");
|
||||
|
||||
result = gnc_verify_cancel_dialog
|
||||
(gnc_split_register_get_parent (reg),
|
||||
GTK_RESPONSE_YES, message);
|
||||
window = gnc_split_register_get_parent(reg);
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_NONE,
|
||||
"%s", title);
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
|
||||
"%s", message);
|
||||
gtk_dialog_add_buttons(GTK_DIALOG(dialog),
|
||||
_("_Don't Record"), GTK_RESPONSE_REJECT,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
_("_Record"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
response = gnc_dialog_run(GTK_DIALOG(dialog), "transaction_changed");
|
||||
gtk_widget_destroy(dialog);
|
||||
}
|
||||
|
||||
switch (result)
|
||||
switch (response)
|
||||
{
|
||||
case GTK_RESPONSE_YES:
|
||||
case GTK_RESPONSE_ACCEPT:
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_NO:
|
||||
case GTK_RESPONSE_REJECT:
|
||||
{
|
||||
VirtualCellLocation vcell_loc;
|
||||
Split *new_split;
|
||||
@ -1512,10 +1527,8 @@ gnc_split_register_traverse (VirtualLocation *p_new_virt_loc,
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_CANCEL:
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
break;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@ -1538,6 +1551,7 @@ gboolean
|
||||
gnc_split_register_recn_cell_confirm (char old_flag, gpointer data)
|
||||
{
|
||||
SplitRegister *reg = data;
|
||||
GtkWidget *dialog, *window;
|
||||
gint response;
|
||||
const gchar *title = _("Mark split as unreconciled?");
|
||||
const gchar *message =
|
||||
@ -1549,11 +1563,17 @@ gnc_split_register_recn_cell_confirm (char old_flag, gpointer data)
|
||||
return TRUE;
|
||||
|
||||
/* Does the user want to be warned? */
|
||||
response = gnc_warning_remember_dialog(gnc_split_register_get_parent(reg),
|
||||
"mark_split_unreconciled",
|
||||
"_Unreconcile", GTK_STOCK_CANCEL,
|
||||
"<b>%s</b>\n\n%s\n",
|
||||
title, message);
|
||||
|
||||
window = gnc_split_register_get_parent(reg);
|
||||
dialog =
|
||||
gtk_message_dialog_new_with_markup(GTK_WINDOW(window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_CANCEL,
|
||||
"%s", title);
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
|
||||
"%s", message);
|
||||
gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Unreconcile"), GTK_RESPONSE_YES);
|
||||
response = gnc_dialog_run(GTK_DIALOG(dialog), "mark_split_unreconciled");
|
||||
gtk_widget_destroy(dialog);
|
||||
return (response == GTK_RESPONSE_YES);
|
||||
}
|
||||
|
@ -27,9 +27,9 @@
|
||||
|
||||
#include "Group.h"
|
||||
#include "datecell.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-engine.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include "gnc-err-popup.h"
|
||||
#include "gnc-ui.h"
|
||||
#include "pricecell.h"
|
||||
#include "recncell.h"
|
||||
@ -1783,15 +1783,24 @@ gnc_split_register_get_security_io_flags (VirtualLocation virt_loc,
|
||||
static gboolean
|
||||
xaccTransWarnReadOnly (const Transaction *trans)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
const gchar *reason;
|
||||
const gchar *format =
|
||||
_("Cannot modify or delete this transaction. This transaction is "
|
||||
"marked read-only because:\n\n'%s'");
|
||||
|
||||
if (!trans) return FALSE;
|
||||
|
||||
reason = xaccTransGetReadOnly (trans);
|
||||
if (reason) {
|
||||
gnc_send_gui_error(_("Cannot modify or delete this transaction.\n"
|
||||
"This transaction is marked read-only because:\n\n'%s'"),
|
||||
reason);
|
||||
dialog = gtk_message_dialog_new(NULL,
|
||||
0,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
format,
|
||||
reason);
|
||||
gtk_dialog_run(GTK_DIALOG(dialog));
|
||||
gtk_widget_destroy(dialog);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -1827,17 +1836,25 @@ gnc_split_register_confirm (VirtualLocation virt_loc, gpointer user_data)
|
||||
|
||||
if (recn == YREC)
|
||||
{
|
||||
GtkWidget *dialog, *window;
|
||||
gint response;
|
||||
const gchar *title = _("Change reconciled split?");
|
||||
const gchar *message = _("You are about to change a reconciled split. Doing so might make "
|
||||
"future reconciliation difficult! Continue with this change?");
|
||||
|
||||
/* Does the user want to be warned? */
|
||||
response = gnc_warning_remember_dialog(gnc_split_register_get_parent(reg),
|
||||
"change_reconciled_split",
|
||||
_("Change _Split"), GTK_STOCK_CANCEL,
|
||||
"<b>%s</b>\n\n%s\n",
|
||||
_("Change reconciled split?"),
|
||||
_("You are about to change a reconciled split. Doing so might make "
|
||||
"future reconciliation difficult! Continue with this change?"));
|
||||
|
||||
window = gnc_split_register_get_parent(reg);
|
||||
dialog =
|
||||
gtk_message_dialog_new_with_markup(GTK_WINDOW(window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_CANCEL,
|
||||
"%s", title);
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
|
||||
"%s", message);
|
||||
gtk_dialog_add_button(GTK_DIALOG(dialog), _("Change _Split"), GTK_RESPONSE_YES);
|
||||
response = gnc_dialog_run(GTK_DIALOG(dialog), "change_reconciled_split");
|
||||
gtk_widget_destroy(dialog);
|
||||
if (response != GTK_RESPONSE_YES)
|
||||
return FALSE;
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "combocell.h"
|
||||
#include "datecell.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "gnc-component-manager.h"
|
||||
#include "gnc-gconf-utils.h"
|
||||
#include "split-register-p.h"
|
||||
@ -414,15 +415,28 @@ gnc_split_register_duplicate_current (SplitRegister *reg)
|
||||
* it before we can duplicate. Make sure the user wants to do that. */
|
||||
if (changed)
|
||||
{
|
||||
const char *message = _("The current transaction has been changed.\n"
|
||||
"Would you like to record it?");
|
||||
gint result;
|
||||
GtkWidget *dialog, *window;
|
||||
gint response;
|
||||
const char *title = _("Save transaction before duplicating?");
|
||||
const char *message =
|
||||
_("The current transaction has been changed. Would you like to "
|
||||
"record the changes before duplicating the transaction, or "
|
||||
"cancel the duplication?");
|
||||
|
||||
result = gnc_ok_cancel_dialog
|
||||
(gnc_split_register_get_parent (reg),
|
||||
GTK_RESPONSE_OK, message);
|
||||
window = gnc_split_register_get_parent(reg);
|
||||
dialog = gtk_message_dialog_new(GTK_WINDOW(window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_CANCEL,
|
||||
"%s", title);
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
|
||||
"%s", message);
|
||||
gtk_dialog_add_button(GTK_DIALOG(dialog),
|
||||
_("_Record"), GTK_RESPONSE_ACCEPT);
|
||||
response = gnc_dialog_run(GTK_DIALOG(dialog), "transaction_duplicated");
|
||||
gtk_widget_destroy(dialog);
|
||||
|
||||
if (result != GTK_RESPONSE_OK)
|
||||
if (response != GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
gnc_resume_gui_refresh ();
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user