Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added method to cancel file loading before closing tab (#637) #644

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions xed/xed-notebook.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,12 @@ static void
remove_tab (XedTab *tab,
XedNotebook *nb)
{
/* First cancel any loading */
if (xed_tab_get_state (tab) == XED_TAB_STATE_LOADING)
{
_xed_tab_cancel_load (tab);
}

gint position;

position = gtk_notebook_page_num (GTK_NOTEBOOK (nb), GTK_WIDGET (tab));
Expand Down
9 changes: 9 additions & 0 deletions xed/xed-tab.c
Original file line number Diff line number Diff line change
Expand Up @@ -1994,6 +1994,15 @@ _xed_tab_load (XedTab *tab,
load (tab, encoding, line_pos);
}

void
_xed_tab_cancel_load (XedTab *tab)
{
g_return_if_fail (XED_IS_PROGRESS_INFO_BAR (tab->priv->info_bar));
g_return_if_fail (G_IS_CANCELLABLE (tab->priv->cancellable));

g_cancellable_cancel (tab->priv->cancellable);
}

void
_xed_tab_load_stream (XedTab *tab,
GInputStream *stream,
Expand Down
2 changes: 2 additions & 0 deletions xed/xed-tab.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ void _xed_tab_load (XedTab *tab,
gint line_pos,
gboolean create);

void _xed_tab_cancel_load (XedTab *tab);

void _xed_tab_load_stream (XedTab *tab,
GInputStream *location,
const GtkSourceEncoding *encoding,
Expand Down
Loading