mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add parent widget to gnc_gnome_help function
If there are any errors from starting help with gnc_gnome_help they are displayed with gnc_error_dialog which defaults to setting the parent window to that of GnuCash. This can be confusing if the dialog is behind another window, say the preference window as it would appear that Gnucash is unresponsive so add the GtkWindow parameter to gnc_gnome_help and populate appropriately.
This commit is contained in:
parent
8c2538546b
commit
2c82ad5f78
@ -653,7 +653,7 @@ search_cancel_cb (GtkButton *button, GNCSearchWindow *sw)
|
||||
static void
|
||||
search_help_cb (GtkButton *button, GNCSearchWindow *sw)
|
||||
{
|
||||
gnc_gnome_help (HF_HELP, HL_FIND_TRANSACTIONS);
|
||||
gnc_gnome_help (GTK_WINDOW(sw->dialog), HF_HELP, HL_FIND_TRANSACTIONS);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1020,11 +1020,11 @@ gnc_account_window_response_cb (GtkDialog *dialog,
|
||||
{
|
||||
case NEW_ACCOUNT:
|
||||
DEBUG("new acct dialog, HELP");
|
||||
gnc_gnome_help(HF_HELP, HL_ACC);
|
||||
gnc_gnome_help (GTK_WINDOW(dialog), HF_HELP, HL_ACC);
|
||||
break;
|
||||
case EDIT_ACCOUNT:
|
||||
DEBUG("edit acct dialog, HELP");
|
||||
gnc_gnome_help(HF_HELP, HL_ACCEDIT);
|
||||
gnc_gnome_help (GTK_WINDOW(dialog), HF_HELP, HL_ACCEDIT);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
|
@ -279,7 +279,7 @@ gnc_book_close_response_cb(GtkDialog *dialog, gint response, GtkDialog *unused)
|
||||
switch (response)
|
||||
{
|
||||
case GTK_RESPONSE_HELP:
|
||||
gnc_gnome_help(HF_HELP, HL_CLOSE_BOOK);
|
||||
gnc_gnome_help (GTK_WINDOW(dialog), HF_HELP, HL_CLOSE_BOOK);
|
||||
break;
|
||||
case GTK_RESPONSE_OK:
|
||||
cbw->close_date = gnc_date_edit_get_date(GNC_DATE_EDIT(cbw->close_date_widget));
|
||||
|
@ -125,7 +125,7 @@ gnc_ui_file_access_response_cb(GtkDialog *dialog, gint response, GtkDialog *unus
|
||||
switch ( response )
|
||||
{
|
||||
case GTK_RESPONSE_HELP:
|
||||
gnc_gnome_help( HF_HELP, HL_GLOBPREFS );
|
||||
gnc_gnome_help (GTK_WINDOW(dialog), HF_HELP, HL_GLOBPREFS );
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_OK:
|
||||
|
@ -1197,7 +1197,7 @@ gnc_preferences_response_cb (GtkDialog *dialog, gint response, GtkDialog *unused
|
||||
switch (response)
|
||||
{
|
||||
case GTK_RESPONSE_HELP:
|
||||
gnc_gnome_help (HF_HELP, HL_GLOBPREFS);
|
||||
gnc_gnome_help (GTK_WINDOW(dialog), HF_HELP, HL_GLOBPREFS);
|
||||
break;
|
||||
|
||||
case GTK_RESPONSE_DELETE_EVENT:
|
||||
|
@ -90,13 +90,13 @@ gnc_gnome_utils_init (void)
|
||||
static void
|
||||
gnc_global_options_help_cb (GNCOptionWin *win, gpointer dat)
|
||||
{
|
||||
gnc_gnome_help (HF_HELP, HL_GLOBPREFS);
|
||||
gnc_gnome_help (GTK_WINDOW(gnc_options_dialog_widget (win)), HF_HELP, HL_GLOBPREFS);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_book_options_help_cb (GNCOptionWin *win, gpointer dat)
|
||||
{
|
||||
gnc_gnome_help (HF_HELP, HL_BOOK_OPTIONS);
|
||||
gnc_gnome_help (GTK_WINDOW(gnc_options_dialog_widget (win)), HF_HELP, HL_BOOK_OPTIONS);
|
||||
}
|
||||
|
||||
void
|
||||
@ -133,7 +133,7 @@ gnc_options_dialog_set_new_book_option_values (GNCOptionDB *odb)
|
||||
static void
|
||||
gnc_style_sheet_options_help_cb (GNCOptionWin *win, gpointer dat)
|
||||
{
|
||||
gnc_gnome_help (HF_HELP, HL_STYLE_SHEET);
|
||||
gnc_gnome_help (GTK_WINDOW(gnc_options_dialog_widget (win)), HF_HELP, HL_STYLE_SHEET);
|
||||
}
|
||||
|
||||
void
|
||||
@ -147,7 +147,7 @@ gnc_options_dialog_set_style_sheet_options_help_cb (GNCOptionWin *win)
|
||||
static void
|
||||
gnc_commodity_help_cb (void)
|
||||
{
|
||||
gnc_gnome_help (HF_HELP, HL_COMMODITY);
|
||||
gnc_gnome_help (NULL, HF_HELP, HL_COMMODITY);
|
||||
}
|
||||
|
||||
/* gnc_configure_date_format
|
||||
@ -240,7 +240,7 @@ gnc_add_css_file (void)
|
||||
* ?anchor varient, see https://gitlab.gnome.org/GNOME/yelp/issues/116
|
||||
*/
|
||||
static gchar *
|
||||
gnc_gnome_help_yelp_anchor_fix (const char *file_name, const char *anchor)
|
||||
gnc_gnome_help_yelp_anchor_fix (GtkWindow *parent, const char *file_name, const char *anchor)
|
||||
{
|
||||
const gchar * const *sdatadirs = g_get_system_data_dirs ();
|
||||
const gchar * const *langs = g_get_language_names ();
|
||||
@ -261,7 +261,7 @@ gnc_gnome_help_yelp_anchor_fix (const char *file_name, const char *anchor)
|
||||
|
||||
if (!help_path)
|
||||
{
|
||||
gnc_error_dialog (NULL, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
|
||||
gnc_error_dialog (parent, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
|
||||
PERR("Unable to find 'gnome/help' directory");
|
||||
return NULL;
|
||||
}
|
||||
@ -283,7 +283,7 @@ gnc_gnome_help_yelp_anchor_fix (const char *file_name, const char *anchor)
|
||||
uri = g_strconcat ("ghelp:", full_path, "?", anchor, NULL);
|
||||
else
|
||||
{
|
||||
gnc_error_dialog (NULL, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
|
||||
gnc_error_dialog (parent, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
|
||||
PERR("Unable to find valid help language directory");
|
||||
return NULL;
|
||||
}
|
||||
@ -298,7 +298,7 @@ gnc_gnome_help_yelp_anchor_fix (const char *file_name, const char *anchor)
|
||||
* toolkit.
|
||||
*/
|
||||
void
|
||||
gnc_gnome_help (const char *dir, const char *detail)
|
||||
gnc_gnome_help (GtkWindow *parent, const char *dir, const char *detail)
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSString *subdir = [NSString stringWithUTF8String: dir];
|
||||
@ -339,9 +339,9 @@ gnc_gnome_help (const char *dir, const char *detail)
|
||||
componentsJoinedByString: @"-"];
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath: docs_dir])
|
||||
{
|
||||
gnc_error_dialog(NULL, "%s\n%s\n%s: %s", _(msg_no_help_found),
|
||||
_(msg_no_help_reason),
|
||||
_(msg_no_help_location), [docs_dir UTF8String]);
|
||||
gnc_error_dialog (parent, "%s\n%s\n%s: %s", _(msg_no_help_found),
|
||||
_(msg_no_help_reason),
|
||||
_(msg_no_help_location), [docs_dir UTF8String]);
|
||||
[pool release];
|
||||
return;
|
||||
}
|
||||
@ -431,13 +431,13 @@ gnc_gnome_help (const char *dir, const char *detail)
|
||||
[[NSWorkspace sharedWorkspace] openURL: url];
|
||||
else
|
||||
{
|
||||
gnc_error_dialog(NULL, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
|
||||
gnc_error_dialog (parent, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
|
||||
}
|
||||
[pool release];
|
||||
}
|
||||
#elif defined G_OS_WIN32 /* G_OS_WIN32 */
|
||||
void
|
||||
gnc_gnome_help (const char *file_name, const char *anchor)
|
||||
gnc_gnome_help (GtkWindow *parent, const char *file_name, const char *anchor)
|
||||
{
|
||||
const gchar * const *lang;
|
||||
gchar *pkgdatadir, *fullpath, *found = NULL;
|
||||
@ -459,7 +459,7 @@ gnc_gnome_help (const char *file_name, const char *anchor)
|
||||
|
||||
if (!found)
|
||||
{
|
||||
gnc_error_dialog (NULL, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
|
||||
gnc_error_dialog (parent, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -469,14 +469,14 @@ gnc_gnome_help (const char *file_name, const char *anchor)
|
||||
}
|
||||
#else
|
||||
void
|
||||
gnc_gnome_help (const char *file_name, const char *anchor)
|
||||
gnc_gnome_help (GtkWindow *parent, const char *file_name, const char *anchor)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gchar *uri = NULL;
|
||||
gboolean success = TRUE;
|
||||
|
||||
if (anchor)
|
||||
uri = gnc_gnome_help_yelp_anchor_fix (file_name, anchor);
|
||||
uri = gnc_gnome_help_yelp_anchor_fix (parent, file_name, anchor);
|
||||
else
|
||||
uri = g_strconcat ("ghelp:", file_name, NULL);
|
||||
|
||||
@ -491,7 +491,7 @@ gnc_gnome_help (const char *file_name, const char *anchor)
|
||||
|
||||
g_assert(error != NULL);
|
||||
{
|
||||
gnc_error_dialog(NULL, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
|
||||
gnc_error_dialog (parent, "%s\n%s", _(msg_no_help_found), _(msg_no_help_reason));
|
||||
}
|
||||
PERR ("%s", error->message);
|
||||
g_error_free(error);
|
||||
|
@ -53,11 +53,13 @@ void gnc_add_css_file (void);
|
||||
* This routine will display an error message
|
||||
* if it can't find the help file or can't open the help browser.
|
||||
*
|
||||
* @param parent The parent window for any dialogs.
|
||||
*
|
||||
* @param file_name The name of the help file.
|
||||
*
|
||||
* @param anchor The anchor the help browser should scroll to.
|
||||
*/
|
||||
void gnc_gnome_help (const char *file_name,
|
||||
void gnc_gnome_help (GtkWindow *parent, const char *file_name,
|
||||
const char *anchor);
|
||||
/** Launch the default browser and open the provided URI.
|
||||
*/
|
||||
|
@ -4529,13 +4529,13 @@ gnc_main_window_cmd_window_raise (GtkAction *action,
|
||||
static void
|
||||
gnc_main_window_cmd_help_tutorial (GtkAction *action, GncMainWindow *window)
|
||||
{
|
||||
gnc_gnome_help (HF_GUIDE, NULL);
|
||||
gnc_gnome_help (GTK_WINDOW(window), HF_GUIDE, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_main_window_cmd_help_contents (GtkAction *action, GncMainWindow *window)
|
||||
{
|
||||
gnc_gnome_help (HF_HELP, NULL);
|
||||
gnc_gnome_help (GTK_WINDOW(window), HF_HELP, NULL);
|
||||
}
|
||||
|
||||
/** This is a helper function to find a data file and suck it into
|
||||
|
@ -106,7 +106,7 @@ gnc_error_dialog (GtkWindow *parent,
|
||||
|
||||
|
||||
extern void
|
||||
gnc_gnome_help (const char *file_name, const char *target_link);
|
||||
gnc_gnome_help (GtkWindow *parent, const char *file_name, const char *target_link);
|
||||
|
||||
int gnc_choose_radio_option_dialog (GtkWidget *parent,
|
||||
const char *title,
|
||||
|
@ -107,7 +107,8 @@ custom_report_dialog_close_cb(GtkWidget* widget, gpointer data)
|
||||
void
|
||||
custom_report_help_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gnc_gnome_help(HF_HELP, HL_USAGE_CUSTOMREP);
|
||||
CustomReportDialog *crd = data;
|
||||
gnc_gnome_help (GTK_WINDOW(crd->dialog), HF_HELP, HL_USAGE_CUSTOMREP);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -390,7 +390,8 @@ gnc_customer_window_cancel_cb (GtkWidget *widget, gpointer data)
|
||||
void
|
||||
gnc_customer_window_help_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gnc_gnome_help(HF_HELP, HL_USAGE_CUSTOMER);
|
||||
CustomerWindow *cw = data;
|
||||
gnc_gnome_help (GTK_WINDOW(cw->dialog), HF_HELP, HL_USAGE_CUSTOMER);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -248,7 +248,8 @@ gnc_employee_window_cancel_cb (GtkWidget *widget, gpointer data)
|
||||
void
|
||||
gnc_employee_window_help_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gnc_gnome_help(HF_HELP, HL_USAGE_EMPLOYEE);
|
||||
EmployeeWindow *ew = data;
|
||||
gnc_gnome_help (GTK_WINDOW(ew->dialog), HF_HELP, HL_USAGE_EMPLOYEE);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -544,13 +544,13 @@ gnc_invoice_window_help_cb (GtkWidget *widget, gpointer data)
|
||||
switch(owner_type)
|
||||
{
|
||||
case GNC_OWNER_CUSTOMER:
|
||||
gnc_gnome_help (HF_HELP, HL_USAGE_INVOICE);
|
||||
gnc_gnome_help (GTK_WINDOW(iw->dialog), HF_HELP, HL_USAGE_INVOICE);
|
||||
break;
|
||||
case GNC_OWNER_VENDOR:
|
||||
gnc_gnome_help (HF_HELP, HL_USAGE_BILL);
|
||||
gnc_gnome_help (GTK_WINDOW(iw->dialog), HF_HELP, HL_USAGE_BILL);
|
||||
break;
|
||||
default:
|
||||
gnc_gnome_help (HF_HELP, HL_USAGE_VOUCHER);
|
||||
gnc_gnome_help (GTK_WINDOW(iw->dialog), HF_HELP, HL_USAGE_VOUCHER);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,8 @@ gnc_job_window_cancel_cb (GtkWidget *widget, gpointer data)
|
||||
void
|
||||
gnc_job_window_help_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gnc_gnome_help (HF_HELP, HL_USAGE_JOB);
|
||||
JobWindow *jw = data;
|
||||
gnc_gnome_help (GTK_WINDOW(jw->dialog), HF_HELP, HL_USAGE_JOB);
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,7 +122,7 @@ gnc_ui_new_user_ok_cb (GtkWidget * widget, gpointer data)
|
||||
}
|
||||
else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (new_user->tutorial_button)))
|
||||
{
|
||||
gnc_gnome_help (HF_GUIDE, NULL);
|
||||
gnc_gnome_help (GTK_WINDOW(new_user->window), HF_GUIDE, NULL);
|
||||
gncp_new_user_finish ();
|
||||
}
|
||||
gtk_widget_destroy (new_user->window);
|
||||
|
@ -232,7 +232,8 @@ gnc_order_window_cancel_cb (GtkWidget *widget, gpointer data)
|
||||
void
|
||||
gnc_order_window_help_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gnc_gnome_help(HF_HELP, HL_USAGE_BILL);
|
||||
OrderWindow *ow = data;
|
||||
gnc_gnome_help (GTK_WINDOW(ow->dialog), HF_HELP, HL_USAGE_BILL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2675,7 +2675,7 @@ gnc_ui_print_check_response_cb(GtkDialog *dialog,
|
||||
switch (response)
|
||||
{
|
||||
case GTK_RESPONSE_HELP:
|
||||
gnc_gnome_help(HF_HELP, HL_PRINTCHECK);
|
||||
gnc_gnome_help (GTK_WINDOW(dialog), HF_HELP, HL_PRINTCHECK);
|
||||
return;
|
||||
|
||||
case GTK_RESPONSE_OK:
|
||||
|
@ -230,7 +230,7 @@ editor_cancel_button_clicked_cb( GtkButton *b, GncSxEditorDialog *sxed )
|
||||
static void
|
||||
editor_help_button_clicked_cb(GtkButton *b, GncSxEditorDialog *sxed)
|
||||
{
|
||||
gnc_gnome_help(HF_HELP, HL_SXEDITOR);
|
||||
gnc_gnome_help (GTK_WINDOW(sxed->dialog), HF_HELP, HL_SXEDITOR);
|
||||
}
|
||||
|
||||
|
||||
|
@ -227,7 +227,7 @@ editor_cancel_button_clicked_cb (GtkButton *b, GncSxEditorDialog2 *sxed)
|
||||
static void
|
||||
editor_help_button_clicked_cb (GtkButton *b, GncSxEditorDialog2 *sxed)
|
||||
{
|
||||
gnc_gnome_help (HF_HELP, HL_SXEDITOR);
|
||||
gnc_gnome_help (GTK_WINDOW(sxed->dialog), HF_HELP, HL_SXEDITOR);
|
||||
}
|
||||
|
||||
|
||||
|
@ -261,7 +261,8 @@ gnc_vendor_window_cancel_cb (GtkWidget *widget, gpointer data)
|
||||
void
|
||||
gnc_vendor_window_help_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gnc_gnome_help(HF_HELP, HL_USAGE_VENDOR);
|
||||
VendorWindow *vw = data;
|
||||
gnc_gnome_help (GTK_WINDOW(vw->dialog), HF_HELP, HL_USAGE_VENDOR);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -244,9 +244,9 @@ gnc_report_system_help_url_cb (const char *location, const char *label,
|
||||
g_return_val_if_fail (location != NULL, FALSE);
|
||||
|
||||
if (label && (*label != '\0'))
|
||||
gnc_gnome_help (location, label);
|
||||
gnc_gnome_help (GTK_WINDOW(result->parent), location, label);
|
||||
else
|
||||
gnc_gnome_help (location, NULL);
|
||||
gnc_gnome_help (GTK_WINDOW(result->parent), location, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1153,7 +1153,8 @@ gnc_reconcile_window_get_current_split(RecnWindow *recnData)
|
||||
static void
|
||||
gnc_ui_reconcile_window_help_cb(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gnc_gnome_help(HF_HELP, HL_RECNWIN);
|
||||
RecnWindow *recnData = data;
|
||||
gnc_gnome_help (GTK_WINDOW(recnData->window), HF_HELP, HL_RECNWIN);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1101,7 +1101,8 @@ gnc_reconcile_window_get_current_split (RecnWindow2 *recnData)
|
||||
static void
|
||||
gnc_ui_reconcile_window_help_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gnc_gnome_help (HF_HELP, HL_RECNWIN);
|
||||
RecnWindow2 *recnData = data;
|
||||
gnc_gnome_help (GTK_WINDOW(recnData->window), HF_HELP, HL_RECNWIN);
|
||||
}
|
||||
|
||||
|
||||
|
@ -252,7 +252,8 @@ gnc_bi_import_gui_cancel_cb (GtkWidget *widget, gpointer data)
|
||||
void
|
||||
gnc_bi_import_gui_help_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gnc_gnome_help (HF_GUIDE, HL_IMPORT_BC);
|
||||
BillImportGui *gui = data;
|
||||
gnc_gnome_help (GTK_WINDOW(gui->dialog), HF_GUIDE, HL_IMPORT_BC);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -228,7 +228,8 @@ gnc_customer_import_gui_cancel_cb (GtkWidget *widget, gpointer data)
|
||||
void
|
||||
gnc_customer_import_gui_help_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gnc_gnome_help (HF_GUIDE, HL_IMPORT_CUST);
|
||||
CustomerImportGui *gui = data;
|
||||
gnc_gnome_help (GTK_WINDOW(gui->dialog), HF_GUIDE, HL_IMPORT_CUST);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user