mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 797967 - Manage Document Link errors
If there are no document links, the default dialog is for a file uri and if the escape key is pressed in this default state the following error is added to the trace file... ERROR <Gtk> gtk_widget_event: assertion 'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed This coming from the GtkFileChooserButton and to fix this add a signal callback for the dialog 'key_press_event' to intercept the escape key and emit a GTK_RESPONSE_CANCEL to close the dialog.
This commit is contained in:
parent
1c0530dafd
commit
f685a32d9a
@ -229,6 +229,19 @@ setup_file_dialog (GtkBuilder *builder, GtkFileChooserButton *fcb,
|
|||||||
g_free (display_uri);
|
g_free (display_uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gnc_doclink_get_uri_event_cb (GtkWidget *widget, GdkEventKey *event,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
if (event->keyval == GDK_KEY_Escape)
|
||||||
|
{
|
||||||
|
gtk_dialog_response (GTK_DIALOG(widget),
|
||||||
|
GTK_RESPONSE_CANCEL);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
gnc_doclink_get_uri_dialog (GtkWindow *parent, const gchar *title,
|
gnc_doclink_get_uri_dialog (GtkWindow *parent, const gchar *title,
|
||||||
const gchar *uri)
|
const gchar *uri)
|
||||||
@ -258,6 +271,10 @@ gnc_doclink_get_uri_dialog (GtkWindow *parent, const gchar *title,
|
|||||||
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-doclink");
|
gtk_widget_set_name (GTK_WIDGET(dialog), "gnc-id-doclink");
|
||||||
gnc_widget_style_context_add_class (GTK_WIDGET(dialog), "gnc-class-doclink");
|
gnc_widget_style_context_add_class (GTK_WIDGET(dialog), "gnc-class-doclink");
|
||||||
|
|
||||||
|
// Use this event to capture the escape key being pressed
|
||||||
|
g_signal_connect (dialog, "key_press_event",
|
||||||
|
G_CALLBACK(gnc_doclink_get_uri_event_cb), dialog);
|
||||||
|
|
||||||
head_label = GTK_WIDGET(gtk_builder_get_object (builder, "path_head_label"));
|
head_label = GTK_WIDGET(gtk_builder_get_object (builder, "path_head_label"));
|
||||||
ok_button = GTK_WIDGET(gtk_builder_get_object (builder, "ok_button"));
|
ok_button = GTK_WIDGET(gtk_builder_get_object (builder, "ok_button"));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user