[libhandy/tabs: 19/62] Fixed the popover thing
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/tabs: 19/62] Fixed the popover thing
- Date: Sat, 12 Sep 2020 19:27:43 +0000 (UTC)
commit 045f824af468ab4efa2239d8609601cfe75c6ac6
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sun Sep 6 03:01:47 2020 +0500
Fixed the popover thing
src/hdy-tab-box.c | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/src/hdy-tab-box.c b/src/hdy-tab-box.c
index 170591b0..9c41241c 100644
--- a/src/hdy-tab-box.c
+++ b/src/hdy-tab-box.c
@@ -1855,7 +1855,6 @@ detach_into_new_window (HdyTabBox *self,
page = source_tab_box->detached_page;
- // FIXME
g_signal_emit_by_name (source_tab_box->view, "create-window", &new_view);
if (!HDY_IS_TAB_VIEW (new_view))
@@ -2010,16 +2009,27 @@ resize_drag_icon (HdyTabBox *self,
/* Context menu */
+static gboolean
+reset_setup_menu_cb (HdyTabBox *self)
+{
+ g_signal_emit_by_name (self->view, "setup-menu", NULL);
+
+ return G_SOURCE_REMOVE;
+}
+
static void
-touch_menu_visible_cb (HdyTabBox *self)
+touch_menu_notify_visible_cb (HdyTabBox *self)
{
if (!self->touch_menu || gtk_widget_get_visible (GTK_WIDGET (self->touch_menu)))
return;
- gtk_widget_destroy (GTK_WIDGET (self->touch_menu));
- self->touch_menu = NULL;
+ g_idle_add ((GSourceFunc) reset_setup_menu_cb, self);
+}
- g_signal_emit_by_name (self->view, "setup-menu", NULL);
+static void
+destroy_cb (HdyTabBox *self)
+{
+ self->touch_menu = NULL;
}
static void
@@ -2031,15 +2041,18 @@ do_touch_popup (HdyTabBox *self,
if (!G_IS_MENU_MODEL (model))
return;
- // FIXME
g_signal_emit_by_name (self->view, "setup-menu", info->page);
if (!self->touch_menu) {
self->touch_menu = GTK_POPOVER (gtk_popover_new_from_model (GTK_WIDGET (info->tab), model));
g_signal_connect_object (self->touch_menu, "notify::visible",
- G_CALLBACK (touch_menu_visible_cb), self,
- G_CONNECT_SWAPPED);
+ G_CALLBACK (touch_menu_notify_visible_cb), self,
+ G_CONNECT_AFTER | G_CONNECT_SWAPPED);
+
+ g_signal_connect_object (self->touch_menu, "destroy",
+ G_CALLBACK (destroy_cb), self,
+ G_CONNECT_AFTER | G_CONNECT_SWAPPED);
} else
gtk_popover_set_relative_to (self->touch_menu, GTK_WIDGET (info->tab));
@@ -2070,7 +2083,7 @@ popup_menu_deactivate_cb (HdyTabBox *self)
self->hovering = FALSE;
update_hover (self);
- g_signal_emit_by_name (self->view, "setup-menu", NULL);
+ g_idle_add ((GSourceFunc) reset_setup_menu_cb, self);
}
static void
@@ -2083,7 +2096,6 @@ do_popup (HdyTabBox *self,
if (!G_IS_MENU_MODEL (model))
return;
- // FIXME
g_signal_emit_by_name (self->view, "setup-menu", info->page);
if (!self->context_menu) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]