Merge branch 'prices-in' of /mygit/gnucash into prices-in

This commit is contained in:
Robert Fewell 2017-12-10 10:24:07 +00:00
commit 43f1b2fde0
140 changed files with 1616 additions and 1156 deletions

View File

@ -73,6 +73,23 @@ OPTION (AUTOTOOLS_IN_DIST "Add autotools support to distribution tarballs." ON)
# These are also settable from the command line in a similar way.
SET(GNUCASH_BUILD_ID "" CACHE STRING "Overrides the GnuCash build identification (Build ID) which defaults to a description of the vcs commit from which gnucash is built. Distributions may want to insert a package management based version number instead")
# Check that all of the absolute install paths are inside
# ${CMAKE_INSTALL_PREFIX}. If they're not, disable binreloc as it
# won't be able to find paths that aren't relative to the location of
# the executable.
foreach(install_dir ${CMAKE_INSTALL_FULL_BINDIR}
${CMAKE_INSTALL_FULL_SYSCONFDIR} ${CMAKE_INSTALL_FULL_DATAROOTDIR}
${CMAKE_INSTALL_FULL_DATADIR} ${CMAKE_INSTALL_FULL_LIBDIR})
string(FIND ${install_dir} ${CMAKE_INSTALL_PREFIX} in_prefix)
if(in_prefix EQUAL -1)
set(ENABLE_BINRELOC OFF)
message(WARNING "${install_dir} is set outside of the intallation prefix ${CMAKE_INSTALL_PREFIX}. That will break relocation so ENABLE_BINRELOC is set to off. With relocation disabled GnuCash will run only in its configured install location. You must set GNC_UNINSTALLED=1 and GNC_BUILDDIR=/path/to/builddir to run from the build directory. GnuCash will not run from a DESTDIR.")
break()
endif()
endforeach()
# GnuCash installs two files in ${CMAKE_INSTALL_SYSCONFDIR}
SET(BINDIR ${CMAKE_INSTALL_BINDIR} CACHE STRING "user executables")
SET(SYSCONFDIR ${CMAKE_INSTALL_SYSCONFDIR} CACHE STRING "read-only single-machine data")
SET(DATAROOTDIR ${CMAKE_INSTALL_DATAROOTDIR} CACHE STRING "read-only arch.-independent data root")
@ -82,7 +99,7 @@ SET(LOCALEDIR ${DATAROOTDIR}/locale CACHE STRING "locale-dependent data")
SET(GNC_HELPDIR ${DATADIR} CACHE STRING "where to store help files")
SET(DATADIRNAME share)
SET(GNC_SYSTEM_XDG_DATA_DIRS /usr/local/share /usr/share)
SET(GNC_DBD_DIR ${CMAKE_PREFIX_PATH}/lib/dbd CACHE PATH "specify location of libdbi drivers")
SET(GNC_DBD_DIR ${CMAKE_PREFIX_LIBDIR}/dbd CACHE PATH "specify location of libdbi drivers")
SET(PKGLIBDIR ${CMAKE_INSTALL_LIBDIR}/gnucash)
SET(TEST_MYSQL_URL "" CACHE STRING "MySQL database URL for testing")
SET(TEST_PGSQL_URL "" CACHE STRING "PgSQL database URL for testing")

View File

