[epiphany/wip/exalm/tabs] Fixes
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/wip/exalm/tabs] Fixes
- Date: Wed, 27 Jan 2021 10:03:15 +0000 (UTC)
commit bd6f9b5c943fc34d29412f7f7dc39b35a0541f70
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Wed Jan 27 15:01:47 2021 +0500
Fixes
src/ephy-pages-view.c | 9 ++++++++-
src/ephy-tab-view.c | 6 +++++-
src/ephy-window.c | 3 +++
src/window-commands.c | 11 ++++-------
4 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/src/ephy-pages-view.c b/src/ephy-pages-view.c
index 63dd0ab65..87a334b84 100644
--- a/src/ephy-pages-view.c
+++ b/src/ephy-pages-view.c
@@ -89,9 +89,16 @@ selected_page_changed_cb (HdyTabView *tab_view,
EphyPagesView *self)
{
HdyTabPage *page = hdy_tab_view_get_selected_page (tab_view);
- gint position = hdy_tab_view_get_page_position (tab_view, page);
+ gint position;
GtkListBoxRow *row;
+ if (!page) {
+ gtk_list_box_unselect_all (self->list_box);
+
+ return;
+ }
+
+ position = hdy_tab_view_get_page_position (tab_view, page);
row = gtk_list_box_get_row_at_index (self->list_box, position);
gtk_list_box_select_row (self->list_box, row);
}
diff --git a/src/ephy-tab-view.c b/src/ephy-tab-view.c
index acd23cf0d..af3bd0460 100644
--- a/src/ephy-tab-view.c
+++ b/src/ephy-tab-view.c
@@ -59,7 +59,8 @@ notify_selected_page_cb (EphyTabView *self)
{
HdyTabPage *page = hdy_tab_view_get_selected_page (self->tab_view);
- hdy_tab_page_set_needs_attention (page, FALSE);
+ if (page)
+ hdy_tab_page_set_needs_attention (page, FALSE);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SELECTED_INDEX]);
}
@@ -264,6 +265,9 @@ ephy_tab_view_get_selected_index (EphyTabView *self)
{
HdyTabPage *page = hdy_tab_view_get_selected_page (self->tab_view);
+ if (!page)
+ return -1;
+
return hdy_tab_view_get_page_position (self->tab_view, page);
}
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 3498f03ea..f7d7390e8 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -3029,6 +3029,9 @@ tab_view_notify_selected_page_cb (EphyWindow *window)
page_num = ephy_tab_view_get_selected_index (window->tab_view);
+ if (page_num < 0)
+ return;
+
LOG ("switch-page tab view %p position %d\n", window->tab_view, page_num);
/* get the new tab */
diff --git a/src/window-commands.c b/src/window-commands.c
index d7bdb2a16..3feb7e214 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1180,17 +1180,14 @@ window_cmd_stop (GSimpleAction *action,
static void
check_tab_has_modified_forms_and_reload_cb (EphyWebView *view,
GAsyncResult *result,
- gpointer user_data)
+ EphyEmbed *embed)
{
- EphyWindow *window = EPHY_WINDOW (user_data);
- EphyEmbed *embed;
+ EphyWindow *window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
GtkWidget *dialog;
GtkWidget *button;
gboolean has_modified_forms;
int response = GTK_RESPONSE_ACCEPT;
- embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
-
has_modified_forms = ephy_web_view_has_modified_forms_finish (view, result, NULL);
if (has_modified_forms) {
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
@@ -1220,7 +1217,7 @@ check_tab_has_modified_forms_and_reload_cb (EphyWebView *view,
webkit_web_view_reload (view);
}
- g_object_unref (window);
+ g_object_unref (embed);
}
void
@@ -1237,7 +1234,7 @@ window_cmd_reload (GSimpleAction *action,
ephy_web_view_has_modified_forms (ephy_embed_get_web_view (embed),
NULL,
(GAsyncReadyCallback)check_tab_has_modified_forms_and_reload_cb,
- g_object_ref (window));
+ g_object_ref (embed));
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]