@ -162,13 +162,13 @@ gnc_search_callback_button_execute (GNCSearchCallbackButton *cb,
sw->selected_item_list = g_list_reverse(sw->selected_item_list);
// Call the callback
(cb->cb_multiselect_fn)(sw->selected_item_list, sw->user_data);
(cb->cb_multiselect_fn)(GTK_WINDOW (sw->dialog), sw->selected_item_list, sw->user_data);
}
else
{
// No, stick to the single-item callback
if (cb->cb_fcn)
(cb->cb_fcn)(&(sw->selected_item), sw->user_data);
(cb->cb_fcn)(GTK_WINDOW (sw->dialog), &(sw->selected_item), sw->user_data);
}
}
@ -234,11 +234,11 @@ gnc_search_dialog_select_cb (GtkButton *button, GNCSearchWindow *sw)
if (sw->selected_item == NULL && sw->allow_clear == FALSE)
{
char *msg = _("You must select an item from the list");
gnc_error_dialog (sw->dialog, "%s", msg);
gnc_error_dialog (GTK_WINDOW (sw->dialog), "%s", msg);
return;
}
(sw->selected_cb)(sw->selected_item, sw->select_arg);
(sw->selected_cb)(GTK_WINDOW (sw->dialog), sw->selected_item, sw->select_arg);
gnc_search_dialog_destroy (sw);
}
@ -637,7 +637,7 @@ search_new_item_cb (GtkButton *button, GNCSearchWindow *sw)
g_return_if_fail (sw->new_item_cb);
res = (sw->new_item_cb)(sw->user_data);
res = (sw->new_item_cb)(GTK_WINDOW (sw->dialog), sw->user_data);
if (res)
{
@ -1300,7 +1300,8 @@ gnc_search_dialog_raise (GNCSearchWindow *sw)
}
GNCSearchWindow *
gnc_search_dialog_create (QofIdTypeConst obj_type, const gchar *title,
gnc_search_dialog_create (GtkWindow *parent,
QofIdTypeConst obj_type, const gchar *title,
GList *param_list,
GList *display_list,
QofQuery *start_query, QofQuery *show_start_query,
@ -1345,6 +1346,7 @@ gnc_search_dialog_create (QofIdTypeConst obj_type, const gchar *title,
gnc_search_dialog_init_widgets (sw, title);
if (sw->prefs_group)
gnc_restore_window_size(sw->prefs_group, GTK_WINDOW(sw->dialog));
gtk_window_set_transient_for(GTK_WINDOW(sw->dialog), parent);
gtk_widget_show(sw->dialog);
// Set the style context for this dialog so it can be easily manipulated with css
@ -1465,7 +1467,7 @@ get_display_list (QofIdTypeConst type)
static void
do_nothing (gpointer *a, gpointer b)
do_nothing (GtkWindow *dialog, gpointer *a, gpointer b)
{
return;
}
@ -1494,7 +1496,7 @@ gnc_search_dialog_test (void)
display = get_display_list (GNC_ID_SPLIT);
/* FIXME: All this does is leak. */
gnc_search_dialog_create (GNC_ID_SPLIT, _("Find Transaction"),
gnc_search_dialog_create (NULL, GNC_ID_SPLIT, _("Find Transaction"),
params, display,
NULL, NULL, buttons, NULL, NULL, NULL, NULL,
NULL, NULL, NULL);

View File

@ -40,7 +40,7 @@ typedef struct _GNCSearchWindow GNCSearchWindow;
* result will be a pointer to the selected item (if one is selected)
* and the callback may change the value.
*/
typedef void (*GNCSearchCallback) (gpointer *obj_p, gpointer user_data);
typedef void (*GNCSearchCallback) (GtkWindow *dialog, gpointer *obj_p, gpointer user_data);
typedef void (*GNCSearchResultCB) (QofQuery *query, gpointer user_data,
gpointer *result);
@ -50,7 +50,7 @@ typedef void (*GNCSearchResultCB) (QofQuery *query, gpointer user_data,
* will be added to the query, but not selected. This means the GncGUID
* must be set.
*/
typedef gpointer (*GNCSearchNewItemCB) (gpointer user_data);
typedef gpointer (*GNCSearchNewItemCB) (GtkWindow *dialog, gpointer user_data);
/* Free the general user_data object */
typedef void (*GNCSearchFree) (gpointer user_data);
@ -59,15 +59,17 @@ typedef void (*GNCSearchFree) (gpointer user_data);
* button. The search dialog will close when this callback function
* returns.
*/
typedef void (*GNCSearchSelectedCB) (gpointer selected_object,
typedef void (*GNCSearchSelectedCB) (GtkWindow *dialog,
gpointer selected_object,
gpointer user_data);
/** This callback is called when (if) the user clicks the 'select'
* button. The search dialog will close when this callback function
* returns.
*/
typedef void (*GNCSearchMultiSelectedCB) (GList *list_of_selected_objects,
gpointer user_data);
typedef void (*GNCSearchMultiSelectedCB) (GtkWindow *dialog,
GList *list_of_selected_objects,
gpointer user_data);
typedef struct
{
@ -103,7 +105,8 @@ typedef struct
* the dialog will use the obj_type instead.
*/
GNCSearchWindow *
gnc_search_dialog_create (QofIdTypeConst obj_type, const gchar *title,
gnc_search_dialog_create (GtkWindow *parent,
QofIdTypeConst obj_type, const gchar *title,
GList *param_list,
GList *display_list,
QofQuery *start_query, QofQuery *show_start_query,

View File

@ -39,6 +39,7 @@
#include "gnc-component-manager.h"
#include "qof.h"
#include "gnc-general-search.h"
#include "gnc-ui.h"
#define GNCGENERALSEARCH_CLASS "gnc-general-search-widget"
@ -217,7 +218,7 @@ refresh_handler (GHashTable *changes, gpointer data)
/* The user has selected from the search dialog */
static void
new_item_selected_cb (gpointer item, gpointer user_data)
new_item_selected_cb (GtkWindow *dialog, gpointer item, gpointer user_data)
{
GNCGeneralSearch *gsl = user_data;
gnc_general_search_set_selected (gsl, item);
@ -250,7 +251,7 @@ search_cb(GtkButton * button, gpointer user_data)
return;
}
sw = (priv->search_cb)(gsl->selected_item, priv->user_data);
sw = (priv->search_cb)(gnc_ui_get_gtk_window (GTK_WIDGET (button)), gsl->selected_item, priv->user_data);
/* NULL means nothing to 'select' */
if (sw == NULL)
@ -284,7 +285,7 @@ search_cb(GtkButton * button, gpointer user_data)
* @param comp_iter The iter in the completion's temporary model
* that represents the user selected match.
*
* @param cbe A pointer to a currency entry widget. */
* @param gsl A pointer to a currency entry widget. */
static gboolean
gnc_gsl_match_selected_cb (GtkEntryCompletion *completion,
GtkTreeModel *comp_model,

View File

@ -51,7 +51,7 @@
* it actually returns a search-window, then this widget will set up the
* appropriate callbacks to the search window to obtain selections.
*/
typedef GNCSearchWindow *(*GNCSearchCB) (gpointer start, gpointer user_data);
typedef GNCSearchWindow *(*GNCSearchCB) (GtkWindow *parent, gpointer start, gpointer user_data);
typedef struct
{

View File

@ -1132,7 +1132,7 @@ cleanup_parse_file:
}
if (message)
{
gnc_error_dialog (data->assistant, "%s", message);
gnc_error_dialog (GTK_WINDOW (data->assistant), "%s", message);
}
if (!success)
gxi_session_destroy (data);
@ -1306,7 +1306,7 @@ gxi_add_encoding (GncXmlImportData *data, gpointer encoding_ptr)
if (g_list_find (data->encodings, encoding_ptr))
{
message = _("This encoding has been added to the list already.");
gnc_error_dialog (data->encodings_dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (data->encodings_dialog), "%s", message);
return;
}
@ -1317,7 +1317,7 @@ gxi_add_encoding (GncXmlImportData *data, gpointer encoding_ptr)
g_iconv_close (iconv);
g_free (enc_string);
message = _("This is an invalid encoding.");
gnc_error_dialog (data->encodings_dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (data->encodings_dialog), "%s", message);
return;
}
g_iconv_close (iconv);

View File

@ -467,7 +467,7 @@ gnc_ui_to_account(AccountWindow *aw)
if (!gnc_account_create_opening_balance (account, balance, date, aw->book))
{
const char *message = _("Could not create opening balance.");
gnc_error_dialog(aw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
}
}
else
@ -756,7 +756,7 @@ gnc_common_ok (AccountWindow *aw)
if (g_strcmp0(name, "") == 0)
{
const char *message = _("The account must be given a name.");
gnc_error_dialog(aw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
LEAVE("bad name");
return FALSE;
}
@ -782,7 +782,7 @@ gnc_common_ok (AccountWindow *aw)
!guid_equal(&aw->account, xaccAccountGetGUID (account)))
{
const char *message = _("There is already an account with that name.");
gnc_error_dialog(aw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
LEAVE("duplicate name");
return FALSE;
}
@ -791,7 +791,7 @@ gnc_common_ok (AccountWindow *aw)
if (!gnc_filter_parent_accounts(parent, aw))
{
const char *message = _("You must choose a valid parent account.");
gnc_error_dialog(aw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
LEAVE("invalid parent");
return FALSE;
}
@ -800,7 +800,7 @@ gnc_common_ok (AccountWindow *aw)
if (aw->type == ACCT_TYPE_INVALID)
{
const char *message = _("You must select an account type.");
gnc_error_dialog(aw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
LEAVE("invalid type");
return FALSE;
}
@ -810,7 +810,7 @@ gnc_common_ok (AccountWindow *aw)
{
const char *message = _("The selected account type is incompatible with "
"the one of the selected parent.");
gnc_error_dialog(aw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
LEAVE("incompatible types");
return FALSE;
}
@ -821,7 +821,7 @@ gnc_common_ok (AccountWindow *aw)
if (!commodity)
{
const char *message = _("You must choose a commodity.");
gnc_error_dialog(aw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
LEAVE("invalid commodity");
return FALSE;
}
@ -878,7 +878,7 @@ gnc_new_account_ok (AccountWindow *aw)
{
const char *message = _("You must enter a valid opening balance "
"or leave it blank.");
gnc_error_dialog(aw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
LEAVE(" ");
return;
}
@ -902,7 +902,7 @@ gnc_new_account_ok (AccountWindow *aw)
{
const char *message = _("You must select a transfer account or choose"
" the opening balances equity account.");
gnc_error_dialog(aw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (aw->dialog), "%s", message);
LEAVE(" ");
return;
}

View File

@ -297,14 +297,14 @@ gnc_book_close_response_cb(GtkDialog *dialog, gint response, GtkDialog *unused)
if (!income_acct)
{
gnc_error_dialog(cbw->dialog, "%s",
gnc_error_dialog(GTK_WINDOW (cbw->dialog), "%s",
_("Please select an Equity account to hold the total Period Income."));
break;
}
if (!expense_acct)
{
gnc_error_dialog(cbw->dialog, "%s",
gnc_error_dialog(GTK_WINDOW (cbw->dialog), "%s",
_("Please select an Equity account to hold the total Period Expense."));
break;
}

View File

@ -1282,8 +1282,8 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
gnc_commodity_commit_edit(c);
return TRUE;
}
gnc_warning_dialog(w->dialog, "%s",
_("You may not create a new national currency."));
gnc_warning_dialog (GTK_WINDOW (w->dialog), "%s",
_("You may not create a new national currency."));
return FALSE;
}
@ -1292,10 +1292,10 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
*/
if (g_utf8_collate(name_space, GNC_COMMODITY_NS_TEMPLATE) == 0)
{
gnc_warning_dialog (w->dialog,
_("%s is a reserved commodity type."
gnc_warning_dialog (GTK_WINDOW (w->dialog),
_("%s is a reserved commodity type."
" Please use something else."), GNC_COMMODITY_NS_TEMPLATE);
return FALSE;
return FALSE;
}
if (fullname && fullname[0] &&
@ -1308,7 +1308,7 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
if ((!w->edit_commodity && c) ||
(w->edit_commodity && c && (c != w->edit_commodity)))
{
gnc_warning_dialog (w->dialog, "%s", _("That commodity already exists."));
gnc_warning_dialog (GTK_WINDOW (w->dialog), "%s", _("That commodity already exists."));
g_free(name_space);
return FALSE;
}
@ -1356,10 +1356,10 @@ gnc_ui_commodity_dialog_to_object(CommodityWindow * w)
}
else
{
gnc_warning_dialog(w->dialog, "%s",
_("You must enter a non-empty \"Full name\", "
"\"Symbol/abbreviation\", "
"and \"Type\" for the commodity."));
gnc_warning_dialog (GTK_WINDOW (w->dialog), "%s",
_("You must enter a non-empty \"Full name\", "
"\"Symbol/abbreviation\", "
"and \"Type\" for the commodity."));
g_free(name_space);
return FALSE;
}

View File

@ -144,15 +144,15 @@ gnc_ui_file_access_response_cb(GtkDialog *dialog, gint response, GtkDialog *unus
gboolean open_readonly = faw->readonly_checkbutton
? gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(faw->readonly_checkbutton))
: FALSE;
gnc_file_open_file( url, open_readonly );
gnc_file_open_file (gnc_ui_get_main_window (GTK_WIDGET (dialog)), url, open_readonly);
}
else if ( faw->type == FILE_ACCESS_SAVE_AS )
{
gnc_file_do_save_as( url );
gnc_file_do_save_as (gnc_ui_get_main_window (GTK_WIDGET (dialog)), url);
}
else if ( faw->type == FILE_ACCESS_EXPORT )
{
gnc_file_do_export( url );
gnc_file_do_export (gnc_ui_get_main_window (GTK_WIDGET (dialog)), url);
}
break;
@ -240,7 +240,7 @@ get_default_database( void )
}
static void
gnc_ui_file_access( int type )
gnc_ui_file_access (GtkWindow *parent, int type)
{
FileAccessWindow *faw;
GtkBuilder* builder;
@ -275,6 +275,7 @@ gnc_ui_file_access( int type )
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-file-access.glade", "file_access_dialog" );
faw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "file_access_dialog" ));
gtk_window_set_transient_for (GTK_WINDOW (faw->dialog), parent);
g_object_set_data_full( G_OBJECT(faw->dialog), "FileAccessWindow", faw, g_free );
// Set the style context for this dialog so it can be easily manipulated with css
@ -446,21 +447,21 @@ gnc_ui_file_access( int type )
}
void
gnc_ui_file_access_for_open( void )
gnc_ui_file_access_for_open (GtkWindow *parent)
{
gnc_ui_file_access( FILE_ACCESS_OPEN );
gnc_ui_file_access (parent, FILE_ACCESS_OPEN);
}
void
gnc_ui_file_access_for_save_as( void )
gnc_ui_file_access_for_save_as (GtkWindow *parent)
{
gnc_ui_file_access( FILE_ACCESS_SAVE_AS );
gnc_ui_file_access (parent, FILE_ACCESS_SAVE_AS);
}
void
gnc_ui_file_access_for_export( void )
gnc_ui_file_access_for_export (GtkWindow *parent)
{
gnc_ui_file_access( FILE_ACCESS_EXPORT );
gnc_ui_file_access (parent, FILE_ACCESS_EXPORT);
}

View File

@ -34,9 +34,9 @@
* loading/open and for saving.
*/
void gnc_ui_file_access_for_open( void );
void gnc_ui_file_access_for_save_as( void );
void gnc_ui_file_access_for_export( void );
void gnc_ui_file_access_for_open (GtkWindow *parent);
void gnc_ui_file_access_for_save_as (GtkWindow *parent);
void gnc_ui_file_access_for_export (GtkWindow *parent);
/** @} */

View File

@ -834,7 +834,7 @@ gnc_option_changed_gain_loss_account_widget_cb (GtkTreeSelection *selection,
"the placeholder account by clicking on the arrow " \
"to the left.)");
gnc_error_dialog(NULL, "%s", message);
gnc_error_dialog (gnc_ui_get_gtk_window (book_currency_data->default_gain_loss_account_widget), "%s", message);
if (book_currency_data->prior_gain_loss_account)
{
(gnc_tree_view_account_set_selected_account

View File

@ -193,7 +193,7 @@ gnc_account_separator_validate_cb (GtkEntry *entry, GdkEvent *event, GtkWidget *
if (conflict_msg)
{
gnc_warning_dialog(dialog, "%s", conflict_msg);
gnc_warning_dialog (GTK_WINDOW (dialog), "%s", conflict_msg);
g_free ( conflict_msg );
}
g_free (separator);

View File

@ -85,7 +85,7 @@ gnc_dialog_query_run_callback (GNCDisplayViewButton *cb, gpointer item,
return;
if (cb->cb_fcn)
(cb->cb_fcn)(item, dqv->user_data);
(cb->cb_fcn)(GTK_WINDOW (dqv->dialog), item, dqv->user_data);
}
static void
@ -177,7 +177,7 @@ gnc_dialog_query_view_close (GtkButton *button, DialogQueryView *dqv)
/* PUBLIC INTERFACES */
DialogQueryView *
gnc_dialog_query_view_new (GList *param_list, Query *q)
gnc_dialog_query_view_new (GtkWindow *parent, GList *param_list, Query *q)
{
GtkBuilder *builder;
DialogQueryView *dqv;
@ -191,6 +191,7 @@ gnc_dialog_query_view_new (GList *param_list, Query *q)
/* Grab the dialog, save the dialog info */
dqv->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "query_view_dialog"));
g_object_set_data (G_OBJECT (dqv->dialog), "dialog-info", dqv);
gtk_window_set_transient_for(GTK_WINDOW(dqv->dialog), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dqv->dialog), "GncQueryViewDialog");
@ -313,7 +314,7 @@ void gnc_dialog_query_view_destroy (DialogQueryView *dqv)
}
DialogQueryView *
gnc_dialog_query_view_create (GList *param_list, Query *q,
gnc_dialog_query_view_create (GtkWindow *parent, GList *param_list, Query *q,
const char *title, const char *label,
gboolean abs, gboolean inv_sort,
gint sort_column, GtkSortType order,
@ -324,7 +325,7 @@ gnc_dialog_query_view_create (GList *param_list, Query *q,
if (!param_list || !q)
return NULL;
dqv = gnc_dialog_query_view_new (param_list, q);
dqv = gnc_dialog_query_view_new (parent, param_list, q);
if (!dqv)
return NULL;

View File

@ -31,7 +31,7 @@
typedef struct _DialogQueryView DialogQueryView;
typedef void (*GNCDisplayViewCB)(gpointer obj, gpointer user_data);
typedef void (*GNCDisplayViewCB)(GtkWindow *dialog, gpointer obj, gpointer user_data);
typedef struct
{
const char *label;
@ -39,7 +39,7 @@ typedef struct
} GNCDisplayViewButton;
DialogQueryView *
gnc_dialog_query_view_new (GList *param_list, Query *q);
gnc_dialog_query_view_new (GtkWindow *parent, GList *param_list, Query *q);
void gnc_dialog_query_view_set_title (DialogQueryView *dqv, const char *title);
void gnc_dialog_query_view_set_label (DialogQueryView *dqv, const char *label);
@ -53,7 +53,7 @@ void gnc_dialog_query_view_refresh (DialogQueryView *dqv);
void gnc_dialog_query_view_destroy (DialogQueryView *dqv);
DialogQueryView *
gnc_dialog_query_view_create (GList *param_list, Query *q,
gnc_dialog_query_view_create (GtkWindow *parent, GList *param_list, Query *q,
const char *title, const char *label,
gboolean abs, gboolean inv_sort,
gint sort_column, GtkSortType order,

View File

@ -114,7 +114,7 @@ new_tax_table_ok_cb (NewTaxTable *ntt)
if (name == NULL || *name == '\0')
{
message = _("You must provide a name for this Tax Table.");
gnc_error_dialog (ntt->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (ntt->dialog), "%s", message);
return FALSE;
}
if (gncTaxTableLookupByName (ttw->book, name))
@ -122,7 +122,7 @@ new_tax_table_ok_cb (NewTaxTable *ntt)
message = g_strdup_printf(_(
"You must provide a unique name for this Tax Table. "
"Your choice \"%s\" is already in use."), name);
gnc_error_dialog (ntt->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (ntt->dialog), "%s", message);
g_free (message);
return FALSE;
}
@ -135,7 +135,7 @@ new_tax_table_ok_cb (NewTaxTable *ntt)
gnc_numeric_create (100, 1)) > 0)
{
message = _("Percentage amount must be between -100 and 100.");
gnc_error_dialog (ntt->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (ntt->dialog), "%s", message);
return FALSE;
}
@ -144,7 +144,7 @@ new_tax_table_ok_cb (NewTaxTable *ntt)
if (acc == NULL)
{
message = _("You must choose a Tax Account.");
gnc_error_dialog (ntt->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (ntt->dialog), "%s", message);
return FALSE;
}
@ -563,12 +563,12 @@ tax_table_delete_table_cb (GtkButton *button, TaxTableWindow *ttw)
char *message =
g_strdup_printf (_("Tax table \"%s\" is in use. You cannot delete it."),
gncTaxTableGetName (ttw->current_table));
gnc_error_dialog (ttw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (ttw->dialog), "%s", message);
g_free (message);
return;
}
if (gnc_verify_dialog (ttw->dialog, FALSE,
if (gnc_verify_dialog (GTK_WINDOW (ttw->dialog), FALSE,
_("Are you sure you want to delete \"%s\"?"),
gncTaxTableGetName (ttw->current_table)))
{
@ -611,11 +611,11 @@ tax_table_delete_entry_cb (GtkButton *button, TaxTableWindow *ttw)
{
char *message = _("You cannot remove the last entry from the tax table. "
"Try deleting the tax table if you want to do that.");
gnc_error_dialog (ttw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (ttw->dialog) , "%s", message);
return;
}
if (gnc_verify_dialog (ttw->dialog, FALSE, "%s",
if (gnc_verify_dialog (GTK_WINDOW (ttw->dialog), FALSE, "%s",
_("Are you sure you want to delete this entry?")))
{
/* Ok, let's remove it */

View File

@ -34,6 +34,7 @@
#include "gnc-prefs.h"
#include "gnc-gnome-utils.h"
#include "gnc-engine.h"
#include "gnc-ui.h"
#define GNC_PREFS_GROUP "dialogs.totd"
#define GNC_PREF_CURRENT_TIP "current-tip"
@ -274,7 +275,8 @@ show_handler (const char *class_name, gint component_id,
return(FALSE);
}
gtk_window_present(GTK_WINDOW(totd_dialog->dialog));
gtk_window_set_transient_for (GTK_WINDOW (totd_dialog->dialog),
gnc_ui_get_main_window (NULL));
LEAVE(" ");
return(TRUE);
}
@ -374,3 +376,17 @@ gnc_totd_dialog (GtkWindow *parent, gboolean startup)
LEAVE("");
}
/****************************************************
* Set the totd dialog transient for the currently
* active main window. This will prevent the totd
* dialog from accidentally hiding behind a main
* window.
****************************************************/
void
gnc_totd_dialog_reparent (void)
{
gnc_forall_gui_components(DIALOG_TOTD_CM_CLASS, show_handler, NULL);
}

View File

@ -26,5 +26,6 @@
#define DIALOG_TOTD_H
void gnc_totd_dialog (GtkWindow *parent, gboolean startup);
void gnc_totd_dialog_reparent (void);
#endif

View File

@ -689,7 +689,7 @@ gnc_parse_error_dialog (XferDialog *xferData, const char *error_string)
if (error_string == NULL)
error_string = "";
gnc_error_dialog (xferData->dialog,
gnc_error_dialog (GTK_WINDOW (xferData->dialog),
"%s\n\n%s: %s.",
error_string, _("Error"),
parse_error_string);
@ -1417,7 +1417,7 @@ check_accounts (XferDialog* xferData, Account* from_account,
const char *message = _("You must specify an account to transfer from, "
"or to, or both, for this transaction. "
"Otherwise, it will not be recorded.");
gnc_error_dialog(xferData->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (xferData->dialog), "%s", message);
LEAVE("bad account");
return FALSE;
}
@ -1426,7 +1426,7 @@ check_accounts (XferDialog* xferData, Account* from_account,
{
const char *message = _("You can't transfer from and to the same "
"account!");
gnc_error_dialog(xferData->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (xferData->dialog), "%s", message);
LEAVE("same account");
return FALSE;
}
@ -1442,7 +1442,7 @@ check_accounts (XferDialog* xferData, Account* from_account,
name = gnc_account_get_full_name(from_account);
else
name = gnc_account_get_full_name(to_account);
gnc_error_dialog(xferData->dialog, placeholder_format, name);
gnc_error_dialog (GTK_WINDOW (xferData->dialog), placeholder_format, name);
g_free(name);
LEAVE("placeholder");
return FALSE;
@ -1454,7 +1454,7 @@ check_accounts (XferDialog* xferData, Account* from_account,
_("You can't transfer from a non-currency account. "
"Try reversing the \"from\" and \"to\" accounts "
"and making the \"amount\" negative.");
gnc_error_dialog(xferData->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (xferData->dialog), "%s", message);
LEAVE("non-currency");
return FALSE;
}
@ -1703,7 +1703,7 @@ gnc_xfer_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
if (gnc_numeric_zero_p (amount))
{
const char *message = _("You must enter an amount to transfer.");
gnc_error_dialog(xferData->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (xferData->dialog), "%s", message);
LEAVE("invalid from amount");
return;
}
@ -1823,7 +1823,7 @@ gnc_xfer_dialog_fetch (GtkButton *button, XferDialog *xferData)
}
scm_window = SWIG_NewPointerObj(xferData->dialog,
SWIG_TypeQuery("_p_GtkWidget"), 0);
SWIG_TypeQuery("_p_GtkWindow"), 0);
if (scm_is_true (scm_not (book_scm)))
{

View File

@ -187,7 +187,7 @@ static gboolean autosave_timeout_cb(gpointer user_data)
return FALSE;
/* Store the current toplevel window for later use. */
toplevel = gnc_ui_get_toplevel();
toplevel = GTK_WIDGET (gnc_ui_get_main_window (NULL));
/* Lookup preference to show an explanatory dialog, if wanted. */
show_explanation =
@ -211,7 +211,7 @@ static gboolean autosave_timeout_cb(gpointer user_data)
else
g_debug("autosave_timeout_cb: toplevel is not a GNC_WINDOW\n");
gnc_file_save();
gnc_file_save (GTK_WINDOW (toplevel));
gnc_main_window_set_progressbar_window(NULL);

View File

@ -76,7 +76,8 @@ static gint save_in_progress = 0;
\********************************************************************/
char *
gnc_file_dialog (const char * title,
gnc_file_dialog (GtkWindow *parent,
const char * title,
GList * filters,
const char * starting_dir,
GNCFileDialogType type
@ -124,7 +125,7 @@ gnc_file_dialog (const char * title,
file_box = gtk_file_chooser_dialog_new(
title,
NULL,
parent,
action,
_("_Cancel"), GTK_RESPONSE_CANCEL,
NULL);
@ -139,10 +140,6 @@ gnc_file_dialog (const char * title,
starting_dir);
gtk_window_set_modal(GTK_WINDOW(file_box), TRUE);
/*
gtk_window_set_transient_for(GTK_WINDOW(file_box),
GTK_WINDOW(gnc_ui_get_toplevel()));
*/
if (filters != NULL)
{
@ -195,11 +192,11 @@ gnc_file_dialog (const char * title,
gboolean
show_session_error (QofBackendError io_error,
show_session_error (GtkWindow *parent,
QofBackendError io_error,
const char *newfile,
GNCFileDialogType type)
{
GtkWidget *parent = gnc_ui_get_toplevel();
GtkWidget *dialog;
gboolean uh_oh = TRUE;
const char *fmt, *label;
@ -306,7 +303,7 @@ show_session_error (QofBackendError io_error,
break;
}
dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
dialog = gtk_message_dialog_new(parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
@ -316,7 +313,7 @@ show_session_error (QofBackendError io_error,
_("_Cancel"), GTK_RESPONSE_CANCEL,
label, GTK_RESPONSE_YES,
NULL);
if (parent == NULL)
if (!parent)
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
response = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
@ -531,13 +528,13 @@ gnc_book_opened (void)
}
void
gnc_file_new (void)
gnc_file_new (GtkWindow *parent)
{
QofSession *session;
/* 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 (TRUE))
if (!gnc_file_query_save (parent, TRUE))
return;
if (gnc_current_session_exist())
@ -568,9 +565,8 @@ gnc_file_new (void)
}
gboolean
gnc_file_query_save (gboolean can_cancel)
gnc_file_query_save (GtkWindow *parent, gboolean can_cancel)
{
GtkWidget *parent = gnc_ui_get_toplevel();
QofBook *current_book;
if (!gnc_current_session_exist())
@ -595,7 +591,7 @@ gnc_file_query_save (gboolean can_cancel)
time64 oldest_change;
gint minutes;
dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
dialog = gtk_message_dialog_new(parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE,
@ -623,7 +619,7 @@ gnc_file_query_save (gboolean can_cancel)
switch (response)
{
case GTK_RESPONSE_YES:
gnc_file_save ();
gnc_file_save (parent);
/* Go check the loop condition. */
break;
@ -651,7 +647,7 @@ gnc_file_query_save (gboolean can_cancel)
#define RESPONSE_READONLY 4
static gboolean
gnc_post_file_open (const char * filename, gboolean is_readonly)
gnc_post_file_open (GtkWindow *parent, const char * filename, gboolean is_readonly)
{
QofSession *current_session, *new_session;
QofBook *new_book;
@ -677,7 +673,8 @@ RESTART:
newfile = gnc_uri_normalize_uri ( filename, TRUE );
if (!newfile)
{
show_session_error (ERR_FILEIO_FILE_NOT_FOUND, filename,
show_session_error (parent,
ERR_FILEIO_FILE_NOT_FOUND, filename,
GNC_FILE_DIALOG_OPEN);
return FALSE;
}
@ -743,14 +740,14 @@ RESTART:
if (ERR_BACKEND_BAD_URL == io_err)
{
gchar *directory;
show_session_error (io_err, newfile, GNC_FILE_DIALOG_OPEN);
show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_OPEN);
io_err = ERR_BACKEND_NO_ERR;
if (g_file_test (filename, G_FILE_TEST_IS_DIR))
directory = g_strdup (filename);
else
directory = gnc_get_default_directory (GNC_PREFS_GROUP_OPEN_SAVE);
filename = gnc_file_dialog (NULL, NULL, directory,
filename = gnc_file_dialog (parent, NULL, NULL, directory,
GNC_FILE_DIALOG_OPEN);
qof_session_destroy (new_session);
new_session = NULL;
@ -780,12 +777,7 @@ RESTART:
else
displayname = g_strdup (newfile);
// Bug#467521: on Mac (and maybe Win?), the dialog will appear below the
// splash, but is modal, so we can't get rid of the splash... So, get
// rid of it now.
gnc_destroy_splash_screen();
dialog = gtk_message_dialog_new(NULL,
dialog = gtk_message_dialog_new(parent,
0,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE,
@ -820,16 +812,10 @@ RESTART:
break;
case RESPONSE_READONLY:
is_readonly = TRUE;
// re-enable the splash screen, file loading and display of
// reports may take some time
gnc_show_splash_screen();
/* user told us to open readonly. We do ignore locks (just as before), but now also force the opening. */
qof_session_begin (new_session, newfile, is_readonly, FALSE, TRUE);
break;
case RESPONSE_OPEN:
// re-enable the splash screen, file loading and display of
// reports may take some time
gnc_show_splash_screen();
/* user told us to ignore locks. So ignore them. */
qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
break;
@ -838,14 +824,14 @@ RESTART:
* database so that the user will get a window that
* they can click "Exit" on.
*/
gnc_file_new ();
gnc_file_new (parent);
break;
}
}
/* if the database doesn't exist, ask the user ... */
else if ((ERR_BACKEND_NO_SUCH_DB == io_err))
{
if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_OPEN))
if (!show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_OPEN))
{
/* user told us to create a new database. Do it. We
* shouldn't have to worry about locking or clobbering,
@ -867,7 +853,7 @@ RESTART:
else
{
uh_oh = show_session_error (io_err, newfile, GNC_FILE_DIALOG_OPEN);
uh_oh = show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_OPEN);
}
if (!uh_oh)
@ -914,14 +900,14 @@ RESTART:
}
}
uh_oh = show_session_error (io_err, newfile, GNC_FILE_DIALOG_OPEN);
uh_oh = show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_OPEN);
/* Attempt to update the database if it's too old */
if ( !uh_oh && io_err == ERR_SQL_DB_TOO_OLD )
{
gnc_window_show_progress(_("Re-saving user data..."), 0.0);
qof_session_safe_save(new_session, gnc_window_show_progress);
io_err = qof_session_get_error(new_session);
uh_oh = show_session_error(io_err, newfile, GNC_FILE_DIALOG_SAVE);
uh_oh = show_session_error(parent, io_err, newfile, GNC_FILE_DIALOG_SAVE);
}
/* Database is either too old and couldn't (or user didn't
* want it to) be updated or it's too new. Mark it as
@ -940,7 +926,7 @@ RESTART:
* The backend forgot to set an error. So make one up. */
if (!uh_oh && !new_root)
{
uh_oh = show_session_error (ERR_BACKEND_MISC, newfile,
uh_oh = show_session_error (parent, ERR_BACKEND_MISC, newfile,
GNC_FILE_DIALOG_OPEN);
}
@ -956,7 +942,7 @@ RESTART:
uh_oh = TRUE;
// XXX: should pull out the file name here */
gnc_error_dialog(gnc_ui_get_toplevel(), msg, "");
gnc_error_dialog (parent, msg, "");
g_free (msg);
}
if (template_root != NULL)
@ -1052,14 +1038,14 @@ RESTART:
* paths, never db uris.
*/
gboolean
gnc_file_open (void)
gnc_file_open (GtkWindow *parent)
{
const gchar * newfile;
gchar *last = NULL;
gchar *default_dir = NULL;
gboolean result;
if (!gnc_file_query_save (TRUE))
if (!gnc_file_query_save (parent, TRUE))
return FALSE;
if ( last && gnc_uri_is_file_uri ( last ) )
@ -1071,11 +1057,11 @@ gnc_file_open (void)
else
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_OPEN_SAVE);
newfile = gnc_file_dialog (_("Open"), NULL, default_dir, GNC_FILE_DIALOG_OPEN);
newfile = gnc_file_dialog (parent, _("Open"), NULL, default_dir, GNC_FILE_DIALOG_OPEN);
g_free ( last );
g_free ( default_dir );
result = gnc_post_file_open ( newfile, /*is_readonly*/ FALSE );
result = gnc_post_file_open (parent, newfile, /*is_readonly*/ FALSE );
/* This dialogue can show up early in the startup process. If the
* user fails to pick a file (by e.g. hitting the cancel button), we
@ -1087,14 +1073,14 @@ gnc_file_open (void)
}
gboolean
gnc_file_open_file (const char * newfile, gboolean open_readonly)
gnc_file_open_file (GtkWindow *parent, const char * newfile, gboolean open_readonly)
{
if (!newfile) return FALSE;
if (!gnc_file_query_save (TRUE))
if (!gnc_file_query_save (parent, TRUE))
return FALSE;
return gnc_post_file_open (newfile, open_readonly);
return gnc_post_file_open (parent, newfile, open_readonly);
}
/* Note: this dialog will only be used when dbi is not enabled
@ -1102,7 +1088,7 @@ gnc_file_open_file (const char * newfile, gboolean open_readonly)
* never db uris
*/
void
gnc_file_export (void)
gnc_file_export (GtkWindow *parent)
{
const char *filename;
char *default_dir = NULL; /* Default to last open */
@ -1120,13 +1106,14 @@ gnc_file_export (void)
else
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_EXPORT);
filename = gnc_file_dialog (_("Save"), NULL, default_dir,
filename = gnc_file_dialog (parent,
_("Save"), NULL, default_dir,
GNC_FILE_DIALOG_SAVE);
g_free ( last );
g_free ( default_dir );
if (!filename) return;
gnc_file_do_export( filename );
gnc_file_do_export (parent, filename);
LEAVE (" ");
}
@ -1163,7 +1150,7 @@ check_file_path (const char *path)
void
gnc_file_do_export(const char * filename)
gnc_file_do_export(GtkWindow *parent, const char * filename)
{
QofSession *current_session, *new_session;
gboolean ok;
@ -1186,7 +1173,7 @@ gnc_file_do_export(const char * filename)
norm_file = gnc_uri_normalize_uri ( filename, TRUE );
if (!norm_file)
{
show_session_error (ERR_FILEIO_FILE_NOT_FOUND, filename,
show_session_error (parent, ERR_FILEIO_FILE_NOT_FOUND, filename,
GNC_FILE_DIALOG_EXPORT);
return;
}
@ -1214,7 +1201,7 @@ gnc_file_do_export(const char * filename)
{
if (check_file_path (path))
{
show_session_error (ERR_FILEIO_RESERVED_WRITE, newfile,
show_session_error (parent, ERR_FILEIO_RESERVED_WRITE, newfile,
GNC_FILE_DIALOG_SAVE);
return;
}
@ -1228,7 +1215,7 @@ gnc_file_do_export(const char * filename)
if (strlen (oldfile) && (strcmp(oldfile, newfile) == 0))
{
g_free (newfile);
show_session_error (ERR_FILEIO_WRITE_ERROR, filename,
show_session_error (parent, ERR_FILEIO_WRITE_ERROR, filename,
GNC_FILE_DIALOG_EXPORT);
return;
}
@ -1262,7 +1249,7 @@ gnc_file_do_export(const char * filename)
/* 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, GNC_FILE_DIALOG_EXPORT))
if (!show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_EXPORT))
{
/* user told us to ignore locks. So ignore them. */
qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
@ -1296,7 +1283,7 @@ gnc_file_do_export(const char * filename)
static gboolean been_here_before = FALSE;
void
gnc_file_save (void)
gnc_file_save (GtkWindow *parent)
{
QofBackendError io_err;
const char * newfile;
@ -1310,19 +1297,19 @@ gnc_file_save (void)
if (!strlen (qof_session_get_url (session)))
{
gnc_file_save_as ();
gnc_file_save_as (parent);
return;
}
if (qof_book_is_readonly(qof_session_get_book(session)))
{
gint response = gnc_ok_cancel_dialog(gnc_ui_get_toplevel(),
gint response = gnc_ok_cancel_dialog(parent,
GTK_RESPONSE_CANCEL,
_("The database was opened read-only. "
"Do you want to save it to a different place?"));
if (response == GTK_RESPONSE_OK)
{
gnc_file_save_as ();
gnc_file_save_as (parent);
}
return;
}
@ -1342,11 +1329,11 @@ gnc_file_save (void)
if (ERR_BACKEND_NO_ERR != io_err)
{
newfile = qof_session_get_url(session);
show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE);
show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_SAVE);
if (been_here_before) return;
been_here_before = TRUE;
gnc_file_save_as (); /* been_here prevents infinite recursion */
gnc_file_save_as (parent); /* been_here prevents infinite recursion */
been_here_before = FALSE;
return;
}
@ -1362,7 +1349,7 @@ gnc_file_save (void)
* never db uris. See gnc_file_do_save_as for that.
*/
void
gnc_file_save_as (void)
gnc_file_save_as (GtkWindow *parent)
{
const gchar *filename;
gchar *default_dir = NULL; /* Default to last open */
@ -1380,19 +1367,20 @@ gnc_file_save_as (void)
else
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_OPEN_SAVE);
filename = gnc_file_dialog (_("Save"), NULL, default_dir,
filename = gnc_file_dialog (parent,
_("Save"), NULL, default_dir,
GNC_FILE_DIALOG_SAVE);
g_free ( last );
g_free ( default_dir );
if (!filename) return;
gnc_file_do_save_as( filename );
gnc_file_do_save_as (parent, filename);
LEAVE (" ");
}
void
gnc_file_do_save_as (const char* filename)
gnc_file_do_save_as (GtkWindow *parent, const char* filename)
{
QofSession *new_session;
QofSession *session;
@ -1417,7 +1405,7 @@ gnc_file_do_save_as (const char* filename)
norm_file = gnc_uri_normalize_uri ( filename, TRUE );
if (!norm_file)
{
show_session_error (ERR_FILEIO_FILE_NOT_FOUND, filename,
show_session_error (parent, ERR_FILEIO_FILE_NOT_FOUND, filename,
GNC_FILE_DIALOG_SAVE);
return;
}
@ -1445,7 +1433,7 @@ gnc_file_do_save_as (const char* filename)
{
if (check_file_path (path))
{
show_session_error (ERR_FILEIO_RESERVED_WRITE, newfile,
show_session_error (parent, ERR_FILEIO_RESERVED_WRITE, newfile,
GNC_FILE_DIALOG_SAVE);
return;
}
@ -1460,7 +1448,7 @@ gnc_file_do_save_as (const char* filename)
if (strlen (oldfile) && (strcmp(oldfile, newfile) == 0))
{
g_free (newfile);
gnc_file_save ();
gnc_file_save (parent);
return;
}
@ -1503,7 +1491,7 @@ gnc_file_do_save_as (const char* filename)
/* if file appears to be locked, ask the user ... */
else if (ERR_BACKEND_LOCKED == io_err || ERR_BACKEND_READONLY == io_err)
{
if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE))
if (!show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_SAVE))
{
/* user told us to ignore locks. So ignore them. */
qof_session_begin (new_session, newfile, TRUE, FALSE, FALSE);
@ -1515,7 +1503,7 @@ gnc_file_do_save_as (const char* filename)
(ERR_BACKEND_NO_SUCH_DB == io_err) ||
(ERR_SQL_DB_TOO_OLD == io_err))
{
if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE))
if (!show_session_error (parent, 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, FALSE);
@ -1529,7 +1517,7 @@ gnc_file_do_save_as (const char* filename)
io_err = qof_session_get_error (new_session);
if (ERR_BACKEND_NO_ERR != io_err)
{
show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE);
show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_SAVE);
xaccLogDisable();
qof_session_destroy (new_session);
xaccLogEnable();
@ -1575,7 +1563,7 @@ gnc_file_do_save_as (const char* filename)
/* Well, poop. The save failed, so the new session is invalid and we
* need to restore the old one.
*/
show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE);
show_session_error (parent, io_err, newfile, GNC_FILE_DIALOG_SAVE);
qof_event_suspend();
qof_session_swap_data( new_session, session );
qof_session_destroy( new_session );
@ -1604,7 +1592,7 @@ gnc_file_do_save_as (const char* filename)
}
void
gnc_file_revert (void)
gnc_file_revert (GtkWindow *parent)
{
QofSession *session;
const gchar *fileurl, *filename, *tmp;
@ -1626,7 +1614,7 @@ gnc_file_revert (void)
return;
qof_book_mark_session_saved (qof_session_get_book (session));
gnc_file_open_file (fileurl, qof_book_is_readonly(gnc_get_current_book()));}
gnc_file_open_file (parent, fileurl, qof_book_is_readonly(gnc_get_current_book()));}
void
gnc_file_quit (void)

View File

@ -126,30 +126,34 @@ typedef enum
GNC_FILE_DIALOG_EXPORT
} GNCFileDialogType;
void gnc_file_new (void);
gboolean gnc_file_open (void);
void gnc_file_export(void);
void gnc_file_save (void);
void gnc_file_save_as (void);
void gnc_file_do_export(const char* filename);
void gnc_file_do_save_as(const char* filename);
void gnc_file_revert (void);
void gnc_file_new (GtkWindow *parent);
gboolean gnc_file_open (GtkWindow *parent);
void gnc_file_export(GtkWindow *parent);
void gnc_file_save (GtkWindow *parent);
void gnc_file_save_as (GtkWindow *parent);
void gnc_file_do_export(GtkWindow *parent, const char* filename);
void gnc_file_do_save_as(GtkWindow *parent, const char* filename);
void gnc_file_revert (GtkWindow *parent);
/** Tell the user about errors in the backends
*/
gboolean show_session_error (QofBackendError io_error,
gboolean show_session_error (GtkWindow *parent,
QofBackendError io_error,
const char *newfile,
GNCFileDialogType type);
char * gnc_file_dialog (const char * title,
char * gnc_file_dialog (GtkWindow *parent,
const char * title,
GList * filters,
const char * starting_dir,
GNCFileDialogType type);
gboolean gnc_file_open_file (const char *filename, gboolean open_readonly);
gboolean gnc_file_open_file (GtkWindow *parent,
const char *filename,
gboolean open_readonly);
gboolean gnc_file_query_save (gboolean can_cancel);
gboolean gnc_file_query_save (GtkWindow *parent, gboolean can_cancel);
void gnc_file_quit (void);

View File

@ -736,7 +736,7 @@ gnc_gui_init(void)
/* Load css configuration file */
gnc_add_css_file ();
gnc_totd_dialog(GTK_WINDOW(main_window), TRUE);
gnc_totd_dialog (gnc_get_splash_screen (), TRUE);
LEAVE ("");
return main_window;
@ -782,7 +782,7 @@ gnc_shutdown (int exit_status)
{
if (!gnome_is_terminating)
{
if (gnc_file_query_save(FALSE))
if (gnc_file_query_save (gnc_ui_get_main_window (NULL), FALSE))
{
gnc_hook_run(HOOK_UI_SHUTDOWN, NULL);
gnc_gui_shutdown();

View File

@ -50,7 +50,7 @@
* Return: the result the user selected *
\********************************************************************/
gint
gnc_ok_cancel_dialog(GtkWidget *parent,
gnc_ok_cancel_dialog(GtkWindow *parent,
gint default_result,
const gchar *format, ...)
{
@ -59,12 +59,12 @@ gnc_ok_cancel_dialog(GtkWidget *parent,
gchar *buffer;
va_list args;
if (parent == NULL)
parent = gnc_ui_get_toplevel();
if (!parent)
parent = gnc_ui_get_main_window (NULL);
va_start(args, format);
buffer = g_strdup_vprintf(format, args);
dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
dialog = gtk_message_dialog_new (parent,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_OK_CANCEL,
@ -73,7 +73,7 @@ gnc_ok_cancel_dialog(GtkWidget *parent,
g_free(buffer);
va_end(args);
if (parent == NULL)
if (!parent)
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
gtk_dialog_set_default_response (GTK_DIALOG(dialog), default_result);
@ -99,7 +99,7 @@ gnc_ok_cancel_dialog(GtkWidget *parent,
* string. *
\********************************************************************/
gboolean
gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
gnc_verify_dialog(GtkWindow *parent, gboolean yes_is_default,
const gchar *format, ...)
{
GtkWidget *dialog;
@ -107,12 +107,12 @@ gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
gint result;
va_list args;
if (parent == NULL)
parent = gnc_ui_get_toplevel();
if (!parent)
parent = gnc_ui_get_main_window (NULL);
va_start(args, format);
buffer = g_strdup_vprintf(format, args);
dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
dialog = gtk_message_dialog_new (parent,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_YES_NO,
@ -121,7 +121,7 @@ gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
g_free(buffer);
va_end(args);
if (parent == NULL)
if (!parent)
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
gtk_dialog_set_default_response(GTK_DIALOG(dialog),
@ -131,6 +131,30 @@ gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
return (result == GTK_RESPONSE_YES);
}
static void
gnc_message_dialog_common (GtkWindow *parent, const gchar *format, GtkMessageType msg_type, va_list args)
{
GtkWidget *dialog = NULL;
gchar *buffer;
if (!parent)
parent = gnc_ui_get_main_window (NULL);
buffer = g_strdup_vprintf(format, args);
dialog = gtk_message_dialog_new (parent,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
msg_type,
GTK_BUTTONS_CLOSE,
"%s",
buffer);
g_free(buffer);
if (!parent)
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
/********************************************************************\
* gnc_info_dialog *
@ -144,36 +168,19 @@ gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
* Return: none *
\********************************************************************/
void
gnc_info_dialog(GtkWidget *parent, const gchar *format, ...)
gnc_info_dialog (GtkWindow *parent, const gchar *format, ...)
{
GtkWidget *dialog;
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_INFO,
GTK_BUTTONS_CLOSE,
"%s",
buffer);
gnc_message_dialog_common (parent, format, GTK_MESSAGE_INFO, args);
va_end(args);
if (parent == NULL)
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
}
/********************************************************************\
* gnc_warning_dialog_common *
* gnc_warning_dialog *
* displays a warning dialog box *
* *
* Args: parent - the parent window *
@ -183,44 +190,20 @@ gnc_info_dialog(GtkWidget *parent, const gchar *format, ...)
* string. *
* Return: none *
\********************************************************************/
static void
gnc_warning_dialog_common(GtkWidget *parent, const gchar *format, va_list args)
{
GtkWidget *dialog = NULL;
gchar *buffer;
if (parent == NULL)
parent = GTK_WIDGET(gnc_ui_get_toplevel());
buffer = g_strdup_vprintf(format, args);
dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_CLOSE,
"%s",
buffer);
g_free(buffer);
if (parent == NULL)
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
void
gnc_warning_dialog(GtkWidget *parent, const gchar *format, ...)
gnc_warning_dialog (GtkWindow *parent, const gchar *format, ...)
{
va_list args;
va_start(args, format);
gnc_warning_dialog_common(parent, format, args);
gnc_message_dialog_common (parent, format, GTK_MESSAGE_WARNING, args);
va_end(args);
}
/********************************************************************\
* gnc_error_dialog_common *
* gnc_error_dialog *
* displays an error dialog box *
* *
* Args: parent - the parent window *
@ -230,38 +213,12 @@ gnc_warning_dialog(GtkWidget *parent, const gchar *format, ...)
* string. *
* Return: none *
\********************************************************************/
static void
gnc_error_dialog_common(GtkWidget *parent, const gchar *format, va_list args)
{
GtkWidget *dialog;
gchar *buffer;
if (parent == NULL)
parent = GTK_WIDGET(gnc_ui_get_toplevel());
buffer = g_strdup_vprintf(format, args);
dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s",
buffer);
g_free(buffer);
if (parent == NULL)
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), FALSE);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
}
void
gnc_error_dialog(GtkWidget *parent, const gchar *format, ...)
void gnc_error_dialog (GtkWindow* parent, const char* format, ...)
{
va_list args;
va_start(args, format);
gnc_error_dialog_common(parent, format, args);
gnc_message_dialog_common (parent, format, GTK_MESSAGE_ERROR, args);
va_end(args);
}

View File

@ -24,12 +24,11 @@
#define QUERY_USER_H
extern void
gnc_info_dialog(GtkWidget *parent,
const char *format, ...) G_GNUC_PRINTF (2, 3);
extern void
gnc_error_dialog(GtkWidget *parent,
gnc_info_dialog (GtkWindow *parent,
const char *format, ...) G_GNUC_PRINTF (2, 3);
void gnc_error_dialog (GtkWindow* parent, const char* format, ...) G_GNUC_PRINTF (2, 3);
#endif

View File

@ -720,8 +720,8 @@ gnc_main_window_restore_window (GncMainWindow *window, GncMainWindowSaveData *da
if (active_windows)
DEBUG("first window %p.", active_windows->data);
window = gnc_main_window_new();
gtk_widget_show(GTK_WIDGET(window));
}
gtk_widget_show(GTK_WIDGET(window));
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
@ -952,6 +952,7 @@ gnc_main_window_restore_default_state(GncMainWindow *window)
DEBUG("no saved state file");
if (!window)
window = g_list_nth_data(active_windows, 0);
gtk_widget_show (GTK_WIDGET(window));
action = gnc_main_window_find_action(window, "ViewAccountTreeAction");
gtk_action_activate(action);
}
@ -1293,7 +1294,7 @@ gnc_main_window_prompt_for_save (GtkWidget *window)
switch (response)
{
case GTK_RESPONSE_APPLY:
gnc_file_save();
gnc_file_save (GTK_WINDOW (window));
return FALSE;
case GTK_RESPONSE_CLOSE:
@ -1600,14 +1601,13 @@ static guint gnc_statusbar_notification_messageid = 0;
* statusbar by generate_statusbar_lastmodified_message. */
static gboolean statusbar_notification_off(gpointer user_data_unused)
{
GtkWidget *widget = gnc_ui_get_toplevel();
GncMainWindow *mainwindow = GNC_MAIN_WINDOW (gnc_ui_get_main_window (NULL));
//g_warning("statusbar_notification_off\n");
if (gnc_statusbar_notification_messageid == 0)
return FALSE;
if (widget && GNC_IS_MAIN_WINDOW(widget))
if (mainwindow)
{
GncMainWindow *mainwindow = GNC_MAIN_WINDOW(widget);
GtkWidget *statusbar = gnc_main_window_get_statusbar(GNC_WINDOW(mainwindow));
gtk_statusbar_remove(GTK_STATUSBAR(statusbar), 0, gnc_statusbar_notification_messageid);
gnc_statusbar_notification_messageid = 0;
@ -2670,16 +2670,16 @@ GncMainWindow *
gnc_main_window_new (void)
{
GncMainWindow *window;
GtkWidget *old_window;
GtkWindow *old_window;
window = g_object_new (GNC_TYPE_MAIN_WINDOW, NULL);
gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
old_window = gnc_ui_get_toplevel();
old_window = gnc_ui_get_main_window (NULL);
if (old_window)
{
gint width, height;
gtk_window_get_size (GTK_WINDOW (old_window), &width, &height);
gtk_window_get_size (old_window, &width, &height);
gtk_window_resize (GTK_WINDOW (window), width, height);
if ((gdk_window_get_state((gtk_widget_get_window (GTK_WIDGET(old_window))))
& GDK_WINDOW_STATE_MAXIMIZED) != 0)
@ -4554,19 +4554,41 @@ gnc_main_window_show_all_windows(void)
#endif
}
/** Get a pointer to the first active top level window or NULL
* if there is none.
*
* @return A pointer to a GtkWindow object. */
GtkWidget *
gnc_ui_get_toplevel (void)
GtkWindow *
gnc_ui_get_gtk_window (GtkWidget *widget)
{
GtkWidget *toplevel;
if (!widget)
return NULL;
toplevel = gtk_widget_get_toplevel (widget);
if (toplevel && GTK_IS_WINDOW (toplevel))
return GTK_WINDOW (toplevel);
else
return NULL;
}
GtkWindow *
gnc_ui_get_main_window (GtkWidget *widget)
{
GList *window;
GtkWindow *toplevel = gnc_ui_get_gtk_window (widget);
while (toplevel && !GNC_IS_MAIN_WINDOW (toplevel))
toplevel = gtk_window_get_transient_for(toplevel);
if (toplevel)
return toplevel;
for (window = active_windows; window; window = window->next)
if (gtk_window_is_active (GTK_WINDOW (window->data)))
return window->data;
for (window = active_windows; window; window = window->next)
if (gtk_widget_get_mapped (GTK_WIDGET(window->data)))
return window->data;
return NULL;
}

View File

@ -696,7 +696,8 @@ gnc_plugin_file_history_cmd_open_file (GtkAction *action,
filename = g_object_get_data(G_OBJECT(action), FILENAME_STRING);
gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
/* also opens new account page */
gnc_file_open_file (filename, /*open_readonly*/ FALSE);
gnc_file_open_file (GTK_WINDOW (data->window),
filename, /*open_readonly*/ FALSE);
gnc_window_set_progressbar_window (NULL);
}

View File

@ -206,3 +206,8 @@ gnc_update_splash_screen (const gchar *string, double percentage)
gtk_main_iteration ();
}
}
GtkWindow *gnc_get_splash_screen (void)
{
return GTK_WINDOW(splash);
}

View File

@ -22,10 +22,12 @@
#ifndef GNC_SPLASH_H
#define GNC_SPLASH_H
#include <gtk/gtk.h>
void gnc_show_splash_screen (void);
void gnc_destroy_splash_screen (void);
void gnc_update_splash_screen (const gchar *string, double percentage);
GtkWindow *gnc_get_splash_screen (void);
#define GNC_SPLASH_PERCENTAGE_UNKNOWN 101

View File

@ -167,13 +167,13 @@ gnc_tree_control_split_reg_trans_open_and_warn (GncTreeViewSplitReg *view, Trans
gboolean
gtc_sr_trans_test_for_edit (GncTreeViewSplitReg *view, Transaction *trans)
{
GtkWidget *window;
GtkWindow *window;
Transaction *dirty_trans;
/* Make sure we have stopped editing */
gnc_tree_view_split_reg_finish_edit (view);
window = gnc_tree_view_split_reg_get_parent (view);
window = gnc_ui_get_main_window (GTK_WIDGET (view));
/* Get dirty_trans */
dirty_trans = gnc_tree_view_split_reg_get_dirty_trans (view);
@ -354,7 +354,7 @@ void
gnc_tree_control_split_reg_exchange_rate (GncTreeViewSplitReg *view)
{
GncTreeModelSplitReg *model;
GtkWidget *window;
GtkWindow *window;
Account *anchor;
Transaction *trans;
Split *split = NULL;
@ -397,7 +397,7 @@ gnc_tree_control_split_reg_exchange_rate (GncTreeViewSplitReg *view)
if (num_splits < 2)
return;
window = gnc_tree_view_split_reg_get_parent (view);
window = gnc_ui_get_main_window (GTK_WIDGET (view));
/* Make sure we NEED this for this type of register */
if (!gnc_tree_util_split_reg_has_rate (view))
@ -1078,7 +1078,7 @@ gnc_tree_control_split_reg_delete (GncTreeViewSplitReg *view, gpointer data)
void
gnc_tree_control_split_reg_reverse_current (GncTreeViewSplitReg *view)
{
GtkWidget *window;
GtkWindow *window;
Transaction *trans = NULL, *new_trans = NULL;
GList *snode = NULL;
@ -1113,7 +1113,7 @@ gnc_tree_control_split_reg_reverse_current (GncTreeViewSplitReg *view)
return;
}
window = gnc_tree_view_split_reg_get_parent (view);
window = gnc_ui_get_main_window (GTK_WIDGET (view));
if (xaccTransGetReversedBy (trans))
{
@ -1167,7 +1167,7 @@ gboolean
gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
{
GncTreeModelSplitReg *model;
GtkWidget *window;
GtkWindow *window;
RowDepth depth;
Transaction *trans;
Split *blank_split;
@ -1228,7 +1228,7 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
return FALSE;
}
window = gnc_tree_view_split_reg_get_parent (view);
window = gnc_ui_get_main_window (GTK_WIDGET (view));
/* Ok, we are now ready to make the copy. */
if (depth == SPLIT3)
@ -1259,7 +1259,7 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
else
in_num = gnc_get_num_action (NULL, split);
if (!gnc_dup_trans_dialog (window, title, FALSE,
if (!gnc_dup_trans_dialog (GTK_WIDGET (window), title, FALSE,
&date, in_num, &out_num, NULL, NULL))
{
LEAVE("dup cancelled");
@ -1334,7 +1334,7 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
? gnc_get_num_action (trans, NULL)
: NULL);
if (!gnc_dup_trans_dialog (window, NULL, TRUE,
if (!gnc_dup_trans_dialog (GTK_WIDGET (window), NULL, TRUE,
&date, in_num, &out_num, in_tnum, &out_tnum))
{
LEAVE("dup cancelled");
@ -1348,7 +1348,7 @@ gnc_tree_control_split_reg_duplicate_current (GncTreeViewSplitReg *view)
gnc_gdate_set_time64 (&d, date);
if (g_date_compare (&d, readonly_threshold) < 0)
{
GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GtkWidget *dialog = gtk_message_dialog_new (window,
0,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
@ -1946,7 +1946,7 @@ gnc_tree_control_split_reg_recn_test (GncTreeViewSplitReg *view, GtkTreePath *sp
Account *
gnc_tree_control_split_reg_get_account_by_name (GncTreeViewSplitReg *view, const char *name)
{
GtkWidget *window;
GtkWindow *window;
const char *placeholder = _("The account %s does not allow transactions.");
const char *missing = _("The account %s does not exist. "
"Would you like to create it?");
@ -1964,7 +1964,7 @@ gnc_tree_control_split_reg_get_account_by_name (GncTreeViewSplitReg *view, const
if (!account)
account = gnc_account_lookup_by_code (gnc_get_current_root_account(), name);
window = gnc_tree_view_split_reg_get_parent (view);
window = gnc_ui_get_main_window (GTK_WIDGET (view));
if (!account)
{
@ -2106,9 +2106,9 @@ gnc_tree_control_split_reg_paste_trans (GncTreeViewSplitReg *view)
//FIXME You can not paste from gl to a register, is this too simplistic
if (clipboard_acct == NULL && anchor_acct != NULL)
{
GtkWidget *window;
GtkWindow *window;
window = gnc_tree_view_split_reg_get_parent (view);
window = gnc_ui_get_main_window (GTK_WIDGET (view));
gnc_error_dialog (window, "%s",
_("You can not paste from the general journal to a register."));
return;

View File

@ -824,7 +824,7 @@ void
gnc_tree_util_split_reg_set_value_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gnc_numeric input, gboolean force)
{
// GncTreeModelSplitReg *model;
GtkWidget *window;
GtkWindow *window;
// Account *anchor;
// Account *acct = xaccSplitGetAccount (split);
// gnc_commodity *currency;
@ -845,7 +845,7 @@ gnc_tree_util_split_reg_set_value_for (GncTreeViewSplitReg *view, Transaction *t
return;
}
window = gnc_tree_view_split_reg_get_parent (view);
window = gnc_ui_get_main_window (GTK_WIDGET (view));
if (gtu_sr_needs_exchange_rate (view, trans, split))
{

View File

@ -79,27 +79,27 @@
/* Dialog windows ***************************************************/
extern gboolean
gnc_verify_dialog(GtkWidget *parent,
gboolean yes_is_default,
const char *format, ...) G_GNUC_PRINTF (3, 4);
gnc_verify_dialog (GtkWindow *parent,
gboolean yes_is_default,
const char *format, ...) G_GNUC_PRINTF (3, 4);
extern gint
gnc_ok_cancel_dialog(GtkWidget *parent,
gint default_result,
const char *format, ...) G_GNUC_PRINTF (3, 4);
gnc_ok_cancel_dialog (GtkWindow *parent,
gint default_result,
const char *format, ...) G_GNUC_PRINTF (3, 4);
extern void
gnc_warning_dialog(GtkWidget *parent,
const char *format, ...) G_GNUC_PRINTF (2, 3);
gnc_warning_dialog (GtkWindow *parent,
const char *format, ...) G_GNUC_PRINTF (2, 3);
extern void
gnc_info_dialog(GtkWidget *parent,
const char *format, ...) G_GNUC_PRINTF (2, 3);
extern void
gnc_error_dialog(GtkWidget *parent,
gnc_info_dialog (GtkWindow *parent,
const char *format, ...) G_GNUC_PRINTF (2, 3);
extern void
gnc_error_dialog (GtkWindow *parent,
const char *format, ...) G_GNUC_PRINTF (2, 3);
extern void
gnc_gnome_help (const char *file_name, const char *target_link);
@ -141,7 +141,34 @@ gboolean gnc_get_username_password (GtkWidget *parent,
/* Managing the GUI Windows *****************************************/
GtkWidget *gnc_ui_get_toplevel (void);
/** Get a pointer to the widget's immediate top level GtkWindow. This can be a dialog
* window or a GncMainWindow. If the widget is not a child of
* a GtkWindow (yet), NULL is returned.
*
* @param widget the widget to find a GtkWindow for.
* @return A pointer to a GtkWindow object or NULL if no toplevel was found. */
GtkWindow *gnc_ui_get_gtk_window (GtkWidget *widget);
/** Get a pointer to the final GncMainWindow widget is rooted
* in. If widget is a child of a GncMainWindow return that window.
* If it's a child of a dialog window recursively query the
* dialog's transient parent until the first parent that's a GncMainWindow
* and return that. If widget is NULL or not part of any GtkWindow,
* get a pointer to the first active top level window. If there is
* none, return the first mapped window. If there's no mapped window
* return NULL.
*
* An example of why searching for a GncMainWindow makes sense: suppose
* a user has opened a search dialog for vendors and in that dialog has
* clicked "View vendor invoices". This opens another search window in
* which the user can click "View/Edit bill". Clicking that button should
* open a new tab in the GncMainWindow from which the first search dialog
* was opened.
*
* @param widget the widget to find a GncMainWindow for.
* @return A pointer to a GtkWindow object. */
GtkWindow *gnc_ui_get_main_window (GtkWidget *widget);
/* Changing the GUI Cursor ******************************************/

View File

@ -57,18 +57,18 @@ void gnc_options_dialog_set_scm_callbacks (GNCOptionWin *win,
SCM apply_cb, SCM close_cb);
gboolean
gnc_verify_dialog(GtkWidget *parent, gboolean yes_is_default,
const gchar *format, ...);
gnc_verify_dialog (GtkWindow *parent, gboolean yes_is_default,
const gchar *format, ...);
void
gnc_warning_dialog(GtkWidget *parent,
const gchar *format, ...);
gnc_warning_dialog (GtkWindow *parent,
const gchar *format, ...);
void
gnc_error_dialog(GtkWidget *parent,
gnc_error_dialog (GtkWindow *parent,
const char *format, ...);
void
gnc_info_dialog (GtkWindow *parent,
const char *format, ...);
void
gnc_info_dialog(GtkWidget *parent,
const char *format, ...);
void gnc_add_scm_extension (SCM extension);

View File

@ -3,7 +3,6 @@
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="totd_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes">GnuCash Tip Of The Day</property>

View File

@ -58,6 +58,7 @@
#include "gnc-path.h"
#include "gnc-gui-query.h"
#include "gnc-tree-view-account.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "io-example-account.h"
#include "top-level.h"
@ -1317,7 +1318,7 @@ static void
after_assistant(void)
{
qof_book_mark_session_dirty(gnc_get_current_book());
gnc_ui_file_access_for_save_as();
gnc_ui_file_access_for_save_as (gnc_ui_get_main_window (NULL));
}
static void

View File

@ -410,7 +410,7 @@ gnc_stock_split_assistant_finish (GtkAssistant *assistant,
pdb = gnc_pricedb_get_db (book);
if (!gnc_pricedb_add_price (pdb, price))
gnc_error_dialog (info->window, "%s", _("Error adding price."));
gnc_error_dialog (GTK_WINDOW (info->window), "%s", _("Error adding price."));
}
@ -778,7 +778,7 @@ gnc_stock_split_dialog (GtkWidget *parent, Account * initial)
if (fill_account_list (info, initial) == 0)
{
gnc_warning_dialog (parent, "%s", _("You don't have any stock accounts with balances!"));
gnc_warning_dialog (GTK_WINDOW (parent), "%s", _("You don't have any stock accounts with balances!"));
gnc_close_gui_component_by_data (ASSISTANT_STOCK_SPLIT_CM_CLASS, info);
return;
}

View File

@ -189,14 +189,14 @@ typedef struct _invoice_select_info
} GncISI;
static GNCSearchWindow *
gnc_invoice_select_search_cb (gpointer start, gpointer isip)
gnc_invoice_select_search_cb (GtkWindow *parent, gpointer start, gpointer isip)
{
GncISI *isi = isip;
if (!isi) return NULL;
g_assert(isi->book);
return gnc_invoice_search (start,
return gnc_invoice_search (parent, start,
isi->have_owner ? &isi->owner : NULL,
isi->book);
}

View File

@ -95,7 +95,7 @@ customerCB (const char *location, const char *label,
/* href="...:customer=<guid>" */
HANDLE_TYPE ("customer=", GNC_ID_CUSTOMER);
customer = (GncCustomer *) entity;
gnc_ui_customer_edit (customer);
gnc_ui_customer_edit (result->parent, customer);
return TRUE;
}
@ -110,7 +110,7 @@ vendorCB (const char *location, const char *label,
/* href="...:vendor=<guid>" */
HANDLE_TYPE ("vendor=", GNC_ID_VENDOR);
vendor = (GncVendor *) entity;
gnc_ui_vendor_edit (vendor);
gnc_ui_vendor_edit (result->parent, vendor);
return TRUE;
}
@ -126,7 +126,7 @@ employeeCB (const char *location, const char *label,
HANDLE_TYPE ("employee=", GNC_ID_EMPLOYEE);
employee = (GncEmployee *) entity;
gnc_ui_employee_edit (employee);
gnc_ui_employee_edit (result->parent, employee);
return TRUE;
}
@ -141,7 +141,7 @@ invoiceCB (const char *location, const char *label,
/* href="...:invoice=<guid>" */
HANDLE_TYPE ("invoice=", GNC_ID_INVOICE);
invoice = (GncInvoice *) entity;
gnc_ui_invoice_edit (invoice);
gnc_ui_invoice_edit (result->parent, invoice);
return TRUE;
}
@ -156,7 +156,7 @@ jobCB (const char *location, const char *label,
/* href="...:job=<guid>" */
HANDLE_TYPE ("job=", GNC_ID_JOB);
job = (GncJob *) entity;
gnc_ui_job_edit (job);
gnc_ui_job_edit (result->parent, job);
return TRUE;
}
@ -306,7 +306,7 @@ ownerreportCB (const char *location, const char *label,
}
/* Ok, let's run this report */
gnc_business_call_owner_report (&owner, acc);
gnc_business_call_owner_report (result->parent, &owner, acc);
return TRUE;
}

View File

@ -289,14 +289,14 @@ verify_term_ok (NewBillTerm *nbt)
case GNC_TERM_TYPE_DAYS:
if (days_due_days<days_disc_days)
{
gnc_error_dialog (nbt->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (nbt->dialog), "%s", message);
result=FALSE;
}
break;
case GNC_TERM_TYPE_PROXIMO:
if (prox_due_days<prox_disc_days)
{
gnc_error_dialog (nbt->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (nbt->dialog), "%s", message);
result=FALSE;
}
break;
@ -324,7 +324,7 @@ new_billterm_ok_cb (NewBillTerm *nbt)
if (name == NULL || *name == '\0')
{
message = _("You must provide a name for this Billing Term.");
gnc_error_dialog (nbt->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (nbt->dialog), "%s", message);
return FALSE;
}
if (gncBillTermLookupByName (btw->book, name))
@ -332,7 +332,7 @@ new_billterm_ok_cb (NewBillTerm *nbt)
message = g_strdup_printf(_(
"You must provide a unique name for this Billing Term. "
"Your choice \"%s\" is already in use."), name);
gnc_error_dialog (nbt->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (nbt->dialog), "%s", message);
g_free (message);
return FALSE;
}
@ -664,13 +664,13 @@ billterms_delete_term_cb (GtkButton *button, BillTermsWindow *btw)
if (gncBillTermGetRefcount (btw->current_term) > 0)
{
gnc_error_dialog (btw->dialog,
gnc_error_dialog (GTK_WINDOW (btw->dialog),
_("Term \"%s\" is in use. You cannot delete it."),
gncBillTermGetName (btw->current_term));
return;
}
if (gnc_verify_dialog (btw->dialog, FALSE,
if (gnc_verify_dialog (GTK_WINDOW (btw->dialog), FALSE,
_("Are you sure you want to delete \"%s\"?"),
gncBillTermGetName (btw->current_term)))
{

View File

@ -157,7 +157,7 @@ remove_clicked (CommoditiesDialog *cd)
"at least one of your accounts. You may "
"not delete it.");
gnc_warning_dialog (cd->dialog, "%s", message);
gnc_warning_dialog (GTK_WINDOW (cd->dialog), "%s", message);
g_list_free (accounts);
return;
}

View File

@ -115,8 +115,8 @@ typedef enum
struct _customer_select_window
{
QofBook * book;
QofQuery * q;
QofBook *book;
QofQuery *q;
};
struct _customer_window
@ -279,14 +279,14 @@ static void gnc_ui_to_customer (CustomerWindow *cw, GncCustomer *cust)
gnc_resume_gui_refresh ();
}
static gboolean check_edit_amount (GtkWidget *dialog, GtkWidget *amount,
static gboolean check_edit_amount (GtkWidget *amount,
gnc_numeric *min, gnc_numeric *max,
const char * error_message)
{
if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (amount)))
{
if (error_message)
gnc_error_dialog (dialog, "%s", error_message);
gnc_error_dialog (gnc_ui_get_gtk_window (amount), "%s", error_message);
return TRUE;
}
/* We've got a valid-looking number; check mix/max */
@ -297,21 +297,21 @@ static gboolean check_edit_amount (GtkWidget *dialog, GtkWidget *amount,
(max && gnc_numeric_compare (val, *max) > 0))
{
if (error_message)
gnc_error_dialog (dialog, "%s", error_message);
gnc_error_dialog (gnc_ui_get_gtk_window (amount), "%s", error_message);
return TRUE;
}
}
return FALSE;
}
static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
static gboolean check_entry_nonempty (GtkWidget *entry,
const char * error_message)
{
const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
if (g_strcmp0 (res, "") == 0)
{
if (error_message)
gnc_error_dialog (dialog, "%s", error_message);
gnc_error_dialog (gnc_ui_get_gtk_window (entry), "%s", error_message);
return TRUE;
}
return FALSE;
@ -325,7 +325,7 @@ gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data)
gchar *string;
/* Check for valid company name */
if (check_entry_nonempty (cw->dialog, cw->company_entry,
if (check_entry_nonempty (cw->company_entry,
_("You must enter a company name. "
"If this customer is an individual (and not a company) "
"you should enter the same value for:\nIdentification "
@ -333,13 +333,13 @@ gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data)
return;
/* Make sure we have an address */
if (check_entry_nonempty (cw->dialog, cw->addr1_entry, NULL) &&
check_entry_nonempty (cw->dialog, cw->addr2_entry, NULL) &&
check_entry_nonempty (cw->dialog, cw->addr3_entry, NULL) &&
check_entry_nonempty (cw->dialog, cw->addr4_entry, NULL))
if (check_entry_nonempty (cw->addr1_entry, NULL) &&
check_entry_nonempty (cw->addr2_entry, NULL) &&
check_entry_nonempty (cw->addr3_entry, NULL) &&
check_entry_nonempty (cw->addr4_entry, NULL))
{
const char *msg = _("You must enter a billing address.");
gnc_error_dialog (cw->dialog, "%s", msg);
gnc_error_dialog (gnc_ui_get_gtk_window (widget), "%s", msg);
return;
}
@ -347,12 +347,12 @@ gnc_customer_window_ok_cb (GtkWidget *widget, gpointer data)
min = gnc_numeric_zero ();
max = gnc_numeric_create (100, 1);
if (check_edit_amount (cw->dialog, cw->discount_amount, &min, &max,
if (check_edit_amount (cw->discount_amount, &min, &max,
_("Discount percentage must be between 0-100 "
"or you must leave it blank.")))
return;
if (check_edit_amount (cw->dialog, cw->credit_amount, &min, NULL,
if (check_edit_amount (cw->credit_amount, &min, NULL,
_("Credit must be a positive amount or "
"you must leave it blank.")))
return;
@ -528,7 +528,7 @@ find_handler (gpointer find_data, gpointer user_data)
}
static CustomerWindow *
gnc_customer_new_window (QofBook *bookp, GncCustomer *cust)
gnc_customer_new_window (GtkWindow *parent, QofBook *bookp, GncCustomer *cust)
{
CustomerWindow *cw;
GtkBuilder *builder;
@ -549,6 +549,7 @@ gnc_customer_new_window (QofBook *bookp, GncCustomer *cust)
find_handler, &customer_guid);
if (cw)
{
gtk_window_set_transient_for (GTK_WINDOW(cw->dialog), parent);
gtk_window_present (GTK_WINDOW(cw->dialog));
return(cw);
}
@ -574,6 +575,7 @@ gnc_customer_new_window (QofBook *bookp, GncCustomer *cust)
gnc_builder_add_from_file (builder, "dialog-customer.glade", "taxtable_store");
gnc_builder_add_from_file (builder, "dialog-customer.glade", "customer_dialog");
cw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "customer_dialog"));
gtk_window_set_transient_for (GTK_WINDOW(cw->dialog), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(cw->dialog), "GncCustomerDialog");
@ -752,26 +754,26 @@ gnc_customer_new_window (QofBook *bookp, GncCustomer *cust)
}
CustomerWindow *
gnc_ui_customer_edit (GncCustomer *cust)
gnc_ui_customer_edit (GtkWindow *parent, GncCustomer *cust)
{
CustomerWindow *cw;
if (!cust) return NULL;
cw = gnc_customer_new_window (gncCustomerGetBook(cust), cust);
cw = gnc_customer_new_window (parent, gncCustomerGetBook(cust), cust);
return cw;
}
CustomerWindow *
gnc_ui_customer_new (QofBook *bookp)
gnc_ui_customer_new (GtkWindow *parent, QofBook *bookp)
{
CustomerWindow *cw;
/* Make sure required options exist */
if (!bookp) return NULL;
cw = gnc_customer_new_window (bookp, NULL);
cw = gnc_customer_new_window (parent, bookp, NULL);
return cw;
}
@ -779,7 +781,7 @@ gnc_ui_customer_new (QofBook *bookp)
/* Functions for customer selection widgets */
static void
invoice_customer_cb (gpointer *cust_p, gpointer user_data)
invoice_customer_cb (GtkWindow *dialog, gpointer *cust_p, gpointer user_data)
{
struct _customer_select_window *sw = user_data;
GncOwner owner;
@ -793,12 +795,12 @@ invoice_customer_cb (gpointer *cust_p, gpointer user_data)
return;
gncOwnerInitCustomer (&owner, cust);
gnc_invoice_search (NULL, &owner, sw->book);
gnc_invoice_search (dialog, NULL, &owner, sw->book);
return;
}
static void
order_customer_cb (gpointer *cust_p, gpointer user_data)
order_customer_cb (GtkWindow *dialog, gpointer *cust_p, gpointer user_data)
{
struct _customer_select_window *sw = user_data;
GncOwner owner;
@ -812,12 +814,12 @@ order_customer_cb (gpointer *cust_p, gpointer user_data)
return;
gncOwnerInitCustomer (&owner, cust);
gnc_order_search (NULL, &owner, sw->book);
gnc_order_search (dialog, NULL, &owner, sw->book);
return;
}
static void
jobs_customer_cb (gpointer *cust_p, gpointer user_data)
jobs_customer_cb (GtkWindow *dialog, gpointer *cust_p, gpointer user_data)
{
struct _customer_select_window *sw = user_data;
GncOwner owner;
@ -831,12 +833,12 @@ jobs_customer_cb (gpointer *cust_p, gpointer user_data)
return;
gncOwnerInitCustomer (&owner, cust);
gnc_job_search (NULL, &owner, sw->book);
gnc_job_search (dialog, NULL, &owner, sw->book);
return;
}
static void
payment_customer_cb (gpointer *cust_p, gpointer user_data)
payment_customer_cb (GtkWindow *dialog, gpointer *cust_p, gpointer user_data)
{
struct _customer_select_window *sw = user_data;
GncOwner owner;
@ -850,12 +852,12 @@ payment_customer_cb (gpointer *cust_p, gpointer user_data)
return;
gncOwnerInitCustomer (&owner, cust);
gnc_ui_payment_new (&owner, sw->book);
gnc_ui_payment_new (dialog, &owner, sw->book);
return;
}
static void
edit_customer_cb (gpointer *cust_p, gpointer user_data)
edit_customer_cb (GtkWindow *dialog, gpointer *cust_p, gpointer user_data)
{
GncCustomer *cust;
@ -865,20 +867,20 @@ edit_customer_cb (gpointer *cust_p, gpointer user_data)
if (!cust)
return;
gnc_ui_customer_edit (cust);
gnc_ui_customer_edit (dialog, cust);
return;
}
static gpointer
new_customer_cb (gpointer user_data)
new_customer_cb (GtkWindow *dialog, gpointer user_data)
{
struct _customer_select_window *sw = user_data;
CustomerWindow *cw;
g_return_val_if_fail (sw, NULL);
cw = gnc_ui_customer_new (sw->book);
cw = gnc_ui_customer_new (dialog, sw->book);
return cw_get_customer (cw);
}
@ -894,7 +896,7 @@ free_userdata_cb (gpointer user_data)
}
GNCSearchWindow *
gnc_customer_search (GncCustomer *start, QofBook *book)
gnc_customer_search (GtkWindow *parent, GncCustomer *start, QofBook *book)
{
QofQuery *q, *q2 = NULL;
QofIdType type = GNC_CUSTOMER_MODULE_NAME;
@ -957,7 +959,7 @@ gnc_customer_search (GncCustomer *start, QofBook *book)
sw->book = book;
sw->q = q;
return gnc_search_dialog_create (type, _("Find Customer"),
return gnc_search_dialog_create (parent, type, _("Find Customer"),
params, columns, q, q2, buttons, NULL,
new_customer_cb, sw, free_userdata_cb,
GNC_PREFS_GROUP_SEARCH, NULL,
@ -965,18 +967,18 @@ gnc_customer_search (GncCustomer *start, QofBook *book)
}
GNCSearchWindow *
gnc_customer_search_select (gpointer start, gpointer book)
gnc_customer_search_select (GtkWindow *parent, gpointer start, gpointer book)
{
if (!book) return NULL;
return gnc_customer_search (start, book);
return gnc_customer_search (parent, start, book);
}
GNCSearchWindow *
gnc_customer_search_edit (gpointer start, gpointer book)
gnc_customer_search_edit (GtkWindow *parent, gpointer start, gpointer book)
{
if (start)
gnc_ui_customer_edit (start);
gnc_ui_customer_edit (parent, start);
return NULL;
}

View File

@ -31,11 +31,11 @@ typedef struct _customer_window CustomerWindow;
#include "dialog-search.h"
/* Functions to create and edit a customer */
CustomerWindow * gnc_ui_customer_edit (GncCustomer *cust);
CustomerWindow * gnc_ui_customer_new (QofBook *book);
CustomerWindow * gnc_ui_customer_edit (GtkWindow *parent, GncCustomer *cust);
CustomerWindow * gnc_ui_customer_new (GtkWindow *parent, QofBook *book);
/* Search for customers */
GNCSearchWindow *gnc_customer_search (GncCustomer *start, QofBook *book);
GNCSearchWindow *gnc_customer_search (GtkWindow *parent, GncCustomer *start, QofBook *book);
/*
* These callbacks are for use with the gnc_general_search widget
@ -43,7 +43,7 @@ GNCSearchWindow *gnc_customer_search (GncCustomer *start, QofBook *book);
* select() provides a Select Dialog and returns it.
* edit() opens the existing customer for editing and returns NULL.
*/
GNCSearchWindow * gnc_customer_search_select (gpointer start, gpointer book);
GNCSearchWindow * gnc_customer_search_edit (gpointer start, gpointer book);
GNCSearchWindow * gnc_customer_search_select (GtkWindow *parent, gpointer start, gpointer book);
GNCSearchWindow * gnc_customer_search_edit (GtkWindow *parent, gpointer start, gpointer book);
#endif /* GNC_DIALOG_CUSTOMER_H_ */

View File

@ -71,14 +71,14 @@ gnc_dialog_date_close_ok_cb (GtkWidget *widget, gpointer user_data)
if (!acc)
{
gnc_error_dialog (ddc->dialog, "%s",
gnc_error_dialog (GTK_WINDOW (ddc->dialog), "%s",
_("No Account selected. Please try again."));
return;
}
if (xaccAccountGetPlaceholder (acc))
{
gnc_error_dialog (ddc->dialog, "%s",
gnc_error_dialog (GTK_WINDOW (ddc->dialog), "%s",
_("Placeholder account selected. Please try again."));
return;
}

View File

@ -46,6 +46,7 @@
#include "dialog-employee.h"
#include "dialog-invoice.h"
#include "dialog-payment.h"
#include "business-gnome-utils.h"
#define DIALOG_NEW_EMPLOYEE_CM_CLASS "dialog-new-employee"
#define DIALOG_EDIT_EMPLOYEE_CM_CLASS "dialog-edit-employee"
@ -67,8 +68,8 @@ typedef enum
struct _employee_select_window
{
QofBook * book;
QofQuery * q;
QofBook *book;
QofQuery *q;
};
struct _employee_window
@ -174,41 +175,14 @@ static void gnc_ui_to_employee (EmployeeWindow *ew, GncEmployee *employee)
gnc_resume_gui_refresh ();
}
#if 0
static gboolean check_edit_amount (GtkWidget *dialog, GtkWidget *amount,
gnc_numeric *min, gnc_numeric *max,
const char * error_message)
{
if (!gnc_amount_edit_evaluate (GNC_AMOUNT_EDIT (amount)))
{
if (error_message)
gnc_error_dialog (dialog, error_message);
return TRUE;
}
/* We've got a valid-looking number; check mix/max */
if (min || max)
{
gnc_numeric val = gnc_amount_edit_get_amount (GNC_AMOUNT_EDIT (amount));
if ((min && gnc_numeric_compare (*min, val) > 0) ||
(max && gnc_numeric_compare (val, *max) > 0))
{
if (error_message)
gnc_error_dialog (dialog, error_message);
return TRUE;
}
}
return FALSE;
}
#endif
static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
static gboolean check_entry_nonempty (GtkWidget *entry,
const char * error_message)
{
const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
if (g_strcmp0 (res, "") == 0)
{
if (error_message)
gnc_error_dialog (dialog, "%s", error_message);
gnc_error_dialog (gnc_ui_get_gtk_window(entry), "%s", error_message);
return TRUE;
}
return FALSE;
@ -221,23 +195,23 @@ gnc_employee_window_ok_cb (GtkWidget *widget, gpointer data)
gchar *string;
/* Check for valid username */
if (check_entry_nonempty (ew->dialog, ew->username_entry,
if (check_entry_nonempty (ew->username_entry,
_("You must enter a username.")))
return;
/* Check for valid username */
if (check_entry_nonempty (ew->dialog, ew->name_entry,
if (check_entry_nonempty (ew->name_entry,
_("You must enter the employee's name.")))
return;
/* Make sure we have an address */
if (check_entry_nonempty (ew->dialog, ew->addr1_entry, NULL) &&
check_entry_nonempty (ew->dialog, ew->addr2_entry, NULL) &&
check_entry_nonempty (ew->dialog, ew->addr3_entry, NULL) &&
check_entry_nonempty (ew->dialog, ew->addr4_entry, NULL))
if (check_entry_nonempty (ew->addr1_entry, NULL) &&
check_entry_nonempty (ew->addr2_entry, NULL) &&
check_entry_nonempty (ew->addr3_entry, NULL) &&
check_entry_nonempty (ew->addr4_entry, NULL))
{
const char *msg = _("You must enter an address.");
gnc_error_dialog (ew->dialog, "%s", msg);
gnc_error_dialog (gnc_ui_get_gtk_window (widget), "%s", msg);
return;
}
@ -391,7 +365,8 @@ find_handler (gpointer find_data, gpointer user_data)
}
static EmployeeWindow *
gnc_employee_new_window (QofBook *bookp,
gnc_employee_new_window (GtkWindow *parent,
QofBook *bookp,
GncEmployee *employee)
{
EmployeeWindow *ew;
@ -415,6 +390,7 @@ gnc_employee_new_window (QofBook *bookp,
find_handler, &employee_guid);
if (ew)
{
gtk_window_set_transient_for (GTK_WINDOW(ew->dialog), parent);
gtk_window_present (GTK_WINDOW(ew->dialog));
return(ew);
}
@ -437,6 +413,7 @@ gnc_employee_new_window (QofBook *bookp,
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-employee.glade", "employee_dialog");
ew->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "employee_dialog"));
gtk_window_set_transient_for (GTK_WINDOW(ew->dialog), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(ew->dialog), "GncEmployeeDialog");
@ -597,26 +574,26 @@ gnc_employee_new_window (QofBook *bookp,
}
EmployeeWindow *
gnc_ui_employee_new (QofBook *bookp)
gnc_ui_employee_new (GtkWindow *parent, QofBook *bookp)
{
EmployeeWindow *ew;
/* Make sure required options exist */
if (!bookp) return NULL;
ew = gnc_employee_new_window (bookp, NULL);
ew = gnc_employee_new_window (parent, bookp, NULL);
return ew;
}
EmployeeWindow *
gnc_ui_employee_edit (GncEmployee *employee)
gnc_ui_employee_edit (GtkWindow *parent, GncEmployee *employee)
{
EmployeeWindow *ew;
if (!employee) return NULL;
ew = gnc_employee_new_window (gncEmployeeGetBook(employee), employee);
ew = gnc_employee_new_window (parent, gncEmployeeGetBook(employee), employee);
return ew;
}
@ -624,7 +601,7 @@ gnc_ui_employee_edit (GncEmployee *employee)
/* Functions for employee selection widgets */
static void
invoice_employee_cb (gpointer *employee_p, gpointer user_data)
invoice_employee_cb (GtkWindow *dialog, gpointer *employee_p, gpointer user_data)
{
struct _employee_select_window *sw = user_data;
GncOwner owner;
@ -638,12 +615,12 @@ invoice_employee_cb (gpointer *employee_p, gpointer user_data)
return;
gncOwnerInitEmployee (&owner, employee);
gnc_invoice_search (NULL, &owner, sw->book);
gnc_invoice_search (dialog, NULL, &owner, sw->book);
return;
}
static void
payment_employee_cb (gpointer *employee_p, gpointer user_data)
payment_employee_cb (GtkWindow *dialog, gpointer *employee_p, gpointer user_data)
{
struct _employee_select_window *sw = user_data;
GncOwner owner;
@ -657,12 +634,12 @@ payment_employee_cb (gpointer *employee_p, gpointer user_data)
return;
gncOwnerInitEmployee (&owner, employee);
gnc_ui_payment_new (&owner, sw->book);
gnc_ui_payment_new (dialog, &owner, sw->book);
return;
}
static void
edit_employee_cb (gpointer *employee_p, gpointer user_data)
edit_employee_cb (GtkWindow *dialog, gpointer *employee_p, gpointer user_data)
{
GncEmployee *employee;
@ -673,19 +650,19 @@ edit_employee_cb (gpointer *employee_p, gpointer user_data)
if (!employee)
return;
gnc_ui_employee_edit (employee);
gnc_ui_employee_edit (dialog, employee);
return;
}
static gpointer
new_employee_cb (gpointer user_data)
new_employee_cb (GtkWindow *dialog, gpointer user_data)
{
struct _employee_select_window *sw = user_data;
EmployeeWindow *ew;
g_return_val_if_fail (user_data, NULL);
ew = gnc_ui_employee_new (sw->book);
ew = gnc_ui_employee_new (dialog, sw->book);
return ew_get_employee (ew);
}
@ -701,7 +678,7 @@ free_employee_cb (gpointer user_data)
}
GNCSearchWindow *
gnc_employee_search (GncEmployee *start, QofBook *book)
gnc_employee_search (GtkWindow *parent, GncEmployee *start, QofBook *book)
{
QofIdType type = GNC_EMPLOYEE_MODULE_NAME;
struct _employee_select_window *sw;
@ -758,7 +735,7 @@ gnc_employee_search (GncEmployee *start, QofBook *book)
sw->book = book;
sw->q = q;
return gnc_search_dialog_create (type, _("Find Employee"),
return gnc_search_dialog_create (parent, type, _("Find Employee"),
params, columns, q, q2,
buttons, NULL, new_employee_cb,
sw, free_employee_cb,
@ -767,18 +744,18 @@ gnc_employee_search (GncEmployee *start, QofBook *book)
}
GNCSearchWindow *
gnc_employee_search_select (gpointer start, gpointer book)
gnc_employee_search_select (GtkWindow *parent, gpointer start, gpointer book)
{
if (!book) return NULL;
return gnc_employee_search (start, book);
return gnc_employee_search (parent, start, book);
}
GNCSearchWindow *
gnc_employee_search_edit (gpointer start, gpointer book)
gnc_employee_search_edit (GtkWindow *parent, gpointer start, gpointer book)
{
if (start)
gnc_ui_employee_edit (start);
gnc_ui_employee_edit (parent, start);
return NULL;
}

View File

@ -31,11 +31,11 @@ typedef struct _employee_window EmployeeWindow;
#include "dialog-search.h"
/* Functions to edit and create employees */
EmployeeWindow * gnc_ui_employee_edit (GncEmployee *employee);
EmployeeWindow * gnc_ui_employee_new (QofBook *book);
EmployeeWindow * gnc_ui_employee_edit (GtkWindow *parent, GncEmployee *employee);
EmployeeWindow * gnc_ui_employee_new (GtkWindow *parent, QofBook *book);
/* Search for an employee */
GNCSearchWindow * gnc_employee_search (GncEmployee *start, QofBook *book);
GNCSearchWindow * gnc_employee_search (GtkWindow *parent, GncEmployee *start, QofBook *book);
/*
* These callbacks are for use with the gnc_general_search widget
@ -43,7 +43,7 @@ GNCSearchWindow * gnc_employee_search (GncEmployee *start, QofBook *book);
* select() provides a Select Dialog and returns it.
* edit() opens the existing vendor for editing and returns NULL.
*/
GNCSearchWindow * gnc_employee_search_select (gpointer start, gpointer book);
GNCSearchWindow * gnc_employee_search_edit (gpointer start, gpointer book);
GNCSearchWindow * gnc_employee_search_select (GtkWindow *parent, gpointer start, gpointer book);
GNCSearchWindow * gnc_employee_search_edit (GtkWindow *parent, gpointer start, gpointer book);
#endif /* GNC_DIALOG_EMPLOYEE_H_ */

View File

@ -398,7 +398,7 @@ calc_value(FinCalcDialog *fcd, FinCalcValue value)
{
GtkWidget *entry;
gnc_error_dialog(fcd->dialog, "%s", string);
gnc_error_dialog (GTK_WINDOW (fcd->dialog), "%s", string);
if (error_item == 0)
entry = fcd->amounts[0];
else

View File

@ -41,9 +41,10 @@
struct _ftd_data
{
QofQuery * q;
QofQuery * ledger_q;
GNCSearchWindow * sw;
QofQuery *q;
QofQuery *ledger_q;
GNCSearchWindow *sw;
GtkWindow *parent;
};
static void
@ -69,7 +70,7 @@ do_find_cb (QofQuery *query, gpointer user_data, gpointer *result)
if (new_ledger)
{
page = gnc_plugin_page_register_new_ledger (ledger);
gnc_main_window_open_page (NULL, page);
gnc_main_window_open_page (GNC_MAIN_WINDOW(ftd->parent), page);
}
qof_query_destroy (ftd->q);
@ -97,6 +98,7 @@ gnc_ui_find_transactions_dialog_create(GNCLedgerDisplay * orig_ledg)
QofQuery *start_q, *show_q = NULL;
gboolean num_action =
qof_book_use_split_action_for_num_field(gnc_get_current_book());
GtkWindow *parent = GTK_WINDOW(gnc_ledger_display_get_parent(orig_ledg));
/* Build parameter list in reverse order */
if (params == NULL)
@ -221,7 +223,9 @@ gnc_ui_find_transactions_dialog_create(GNCLedgerDisplay * orig_ledg)
ftd->q = start_q; /* save this to destroy it later */
}
ftd->sw = gnc_search_dialog_create (type, _("Find Transaction"),
ftd->parent = parent;
ftd->sw = gnc_search_dialog_create (parent, type, _("Find Transaction"),
params, NULL, start_q, show_q,
NULL, do_find_cb, NULL,
ftd, free_ftd_cb, GNC_PREFS_GROUP_SEARCH, NULL,

View File

@ -41,9 +41,10 @@
struct _ftd_data
{
QofQuery * q;
QofQuery * ledger_q;
GNCSearchWindow * sw;
QofQuery *q;
QofQuery *ledger_q;
GNCSearchWindow *sw;
GtkWindow *parent;
};
static void
@ -70,7 +71,7 @@ do_find_cb (QofQuery *query, gpointer user_data, gpointer *result)
if (new_ledger)
{
page = gnc_plugin_page_register2_new_ledger (ledger);
gnc_main_window_open_page (NULL, page);
gnc_main_window_open_page (GNC_MAIN_WINDOW(ftd->parent), page);
}
qof_query_destroy (ftd->q);
@ -98,6 +99,7 @@ gnc_ui_find_transactions_dialog_create2 (GNCLedgerDisplay2 * orig_ledg)
QofQuery *start_q, *show_q = NULL;
gboolean num_action =
qof_book_use_split_action_for_num_field(gnc_get_current_book());
GtkWindow *parent = GTK_WINDOW(gnc_ledger_display2_get_parent (orig_ledg));
/* Build parameter list in reverse order */
if (params == NULL)
@ -222,7 +224,9 @@ gnc_ui_find_transactions_dialog_create2 (GNCLedgerDisplay2 * orig_ledg)
ftd->q = start_q; /* save this to destroy it later */
}
ftd->sw = gnc_search_dialog_create (type, _("Find Transaction"),
ftd->parent = parent;
ftd->sw = gnc_search_dialog_create (parent, type, _("Find Transaction"),
params, NULL, start_q, show_q,
NULL, do_find_cb, NULL,
ftd, free_ftd_cb, GNC_PREFS_GROUP_SEARCH, NULL,

View File

@ -120,10 +120,10 @@ typedef enum
struct _invoice_select_window
{
QofBook * book;
GncOwner * owner;
QofQuery * q;
GncOwner owner_def;
QofBook *book;
GncOwner *owner;
QofQuery *q;
GncOwner owner_def;
};
#define UNUSED_VAR __attribute__ ((unused))
@ -207,17 +207,16 @@ struct _invoice_window
};
/* Forward definitions for CB functions */
void gnc_invoice_window_closeCB (GtkWidget *widget, gpointer data);
void gnc_invoice_window_active_toggled_cb (GtkWidget *widget, gpointer data);
gboolean gnc_invoice_window_leave_notes_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data);
DialogQueryView *gnc_invoice_show_bills_due (QofBook *book, double days_in_advance, GncWhichDueType duetype);
DialogQueryView *gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, double days_in_advance, GncWhichDueType duetype);
#define INV_WIDTH_PREFIX "invoice_reg"
#define BILL_WIDTH_PREFIX "bill_reg"
#define VOUCHER_WIDTH_PREFIX "voucher_reg"
static void gnc_invoice_update_window (InvoiceWindow *iw, GtkWidget *widget);
static InvoiceWindow * gnc_ui_invoice_modify (GncInvoice *invoice);
static InvoiceWindow * gnc_ui_invoice_modify (GtkWindow *parent, GncInvoice *invoice);
/*******************************************************************************/
/* FUNCTIONS FOR ACCESSING DATA STRUCTURE FIELDS */
@ -389,7 +388,7 @@ gnc_invoice_window_verify_ok (InvoiceWindow *iw)
res = gncOwnerGetName (&(iw->owner));
if (res == NULL || g_strcmp0 (res, "") == 0)
{
gnc_error_dialog (iw_get_window(iw), "%s",
gnc_error_dialog (GTK_WINDOW (iw_get_window(iw)), "%s",
/* Translators: In this context,
* 'Billing information' maps to the
* label in the frame and means
@ -450,7 +449,7 @@ gnc_invoice_window_ok_cb (GtkWidget *widget, gpointer data)
*/
if ((iw->dialog_type == NEW_INVOICE || iw->dialog_type == DUP_INVOICE)
&& iw->created_invoice)
gnc_ui_invoice_edit (iw->created_invoice);
gnc_ui_invoice_edit (gnc_ui_get_main_window (iw->dialog), iw->created_invoice);
gnc_close_gui_component (iw->component_id);
}
@ -495,29 +494,23 @@ gnc_invoice_window_destroy_cb (GtkWidget *widget, gpointer data)
}
void
gnc_invoice_window_closeCB (GtkWidget *widget, gpointer data)
{
gnc_invoice_window_ok_cb (widget, data);
}
void
gnc_invoice_window_editCB (GtkWidget *widget, gpointer data)
gnc_invoice_window_editCB (GtkWindow *parent, gpointer data)
{
InvoiceWindow *iw = data;
GncInvoice *invoice = iw_get_invoice (iw);
if (invoice)
gnc_ui_invoice_modify (invoice);
gnc_ui_invoice_modify (parent, invoice);
}
void
gnc_invoice_window_duplicateInvoiceCB (GtkWidget *widget, gpointer data)
gnc_invoice_window_duplicateInvoiceCB (GtkWindow *parent, gpointer data)
{
InvoiceWindow *iw = data;
GncInvoice *invoice = iw_get_invoice (iw);
if (invoice)
gnc_ui_invoice_duplicate (invoice, TRUE, NULL);
gnc_ui_invoice_duplicate (parent, invoice, TRUE, NULL);
}
void gnc_invoice_window_entryUpCB (GtkWidget *widget, gpointer data)
@ -600,7 +593,7 @@ gnc_invoice_window_deleteCB (GtkWidget *widget, gpointer data)
else
msg = g_strdup (message);
result = gnc_verify_dialog (iw_get_window(iw), FALSE, "%s", msg);
result = gnc_verify_dialog (GTK_WINDOW (iw_get_window(iw)), FALSE, "%s", msg);
g_free (msg);
if (!result)
@ -648,7 +641,7 @@ gnc_invoice_window_blankCB (GtkWidget *widget, gpointer data)
}
static void
gnc_invoice_window_print_invoice(GncInvoice *invoice)
gnc_invoice_window_print_invoice(GtkWindow *parent, GncInvoice *invoice)
{
SCM func, arg, arg2;
SCM args = SCM_EOL;
@ -674,13 +667,13 @@ gnc_invoice_window_print_invoice(GncInvoice *invoice)
/* scm_gc_unprotect_object(func); */
if (report_id >= 0)
reportWindow (report_id);
reportWindow (report_id, parent);
}
void
gnc_invoice_window_printCB (GtkWidget *unused_widget, gpointer data)
gnc_invoice_window_printCB (GtkWindow* parent, gpointer data)
{
InvoiceWindow *iw = data;
gnc_invoice_window_print_invoice(iw_get_invoice (iw));
gnc_invoice_window_print_invoice (parent, iw_get_invoice (iw));
}
static gboolean
@ -764,6 +757,7 @@ struct post_invoice_params
char *memo; /* Memo for posting transaction */
Account *acc; /* Account to post to */
gboolean accumulate; /* Whether to accumulate splits */
GtkWindow *parent;
};
static void
@ -794,7 +788,7 @@ gnc_invoice_post(InvoiceWindow *iw, struct post_invoice_params *post_params)
/* Check that there is at least one Entry */
if (gncInvoiceGetEntries (invoice) == NULL)
{
gnc_error_dialog (iw_get_window(iw), "%s",
gnc_error_dialog (GTK_WINDOW (iw_get_window(iw)), "%s",
_("The Invoice must have at least one Entry."));
return;
}
@ -853,7 +847,7 @@ gnc_invoice_post(InvoiceWindow *iw, struct post_invoice_params *post_params)
*/
if (show_dialog)
{
gnc_info_dialog(iw_get_window(iw), "%s", text);
gnc_info_dialog(GTK_WINDOW (iw_get_window(iw)), "%s", text);
show_dialog = FALSE;
}
@ -967,7 +961,7 @@ cleanup:
else
{
text = _("The post action was canceled because not all exchange rates were given.");
gnc_info_dialog(iw_get_window(iw), "%s", text);
gnc_info_dialog(GTK_WINDOW (iw_get_window(iw)), "%s", text);
}
/* ... and redisplay here. */
@ -1028,20 +1022,20 @@ void gnc_invoice_window_paste_cb (GtkWidget *widget, gpointer data)
gnucash_register_paste_clipboard (iw->reg);
}
void gnc_invoice_window_new_invoice_cb (GtkWidget *widget, gpointer data)
void gnc_invoice_window_new_invoice_cb (GtkWindow *parent, gpointer data)
{
InvoiceWindow *iw = data;
if (gncOwnerGetJob (&iw->job))
{
gnc_ui_invoice_new (&iw->job, iw->book);
gnc_ui_invoice_new (parent, &iw->job, iw->book);
}
else
{
gnc_ui_invoice_new (&iw->owner, iw->book);
gnc_ui_invoice_new (parent, &iw->owner, iw->book);
}
}
void gnc_business_call_owner_report (GncOwner *owner, Account *acc)
void gnc_business_call_owner_report (GtkWindow *parent, GncOwner *owner, Account *acc)
{
int id;
SCM args;
@ -1079,24 +1073,24 @@ void gnc_business_call_owner_report (GncOwner *owner, Account *acc)
id = scm_to_int (arg);
if (id >= 0)
reportWindow (id);
reportWindow (id, parent);
}
void gnc_invoice_window_report_owner_cb (GtkWidget *widget, gpointer data)
void gnc_invoice_window_report_owner_cb (GtkWindow *parent, gpointer data)
{
InvoiceWindow *iw = data;
gnc_business_call_owner_report (&iw->owner, NULL);
gnc_business_call_owner_report (parent, &iw->owner, NULL);
}
void gnc_invoice_window_payment_cb (GtkWidget *widget, gpointer data)
void gnc_invoice_window_payment_cb (GtkWindow *parent, gpointer data)
{
InvoiceWindow *iw = data;
GncInvoice *invoice = iw_get_invoice(iw);
if (gncOwnerGetJob (&iw->job))
gnc_ui_payment_new_with_invoice (&iw->job, iw->book, invoice);
gnc_ui_payment_new_with_invoice (parent, &iw->job, iw->book, invoice);
else
gnc_ui_payment_new_with_invoice (&iw->owner, iw->book, invoice);
gnc_ui_payment_new_with_invoice (parent, &iw->owner, iw->book, invoice);
}
/* Sorting callbacks */
@ -1285,7 +1279,7 @@ gnc_invoice_job_changed_cb (GtkWidget *widget, gpointer data)
}
static GNCSearchWindow *
gnc_invoice_select_job_cb (gpointer jobp, gpointer user_data)
gnc_invoice_select_job_cb (GtkWindow *parent, gpointer jobp, gpointer user_data)
{
GncJob *j = jobp;
InvoiceWindow *iw = user_data;
@ -1301,7 +1295,7 @@ gnc_invoice_select_job_cb (gpointer jobp, gpointer user_data)
else
gncOwnerCopy (&(iw->owner), &owner);
return gnc_job_search (j, &owner, iw->book);
return gnc_job_search (parent, j, &owner, iw->book);
}
static void
@ -1347,7 +1341,7 @@ gnc_invoice_update_job_choice (InvoiceWindow *iw)
}
static GNCSearchWindow *
gnc_invoice_select_proj_job_cb (gpointer jobp, gpointer user_data)
gnc_invoice_select_proj_job_cb (GtkWindow *parent, gpointer jobp, gpointer user_data)
{
GncJob *j = jobp;
InvoiceWindow *iw = user_data;
@ -1363,7 +1357,7 @@ gnc_invoice_select_proj_job_cb (gpointer jobp, gpointer user_data)
else
gncOwnerCopy (&(iw->proj_cust), &owner);
return gnc_job_search (j, &owner, iw->book);
return gnc_job_search (parent, j, &owner, iw->book);
}
static int
@ -2456,7 +2450,7 @@ gnc_invoice_create_page (InvoiceWindow *iw, gpointer page)
}
static InvoiceWindow *
gnc_invoice_window_new_invoice (InvoiceDialogType dialog_type, QofBook *bookp,
gnc_invoice_window_new_invoice (GtkWindow *parent, InvoiceDialogType dialog_type, QofBook *bookp,
const GncOwner *owner, GncInvoice *invoice)
{
InvoiceWindow *iw;
@ -2483,6 +2477,7 @@ gnc_invoice_window_new_invoice (InvoiceDialogType dialog_type, QofBook *bookp,
find_handler, &invoice_guid);
if (iw)
{
gtk_window_set_transient_for (GTK_WINDOW(iw->dialog), parent);
gtk_window_present (GTK_WINDOW(iw->dialog));
return(iw);
}
@ -2542,6 +2537,7 @@ gnc_invoice_window_new_invoice (InvoiceDialogType dialog_type, QofBook *bookp,
gnc_builder_add_from_file (builder, "dialog-invoice.glade", "terms_store");
gnc_builder_add_from_file (builder, "dialog-invoice.glade", "new_invoice_dialog");
iw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "new_invoice_dialog"));
gtk_window_set_transient_for (GTK_WINDOW(iw->dialog), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(iw->dialog), "GncInvoiceDialog");
@ -2672,7 +2668,7 @@ gnc_invoice_window_new_invoice (InvoiceDialogType dialog_type, QofBook *bookp,
}
InvoiceWindow *
gnc_ui_invoice_edit (GncInvoice *invoice)
gnc_ui_invoice_edit (GtkWindow *parent, GncInvoice *invoice)
{
InvoiceWindow *iw;
InvoiceDialogType type;
@ -2686,18 +2682,19 @@ gnc_ui_invoice_edit (GncInvoice *invoice)
type = EDIT_INVOICE;
iw = gnc_invoice_new_page (gncInvoiceGetBook(invoice), type,
invoice, gncInvoiceGetOwner (invoice), NULL);
invoice, gncInvoiceGetOwner (invoice),
GNC_MAIN_WINDOW(gnc_ui_get_main_window (GTK_WIDGET (parent))));
return iw;
}
static InvoiceWindow *
gnc_ui_invoice_modify (GncInvoice *invoice)
gnc_ui_invoice_modify (GtkWindow *parent, GncInvoice *invoice)
{
InvoiceWindow *iw;
if (!invoice) return NULL;
iw = gnc_invoice_window_new_invoice (MOD_INVOICE, NULL, NULL, invoice);
iw = gnc_invoice_window_new_invoice (parent, MOD_INVOICE, NULL, NULL, invoice);
return iw;
}
@ -2715,7 +2712,7 @@ set_gncEntry_date(gpointer data, gpointer user_data)
}
InvoiceWindow * gnc_ui_invoice_duplicate (GncInvoice *old_invoice, gboolean open_properties, const GDate *new_date)
InvoiceWindow * gnc_ui_invoice_duplicate (GtkWindow *parent, GncInvoice *old_invoice, gboolean open_properties, const GDate *new_date)
{
InvoiceWindow *iw = NULL;
GncInvoice *new_invoice = NULL;
@ -2764,12 +2761,12 @@ InvoiceWindow * gnc_ui_invoice_duplicate (GncInvoice *old_invoice, gboolean open
if (open_properties)
{
// Open the "properties" pop-up for the invoice...
iw = gnc_invoice_window_new_invoice (DUP_INVOICE, NULL, NULL, new_invoice);
iw = gnc_invoice_window_new_invoice (parent, DUP_INVOICE, NULL, NULL, new_invoice);
}
else
{
// Open the newly created invoice in the "edit" window
iw = gnc_ui_invoice_edit (new_invoice);
iw = gnc_ui_invoice_edit (parent, new_invoice);
// Check the ID; set one if necessary
if (g_strcmp0 (gtk_entry_get_text (GTK_ENTRY (iw->id_entry)), "") == 0)
{
@ -2780,22 +2777,22 @@ InvoiceWindow * gnc_ui_invoice_duplicate (GncInvoice *old_invoice, gboolean open
}
InvoiceWindow *
gnc_ui_invoice_new (GncOwner *ownerp, QofBook *bookp)
gnc_ui_invoice_new (GtkWindow *parent, GncOwner *owner, QofBook *book)
{
InvoiceWindow *iw;
GncOwner owner;
GncOwner inv_owner;
if (ownerp)
if (owner)
{
gncOwnerCopy (ownerp, &owner);
gncOwnerCopy (owner, &inv_owner);
}
else
gncOwnerInitCustomer (&owner, NULL); /* XXX: pass in the owner type? */
gncOwnerInitCustomer (&inv_owner, NULL); /* XXX: pass in the owner type? */
/* Make sure required options exist */
if (!bookp) return NULL;
if (!book) return NULL;
iw = gnc_invoice_window_new_invoice (NEW_INVOICE, bookp, &owner, NULL);
iw = gnc_invoice_window_new_invoice (parent, NEW_INVOICE, book, &inv_owner, NULL);
return iw;
}
@ -2803,47 +2800,67 @@ gnc_ui_invoice_new (GncOwner *ownerp, QofBook *bookp)
/* Functions for invoice selection widgets */
static void
edit_invoice_direct (gpointer invoice, gpointer user_data)
edit_invoice_direct (GtkWindow *dialog, gpointer invoice, gpointer user_data)
{
g_return_if_fail (invoice);
gnc_ui_invoice_edit (invoice);
gnc_ui_invoice_edit (gnc_ui_get_main_window (GTK_WIDGET (dialog)), invoice);
}
static void
edit_invoice_cb (gpointer inv, gpointer user_data)
edit_invoice_cb (GtkWindow *dialog, gpointer inv, gpointer user_data)
{
GncInvoice *invoice = inv;
g_return_if_fail (invoice && user_data);
edit_invoice_direct (invoice, user_data);
edit_invoice_direct (dialog, invoice, user_data);
}
static void
multi_edit_invoice_cb (GList *invoice_list, gpointer user_data)
struct multi_edit_invoice_data
{
g_list_foreach(invoice_list, edit_invoice_cb, user_data);
gpointer user_data;
GtkWindow *parent;
};
static void
multi_edit_invoice_one (gpointer inv, gpointer user_data)
{
struct multi_edit_invoice_data *meid = user_data;
edit_invoice_cb (meid->parent, inv, meid->user_data);
}
static void
pay_invoice_direct (gpointer inv, gpointer user_data)
multi_edit_invoice_cb (GtkWindow *dialog, GList *invoice_list, gpointer user_data)
{
struct multi_edit_invoice_data meid;
meid.user_data = user_data;
meid.parent = dialog;
g_list_foreach (invoice_list, multi_edit_invoice_one, &meid);
}
static void
pay_invoice_direct (GtkWindow *dialog, gpointer inv, gpointer user_data)
{
GncInvoice *invoice = inv;
g_return_if_fail (invoice);
gnc_ui_payment_new_with_invoice (gncInvoiceGetOwner (invoice),
gnc_ui_payment_new_with_invoice (dialog, gncInvoiceGetOwner (invoice),
gncInvoiceGetBook (invoice), invoice);
}
static void
pay_invoice_cb (gpointer *invoice_p, gpointer user_data)
pay_invoice_cb (GtkWindow *dialog, gpointer *invoice_p, gpointer user_data)
{
g_return_if_fail (invoice_p && user_data);
if (! *invoice_p)
return;
pay_invoice_direct (*invoice_p, user_data);
pay_invoice_direct (dialog, *invoice_p, user_data);
}
struct multi_duplicate_invoice_data
{
GDate date;
GtkWindow *parent;
};
static void multi_duplicate_invoice_one(gpointer data, gpointer user_data)
@ -2858,7 +2875,7 @@ static void multi_duplicate_invoice_one(gpointer data, gpointer user_data)
// In this simplest form, we just use the existing duplication
// algorithm, only without opening the "edit invoice" window for editing
// the number etc. for each of the invoices.
InvoiceWindow *iw = gnc_ui_invoice_duplicate(old_invoice, FALSE, &dup_user_data->date);
InvoiceWindow *iw = gnc_ui_invoice_duplicate(dup_user_data->parent, old_invoice, FALSE, &dup_user_data->date);
// FIXME: Now we could use this invoice and manipulate further data.
g_assert(iw);
new_invoice = iw_get_invoice(iw);
@ -2867,7 +2884,7 @@ static void multi_duplicate_invoice_one(gpointer data, gpointer user_data)
}
static void
multi_duplicate_invoice_cb (GList *invoice_list, gpointer user_data)
multi_duplicate_invoice_cb (GtkWindow *dialog, GList *invoice_list, gpointer user_data)
{
g_return_if_fail (invoice_list);
switch (g_list_length(invoice_list))
@ -2878,7 +2895,7 @@ multi_duplicate_invoice_cb (GList *invoice_list, gpointer user_data)
{
// Duplicate exactly one invoice
GncInvoice *old_invoice = invoice_list->data;
gnc_ui_invoice_duplicate(old_invoice, TRUE, NULL);
gnc_ui_invoice_duplicate(dialog, old_invoice, TRUE, NULL);
return;
}
default:
@ -2889,7 +2906,8 @@ multi_duplicate_invoice_cb (GList *invoice_list, gpointer user_data)
// Default date: Today
gnc_gdate_set_time64(&dup_user_data.date, gnc_time (NULL));
dialog_ok = gnc_dup_date_dialog (NULL, _("Date of duplicated entries"), &dup_user_data.date);
dup_user_data.parent = dialog;
dialog_ok = gnc_dup_date_dialog (GTK_WIDGET(dialog), _("Date of duplicated entries"), &dup_user_data.date);
if (!dialog_ok)
{
// User pressed cancel, so don't duplicate anything here.
@ -2909,7 +2927,7 @@ static void post_one_invoice_cb(gpointer data, gpointer user_data)
{
GncInvoice *invoice = data;
struct post_invoice_params *post_params = user_data;
InvoiceWindow *iw = gnc_ui_invoice_edit(invoice);
InvoiceWindow *iw = gnc_ui_invoice_edit(post_params->parent, invoice);
gnc_invoice_post(iw, post_params);
}
@ -2926,7 +2944,7 @@ static void gnc_invoice_is_posted(gpointer inv, gpointer test_value)
static void
multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
multi_post_invoice_cb (GtkWindow *dialog, GList *invoice_list, gpointer user_data)
{
struct post_invoice_params post_params;
gboolean test;
@ -2935,7 +2953,7 @@ multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
if (g_list_length(invoice_list) == 0)
return;
// Get the posting parameters for these invoices
iw = gnc_ui_invoice_edit(invoice_list->data);
iw = gnc_ui_invoice_edit(dialog, invoice_list->data);
test = FALSE;
gnc_suspend_gui_refresh (); // Turn off GUI refresh for the duration.
// Check if any of the selected invoices have already been posted.
@ -2943,7 +2961,7 @@ multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
gnc_resume_gui_refresh ();
if (test)
{
gnc_error_dialog (iw_get_window(iw), "%s",
gnc_error_dialog (GTK_WINDOW (iw_get_window(iw)), "%s",
_("One or more selected invoices have already been posted.\nRe-check your selection."));
return;
}
@ -2953,6 +2971,7 @@ multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
&post_params.memo, &post_params.acc,
&post_params.accumulate))
return;
post_params.parent = dialog;
// Turn off GUI refresh for the duration. This is more than just an
// optimization. If the search that got us here is based on the "posted"
@ -2963,30 +2982,41 @@ multi_post_invoice_cb (GList *invoice_list, gpointer user_data)
gnc_resume_gui_refresh ();
}
static void print_one_invoice_cb(gpointer data, gpointer user_data)
static void print_one_invoice_cb(GtkWindow *dialog, gpointer data, gpointer user_data)
{
GncInvoice *invoice = data;
gnc_invoice_window_print_invoice(invoice); // that's all!
gnc_invoice_window_print_invoice (dialog, invoice);
}
static void
multi_print_invoice_cb (GList *invoice_list, gpointer user_data)
multi_print_invoice_one (gpointer data, gpointer user_data)
{
struct multi_edit_invoice_data *meid = user_data;
print_one_invoice_cb (meid->parent, data, meid->user_data);
}
static void
multi_print_invoice_cb (GtkWindow *dialog, GList *invoice_list, gpointer user_data)
{
struct multi_edit_invoice_data meid;
if (g_list_length(invoice_list) == 0)
return;
g_list_foreach(invoice_list, print_one_invoice_cb, user_data);
meid.user_data = user_data;
meid.parent = dialog;
g_list_foreach (invoice_list, multi_print_invoice_one, &meid);
}
static gpointer
new_invoice_cb (gpointer user_data)
new_invoice_cb (GtkWindow *dialog, gpointer user_data)
{
struct _invoice_select_window *sw = user_data;
InvoiceWindow *iw;
g_return_val_if_fail (user_data, NULL);
iw = gnc_ui_invoice_new (sw->owner, sw->book);
iw = gnc_ui_invoice_new (dialog, sw->owner, sw->book);
return iw_get_invoice (iw);
}
@ -3002,7 +3032,7 @@ free_invoice_cb (gpointer user_data)
}
GNCSearchWindow *
gnc_invoice_search (GncInvoice *start, GncOwner *owner, QofBook *book)
gnc_invoice_search (GtkWindow *parent, GncInvoice *start, GncOwner *owner, QofBook *book)
{
QofIdType type = GNC_INVOICE_MODULE_NAME;
struct _invoice_select_window *sw;
@ -3269,14 +3299,14 @@ gnc_invoice_search (GncInvoice *start, GncOwner *owner, QofBook *book)
buttons = inv_buttons;
break;
}
return gnc_search_dialog_create (type, title, params, columns, q, q2,
return gnc_search_dialog_create (parent, type, title, params, columns, q, q2,
buttons, NULL, new_invoice_cb,
sw, free_invoice_cb, GNC_PREFS_GROUP_SEARCH,
label, style_class);
}
DialogQueryView *
gnc_invoice_show_bills_due (QofBook *book, double days_in_advance, GncWhichDueType duetype)
gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, double days_in_advance, GncWhichDueType duetype)
{
QofIdType type = GNC_INVOICE_MODULE_NAME;
Query *q;
@ -3411,7 +3441,8 @@ gnc_invoice_show_bills_due (QofBook *book, double days_in_advance, GncWhichDueTy
len);
title = _("Due Invoices Reminder");
}
dialog = gnc_dialog_query_view_create(param_list, q,
dialog = gnc_dialog_query_view_create(parent, param_list, q,
title,
message,
TRUE, FALSE,
@ -3426,7 +3457,7 @@ gnc_invoice_show_bills_due (QofBook *book, double days_in_advance, GncWhichDueTy
}
void
gnc_invoice_remind_bills_due (void)
gnc_invoice_remind_bills_due (GtkWindow *parent)
{
QofBook *book;
gint days;
@ -3435,11 +3466,11 @@ gnc_invoice_remind_bills_due (void)
book = qof_session_get_book(gnc_get_current_session());
days = gnc_prefs_get_float(GNC_PREFS_GROUP_BILL, GNC_PREF_DAYS_IN_ADVANCE);
gnc_invoice_show_bills_due(book, days, DUE_FOR_VENDOR);
gnc_invoice_show_docs_due (parent, book, days, DUE_FOR_VENDOR);
}
void
gnc_invoice_remind_invoices_due (void)
gnc_invoice_remind_invoices_due (GtkWindow *parent)
{
QofBook *book;
gint days;
@ -3448,7 +3479,7 @@ gnc_invoice_remind_invoices_due (void)
book = qof_session_get_book(gnc_get_current_session());
days = gnc_prefs_get_float(GNC_PREFS_GROUP_INVOICE, GNC_PREF_DAYS_IN_ADVANCE);
gnc_invoice_show_bills_due(book, days, DUE_FOR_CUSTOMER);
gnc_invoice_show_docs_due (parent, book, days, DUE_FOR_CUSTOMER);
}
void
@ -3457,7 +3488,7 @@ gnc_invoice_remind_bills_due_cb (void)
if (!gnc_prefs_get_bool(GNC_PREFS_GROUP_BILL, GNC_PREF_NOTIFY_WHEN_DUE))
return;
gnc_invoice_remind_bills_due();
gnc_invoice_remind_bills_due (GTK_WINDOW(gnc_ui_get_main_window (NULL)));
}
void
@ -3466,5 +3497,5 @@ gnc_invoice_remind_invoices_due_cb (void)
if (!gnc_prefs_get_bool(GNC_PREFS_GROUP_INVOICE, GNC_PREF_NOTIFY_WHEN_DUE))
return;
gnc_invoice_remind_invoices_due();
gnc_invoice_remind_invoices_due (GTK_WINDOW(gnc_ui_get_main_window (NULL)));
}

View File

@ -47,12 +47,12 @@ typedef enum
/* Create and edit an invoice */
InvoiceWindow * gnc_ui_invoice_edit (GncInvoice *invoice);
InvoiceWindow * gnc_ui_invoice_new (GncOwner *owner, QofBook *book);
InvoiceWindow * gnc_ui_invoice_edit (GtkWindow *parent, GncInvoice *invoice);
InvoiceWindow * gnc_ui_invoice_new (GtkWindow *parent, GncOwner *owner, QofBook *book);
/** Create a new invoice as a duplicate of the given existing invoice.
*
* \param invoice The invoice which is being duplicated
* \param old_invoice The invoice which is being duplicated
* \param open_properties If TRUE, open the "invoice properties" dialog window after creating the new invoice
* \param new_date If non-NULL, use this date as the date for the "opening date" and also as date for all invoice entries.
*
@ -60,12 +60,12 @@ InvoiceWindow * gnc_ui_invoice_new (GncOwner *owner, QofBook *book);
* among others the "created_invoice" as a GncInvoice* pointer on the newly
* created invoice.
*/
InvoiceWindow * gnc_ui_invoice_duplicate (GncInvoice *invoice, gboolean open_properties, const GDate *new_date);
InvoiceWindow* gnc_ui_invoice_duplicate (GtkWindow* parent, GncInvoice* old_invoice, gboolean open_properties, const GDate* new_date);
/* Search for invoices */
GNCSearchWindow * gnc_invoice_search (GncInvoice *start, GncOwner *owner, QofBook *book);
GNCSearchWindow * gnc_invoice_search (GtkWindow *parent, GncInvoice *start, GncOwner *owner, QofBook *book);
void gnc_business_call_owner_report (GncOwner *owner, Account *acc);
void gnc_business_call_owner_report (GtkWindow* parent, GncOwner *owner, Account *acc);
void gnc_invoice_window_sort (InvoiceWindow *iw, invoice_sort_type_t sort_code);
@ -90,13 +90,13 @@ GtkWidget *gnc_invoice_get_register(InvoiceWindow *iw);
/* definitions for CB functions */
void gnc_invoice_window_destroy_cb (GtkWidget *widget, gpointer data);
void gnc_invoice_window_new_invoice_cb (GtkWidget *widget, gpointer data);
void gnc_invoice_window_printCB (GtkWidget *widget, gpointer data);
void gnc_invoice_window_new_invoice_cb (GtkWindow* parent, gpointer data);
void gnc_invoice_window_printCB (GtkWindow* parent, gpointer data);
void gnc_invoice_window_cut_cb (GtkWidget *widget, gpointer data);
void gnc_invoice_window_copy_cb (GtkWidget *widget, gpointer data);
void gnc_invoice_window_paste_cb (GtkWidget *widget, gpointer data);
void gnc_invoice_window_editCB (GtkWidget *widget, gpointer data);
void gnc_invoice_window_duplicateInvoiceCB (GtkWidget *widget, gpointer data);
void gnc_invoice_window_editCB (GtkWindow* parent, gpointer data);
void gnc_invoice_window_duplicateInvoiceCB (GtkWindow* parent, gpointer data);
void gnc_invoice_window_postCB (GtkWidget *widget, gpointer data);
void gnc_invoice_window_unpostCB (GtkWidget *widget, gpointer data);
void gnc_invoice_window_recordCB (GtkWidget *widget, gpointer data);
@ -104,8 +104,8 @@ void gnc_invoice_window_cancelCB (GtkWidget *widget, gpointer data);
void gnc_invoice_window_deleteCB (GtkWidget *widget, gpointer data);
void gnc_invoice_window_blankCB (GtkWidget *widget, gpointer data);
void gnc_invoice_window_duplicateCB (GtkWidget *widget, gpointer data);
void gnc_invoice_window_payment_cb (GtkWidget *widget, gpointer data);
void gnc_invoice_window_report_owner_cb (GtkWidget *widget, gpointer data);
void gnc_invoice_window_payment_cb (GtkWindow *parent, gpointer data);
void gnc_invoice_window_report_owner_cb (GtkWindow *parent, gpointer data);
void gnc_invoice_window_entryUpCB (GtkWidget *widget, gpointer data);
void gnc_invoice_window_entryDownCB (GtkWidget *widget, gpointer data);

View File

@ -63,10 +63,10 @@ typedef enum
struct _job_select_window
{
QofBook * book;
GncOwner * owner;
QofQuery * q;
GncOwner owner_def;
QofBook *book;
GncOwner *owner;
QofQuery *q;
GncOwner owner_def;
};
struct _job_window
@ -137,7 +137,7 @@ gnc_job_verify_ok (JobWindow *jw)
if (g_strcmp0 (res, "") == 0)
{
const char *message = _("The Job must be given a name.");
gnc_error_dialog(jw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (jw->dialog), "%s", message);
return FALSE;
}
@ -147,7 +147,7 @@ gnc_job_verify_ok (JobWindow *jw)
if (res == NULL || g_strcmp0 (res, "") == 0)
{
const char *message = _("You must choose an owner for this job.");
gnc_error_dialog(jw->dialog, "%s", message);
gnc_error_dialog (GTK_WINDOW (jw->dialog), "%s", message);
return FALSE;
}
@ -302,7 +302,7 @@ find_handler (gpointer find_data, gpointer user_data)
}
static JobWindow *
gnc_job_new_window (QofBook *bookp, GncOwner *owner, GncJob *job)
gnc_job_new_window (GtkWindow *parent, QofBook *bookp, GncOwner *owner, GncJob *job)
{
JobWindow *jw;
GtkBuilder *builder;
@ -321,6 +321,7 @@ gnc_job_new_window (QofBook *bookp, GncOwner *owner, GncJob *job)
find_handler, &job_guid);
if (jw)
{
gtk_window_set_transient_for (GTK_WINDOW(jw->dialog), parent);
gtk_window_present (GTK_WINDOW(jw->dialog));
return(jw);
}
@ -339,6 +340,7 @@ gnc_job_new_window (QofBook *bookp, GncOwner *owner, GncJob *job)
/* Find the dialog */
jw->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "job_dialog"));
gtk_window_set_transient_for (GTK_WINDOW(jw->dialog), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(jw->dialog), "GncJobDialog");
@ -433,17 +435,8 @@ gnc_job_new_window (QofBook *bookp, GncOwner *owner, GncJob *job)
return jw;
}
GncJob *
gnc_ui_job_new_return_handle (GncOwner *owner, QofBook *book)
{
JobWindow *jw;
if (!book) return NULL;
jw = gnc_ui_job_new (owner, book);
return jw_get_job (jw);
}
JobWindow *
gnc_ui_job_new (GncOwner *ownerp, QofBook *bookp)
gnc_ui_job_new (GtkWindow *parent, GncOwner *ownerp, QofBook *bookp)
{
JobWindow *jw;
GncOwner owner;
@ -461,25 +454,25 @@ gnc_ui_job_new (GncOwner *ownerp, QofBook *bookp)
else
gncOwnerInitCustomer (&owner, NULL); /* XXX */
jw = gnc_job_new_window (bookp, &owner, NULL);
jw = gnc_job_new_window (parent, bookp, &owner, NULL);
return jw;
}
JobWindow *
gnc_ui_job_edit (GncJob *job)
gnc_ui_job_edit (GtkWindow *parent, GncJob *job)
{
JobWindow *jw;
if (!job) return NULL;
jw = gnc_job_new_window (gncJobGetBook(job), gncJobGetOwner(job), job);
jw = gnc_job_new_window (parent, gncJobGetBook(job), gncJobGetOwner(job), job);
return jw;
}
/* Search functionality */
static void
edit_job_cb (gpointer *job_p, gpointer user_data)
edit_job_cb (GtkWindow *dialog, gpointer *job_p, gpointer user_data)
{
GncJob *job;
@ -490,11 +483,11 @@ edit_job_cb (gpointer *job_p, gpointer user_data)
if (!job)
return;
gnc_ui_job_edit (job);
gnc_ui_job_edit (dialog, job);
}
static void
invoice_job_cb (gpointer *job_p, gpointer user_data)
invoice_job_cb (GtkWindow *dialog, gpointer *job_p, gpointer user_data)
{
struct _job_select_window * sw = user_data;
GncJob *job;
@ -507,11 +500,11 @@ invoice_job_cb (gpointer *job_p, gpointer user_data)
return;
gncOwnerInitJob (&owner, job);
gnc_invoice_search (NULL, &owner, sw->book);
gnc_invoice_search (dialog, NULL, &owner, sw->book);
}
static void
payment_job_cb (gpointer *job_p, gpointer user_data)
payment_job_cb (GtkWindow *dialog, gpointer *job_p, gpointer user_data)
{
struct _job_select_window *sw = user_data;
GncOwner owner;
@ -525,19 +518,19 @@ payment_job_cb (gpointer *job_p, gpointer user_data)
return;
gncOwnerInitJob (&owner, job);
gnc_ui_payment_new (&owner, sw->book);
gnc_ui_payment_new (dialog, &owner, sw->book);
return;
}
static gpointer
new_job_cb (gpointer user_data)
new_job_cb (GtkWindow *dialog, gpointer user_data)
{
struct _job_select_window *sw = user_data;
JobWindow *jw;
g_return_val_if_fail (user_data, NULL);
jw = gnc_ui_job_new (sw->owner, sw->book);
jw = gnc_ui_job_new (dialog, sw->owner, sw->book);
return jw_get_job (jw);
}
@ -553,7 +546,7 @@ free_userdata_cb (gpointer user_data)
}
GNCSearchWindow *
gnc_job_search (GncJob *start, GncOwner *owner, QofBook *book)
gnc_job_search (GtkWindow *parent, GncJob *start, GncOwner *owner, QofBook *book)
{
QofQuery *q, *q2 = NULL;
QofIdType type = GNC_JOB_MODULE_NAME;
@ -647,7 +640,7 @@ gnc_job_search (GncJob *start, GncOwner *owner, QofBook *book)
sw->book = book;
sw->q = q;
return gnc_search_dialog_create (type, _("Find Job"),
return gnc_search_dialog_create (parent, type, _("Find Job"),
params, columns, q, q2, buttons, NULL,
new_job_cb, sw, free_userdata_cb,
GNC_PREFS_GROUP_SEARCH, NULL,
@ -657,7 +650,7 @@ gnc_job_search (GncJob *start, GncOwner *owner, QofBook *book)
/* Functions for widgets for job selection */
GNCSearchWindow *
gnc_job_search_select (gpointer start, gpointer book)
gnc_job_search_select (GtkWindow *parent, gpointer start, gpointer book)
{
GncJob *j = start;
GncOwner owner, *ownerp;
@ -672,14 +665,14 @@ gnc_job_search_select (gpointer start, gpointer book)
else
gncOwnerInitCustomer (&owner, NULL); /* XXX */
return gnc_job_search (start, &owner, book);
return gnc_job_search (parent, start, &owner, book);
}
GNCSearchWindow *
gnc_job_search_edit (gpointer start, gpointer book)
gnc_job_search_edit (GtkWindow *parent, gpointer start, gpointer book)
{
if (start)
gnc_ui_job_edit (start);
gnc_ui_job_edit (parent, start);
return NULL;
}

View File

@ -32,13 +32,12 @@ typedef struct _job_window JobWindow;
#include "dialog-search.h"
/* Create or Edit a job */
GncJob * gnc_ui_job_new_return_handle (GncOwner *owner, QofBook *book);
JobWindow * gnc_ui_job_edit (GncJob *job);
JobWindow * gnc_ui_job_new (GncOwner *owner, QofBook *book);
JobWindow * gnc_ui_job_edit (GtkWindow *parent, GncJob *job);
JobWindow * gnc_ui_job_new (GtkWindow *parent, GncOwner *owner, QofBook *book);
/* Search for Jobs */
GNCSearchWindow * gnc_job_search (GncJob *start, GncOwner *owner,
QofBook *book);
GNCSearchWindow * gnc_job_search (GtkWindow *parent, GncJob *start,
GncOwner *owner, QofBook *book);
/*
* These callbacks are for use with the gnc_general_search widget
@ -46,7 +45,7 @@ GNCSearchWindow * gnc_job_search (GncJob *start, GncOwner *owner,
* select() provides a Select Dialog and returns it.
* edit() opens the existing customer for editing and returns NULL.
*/
GNCSearchWindow * gnc_job_search_select (gpointer start, gpointer book);
GNCSearchWindow * gnc_job_search_edit (gpointer start, gpointer book);
GNCSearchWindow * gnc_job_search_select (GtkWindow *parent, gpointer start, gpointer book);
GNCSearchWindow * gnc_job_search_edit (GtkWindow *parent, gpointer start, gpointer book);
#endif /* GNC_DIALOG_JOB_H_ */

View File

@ -67,7 +67,7 @@ after_hierarchy_assistant(void)
gnc_set_first_startup (FALSE);
qof_book_mark_session_dirty(gnc_get_current_book());
gnc_ui_file_access_for_save_as();
gnc_ui_file_access_for_save_as (gnc_ui_get_main_window (NULL));
}
void

View File

@ -71,10 +71,10 @@ typedef enum
struct _order_select_window
{
QofBook * book;
GncOwner * owner;
QofQuery * q;
GncOwner owner_def;
QofBook *book;
GncOwner *owner;
QofQuery *q;
GncOwner owner_def;
};
struct _order_window
@ -168,7 +168,7 @@ gnc_order_window_verify_ok (OrderWindow *ow)
res = gtk_entry_get_text (GTK_ENTRY (ow->id_entry));
if (g_strcmp0 (res, "") == 0)
{
gnc_error_dialog (ow->dialog, "%s",
gnc_error_dialog (GTK_WINDOW (ow->dialog), "%s",
_("The Order must be given an ID."));
return FALSE;
}
@ -178,7 +178,7 @@ gnc_order_window_verify_ok (OrderWindow *ow)
res = gncOwnerGetName (&(ow->owner));
if (res == NULL || g_strcmp0 (res, "") == 0)
{
gnc_error_dialog (ow->dialog, "%s",
gnc_error_dialog (GTK_WINDOW (ow->dialog), "%s",
_("You need to supply Billing Information."));
return FALSE;
}
@ -246,7 +246,7 @@ gnc_order_window_invoice_cb (GtkWidget *widget, gpointer data)
return;
/* Ok, go make an invoice */
gnc_invoice_search (NULL, &(ow->owner), ow->book);
gnc_invoice_search (gtk_window_get_transient_for(GTK_WINDOW(ow->dialog)), NULL, &(ow->owner), ow->book);
/* refresh the window */
gnc_order_update_window (ow);
@ -274,7 +274,7 @@ gnc_order_window_close_order_cb (GtkWidget *widget, gpointer data)
/* Check that there is at least one Entry */
if (gncOrderGetEntries (order) == NULL)
{
gnc_error_dialog (ow->dialog, "%s",
gnc_error_dialog (GTK_WINDOW (ow->dialog), "%s",
_("The Order must have at least one Entry."));
return;
}
@ -301,7 +301,7 @@ gnc_order_window_close_order_cb (GtkWidget *widget, gpointer data)
"Are you sure you want to close it out before "
"you invoice all the entries?");
if (gnc_verify_dialog (ow->dialog, FALSE, "%s", message) == FALSE)
if (gnc_verify_dialog (GTK_WINDOW (ow->dialog), FALSE, "%s", message) == FALSE)
return;
}
@ -539,7 +539,7 @@ find_handler (gpointer find_data, gpointer user_data)
}
static OrderWindow *
gnc_order_new_window (QofBook *bookp, OrderDialogType type,
gnc_order_new_window (GtkWindow *parent, QofBook *bookp, OrderDialogType type,
GncOrder *order, GncOwner *owner)
{
OrderWindow *ow;
@ -573,6 +573,7 @@ gnc_order_new_window (QofBook *bookp, OrderDialogType type,
if (ow)
{
gtk_window_present (GTK_WINDOW(ow->dialog));
gtk_window_set_transient_for (GTK_WINDOW(ow->dialog), parent);
return(ow);
}
}
@ -591,6 +592,7 @@ gnc_order_new_window (QofBook *bookp, OrderDialogType type,
builder = gtk_builder_new();
gnc_builder_add_from_file (builder, "dialog-order.glade", "order_entry_dialog");
ow->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "order_entry_dialog"));
gtk_window_set_transient_for (GTK_WINDOW(ow->dialog), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(ow->dialog), "GncOrderDialog");
@ -683,7 +685,7 @@ gnc_order_new_window (QofBook *bookp, OrderDialogType type,
}
static OrderWindow *
gnc_order_window_new_order (QofBook *bookp, GncOwner *owner)
gnc_order_window_new_order (GtkWindow *parent, QofBook *bookp, GncOwner *owner)
{
OrderWindow *ow;
GtkBuilder *builder;
@ -706,6 +708,7 @@ gnc_order_window_new_order (QofBook *bookp, GncOwner *owner)
gnc_builder_add_from_file (builder, "dialog-order.glade", "new_order_dialog");
ow->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "new_order_dialog"));
gtk_window_set_transient_for (GTK_WINDOW(ow->dialog), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(ow->dialog), "GncOrderDialog");
@ -759,7 +762,7 @@ gnc_order_window_new_order (QofBook *bookp, GncOwner *owner)
}
OrderWindow *
gnc_ui_order_edit (GncOrder *order)
gnc_ui_order_edit (GtkWindow *parent, GncOrder *order)
{
OrderWindow *ow;
OrderDialogType type;
@ -773,14 +776,14 @@ gnc_ui_order_edit (GncOrder *order)
type = VIEW_ORDER;
}
ow = gnc_order_new_window (gncOrderGetBook(order), type, order,
ow = gnc_order_new_window (parent, gncOrderGetBook(order), type, order,
gncOrderGetOwner (order));
return ow;
}
OrderWindow *
gnc_ui_order_new (GncOwner *ownerp, QofBook *bookp)
gnc_ui_order_new (GtkWindow *parent, GncOwner *ownerp, QofBook *bookp)
{
OrderWindow *ow;
GncOwner owner;
@ -806,7 +809,7 @@ gnc_ui_order_new (GncOwner *ownerp, QofBook *bookp)
/* Make sure required options exist */
if (!bookp) return NULL;
ow = gnc_order_window_new_order (bookp, &owner);
ow = gnc_order_window_new_order (parent, bookp, &owner);
return ow;
}
@ -814,7 +817,7 @@ gnc_ui_order_new (GncOwner *ownerp, QofBook *bookp)
/* Functions for order selection widgets */
static void
edit_order_cb (gpointer *order_p, gpointer user_data)
edit_order_cb (GtkWindow *dialog, gpointer *order_p, gpointer user_data)
{
GncOrder *order;
@ -823,20 +826,20 @@ edit_order_cb (gpointer *order_p, gpointer user_data)
order = *order_p;
if (order)
gnc_ui_order_edit (order);
gnc_ui_order_edit (dialog, order);
return;
}
static gpointer
new_order_cb (gpointer user_data)
new_order_cb (GtkWindow *dialog, gpointer user_data)
{
struct _order_select_window *sw = user_data;
OrderWindow *ow;
g_return_val_if_fail (user_data, NULL);
ow = gnc_ui_order_new (sw->owner, sw->book);
ow = gnc_ui_order_new (dialog, sw->owner, sw->book);
return ow_get_order (ow);
}
@ -852,7 +855,7 @@ free_order_cb (gpointer user_data)
}
GNCSearchWindow *
gnc_order_search (GncOrder *start, GncOwner *owner, QofBook *book)
gnc_order_search (GtkWindow *parent, GncOrder *start, GncOwner *owner, QofBook *book)
{
QofIdType type = GNC_ORDER_MODULE_NAME;
struct _order_select_window *sw;
@ -950,7 +953,7 @@ gnc_order_search (GncOrder *start, GncOwner *owner, QofBook *book)
sw->book = book;
sw->q = q;
return gnc_search_dialog_create (type, _("Find Order"),
return gnc_search_dialog_create (parent, type, _("Find Order"),
params, columns, q, q2,
buttons, NULL, new_order_cb,
sw, free_order_cb, GNC_PREFS_GROUP_SEARCH,
@ -958,7 +961,7 @@ gnc_order_search (GncOrder *start, GncOwner *owner, QofBook *book)
}
GNCSearchWindow *
gnc_order_search_select (gpointer start, gpointer book)
gnc_order_search_select (GtkWindow *parent, gpointer start, gpointer book)
{
GncOrder *o = start;
GncOwner owner, *ownerp;
@ -973,14 +976,14 @@ gnc_order_search_select (gpointer start, gpointer book)
else
gncOwnerInitCustomer (&owner, NULL); /* XXX */
return gnc_order_search (start, NULL, book);
return gnc_order_search (parent, start, NULL, book);
}
GNCSearchWindow *
gnc_order_search_edit (gpointer start, gpointer book)
gnc_order_search_edit (GtkWindow *parent, gpointer start, gpointer book)
{
if (start)
gnc_ui_order_edit (start);
gnc_ui_order_edit (parent, start);
return NULL;
}

View File

@ -32,11 +32,11 @@ typedef struct _order_window OrderWindow;
#include "dialog-search.h"
/* Create and edit an order */
OrderWindow * gnc_ui_order_edit (GncOrder *order);
OrderWindow * gnc_ui_order_new (GncOwner *owner, QofBook *book);
OrderWindow * gnc_ui_order_edit (GtkWindow *parent, GncOrder *order);
OrderWindow * gnc_ui_order_new (GtkWindow *parent, GncOwner *owner, QofBook *book);
/* Search for orders */
GNCSearchWindow * gnc_order_search (GncOrder *start, GncOwner *owner,
GNCSearchWindow * gnc_order_search (GtkWindow *parent, GncOrder *start, GncOwner *owner,
QofBook *book);
/*
@ -45,7 +45,7 @@ GNCSearchWindow * gnc_order_search (GncOrder *start, GncOwner *owner,
* select() provides a Select Dialog and returns it.
* edit() opens the existing order for editing and returns NULL.
*/
GNCSearchWindow * gnc_order_search_select (gpointer start, gpointer book);
GNCSearchWindow * gnc_order_search_edit (gpointer start, gpointer book);
GNCSearchWindow * gnc_order_search_select (GtkWindow *parent, gpointer start, gpointer book);
GNCSearchWindow * gnc_order_search_edit (GtkWindow *parent, gpointer start, gpointer book);
#endif /* GNC_DIALOG_ORDER_H_ */

View File

@ -954,7 +954,7 @@ gnc_payment_ok_cb (G_GNUC_UNUSED GtkWidget *widget, gpointer data)
text = _("The transfer and post accounts are associated with different currencies. Please specify the conversion rate.");
xfer = gnc_xfer_dialog(pw->dialog, pw->post_acct);
gnc_info_dialog(pw->dialog, "%s", text);
gnc_info_dialog (GTK_WINDOW (pw->dialog), "%s", text);
gnc_xfer_dialog_select_to_account(xfer, pw->xfer_acct);
gnc_xfer_dialog_set_amount(xfer, pw->amount_tot);
@ -1117,7 +1117,7 @@ static void print_date (G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
}
static PaymentWindow *
new_payment_window (GtkWidget *parent, QofBook *book, InitialPaymentInfo *tx_info)
new_payment_window (GtkWindow *parent, QofBook *book, InitialPaymentInfo *tx_info)
{
PaymentWindow *pw;
GtkBuilder *builder;
@ -1154,6 +1154,7 @@ new_payment_window (GtkWidget *parent, QofBook *book, InitialPaymentInfo *tx_inf
gncOwnerCopy (&pw->tx_info->owner, &(pw->owner));
gnc_payment_set_owner_type (pw, gncOwnerGetType(&pw->tx_info->owner));
gtk_window_set_transient_for (GTK_WINDOW(pw->dialog), parent);
gtk_window_present (GTK_WINDOW(pw->dialog));
return(pw);
}
@ -1173,6 +1174,7 @@ new_payment_window (GtkWidget *parent, QofBook *book, InitialPaymentInfo *tx_inf
gnc_builder_add_from_file (builder, "dialog-payment.glade", "owner_type_combo_model");
gnc_builder_add_from_file (builder, "dialog-payment.glade", "payment_dialog");
pw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "payment_dialog"));
gtk_window_set_transient_for (GTK_WINDOW(pw->dialog), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(pw->dialog), "GncPaymentDialog");
@ -1341,7 +1343,7 @@ new_payment_window (GtkWidget *parent, QofBook *book, InitialPaymentInfo *tx_inf
* Let's assert this to protect from potential future changes. */
g_assert (g_list_length (pw->acct_types) == 1);
acct_type = xaccAccountGetTypeStr(GPOINTER_TO_INT(pw->acct_types->data));
gnc_warning_dialog(pw->dialog,
gnc_warning_dialog(GTK_WINDOW (pw->dialog),
_("You have no valid \"Post To\" accounts. "
"Please create an account of type \"%s\" "
"before you continue to process this payment. "
@ -1364,8 +1366,8 @@ gnc_ui_payment_window_destroy (PaymentWindow *pw)
}
PaymentWindow *
gnc_ui_payment_new_with_invoice (const GncOwner *owner, QofBook *book,
GncInvoice *invoice)
gnc_ui_payment_new_with_invoice (GtkWindow *parent, const GncOwner *owner,
QofBook *book, GncInvoice *invoice)
{
GNCLot *postlot;
InitialPaymentInfo *tx_info;
@ -1395,13 +1397,13 @@ gnc_ui_payment_new_with_invoice (const GncOwner *owner, QofBook *book,
lot_info->amount = gnc_numeric_zero ();
tx_info->lots = g_list_prepend (tx_info->lots, lot_info);
}
return new_payment_window (NULL, book, tx_info);
return new_payment_window (parent, book, tx_info);
}
PaymentWindow *
gnc_ui_payment_new (GncOwner *owner, QofBook *book)
gnc_ui_payment_new (GtkWindow *parent, GncOwner *owner, QofBook *book)
{
return gnc_ui_payment_new_with_invoice (owner, book, NULL);
return gnc_ui_payment_new_with_invoice (parent, owner, book, NULL);
}
// ///////////////
@ -1477,7 +1479,7 @@ static char *gen_split_desc (Transaction *txn, Split *split)
return split_str;
}
static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
static Split *select_payment_split (GtkWindow *parent, Transaction *txn)
{
/* We require the txn to have one split in an Asset account.
* The only exception would be a lot link transaction
@ -1490,7 +1492,7 @@ static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
if (xaccTransGetTxnType(txn) == TXN_TYPE_LINK)
return NULL;
dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
dialog = gtk_message_dialog_new (parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
@ -1513,7 +1515,7 @@ static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
"Please select one, the others will be ignored.\n\n");
GtkDialog *dialog = GTK_DIALOG(
gtk_dialog_new_with_buttons (_("Warning"),
GTK_WINDOW(parent),
parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
_("Continue"), GTK_BUTTONS_OK,
_("Cancel"), GTK_BUTTONS_CANCEL,
@ -1569,7 +1571,7 @@ static Split *select_payment_split (GtkWidget *parent, Transaction *txn)
return payment_splits->data;
}
static GList *select_txn_lots (GtkWidget *parent, Transaction *txn, Account **post_acct, gboolean *abort)
static GList *select_txn_lots (GtkWindow *parent, Transaction *txn, Account **post_acct, gboolean *abort)
{
gboolean has_no_lot_apar_splits = FALSE;
SplitList *post_splits = NULL, *no_lot_post_splits = NULL;
@ -1624,7 +1626,7 @@ static GList *select_txn_lots (GtkWidget *parent, Transaction *txn, Account **po
split_str = tmp_str2;
}
dialog = gtk_message_dialog_new (GTK_WINDOW(parent),
dialog = gtk_message_dialog_new (parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
GTK_BUTTONS_CANCEL,
@ -1648,7 +1650,7 @@ static GList *select_txn_lots (GtkWidget *parent, Transaction *txn, Account **po
return txn_lots;
}
PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner, Transaction *txn)
PaymentWindow * gnc_ui_payment_new_with_txn (GtkWindow* parent, GncOwner *owner, Transaction *txn)
{
Split *payment_split = NULL;
Account *post_acct = NULL;
@ -1682,7 +1684,7 @@ PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget* parent, GncOwner *owner,
tx_info->lots = txn_lots;
gncOwnerCopy (owner, &tx_info->owner);
pw = new_payment_window (NULL,
pw = new_payment_window (parent,
qof_instance_get_book(QOF_INSTANCE(txn)),
tx_info);

View File

@ -30,11 +30,12 @@ typedef struct _payment_window PaymentWindow;
#include "gncInvoice.h"
/* Create a payment window */
PaymentWindow * gnc_ui_payment_new (GncOwner *owner, QofBook *book);
PaymentWindow * gnc_ui_payment_new_with_invoice (const GncOwner *owner,
QofBook *book,
GncInvoice *invoice);
PaymentWindow * gnc_ui_payment_new_with_txn (GtkWidget *parent, GncOwner *owner, Transaction *txn);
PaymentWindow * gnc_ui_payment_new (GtkWindow *parent, GncOwner *owner, QofBook *book);
PaymentWindow * gnc_ui_payment_new_with_invoice (GtkWindow *parent,
const GncOwner *owner,
QofBook *book,
GncInvoice *invoice);
PaymentWindow * gnc_ui_payment_new_with_txn (GtkWindow *parent, GncOwner *owner, Transaction *txn);
/** Returns TRUE if the given transaction (to be used with gnc_ui_payment_new_with_txn() )
* is for a customer, or FALSE if it's from a vendor or employee voucher. */

View File

@ -452,7 +452,7 @@ gnc_prices_dialog_remove_old_clicked (GtkWidget *widget, gpointer data)
GList *comm_list = gnc_prices_dialog_get_commodities (pdb_dialog->remove_view);
// Are you sure you want to delete the entries and we have commodities
if ((g_list_length (comm_list) != 0) && (gnc_verify_dialog (pdb_dialog->remove_dialog, FALSE, fmt, NULL)))
if ((g_list_length (comm_list) != 0) && (gnc_verify_dialog (GTK_WINDOW (pdb_dialog->remove_dialog), FALSE, fmt, NULL)))
{
Timespec last_ts;
GDate fiscal_end_date = get_fiscal_end_date ();
@ -550,7 +550,7 @@ gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data)
}
scm_window = SWIG_NewPointerObj(pdb_dialog->dialog,
SWIG_TypeQuery("_p_GtkWidget"), 0);
SWIG_TypeQuery("_p_GtkWindow"), 0);
gnc_set_busy_cursor (NULL, TRUE);
scm_call_2 (quotes_func, scm_window, book_scm);

View File

@ -279,7 +279,7 @@ pedit_dialog_response_cb (GtkDialog *dialog, gint response, gpointer data)
error_str = gui_to_price (pedit_dialog);
if (error_str)
{
gnc_warning_dialog (pedit_dialog->dialog, "%s", error_str);
gnc_warning_dialog (GTK_WINDOW (pedit_dialog->dialog), "%s", error_str);
return;
}

View File

@ -200,7 +200,7 @@ sxed_confirmed_cancel(GncSxEditorDialog *sxed)
const char *sx_changed_msg =
_( "This Scheduled Transaction has changed; are you "
"sure you want to cancel?" );
if (!gnc_verify_dialog(sxed->dialog, FALSE, "%s", sx_changed_msg))
if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE, "%s", sx_changed_msg))
{
return FALSE;
}
@ -490,7 +490,7 @@ gnc_sxed_check_names (GncSxEditorDialog *sxed)
{
const char *sx_has_no_name_msg =
_( "Please name the Scheduled Transaction." );
gnc_error_dialog( sxed->dialog, "%s", sx_has_no_name_msg );
gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s", sx_has_no_name_msg );
g_free( name );
return FALSE;
@ -517,7 +517,7 @@ gnc_sxed_check_names (GncSxEditorDialog *sxed)
const char *sx_has_existing_name_msg =
_("A Scheduled Transaction with the name \"%s\" already exists. "
"Are you sure you want to name this one the same?");
if (!gnc_verify_dialog (sxed->dialog, FALSE,
if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE,
sx_has_existing_name_msg, name))
{
g_free (name);
@ -540,7 +540,7 @@ gnc_sxed_check_endpoint (GncSxEditorDialog *sxed)
{
const char *sx_end_spec_msg =
_("Please provide a valid end selection.");
gnc_error_dialog (sxed->dialog, "%s", sx_end_spec_msg);
gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s", sx_end_spec_msg);
return FALSE;
}
@ -555,7 +555,7 @@ gnc_sxed_check_endpoint (GncSxEditorDialog *sxed)
{
const char *sx_occur_count_zero_msg =
_("There must be some number of occurrences.");
gnc_error_dialog (sxed->dialog, "%s", sx_occur_count_zero_msg);
gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s", sx_occur_count_zero_msg);
return FALSE;
}
@ -564,7 +564,7 @@ gnc_sxed_check_endpoint (GncSxEditorDialog *sxed)
const char *sx_occur_counts_wrong_msg =
_("The number of remaining occurrences (%d) is greater than "
"the number of total occurrences (%d).");
gnc_error_dialog (sxed->dialog, sx_occur_counts_wrong_msg,
gnc_error_dialog (GTK_WINDOW (sxed->dialog), sx_occur_counts_wrong_msg,
rem, occur);
return FALSE;
}
@ -593,7 +593,7 @@ gnc_sxed_check_endpoint (GncSxEditorDialog *sxed)
const char *invalid_sx_check_msg =
_("You have attempted to create a Scheduled Transaction which "
"will never run. Do you really want to do this?");
if (!gnc_verify_dialog(sxed->dialog, FALSE,
if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE,
"%s", invalid_sx_check_msg))
return FALSE;
}
@ -612,7 +612,7 @@ gnc_sxed_check_autocreate (GncSxEditorDialog *sxed, int ttVarCount,
if (((ttVarCount > 0) || multi_commodity) && autocreateState)
{
gnc_warning_dialog(sxed->dialog, "%s",
gnc_warning_dialog(GTK_WINDOW (sxed->dialog), "%s",
_("Scheduled Transactions with variables "
"or involving more than one commodity "
"cannot be automatically created."));
@ -623,7 +623,7 @@ gnc_sxed_check_autocreate (GncSxEditorDialog *sxed, int ttVarCount,
* only valid if there's actually a transaction to create. */
if (autocreateState && splitCount == 0)
{
gnc_warning_dialog(sxed->dialog, "%s",
gnc_warning_dialog(GTK_WINDOW (sxed->dialog), "%s",
_("Scheduled Transactions without a template "
"transaction cannot be automatically created.") );
return FALSE;
@ -672,7 +672,7 @@ gnc_sxed_split_calculate_formula (GncSxEditorDialog *sxed, Split *s,
{
gchar *err = g_strdup_printf (_("Couldn't parse %s for split \"%s\"."),
key, xaccSplitGetMemo (s));
gnc_error_dialog (GTK_WIDGET(sxed->dialog), "%s", err);
gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s", err);
g_free (err);
return FALSE;
@ -870,7 +870,7 @@ gnc_sxed_check_consistent( GncSxEditorDialog *sxed )
const char *msg =
_("The Scheduled Transaction Editor cannot automatically "
"balance this transaction. Should it still be entered?");
if (!gnc_verify_dialog (sxed->dialog, FALSE, "%s", msg))
if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE, "%s", msg))
return FALSE;
}
@ -1557,7 +1557,7 @@ gnc_sxed_reg_check_close(GncSxEditorDialog *sxed)
return;
}
if (gnc_verify_dialog(sxed->dialog, TRUE, "%s", message))
if (gnc_verify_dialog (GTK_WINDOW (sxed->dialog), TRUE, "%s", message))
{
if ( !gnc_split_register_save( reg, TRUE ) )
return;

View File

@ -198,7 +198,7 @@ sxed_confirmed_cancel (GncSxEditorDialog2 *sxed)
const char *sx_changed_msg =
_( "This Scheduled Transaction has changed; are you "
"sure you want to cancel?" );
if (!gnc_verify_dialog (sxed->dialog, FALSE, "%s", sx_changed_msg))
if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE, "%s", sx_changed_msg))
{
return FALSE;
}
@ -636,7 +636,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
_( "Couldn't parse credit formula for "
"split \"%s\"." ),
xaccSplitGetMemo( s ) );
gnc_error_dialog( GTK_WIDGET(sxed->dialog), "%s",
gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s",
errStr->str );
g_string_free( errStr, TRUE );
@ -658,7 +658,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
_( "Couldn't parse debit formula for "
"split \"%s\"." ),
xaccSplitGetMemo( s ) );
gnc_error_dialog( GTK_WIDGET(sxed->dialog), "%s",
gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s",
(gchar*)errStr->str );
g_string_free( errStr, TRUE );
@ -686,7 +686,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
g_hash_table_destroy (txns);
if (unbalanceable
&& !gnc_verify_dialog (sxed->dialog, FALSE,
&& !gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE,
"%s",
_("The Scheduled Transaction Editor "
"cannot automatically balance "
@ -710,7 +710,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
{
const char *sx_has_no_name_msg =
_("Please name the Scheduled Transaction.");
gnc_error_dialog (sxed->dialog, "%s", sx_has_no_name_msg);
gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s", sx_has_no_name_msg);
g_free (name);
return FALSE;
@ -740,7 +740,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
"name \"%s\" already exists. "
"Are you sure you want to name "
"this one the same?");
if (!gnc_verify_dialog (sxed->dialog, FALSE,
if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE,
sx_has_existing_name_msg,
name))
{
@ -763,7 +763,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
if (((ttVarCount > 0) || multi_commodity) && autocreateState)
{
gnc_warning_dialog (sxed->dialog, "%s",
gnc_warning_dialog (GTK_WINDOW (sxed->dialog), "%s",
_("Scheduled Transactions with variables "
"cannot be automatically created."));
return FALSE;
@ -773,7 +773,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
* only valid if there's actually a transaction to create. */
if (autocreateState && splitCount == 0)
{
gnc_warning_dialog (sxed->dialog, "%s",
gnc_warning_dialog (GTK_WINDOW (sxed->dialog), "%s",
_("Scheduled Transactions without a template "
"transaction cannot be automatically created."));
return FALSE;
@ -790,7 +790,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
{
const char *sx_end_spec_msg =
_("Please provide a valid end selection.");
gnc_error_dialog (sxed->dialog, "%s", sx_end_spec_msg);
gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s", sx_end_spec_msg);
return FALSE;
}
@ -808,7 +808,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
{
const char *sx_occur_count_zero_msg =
_("There must be some number of occurrences.");
gnc_error_dialog (sxed->dialog, "%s",
gnc_error_dialog (GTK_WINDOW (sxed->dialog), "%s",
sx_occur_count_zero_msg);
return FALSE;
}
@ -819,7 +819,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
_("The number of remaining occurrences "
"(%d) is greater than the number of "
"total occurrences (%d).");
gnc_error_dialog (sxed->dialog,
gnc_error_dialog (GTK_WINDOW (sxed->dialog),
sx_occur_counts_wrong_msg,
rem, occur);
return FALSE;
@ -851,7 +851,7 @@ gnc_sxed_check_consistent (GncSxEditorDialog2 *sxed)
_("You have attempted to create a Scheduled "
"Transaction which will never run. Do you "
"really want to do this?");
if (!gnc_verify_dialog (sxed->dialog, FALSE,
if (!gnc_verify_dialog (GTK_WINDOW (sxed->dialog), FALSE,
"%s", invalid_sx_check_msg))
return FALSE;
}
@ -1521,7 +1521,7 @@ gnc_sxed_reg_check_close (GncSxEditorDialog2 *sxed)
if (dirty_trans == NULL)
return;
if (gnc_verify_dialog (sxed->dialog, TRUE, "%s", message))
if (gnc_verify_dialog (GTK_WINDOW (sxed->dialog), TRUE, "%s", message))
{
/* Save the template transactions changes */
xaccTransCommitEdit (dirty_trans);

View File

@ -256,7 +256,7 @@ sxftd_add_template_trans(SXFromTransInfo *sxfti)
}
if ( ! gnc_numeric_zero_p( runningBalance )
&& !gnc_verify_dialog( (GtkWidget *)sxfti->dialog,
&& !gnc_verify_dialog (GTK_WINDOW (sxfti->dialog),
FALSE, "%s",
_("The Scheduled Transaction Editor "
"cannot automatically balance "
@ -553,7 +553,7 @@ sxftd_ok_clicked(SXFromTransInfo *sxfti)
{
if ( sx_error == SXFTD_ERRNO_UNBALANCED_XACTION )
{
gnc_error_dialog( gnc_ui_get_toplevel(), "%s",
gnc_error_dialog (GTK_WINDOW (sxfti->dialog), "%s",
_( "The Scheduled Transaction is unbalanced. "
"You are strongly encouraged to correct this situation." ) );
}
@ -781,7 +781,7 @@ gnc_sx_create_from_trans( Transaction *trans )
{
if ( errno == SXFTD_ERRNO_OPEN_XACTION )
{
gnc_error_dialog( gnc_ui_get_toplevel(), "%s",
gnc_error_dialog (NULL, "%s",
_( "Cannot create a Scheduled Transaction "
"from a Transaction currently "
"being edited. Please Enter the "

View File

@ -41,6 +41,7 @@
#include "dialog-sx-since-last-run.h"
#include "gnc-prefs.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "Query.h"
#include "qof.h"
@ -847,7 +848,7 @@ gnc_sx_sxsincelast_book_opened(void)
if (summary.need_dialog)
{
gnc_ui_sx_since_last_run_dialog(inst_model, auto_created_txns);
gnc_ui_sx_since_last_run_dialog (gnc_ui_get_main_window (NULL), inst_model, auto_created_txns);
auto_created_txns = NULL;
}
else
@ -858,7 +859,7 @@ gnc_sx_sxsincelast_book_opened(void)
return;
gnc_info_dialog
(NULL,
(gnc_ui_get_main_window (NULL),
ngettext
("There are no Scheduled Transactions to be entered at this time. "
"(One transaction automatically created)",
@ -959,7 +960,7 @@ variable_value_changed_cb(GtkCellRendererText *cell,
}
GncSxSinceLastRunDialog*
gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances, GList *auto_created_txn_guids)
gnc_ui_sx_since_last_run_dialog (GtkWindow *parent, GncSxInstanceModel *sx_instances, GList *auto_created_txn_guids)
{
GncSxSinceLastRunDialog *dialog;
GtkBuilder *builder;
@ -970,6 +971,7 @@ gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances, GList *auto_cr
gnc_builder_add_from_file (builder, "dialog-sx.glade", "since_last_run_dialog");
dialog->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "since_last_run_dialog"));
gtk_window_set_transient_for (GTK_WINDOW (dialog->dialog), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(dialog->dialog), "GncSxSinceLastRunDialog");

View File

@ -47,7 +47,7 @@ void gnc_sx_sxsincelast_book_opened(void);
/**
* Create the since-last-run dialog.
**/
GncSxSinceLastRunDialog* gnc_ui_sx_since_last_run_dialog(GncSxInstanceModel *sx_instances,
GncSxSinceLastRunDialog* gnc_ui_sx_since_last_run_dialog (GtkWindow *parent, GncSxInstanceModel *sx_instances,
GList *auto_created_txn_guids);
#endif

View File

@ -272,7 +272,8 @@ row_selected_cb (GtkTreeView *view, GtkTreePath *path,
g_free (uri_scheme);
}
else
gnc_error_dialog (NULL, "%s", _("This transaction is not associated with a valid URI."));
gnc_error_dialog (gnc_ui_get_gtk_window(GTK_WIDGET (view)),
"%s", _("This transaction is not associated with a valid URI."));
}
// Open transaction

View File

@ -70,8 +70,8 @@ typedef enum
struct _vendor_select_window
{
QofBook * book;
QofQuery * q;
QofBook *book;
QofQuery *q;
};
struct _vendor_window
@ -190,14 +190,14 @@ static void gnc_ui_to_vendor (VendorWindow *vw, GncVendor *vendor)
gnc_resume_gui_refresh ();
}
static gboolean check_entry_nonempty (GtkWidget *dialog, GtkWidget *entry,
static gboolean check_entry_nonempty (GtkWidget *entry,
const char * error_message)
{
const char *res = gtk_entry_get_text (GTK_ENTRY (entry));
if (g_strcmp0 (res, "") == 0)
{
if (error_message)
gnc_error_dialog (dialog, "%s", error_message);
gnc_error_dialog (gnc_ui_get_gtk_window (entry), "%s", error_message);
return TRUE;
}
return FALSE;
@ -210,7 +210,7 @@ gnc_vendor_window_ok_cb (GtkWidget *widget, gpointer data)
gchar *string;
/* Check for valid company name */
if (check_entry_nonempty (vw->dialog, vw->company_entry,
if (check_entry_nonempty (vw->company_entry,
_("You must enter a company name. "
"If this vendor is an individual (and not a company) "
"you should enter the same value for:\nIdentification "
@ -218,13 +218,13 @@ gnc_vendor_window_ok_cb (GtkWidget *widget, gpointer data)
return;
/* Make sure we have an address */
if (check_entry_nonempty (vw->dialog, vw->addr1_entry, NULL) &&
check_entry_nonempty (vw->dialog, vw->addr2_entry, NULL) &&
check_entry_nonempty (vw->dialog, vw->addr3_entry, NULL) &&
check_entry_nonempty (vw->dialog, vw->addr4_entry, NULL))
if (check_entry_nonempty (vw->addr1_entry, NULL) &&
check_entry_nonempty (vw->addr2_entry, NULL) &&
check_entry_nonempty (vw->addr3_entry, NULL) &&
check_entry_nonempty (vw->addr4_entry, NULL))
{
const char *msg = _("You must enter a payment address.");
gnc_error_dialog (vw->dialog, "%s", msg);
gnc_error_dialog (gnc_ui_get_gtk_window (widget), "%s", msg);
return;
}
@ -395,7 +395,7 @@ find_handler (gpointer find_data, gpointer user_data)
}
static VendorWindow *
gnc_vendor_new_window (QofBook *bookp, GncVendor *vendor)
gnc_vendor_new_window (GtkWindow *parent, QofBook *bookp, GncVendor *vendor)
{
VendorWindow *vw;
GtkBuilder *builder;
@ -415,6 +415,7 @@ gnc_vendor_new_window (QofBook *bookp, GncVendor *vendor)
find_handler, &vendor_guid);
if (vw)
{
gtk_window_set_transient_for (GTK_WINDOW(vw->dialog), parent);
gtk_window_present (GTK_WINDOW(vw->dialog));
return(vw);
}
@ -440,6 +441,7 @@ gnc_vendor_new_window (QofBook *bookp, GncVendor *vendor)
gnc_builder_add_from_file (builder, "dialog-vendor.glade", "taxtable_store");
gnc_builder_add_from_file (builder, "dialog-vendor.glade", "vendor_dialog");
vw->dialog = GTK_WIDGET (gtk_builder_get_object (builder, "vendor_dialog"));
gtk_window_set_transient_for (GTK_WINDOW(vw->dialog), parent);
// Set the style context for this dialog so it can be easily manipulated with css
gnc_widget_set_style_context (GTK_WIDGET(vw->dialog), "GncVendorDialog");
@ -559,25 +561,25 @@ gnc_vendor_new_window (QofBook *bookp, GncVendor *vendor)
}
VendorWindow *
gnc_ui_vendor_new (QofBook *bookp)
gnc_ui_vendor_new (GtkWindow *parent, QofBook *bookp)
{
VendorWindow *vw;
/* Make sure required options exist */
if (!bookp) return NULL;
vw = gnc_vendor_new_window (bookp, NULL);
vw = gnc_vendor_new_window (parent, bookp, NULL);
return vw;
}
VendorWindow *
gnc_ui_vendor_edit (GncVendor *vendor)
gnc_ui_vendor_edit (GtkWindow *parent, GncVendor *vendor)
{
VendorWindow *vw;
if (!vendor) return NULL;
vw = gnc_vendor_new_window (gncVendorGetBook(vendor), vendor);
vw = gnc_vendor_new_window (parent, gncVendorGetBook(vendor), vendor);
return vw;
}
@ -585,7 +587,7 @@ gnc_ui_vendor_edit (GncVendor *vendor)
/* Functions for vendor selection widgets */
static void
invoice_vendor_cb (gpointer *vendor_p, gpointer user_data)
invoice_vendor_cb (GtkWindow *dialog, gpointer *vendor_p, gpointer user_data)
{
struct _vendor_select_window *sw = user_data;
GncOwner owner;
@ -599,12 +601,12 @@ invoice_vendor_cb (gpointer *vendor_p, gpointer user_data)
return;
gncOwnerInitVendor (&owner, vendor);
gnc_invoice_search (NULL, &owner, sw->book);
gnc_invoice_search (dialog, NULL, &owner, sw->book);
return;
}
static void
order_vendor_cb (gpointer *vendor_p, gpointer user_data)
order_vendor_cb (GtkWindow *dialog, gpointer *vendor_p, gpointer user_data)
{
struct _vendor_select_window *sw = user_data;
GncOwner owner;
@ -618,12 +620,12 @@ order_vendor_cb (gpointer *vendor_p, gpointer user_data)
return;
gncOwnerInitVendor (&owner, vendor);
gnc_order_search (NULL, &owner, sw->book);
gnc_order_search (dialog, NULL, &owner, sw->book);
return;
}
static void
jobs_vendor_cb (gpointer *vendor_p, gpointer user_data)
jobs_vendor_cb (GtkWindow *dialog, gpointer *vendor_p, gpointer user_data)
{
struct _vendor_select_window *sw = user_data;
GncOwner owner;
@ -637,12 +639,12 @@ jobs_vendor_cb (gpointer *vendor_p, gpointer user_data)
return;
gncOwnerInitVendor (&owner, vendor);
gnc_job_search (NULL, &owner, sw->book);
gnc_job_search (dialog, NULL, &owner, sw->book);
return;
}
static void
payment_vendor_cb (gpointer *vendor_p, gpointer user_data)
payment_vendor_cb (GtkWindow *dialog, gpointer *vendor_p, gpointer user_data)
{
struct _vendor_select_window *sw = user_data;
GncOwner owner;
@ -656,12 +658,12 @@ payment_vendor_cb (gpointer *vendor_p, gpointer user_data)
return;
gncOwnerInitVendor (&owner, vendor);
gnc_ui_payment_new (&owner, sw->book);
gnc_ui_payment_new (dialog, &owner, sw->book);
return;
}
static void
edit_vendor_cb (gpointer *vendor_p, gpointer user_data)
edit_vendor_cb (GtkWindow *dialog, gpointer *vendor_p, gpointer user_data)
{
GncVendor *vendor;
@ -672,19 +674,19 @@ edit_vendor_cb (gpointer *vendor_p, gpointer user_data)
if (!vendor)
return;
gnc_ui_vendor_edit (vendor);
gnc_ui_vendor_edit (dialog, vendor);
return;
}
static gpointer
new_vendor_cb (gpointer user_data)
new_vendor_cb (GtkWindow *dialog, gpointer user_data)
{
struct _vendor_select_window *sw = user_data;
VendorWindow *vw;
g_return_val_if_fail (user_data, NULL);
vw = gnc_ui_vendor_new (sw->book);
vw = gnc_ui_vendor_new (dialog, sw->book);
return vw_get_vendor (vw);
}
@ -699,7 +701,7 @@ free_vendor_cb (gpointer user_data)
}
GNCSearchWindow *
gnc_vendor_search (GncVendor *start, QofBook *book)
gnc_vendor_search (GtkWindow *parent, GncVendor *start, QofBook *book)
{
QofIdType type = GNC_VENDOR_MODULE_NAME;
struct _vendor_select_window *sw;
@ -759,7 +761,7 @@ gnc_vendor_search (GncVendor *start, QofBook *book)
sw->book = book;
sw->q = q;
return gnc_search_dialog_create (type, _("Find Vendor"),
return gnc_search_dialog_create (parent, type, _("Find Vendor"),
params, columns, q, q2, buttons, NULL,
new_vendor_cb, sw, free_vendor_cb,
GNC_PREFS_GROUP_SEARCH, NULL,
@ -767,18 +769,18 @@ gnc_vendor_search (GncVendor *start, QofBook *book)
}
GNCSearchWindow *
gnc_vendor_search_select (gpointer start, gpointer book)
gnc_vendor_search_select (GtkWindow *parent, gpointer start, gpointer book)
{
if (!book) return NULL;
return gnc_vendor_search (start, book);
return gnc_vendor_search (parent, start, book);
}
GNCSearchWindow *
gnc_vendor_search_edit (gpointer start, gpointer book)
gnc_vendor_search_edit (GtkWindow *parent, gpointer start, gpointer book)
{
if (start)
gnc_ui_vendor_edit (start);
gnc_ui_vendor_edit (parent, start);
return NULL;
}

View File

@ -31,11 +31,11 @@ typedef struct _vendor_window VendorWindow;
#include "dialog-search.h"
/* Create or Edit Vendors */
VendorWindow * gnc_ui_vendor_edit (GncVendor *vendor);
VendorWindow * gnc_ui_vendor_new (QofBook *book);
VendorWindow * gnc_ui_vendor_edit (GtkWindow *parent, GncVendor *vendor);
VendorWindow * gnc_ui_vendor_new (GtkWindow *parent, QofBook *book);
/* Search for vendors */
GNCSearchWindow * gnc_vendor_search (GncVendor *start, QofBook *book);
GNCSearchWindow * gnc_vendor_search (GtkWindow *parent, GncVendor *start, QofBook *book);
/*
* These callbacks are for use with the gnc_general_search widget
@ -43,7 +43,7 @@ GNCSearchWindow * gnc_vendor_search (GncVendor *start, QofBook *book);
* select() provides a Select Dialog and returns it.
* edit() opens the existing vendor for editing and returns NULL.
*/
GNCSearchWindow * gnc_vendor_search_select (gpointer start, gpointer book);
GNCSearchWindow * gnc_vendor_search_edit (gpointer start, gpointer book);
GNCSearchWindow * gnc_vendor_search_select (GtkWindow *parent, gpointer start, gpointer book);
GNCSearchWindow * gnc_vendor_search_edit (GtkWindow *parent, gpointer start, gpointer book);
#endif /* GNC_DIALOG_VENDOR_H_ */

View File

@ -422,7 +422,7 @@ gnc_plugin_basic_commands_class_init (GncPluginBasicCommandsClass *klass)
/** Initialize a new instance of a basic commands plugin. This
* function currently does nothing.
*
* @param page The new object instance created by the object
* @param plugin The new object instance created by the object
* system. */
static void
gnc_plugin_basic_commands_init (GncPluginBasicCommands *plugin)
@ -456,7 +456,7 @@ gnc_main_window_cmd_file_new (GtkAction *action, GncMainWindowActionData *data)
if (!gnc_main_window_all_finish_pending())
return;
gnc_file_new ();
gnc_file_new (GTK_WINDOW (data->window));
}
static void
@ -469,9 +469,9 @@ gnc_main_window_cmd_file_open (GtkAction *action, GncMainWindowActionData *data)
gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
#ifdef HAVE_DBI_DBI_H
gnc_ui_file_access_for_open();
gnc_ui_file_access_for_open (GTK_WINDOW (data->window));
#else
gnc_file_open ();
gnc_file_open (GTK_WINDOW (data->window));
#endif
gnc_window_set_progressbar_window (NULL);
}
@ -485,7 +485,7 @@ gnc_main_window_cmd_file_save (GtkAction *action, GncMainWindowActionData *data)
return;
gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
gnc_file_save ();
gnc_file_save (GTK_WINDOW (data->window));
gnc_window_set_progressbar_window (NULL);
}
@ -499,9 +499,9 @@ gnc_main_window_cmd_file_save_as (GtkAction *action, GncMainWindowActionData *da
gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
#ifdef HAVE_DBI_DBI_H
gnc_ui_file_access_for_save_as();
gnc_ui_file_access_for_save_as (GTK_WINDOW (data->window));
#else
gnc_file_save_as ();
gnc_file_save_as (GTK_WINDOW (data->window));
#endif
gnc_window_set_progressbar_window (NULL);
}
@ -515,7 +515,7 @@ gnc_main_window_cmd_file_revert (GtkAction *action, GncMainWindowActionData *dat
return;
gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
gnc_file_revert();
gnc_file_revert(GTK_WINDOW (data->window));
gnc_window_set_progressbar_window (NULL);
}
@ -526,7 +526,7 @@ gnc_main_window_cmd_file_export_accounts (GtkAction *action, GncMainWindowAction
gnc_window_set_progressbar_window (GNC_WINDOW(data->window));
#ifdef HAVE_DBI_DBI_H
gnc_ui_file_access_for_export();
gnc_ui_file_access_for_export (GTK_WINDOW (data->window));
#else
gnc_file_export ();
#endif
@ -551,7 +551,7 @@ gnc_main_window_cmd_actions_scheduled_transaction_editor (GtkAction *action, Gnc
static void
gnc_main_window_cmd_actions_since_last_run (GtkAction *action, GncMainWindowActionData *data)
{
GncMainWindow *window;
GtkWindow *window;
GncSxInstanceModel *sx_instances;
GncSxSummary summary;
GList *auto_created_txns = NULL;
@ -560,7 +560,7 @@ gnc_main_window_cmd_actions_since_last_run (GtkAction *action, GncMainWindowActi
g_return_if_fail (data != NULL);
window = data->window;
window = GTK_WINDOW (data->window);
if (qof_book_is_readonly(gnc_get_current_book()))
{
@ -573,18 +573,18 @@ gnc_main_window_cmd_actions_since_last_run (GtkAction *action, GncMainWindowActi
gnc_sx_instance_model_effect_change(sx_instances, TRUE, &auto_created_txns, NULL);
if (summary.need_dialog)
{
gnc_ui_sx_since_last_run_dialog(sx_instances, auto_created_txns);
gnc_ui_sx_since_last_run_dialog (window, sx_instances, auto_created_txns);
auto_created_txns = NULL;
}
else
{
if (summary.num_auto_create_no_notify_instances == 0)
{
gnc_info_dialog(GTK_WIDGET(&window->gtk_window), "%s", nothing_to_do_msg);
gnc_info_dialog (window, "%s", nothing_to_do_msg);
}
else
{
gnc_info_dialog(GTK_WIDGET(&window->gtk_window), ngettext
gnc_info_dialog(window, ngettext
/* Translators: %d is the number of transactions. This is a
ngettext(3) message. */
("There are no Scheduled Transactions to be entered at this time. "

View File

@ -471,7 +471,7 @@ gnc_plugin_business_cmd_customer_new_customer (GtkAction *action,
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
gnc_ui_customer_new (gnc_get_current_book());
gnc_ui_customer_new (GTK_WINDOW (mw->window), gnc_get_current_book ());
}
static void
@ -488,7 +488,7 @@ gnc_plugin_business_cmd_customer_find_customer (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
customer = gncOwnerGetCustomer (priv->last_customer);
gnc_customer_search (customer, gnc_get_current_book());
gnc_customer_search (GTK_WINDOW (mw->window), customer, gnc_get_current_book ());
}
static void
@ -504,7 +504,7 @@ gnc_plugin_business_cmd_customer_new_invoice (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
last_window = mw->window;
gnc_ui_invoice_new (priv->last_customer, gnc_get_current_book());
gnc_ui_invoice_new (GTK_WINDOW (mw->window), priv->last_customer, gnc_get_current_book ());
}
static void
@ -520,7 +520,7 @@ gnc_plugin_business_cmd_customer_find_invoice (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
last_window = mw->window;
gnc_invoice_search (NULL, priv->last_customer, gnc_get_current_book());
gnc_invoice_search (GTK_WINDOW (mw->window), NULL, priv->last_customer, gnc_get_current_book ());
}
static void
@ -535,7 +535,7 @@ gnc_plugin_business_cmd_customer_new_job (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
gnc_ui_job_new (priv->last_customer, gnc_get_current_book());
gnc_ui_job_new (GTK_WINDOW (mw->window), priv->last_customer, gnc_get_current_book ());
}
static void
@ -550,7 +550,7 @@ gnc_plugin_business_cmd_customer_find_job (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
gnc_job_search (NULL, priv->last_customer, gnc_get_current_book());
gnc_job_search (GTK_WINDOW (mw->window), NULL, priv->last_customer, gnc_get_current_book ());
}
static void
@ -565,7 +565,7 @@ gnc_plugin_business_cmd_customer_process_payment (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
gnc_ui_payment_new (priv->last_customer, gnc_get_current_book());
gnc_ui_payment_new (GTK_WINDOW (mw->window), priv->last_customer, gnc_get_current_book ());
}
static void
@ -588,7 +588,7 @@ gnc_plugin_business_cmd_vendor_new_vendor (GtkAction *action,
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
gnc_ui_vendor_new (gnc_get_current_book());
gnc_ui_vendor_new (GTK_WINDOW (mw->window), gnc_get_current_book ());
}
static void
@ -605,7 +605,7 @@ gnc_plugin_business_cmd_vendor_find_vendor (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
vendor = gncOwnerGetVendor (priv->last_vendor);
gnc_vendor_search (vendor, gnc_get_current_book());
gnc_vendor_search (GTK_WINDOW (mw->window), vendor, gnc_get_current_book ());
}
static void
@ -621,7 +621,7 @@ gnc_plugin_business_cmd_vendor_new_bill (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
last_window = mw->window;
gnc_ui_invoice_new (priv->last_vendor, gnc_get_current_book());
gnc_ui_invoice_new (GTK_WINDOW (mw->window), priv->last_vendor, gnc_get_current_book ());
}
static void
@ -637,7 +637,7 @@ gnc_plugin_business_cmd_vendor_find_bill (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
last_window = mw->window;
gnc_invoice_search (NULL, priv->last_vendor, gnc_get_current_book());
gnc_invoice_search (GTK_WINDOW (mw->window), NULL, priv->last_vendor, gnc_get_current_book ());
}
static void
@ -652,7 +652,7 @@ gnc_plugin_business_cmd_vendor_new_job (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
gnc_ui_job_new (priv->last_vendor, gnc_get_current_book());
gnc_ui_job_new (GTK_WINDOW (mw->window), priv->last_vendor, gnc_get_current_book ());
}
static void
@ -667,7 +667,7 @@ gnc_plugin_business_cmd_vendor_find_job (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
gnc_job_search (NULL, priv->last_vendor, gnc_get_current_book());
gnc_job_search (GTK_WINDOW (mw->window), NULL, priv->last_vendor, gnc_get_current_book ());
}
static void
@ -682,7 +682,7 @@ gnc_plugin_business_cmd_vendor_process_payment (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
gnc_ui_payment_new (priv->last_vendor, gnc_get_current_book());
gnc_ui_payment_new (GTK_WINDOW (mw->window), priv->last_vendor, gnc_get_current_book ());
}
static void
@ -705,7 +705,7 @@ gnc_plugin_business_cmd_employee_new_employee (GtkAction *action,
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
gnc_ui_employee_new (gnc_get_current_book());
gnc_ui_employee_new (GTK_WINDOW (mw->window), gnc_get_current_book ());
}
static void
@ -722,7 +722,7 @@ gnc_plugin_business_cmd_employee_find_employee (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
employee = gncOwnerGetEmployee (priv->last_employee);
gnc_employee_search (employee, gnc_get_current_book());
gnc_employee_search (GTK_WINDOW (mw->window), employee, gnc_get_current_book ());
}
static void
@ -738,7 +738,7 @@ gnc_plugin_business_cmd_employee_new_expense_voucher (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
last_window = mw->window;
gnc_ui_invoice_new (priv->last_employee, gnc_get_current_book());
gnc_ui_invoice_new (GTK_WINDOW (mw->window), priv->last_employee, gnc_get_current_book ());
}
static void
@ -754,7 +754,7 @@ gnc_plugin_business_cmd_employee_find_expense_voucher (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
last_window = mw->window;
gnc_invoice_search (NULL, priv->last_employee, gnc_get_current_book());
gnc_invoice_search (GTK_WINDOW (mw->window), NULL, priv->last_employee, gnc_get_current_book ());
}
static void
@ -769,7 +769,7 @@ gnc_plugin_business_cmd_employee_process_payment (GtkAction *action,
plugin = GNC_PLUGIN_BUSINESS (mw->data);
priv = GNC_PLUGIN_BUSINESS_GET_PRIVATE (plugin);
gnc_ui_payment_new (priv->last_employee, gnc_get_current_book());
gnc_ui_payment_new (GTK_WINDOW (mw->window), priv->last_employee, gnc_get_current_book ());
}
static void
@ -800,7 +800,7 @@ gnc_plugin_business_cmd_bills_due_reminder (GtkAction *action,
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
gnc_invoice_remind_bills_due();
gnc_invoice_remind_bills_due (GTK_WINDOW (mw->window));
}
@ -811,7 +811,7 @@ gnc_plugin_business_cmd_invoices_due_reminder (GtkAction *action,
g_return_if_fail (mw != NULL);
g_return_if_fail (GNC_IS_PLUGIN_BUSINESS (mw->data));
gnc_invoice_remind_invoices_due();
gnc_invoice_remind_invoices_due (GTK_WINDOW (mw->window));
}
static void
@ -821,7 +821,7 @@ gnc_plugin_business_cmd_test_search (GtkAction *action,
gnc_search_dialog_test();
}
static void gnc_business_assign_payment (GtkWidget *parent,
static void gnc_business_assign_payment (GtkWindow *parent,
Transaction *trans,
GncOwner *owner)
{
@ -883,7 +883,7 @@ static void gnc_plugin_business_cmd_assign_payment (GtkAction *action,
else
owner_p = plugin_business_priv->last_vendor;
gnc_business_assign_payment (gnc_plugin_page_get_window(plugin_page),
gnc_business_assign_payment (GTK_WINDOW (mw->window),
trans, owner_p);
}
@ -1019,7 +1019,7 @@ gnc_plugin_business_cmd_test_init_data (GtkAction *action,
gnc_account_append_child(root, tax_acct);
// Launch the invoice editor
gnc_ui_invoice_edit(invoice);
gnc_ui_invoice_edit (GTK_WINDOW (data->window), invoice);
}
/* This is the list of actions which are switched inactive in a read-only book. */

View File

@ -60,8 +60,8 @@ GncPlugin *gnc_plugin_business_new (void);
G_END_DECLS
GncMainWindow *gnc_plugin_business_get_window (void);
void gnc_invoice_remind_bills_due (void);
void gnc_invoice_remind_invoices_due (void);
void gnc_invoice_remind_bills_due (GtkWindow *parent);
void gnc_invoice_remind_invoices_due (GtkWindow *parent);
void gnc_invoice_remind_bills_due_cb (void);
void gnc_invoice_remind_invoices_due_cb (void);
const char *gnc_plugin_business_get_invoice_printreport(void);

View File

@ -648,12 +648,14 @@ gnc_plugin_page_invoice_cmd_new_invoice (GtkAction *action,
GncPluginPageInvoice *plugin_page)
{
GncPluginPageInvoicePrivate *priv;
GtkWindow *parent;
g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
ENTER("(action %p, plugin_page %p)", action, plugin_page);
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
gnc_invoice_window_new_invoice_cb(NULL, priv->iw);
parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
gnc_invoice_window_new_invoice_cb(parent, priv->iw);
LEAVE(" ");
}
@ -673,12 +675,14 @@ gnc_plugin_page_invoice_cmd_print (GtkAction *action,
GncPluginPageInvoice *plugin_page)
{
GncPluginPageInvoicePrivate *priv;
GtkWindow *parent;
g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
ENTER("(action %p, plugin_page %p)", action, plugin_page);
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
gnc_invoice_window_printCB(NULL, priv->iw);
parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
gnc_invoice_window_printCB (parent, priv->iw);
LEAVE(" ");
}
@ -729,12 +733,14 @@ gnc_plugin_page_invoice_cmd_edit (GtkAction *action,
GncPluginPageInvoice *plugin_page)
{
GncPluginPageInvoicePrivate *priv;
GtkWindow *parent;
g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
ENTER("(action %p, plugin_page %p)", action, plugin_page);
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
gnc_invoice_window_editCB(NULL, priv->iw);
parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
gnc_invoice_window_editCB (parent, priv->iw);
LEAVE(" ");
}
@ -743,12 +749,14 @@ gnc_plugin_page_invoice_cmd_duplicateInvoice (GtkAction *action,
GncPluginPageInvoice *plugin_page)
{
GncPluginPageInvoicePrivate *priv;
GtkWindow *parent;
g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
ENTER("(action %p, plugin_page %p)", action, plugin_page);
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
gnc_invoice_window_duplicateInvoiceCB(NULL, priv->iw);
parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
gnc_invoice_window_duplicateInvoiceCB(parent, priv->iw);
LEAVE(" ");
}
@ -906,12 +914,14 @@ gnc_plugin_page_invoice_cmd_pay_invoice (GtkAction *action,
GncPluginPageInvoice *plugin_page)
{
GncPluginPageInvoicePrivate *priv;
GtkWindow *parent;
g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
ENTER("(action %p, plugin_page %p)", action, plugin_page);
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
gnc_invoice_window_payment_cb(NULL, priv->iw);
parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
gnc_invoice_window_payment_cb (parent, priv->iw);
LEAVE(" ");
}
@ -920,12 +930,14 @@ gnc_plugin_page_invoice_cmd_company_report (GtkAction *action,
GncPluginPageInvoice *plugin_page)
{
GncPluginPageInvoicePrivate *priv;
GtkWindow *parent;
g_return_if_fail(GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page));
ENTER("(action %p, plugin_page %p)", action, plugin_page);
priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(plugin_page);
gnc_invoice_window_report_owner_cb(NULL, priv->iw);
parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page)));
gnc_invoice_window_report_owner_cb (parent, priv->iw);
LEAVE(" ");
}

View File

@ -775,7 +775,7 @@ gnc_plugin_page_owner_tree_recreate_page (GtkWidget *window,
}
/* Wrapper function to open the proper edit dialog, depending on the owner type */
static void gnc_ui_owner_edit (GncOwner *owner)
static void gnc_ui_owner_edit (GtkWindow *parent, GncOwner *owner)
{
if (NULL == owner) return;
@ -786,22 +786,22 @@ static void gnc_ui_owner_edit (GncOwner *owner)
break;
case GNC_OWNER_CUSTOMER :
{
gnc_ui_customer_edit (owner->owner.customer);
gnc_ui_customer_edit (parent, owner->owner.customer);
break;
}
case GNC_OWNER_JOB :
{
gnc_ui_job_edit (owner->owner.job);
gnc_ui_job_edit (parent, owner->owner.job);
break;
}
case GNC_OWNER_VENDOR :
{
gnc_ui_vendor_edit (owner->owner.vendor);
gnc_ui_vendor_edit (parent, owner->owner.vendor);
break;
}
case GNC_OWNER_EMPLOYEE :
{
gnc_ui_employee_edit (owner->owner.employee);
gnc_ui_employee_edit (parent, owner->owner.employee);
break;
}
}
@ -842,10 +842,12 @@ gnc_plugin_page_owner_tree_double_click_cb (GtkTreeView *treeview,
GncPluginPageOwnerTree *page)
{
GncOwner *owner;
GtkWindow *parent;
g_return_if_fail (GNC_IS_PLUGIN_PAGE_OWNER_TREE (page));
owner = gnc_tree_view_owner_get_owner_from_path (GNC_TREE_VIEW_OWNER(treeview), path);
gnc_ui_owner_edit (owner);
parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
gnc_ui_owner_edit (parent, owner);
}
static void
@ -993,10 +995,12 @@ static void
gnc_plugin_page_owner_tree_cmd_new_owner (GtkAction *action, GncPluginPageOwnerTree *page)
{
GncPluginPageOwnerTreePrivate *priv;
GtkWindow *parent;
g_return_if_fail(GNC_IS_PLUGIN_PAGE_OWNER_TREE(page));
priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE (page);
parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
switch (priv->owner_type)
{
@ -1005,7 +1009,7 @@ gnc_plugin_page_owner_tree_cmd_new_owner (GtkAction *action, GncPluginPageOwnerT
break;
case GNC_OWNER_CUSTOMER :
{
gnc_ui_customer_new (gnc_get_current_book ());
gnc_ui_customer_new (parent, gnc_get_current_book ());
break;
}
case GNC_OWNER_JOB :
@ -1016,12 +1020,12 @@ gnc_plugin_page_owner_tree_cmd_new_owner (GtkAction *action, GncPluginPageOwnerT
}
case GNC_OWNER_VENDOR :
{
gnc_ui_vendor_new (gnc_get_current_book ());
gnc_ui_vendor_new (parent, gnc_get_current_book ());
break;
}
case GNC_OWNER_EMPLOYEE :
{
gnc_ui_employee_new (gnc_get_current_book ());
gnc_ui_employee_new (parent, gnc_get_current_book ());
break;
}
}
@ -1030,12 +1034,14 @@ gnc_plugin_page_owner_tree_cmd_new_owner (GtkAction *action, GncPluginPageOwnerT
static void
gnc_plugin_page_owner_tree_cmd_edit_owner (GtkAction *action, GncPluginPageOwnerTree *page)
{
GtkWindow *parent;
GncOwner *owner = gnc_plugin_page_owner_tree_get_current_owner (page);
if (NULL == owner) return;
ENTER("action %p, page %p", action, page);
gnc_ui_owner_edit (owner);
parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
gnc_ui_owner_edit (parent, owner);
LEAVE(" ");
}
@ -1132,6 +1138,7 @@ gnc_plugin_page_owner_tree_cmd_new_invoice (GtkAction *action,
{
GncPluginPageOwnerTreePrivate *priv;
GncOwner current_owner;
GtkWindow *parent;
ENTER("action %p, page %p", action, page);
@ -1168,8 +1175,9 @@ gnc_plugin_page_owner_tree_cmd_new_invoice (GtkAction *action,
}
}
parent = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
if (gncOwnerGetType(&current_owner) != GNC_OWNER_UNDEFINED)
gnc_ui_invoice_new (&current_owner, gnc_get_current_book());
gnc_ui_invoice_new (parent, &current_owner, gnc_get_current_book ());
LEAVE(" ");
}

View File

@ -694,7 +694,8 @@ gnc_plugin_page_register_new (Account *account, gboolean subaccounts)
if (guid_equal (xaccAccountGetGUID (account), xaccAccountGetGUID (new_account)))
{
gnc_error_dialog (NULL, "%s",
GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (new_register_page)));
gnc_error_dialog (window, "%s",
_("You have tried to open an account in the old register while it is open in the new register."));
return NULL;
}
@ -1570,7 +1571,7 @@ gnc_plugin_page_register_finish_pending (GncPluginPage *page)
return TRUE;
name = gnc_plugin_page_register_get_tab_name(page);
window = gnc_plugin_page_get_window(page);
window = gnc_plugin_page_get_window (page);
dialog = gtk_message_dialog_new(GTK_WINDOW(window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_WARNING,
@ -2802,7 +2803,7 @@ gnc_plugin_page_register_cmd_print_check (GtkAction *action,
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(plugin_page);
reg = gnc_ledger_display_get_split_register (priv->ledger);
ledger_type = gnc_ledger_display_type(priv->ledger);
window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(plugin_page));
window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (plugin_page));
if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
{
account = gnc_plugin_page_register_get_account (plugin_page);
@ -2879,7 +2880,7 @@ gnc_plugin_page_register_cmd_print_check (GtkAction *action,
}
else
{
gnc_error_dialog(window, "%s",
gnc_error_dialog(GTK_WINDOW (window), "%s",
_("You can only print checks from a bank account register or search results."));
LEAVE("Unsupported ledger type");
return;
@ -2957,8 +2958,7 @@ gnc_plugin_page_register_cmd_find_account (GtkAction *action,
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(page));
window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
gnc_find_account_dialog (window, NULL);
}
@ -3041,11 +3041,13 @@ gnc_plugin_page_register_cmd_void_transaction (GtkAction *action,
GtkBuilder *builder;
const char *reason;
gint result;
GtkWindow *window;
ENTER("(action %p, page %p)", action, page);
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER(page));
window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
reg = gnc_ledger_display_get_split_register(priv->ledger);
trans = gnc_split_register_get_current_trans(reg);
@ -3055,13 +3057,13 @@ gnc_plugin_page_register_cmd_void_transaction (GtkAction *action,
return;
if (xaccTransHasReconciledSplits(trans) || xaccTransHasSplitsInState(trans, CREC))
{
gnc_error_dialog(NULL, "%s", _("You cannot void a transaction with reconciled or cleared splits."));
gnc_error_dialog (window, "%s", _("You cannot void a transaction with reconciled or cleared splits."));
return;
}
reason = xaccTransGetReadOnly (trans);
if (reason)
{
gnc_error_dialog(NULL, _("This transaction is marked read-only with the comment: '%s'"), reason);
gnc_error_dialog(window, _("This transaction is marked read-only with the comment: '%s'"), reason);
return;
}
@ -3131,7 +3133,7 @@ gnc_plugin_page_register_cmd_reverse_transaction (GtkAction *action,
if (xaccTransGetReversedBy(trans))
{
gnc_error_dialog(gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page)), "%s",
gnc_error_dialog(GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page))), "%s",
_("A reversing entry has already been created for this transaction."));
return;
}
@ -4155,7 +4157,7 @@ gnc_plugin_page_register_event_handler (QofInstance *entity,
ENTER("entity %p of type %d, page %p, event data %p",
entity, event_type, page, ed);
window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page));
window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
if (GNC_IS_ACCOUNT(entity))
{

View File

@ -678,7 +678,8 @@ gnc_plugin_page_register2_new (Account *account, gboolean subaccounts)
if (guid_equal (xaccAccountGetGUID (account), xaccAccountGetGUID (old_account)))
{
gnc_error_dialog (NULL, "%s",
GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (old_register_page)));
gnc_error_dialog (window, "%s",
_("You have tried to open an account in the new register while it is open in the old register."));
return NULL;
}
@ -2675,7 +2676,7 @@ gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
}
else
{
gnc_error_dialog (window, "%s",
gnc_error_dialog (GTK_WINDOW (window), "%s",
_("You can only print checks from a bank account register or search results."));
LEAVE("Unsupported ledger type");
return;
@ -2769,7 +2770,7 @@ gnc_plugin_page_register2_cmd_find_account (GtkAction *action,
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(page));
window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
gnc_find_account_dialog (window, NULL);
}
@ -2869,6 +2870,7 @@ gnc_plugin_page_register2_cmd_void_transaction (GtkAction *action,
}
if (xaccTransHasReconciledSplits (trans) || xaccTransHasSplitsInState (trans, CREC))
{
GtkWindow *window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
gnc_error_dialog (NULL, "%s", _("You cannot void a transaction with reconciled or cleared splits."));
LEAVE("trans with reconciled splits");
return;
@ -4032,7 +4034,7 @@ gnc_plugin_page_register2_event_handler (QofInstance *entity,
ENTER("entity %p of type %d, page %p, event data %p",
entity, event_type, page, ed);
window = gnc_plugin_page_get_window(GNC_PLUGIN_PAGE(page));
window = gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page));
if (GNC_IS_ACCOUNT(entity))
{

View File

@ -747,6 +747,7 @@ gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page)
GtkTreeSelection *selection;
GList *selected_paths, *to_delete = NULL;
GtkTreeModel *model;
GtkWindow *window;
selection = gtk_tree_view_get_selection(priv->tree_view);
selected_paths = gtk_tree_selection_get_selected_rows(selection, &model);
@ -767,11 +768,12 @@ gnc_plugin_page_sx_list_cmd_delete(GtkAction *action, GncPluginPageSxList *page)
}
}
window = GTK_WINDOW (gnc_plugin_page_get_window (GNC_PLUGIN_PAGE (page)));
/* FIXME: Does this always refer to only one transaction? Or could
multiple SXs be deleted as well? Ideally, the number of
to-be-deleted SXs should be mentioned here; see
dialog-sx-since-last-run.c:807 */
if (gnc_verify_dialog(NULL, FALSE, "%s", _("Do you really want to delete this scheduled transaction?")))
if (gnc_verify_dialog (window, FALSE, "%s", _("Do you really want to delete this scheduled transaction?")))
{
g_list_foreach(to_delete, (GFunc)_destroy_sx, NULL);
}

View File

@ -762,8 +762,8 @@ gsr_default_reverse_txn_handler (GNCSplitReg *gsr, gpointer data)
if (xaccTransGetReversedBy(trans))
{
gnc_error_dialog(gsr->window, "%s",
_("A reversing entry has already been created for this transaction."));
gnc_error_dialog (GTK_WINDOW (gsr->window), "%s",
_("A reversing entry has already been created for this transaction."));
return;
}
@ -1114,7 +1114,7 @@ gsr_default_execassociated_handler (GNCSplitReg *gsr, gpointer data)
uri = xaccTransGetAssociation (trans);
if (g_strcmp0 (uri, "") == 0 && g_strcmp0 (uri, NULL) == 0)
gnc_error_dialog (NULL, "%s", _("This transaction is not associated with a URI."));
gnc_error_dialog (GTK_WINDOW (gsr->window), "%s", _("This transaction is not associated with a URI."));
else
{
if (g_str_has_prefix (uri,"file:/") && !g_str_has_prefix (uri,"file://")) // Check for relative path
@ -1140,7 +1140,7 @@ gsr_default_execassociated_handler (GNCSplitReg *gsr, gpointer data)
g_free (uri_scheme);
}
else
gnc_error_dialog (NULL, "%s", _("This transaction is not associated with a valid URI."));
gnc_error_dialog (GTK_WINDOW (gsr->window), "%s", _("This transaction is not associated with a valid URI."));
}
return;
}

View File

@ -27,7 +27,6 @@
</columns>
</object>
<object class="GtkDialog" id="customer_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">New Customer</property>
<property name="type_hint">dialog</property>

View File

@ -3,7 +3,6 @@
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="employee_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">New Employee</property>
<property name="type_hint">dialog</property>

View File

@ -677,7 +677,6 @@
</columns>
</object>
<object class="GtkDialog" id="new_invoice_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">New Invoice</property>
<property name="type_hint">dialog</property>
@ -1282,7 +1281,6 @@
</action-widgets>
</object>
<object class="GtkDialog" id="unpost_message_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="modal">True</property>

View File

@ -3,7 +3,6 @@
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkDialog" id="job_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Job Dialog</property>
<property name="resizable">False</property>
@ -232,11 +231,11 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="labelrate">
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Rate</property>
<property name="label" translatable="yes">Billing ID</property>
<property name="justify">right</property>
</object>
<packing>
@ -246,11 +245,11 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
<object class="GtkLabel" id="labelrate">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Billing ID</property>
<property name="label" translatable="yes">Rate</property>
<property name="justify">right</property>
</object>
<packing>
@ -287,20 +286,6 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="rate_entry">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="desc_entry">
<property name="visible">True</property>
@ -315,6 +300,20 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="rate_entry">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>

View File

@ -4,7 +4,6 @@
<requires lib="gtk+" version="3.10"/>
<object class="GtkTextBuffer" id="notes_buffer"/>
<object class="GtkDialog" id="order_entry_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Order Entry</property>
<property name="default_width">950</property>
@ -526,7 +525,6 @@
</object>
<object class="GtkTextBuffer" id="text_buffer"/>
<object class="GtkDialog" id="new_order_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">New Order</property>
<property name="type_hint">dialog</property>

View File

@ -57,7 +57,6 @@
</columns>
</object>
<object class="GtkDialog" id="payment_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Process Payment</property>
<property name="default_height">560</property>

View File

@ -1456,7 +1456,6 @@
</action-widgets>
</object>
<object class="GtkDialog" id="since_last_run_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Since Last Run...</property>
<property name="window_position">center-on-parent</property>

View File

@ -27,7 +27,6 @@
</columns>
</object>
<object class="GtkDialog" id="vendor_dialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">New Vendor</property>
<property name="type_hint">dialog</property>

View File

@ -183,7 +183,7 @@ gnc_html_register_url_cb (const char *location, const char *label,
}
page = gnc_plugin_page_register_new (account, FALSE);
gnc_main_window_open_page (NULL, page);
gnc_main_window_open_page (GNC_MAIN_WINDOW (result->parent), page);
if (split)
{
gsr = gnc_plugin_page_register_get_gsr(page);
@ -213,7 +213,7 @@ gnc_html_price_url_cb (const char *location, const char *label,
if (!validate_type("price-guid=", location, GNC_ID_PRICE, result, &guid, &entity))
return FALSE;
if (!gnc_price_edit_by_guid (NULL, &guid))
if (!gnc_price_edit_by_guid (GTK_WIDGET (result->parent), &guid))
{
result->error_message = g_strdup_printf (_("No such price: %s"),
location);
@ -295,6 +295,8 @@ cleanup:
g_error_free(error);
if (file_guid)
g_free(file_guid);
gnc_totd_dialog_reparent ();
}
@ -377,8 +379,6 @@ gnc_main_gui_init (void)
gnc_html_register_url_handler (URL_TYPE_PRICE,
gnc_html_price_url_cb);
gnc_ui_sx_initialize();
/* Register the Owner search type */
gnc_search_core_register_type (GNC_OWNER_MODULE_NAME,
(GNCSearchCoreNew) gnc_search_owner_new);
@ -421,6 +421,8 @@ gnc_main_gui_init (void)
gnc_hook_add_dangler(HOOK_BOOK_OPENED,
(GFunc)gnc_invoice_remind_invoices_due_cb, NULL);
gnc_ui_sx_initialize();
/* Add to preferences under Business */
/* The parameters are; glade file, items to add from glade file - last being the dialog, preference tab name */
gnc_preferences_add_page("business-prefs.glade", "liststore_printinvoice,days_in_adj,cust_days_in_adj,business_prefs",

View File

@ -1314,7 +1314,7 @@ gnc_ui_reconcile_window_delete_cb(GtkButton *button, gpointer data)
"transaction?");
gboolean result;
result = gnc_verify_dialog(recnData->window, FALSE, "%s", message);
result = gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message);
if (!result)
return;
@ -1990,7 +1990,7 @@ recn_cancel(RecnWindow *recnData)
{
const char *message = _("You have made changes to this reconcile "
"window. Are you sure you want to cancel?");
if (!gnc_verify_dialog(recnData->window, FALSE, "%s", message))
if (!gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message))
return;
}
@ -2108,7 +2108,7 @@ recnFinishCB (GtkAction *action, RecnWindow *recnData)
{
const char *message = _("The account is not balanced. "
"Are you sure you want to finish?");
if (!gnc_verify_dialog (recnData->window, FALSE, "%s", message))
if (!gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message))
return;
}
@ -2165,7 +2165,7 @@ recnPostponeCB (GtkAction *action, gpointer data)
{
const char *message = _("Do you want to postpone this reconciliation "
"and finish it later?");
if (!gnc_verify_dialog (recnData->window, FALSE, "%s", message))
if (!gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message))
return;
}

View File

@ -1278,7 +1278,7 @@ gnc_ui_reconcile_window_delete_cb (GtkButton *button, gpointer data)
"transaction?");
gboolean result;
result = gnc_verify_dialog (recnData->window, FALSE, "%s", message);
result = gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message);
if (!result)
return;
@ -1951,7 +1951,7 @@ recn_cancel (RecnWindow2 *recnData)
{
const char *message = _("You have made changes to this reconcile "
"window. Are you sure you want to cancel?");
if (!gnc_verify_dialog(recnData->window, FALSE, "%s", message))
if (!gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message))
return;
}
@ -2069,7 +2069,7 @@ recnFinishCB (GtkAction *action, RecnWindow2 *recnData)
{
const char *message = _("The account is not balanced. "
"Are you sure you want to finish?");
if (!gnc_verify_dialog (recnData->window, FALSE, "%s", message))
if (!gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message))
return;
}
@ -2126,7 +2126,7 @@ recnPostponeCB (GtkAction *action, gpointer data)
{
const char *message = _("Do you want to postpone this reconciliation "
"and finish it later?");
if (!gnc_verify_dialog (recnData->window, FALSE, "%s", message))
if (!gnc_verify_dialog (GTK_WINDOW (recnData->window), FALSE, "%s", message))
return;
}

View File

@ -646,7 +646,7 @@ inner_main (void *closure, int argc, char **argv)
if (!nofile && (fn = get_file_to_load()))
{
gnc_update_splash_screen(_("Loading data..."), GNC_SPLASH_PERCENTAGE_UNKNOWN);
gnc_file_open_file(fn, /*open_readonly*/ FALSE);
gnc_file_open_file(gnc_get_splash_screen(), fn, /*open_readonly*/ FALSE);
g_free(fn);
}
else if (gnc_prefs_get_bool(GNC_PREFS_GROUP_NEW_USER, GNC_PREF_FIRST_STARTUP))

View File

@ -543,7 +543,7 @@ load_to_stream( GncHtmlWebkit* self, URLType type,
{
if ( !https_allowed() )
{
gnc_error_dialog( priv->base.parent, "%s",
gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
_("Secure HTTP access is disabled. "
"You can enable it in the Network section of "
"the Preferences dialog."));
@ -553,7 +553,7 @@ load_to_stream( GncHtmlWebkit* self, URLType type,
if ( !http_allowed() )
{
gnc_error_dialog( priv->base.parent, "%s",
gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
_("Network HTTP access is disabled. "
"You can enable it in the Network section of "
"the Preferences dialog."));
@ -881,18 +881,19 @@ impl_webkit_show_url( GncHtml* self, URLType type,
result.base_type = URL_TYPE_FILE;
result.base_location = NULL;
result.error_message = NULL;
result.parent = GTK_WINDOW (priv->base.parent);
ok = url_handler( location, label, new_window, &result );
if ( !ok )
{
if ( result.error_message )
{
gnc_error_dialog( priv->base.parent, "%s", result.error_message );
gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s", result.error_message );
}
else
{
/* %s is a URL (some location somewhere). */
gnc_error_dialog( priv->base.parent, _("There was an error accessing %s."), location );
gnc_error_dialog (GTK_WINDOW (priv->base.parent), _("There was an error accessing %s."), location );
}
if ( priv->base.load_cb )
@ -958,7 +959,7 @@ impl_webkit_show_url( GncHtml* self, URLType type,
{
if ( !https_allowed() )
{
gnc_error_dialog( priv->base.parent, "%s",
gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
_("Secure HTTP access is disabled. "
"You can enable it in the Network section of "
"the Preferences dialog.") );
@ -970,7 +971,7 @@ impl_webkit_show_url( GncHtml* self, URLType type,
{
if ( !http_allowed() )
{
gnc_error_dialog( priv->base.parent, "%s",
gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
_("Network HTTP access is disabled. "
"You can enable it in the Network section of "
"the Preferences dialog.") );

View File

@ -561,7 +561,7 @@ load_to_stream( GncHtmlWebkit* self, URLType type,
{
if ( !https_allowed() )
{
gnc_error_dialog( priv->base.parent, "%s",
gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
_("Secure HTTP access is disabled. "
"You can enable it in the Network section of "
"the Preferences dialog."));
@ -571,7 +571,7 @@ load_to_stream( GncHtmlWebkit* self, URLType type,
if ( !http_allowed() )
{
gnc_error_dialog( priv->base.parent, "%s",
gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
_("Network HTTP access is disabled. "
"You can enable it in the Network section of "
"the Preferences dialog."));
@ -853,18 +853,19 @@ impl_webkit_show_url( GncHtml* self, URLType type,
result.base_type = URL_TYPE_FILE;
result.base_location = NULL;
result.error_message = NULL;
result.parent = GTK_WINDOW (priv->base.parent);
ok = url_handler( location, label, new_window, &result );
if ( !ok )
{
if ( result.error_message )
{
gnc_error_dialog( priv->base.parent, "%s", result.error_message );
gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s", result.error_message );
}
else
{
/* %s is a URL (some location somewhere). */
gnc_error_dialog( priv->base.parent, _("There was an error accessing %s."), location );
gnc_error_dialog (GTK_WINDOW (priv->base.parent), _("There was an error accessing %s."), location );
}
if ( priv->base.load_cb )
@ -930,7 +931,7 @@ impl_webkit_show_url( GncHtml* self, URLType type,
{
if ( !https_allowed() )
{
gnc_error_dialog( priv->base.parent, "%s",
gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
_("Secure HTTP access is disabled. "
"You can enable it in the Network section of "
"the Preferences dialog.") );
@ -942,7 +943,7 @@ impl_webkit_show_url( GncHtml* self, URLType type,
{
if ( !http_allowed() )
{
gnc_error_dialog( priv->base.parent, "%s",
gnc_error_dialog (GTK_WINDOW (priv->base.parent), "%s",
_("Network HTTP access is disabled. "
"You can enable it in the Network section of "
"the Preferences dialog.") );

View File

@ -67,6 +67,9 @@ typedef struct
URLType base_type;
gchar* base_location;
/* The window that triggered this URL request */
GtkWindow *parent;
/* The following members are used if the handler fails (returns FALSE). */
gchar* error_message;
} GNCURLResult;

View File

@ -373,7 +373,7 @@ aai_wizard_button_clicked_cb(GtkButton *button, gpointer user_data)
{
g_warning("on_aqhbci_button: Oops, no aqhbci setup wizard found.");
gnc_error_dialog
(info->window,
(GTK_WINDOW (info->window),
_("The external program \"AqBanking Setup Wizard\" has not "
"been found. \n\n"
"The %s package should include the "
@ -530,7 +530,7 @@ child_exit_cb(GPid pid, gint status, gpointer data)
"value: %d. The called program was \"%s\".\n",
exit_status, deferred_info->wizard_path);
gnc_error_dialog
(info->window, "%s",
(GTK_WINDOW (info->window), "%s",
_("The external program \"AqBanking Setup Wizard\" failed "
"to run successfully because the "
"additional software \"Qt\" was not found. "
@ -551,7 +551,7 @@ child_exit_cb(GPid pid, gint status, gpointer data)
"value: %d. The called program was \"%s\".\n",
exit_status, deferred_info->wizard_path);
gnc_error_dialog
(info->window, "%s",
(GTK_WINDOW (info->window), "%s",
_("The external program \"AqBanking Setup Wizard\" failed "
"to run successfully. Online Banking can only be setup "
"if this wizard has run successfully. "

View File

@ -606,7 +606,7 @@ gnc_ab_trans_dialog_verify_values(GncABTransDialog *td)
const char* localBankCode = AB_Transaction_GetLocalBankCode(td->ab_trans);
const char* localAccountCode = AB_Transaction_GetLocalAccountNumber(td->ab_trans);
values_ok = FALSE;
gnc_error_dialog(td->dialog,
gnc_error_dialog(GTK_WINDOW (td->dialog),
_("Your local bank account does not yet have the SEPA account information stored."
" We are sorry, but in this development version one additional step is necessary "
"which has not yet been implemented directly in gnucash. "
@ -1179,7 +1179,7 @@ gnc_ab_trans_dialog_add_templ_cb(GtkButton *button, gpointer user_data)
find_templ_helper, &data);
if (data.pointer)
{
gnc_error_dialog(dialog, "%s",
gnc_error_dialog(GTK_WINDOW (dialog), "%s",
_("A template with the given name already exists. "
"Please enter another name."));
continue;
@ -1313,8 +1313,8 @@ gnc_ab_trans_dialog_del_templ_cb(GtkButton *button, gpointer user_data)
}
gtk_tree_model_get(model, &iter, TEMPLATE_NAME, &name, -1);
if (gnc_verify_dialog(
td->parent, FALSE,
if (gnc_verify_dialog (
GTK_WINDOW (td->parent), FALSE,
_("Do you really want to delete the template with the name \"%s\"?"),
name))
{

View File

@ -80,7 +80,7 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
if (!ab_acc)
{
g_warning("gnc_ab_getbalance: No AqBanking account found");
gnc_error_dialog(parent, _("No valid online banking account assigned."));
gnc_error_dialog (GTK_WINDOW (parent), _("No valid online banking account assigned."));
goto cleanup;
}
@ -94,7 +94,7 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
{
g_warning("gnc_ab_getbalance: JobGetBalance not available for this "
"account");
gnc_error_dialog(parent, _("Online action \"Get Balance\" not available for this account."));
gnc_error_dialog (GTK_WINDOW (parent), _("Online action \"Get Balance\" not available for this account."));
goto cleanup;
}
job_list = AB_Job_List2_new();
@ -127,9 +127,9 @@ gnc_ab_getbalance(GtkWidget *parent, Account *gnc_acc)
&& job_status != AB_Job_StatusPending)
{
g_warning("gnc_ab_getbalance: Error on executing job");
gnc_error_dialog(parent, _("Error on executing job.\n\nStatus: %s - %s")
, AB_Job_Status2Char(job_status)
, AB_Job_GetResultText(job));
gnc_error_dialog (GTK_WINDOW (parent), _("Error on executing job.\n\nStatus: %s - %s"),
AB_Job_Status2Char(job_status),
AB_Job_GetResultText(job));
goto cleanup;
}

View File

@ -134,7 +134,7 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
if (!ab_acc)
{
g_warning("gnc_ab_gettrans: No AqBanking account found");
gnc_error_dialog(parent, _("No valid online banking account assigned."));
gnc_error_dialog (GTK_WINDOW (parent), _("No valid online banking account assigned."));
goto cleanup;
}
@ -157,7 +157,7 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
{
g_warning("gnc_ab_gettrans: JobGetTransactions not available for this "
"account");
gnc_error_dialog(parent, _("Online action \"Get Transactions\" not available for this account."));
gnc_error_dialog (GTK_WINDOW (parent), _("Online action \"Get Transactions\" not available for this account."));
goto cleanup;
}
AB_JobGetTransactions_SetFromTime(job, from_date);
@ -192,9 +192,9 @@ gnc_ab_gettrans(GtkWidget *parent, Account *gnc_acc)
&& job_status != AB_Job_StatusPending)
{
g_warning("gnc_ab_gettrans: Error on executing job");
gnc_error_dialog(parent, _("Error on executing job.\n\nStatus: %s - %s")
, AB_Job_Status2Char(job_status)
, AB_Job_GetResultText(job));
gnc_error_dialog (GTK_WINDOW (parent), _("Error on executing job.\n\nStatus: %s - %s"),
AB_Job_Status2Char(job_status),
AB_Job_GetResultText(job));
goto cleanup;
}

View File

@ -56,8 +56,8 @@ save_templates(GtkWidget *parent, Account *gnc_acc, GList *templates,
gboolean dont_ask)
{
g_return_if_fail(gnc_acc);
if (dont_ask || gnc_verify_dialog(
parent, FALSE, "%s",
if (dont_ask || gnc_verify_dialog (
GTK_WINDOW (parent), FALSE, "%s",
_("You have changed the list of online transfer templates, "
"but you cancelled the transfer dialog. "
"Do you nevertheless want to store the changes?")))
@ -113,7 +113,7 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
if (!ab_acc)
{
g_warning("gnc_ab_gettrans: No AqBanking account found");
gnc_error_dialog(parent, _("No valid online banking account assigned."));
gnc_error_dialog (GTK_WINDOW (parent), _("No valid online banking account assigned."));
goto cleanup;
}
@ -180,8 +180,8 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
#endif
))
{
if (!gnc_verify_dialog(
parent, FALSE, "%s",
if (!gnc_verify_dialog (
GTK_WINDOW (parent), FALSE, "%s",
_("The backend found an error during the preparation "
"of the job. It is not possible to execute this job. \n"
"\n"
@ -289,8 +289,8 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
&& job_status != AB_Job_StatusPending)
{
successful = FALSE;
if (!gnc_verify_dialog(
parent, FALSE, "%s",
if (!gnc_verify_dialog (
GTK_WINDOW (parent), FALSE, "%s",
_("An error occurred while executing the job. Please check "
"the log window for the exact error message.\n"
"\n"

View File

@ -715,7 +715,7 @@ txn_transaction_cb(const AB_TRANSACTION *element, gpointer user_data)
{
/* Oops, no job, probably not supported by bank */
if (gnc_verify_dialog(
NULL, FALSE, "%s",
GTK_WINDOW (data->parent), FALSE, "%s",
_("The backend found an error during the preparation "
"of the job. It is not possible to execute this job. \n"
"\n"
@ -726,7 +726,8 @@ txn_transaction_cb(const AB_TRANSACTION *element, gpointer user_data)
"\n"
"Do you want to enter the job again?")))
{
gnc_error_dialog(NULL, "Sorry, not implemented yet. Please check the console or trace file logs to see which job was rejected.");
gnc_error_dialog (GTK_WINDOW (data->parent),
"Sorry, not implemented yet. Please check the console or trace file logs to see which job was rejected.");
}
}
else
@ -807,7 +808,7 @@ txn_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
if (!(data->awaiting & AWAIT_TRANSACTIONS))
{
if (gnc_verify_dialog(data->parent, TRUE, "%s",
if (gnc_verify_dialog (GTK_WINDOW (data->parent), TRUE, "%s",
_("The bank has sent transaction information "
"in its response."
"\n"
@ -834,7 +835,7 @@ txn_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
data->ab_acc = gnc_ab_get_ab_account(data->api, gnc_acc);
if (!data->ab_acc)
{
gnc_error_dialog(NULL, "%s",
gnc_error_dialog(GTK_WINDOW (data->parent), "%s",
_("No Online Banking account found for this "
"gnucash account. These transactions will "
"not be executed by Online Banking."));
@ -911,7 +912,7 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
return NULL;
/* Ask the user whether to import unawaited non-zero balance */
if (gnc_verify_dialog(data->parent, TRUE, "%s",
if (gnc_verify_dialog (GTK_WINDOW (data->parent), TRUE, "%s",
_("The bank has sent balance information "
"in its response."
"\n"
@ -1047,7 +1048,7 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
{
const char *message3 = _("Reconcile account now?");
show_recn_window = gnc_verify_dialog(data->parent, TRUE, "%s\n%s\n%s",
show_recn_window = gnc_verify_dialog (GTK_WINDOW (data->parent), TRUE, "%s\n%s\n%s",
message1, message2, message3);
}
g_free(booked_str);
@ -1110,7 +1111,7 @@ gnc_ab_import_context(AB_IMEXPORTER_CONTEXT *context,
{
const char* subject = AB_Message_GetSubject(bankmsg);
const char* text = AB_Message_GetText(bankmsg);
gnc_info_dialog(data->parent, "%s\n%s %s\n%s",
gnc_info_dialog(GTK_WINDOW (data->parent), "%s\n%s %s\n%s",
_("The bank has sent a message in its response."),
_("Subject:"),
subject,

View File

@ -68,7 +68,8 @@ typedef GWEN_SYNCIO GWEN_IO_LAYER;
static QofLogModule log_module = GNC_MOD_IMPORT;
void
gnc_file_aqbanking_import(const gchar *aqbanking_importername,
gnc_file_aqbanking_import(GtkWindow *parent,
const gchar *aqbanking_importername,
const gchar *aqbanking_profilename,
gboolean execute_transactions)
{
@ -96,7 +97,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
/* Select a file */
default_dir = gnc_get_default_directory(GNC_PREFS_GROUP_AQBANKING);
selected_filename = gnc_file_dialog(_("Select a file to import"),
selected_filename = gnc_file_dialog(parent, _("Select a file to import"),
NULL, default_dir,
GNC_FILE_DIALOG_IMPORT);
g_free(default_dir);
@ -141,7 +142,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
if (!importer)
{
g_warning("Import module %s not found", aqbanking_importername);
gnc_error_dialog(NULL, "%s",
gnc_error_dialog(parent, "%s",
_("Import module for DTAUS import not found."));
goto cleanup;
}
@ -229,7 +230,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
/* Before importing the results, if this is a new book, let user specify
* book options, since they affect how transactions are created */
if (gnc_is_new_book())
gnc_new_book_option_display(gnc_ui_get_toplevel());
gnc_new_book_option_display (GTK_WIDGET (parent));
/* Import the results */
ieci = gnc_ab_import_context(context, AWAIT_TRANSACTIONS,
@ -319,7 +320,7 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
if (!successful)
{
g_warning("%s", errstr->str);
gnc_error_dialog(NULL,
gnc_error_dialog(parent,
_("An error occurred while executing jobs: %d of %d failed. "
"Please check the log window or gnucash.trace for the exact "
"error message.\n\n%s")
@ -329,13 +330,13 @@ gnc_file_aqbanking_import(const gchar *aqbanking_importername,
{
if (num_jobs == 0)
{
gnc_info_dialog(NULL,
gnc_info_dialog(parent,
_("No jobs to be send.")
);
}
else
{
gnc_info_dialog(NULL, ngettext
gnc_info_dialog(parent, ngettext
("The job was executed successfully, but as a precaution "
"please check the log window for potential errors.",
"All %d jobs were executed successfully, but as a precaution "

View File

@ -57,7 +57,8 @@ G_BEGIN_DECLS
* transactions as online jobs over aqbanking/HBCI. If FALSE, just import the
* transactions and that's it.
*/
void gnc_file_aqbanking_import (const gchar *aqbanking_importername,
void gnc_file_aqbanking_import (GtkWindow *parent,
const gchar *aqbanking_importername,
const gchar *aqbanking_formatname,
gboolean exec_as_aqbanking_jobs);

View File

@ -1087,7 +1087,7 @@ get_input(GncGWENGui *gui, guint32 flags, const gchar *title, const gchar *text,
gchar *msg = g_strdup_printf(
_("The PIN needs to be at least %d characters \n"
"long. Do you want to try again?"), min_len);
retval = gnc_verify_dialog(gui->parent, TRUE, "%s", msg);
retval = gnc_verify_dialog (GTK_WINDOW (gui->parent), TRUE, "%s", msg);
g_free(msg);
if (!retval)
break;
@ -1589,7 +1589,7 @@ ggg_delete_event_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data)
const char *still_running_msg =
_("The Online Banking job is still running; are you "
"sure you want to cancel?");
if (!gnc_verify_dialog(gui->dialog, FALSE, "%s", still_running_msg))
if (!gnc_verify_dialog (GTK_WINDOW (gui->dialog), FALSE, "%s", still_running_msg))
return FALSE;
set_aborted(gui);

Some files were not shown because too many files have changed in this diff Show More