[libhandy/tabs: 12/62] Progress
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/tabs: 12/62] Progress
- Date: Sat, 12 Sep 2020 19:27:43 +0000 (UTC)
commit 4b2a9fe0289996d67e8083cc6226d9464cb32786
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sat Sep 5 03:06:11 2020 +0500
Progress
src/hdy-tab-box.c | 26 ++++++++++++++++++++++----
src/hdy-tab-view.c | 7 ++++---
2 files changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/src/hdy-tab-box.c b/src/hdy-tab-box.c
index ed85cc9d..37aa5c26 100644
--- a/src/hdy-tab-box.c
+++ b/src/hdy-tab-box.c
@@ -1987,6 +1987,18 @@ resize_drag_icon (HdyTabBox *self,
/* Context menu */
+static void
+touch_menu_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_signal_emit_by_name (self->view, "setup-menu", NULL);
+}
+
static void
do_touch_popup (HdyTabBox *self,
TabInfo *info)
@@ -1997,11 +2009,15 @@ do_touch_popup (HdyTabBox *self,
return;
// FIXME
- g_signal_emit_by_name (self->view, "setup-menu", info->page, NULL);
+ g_signal_emit_by_name (self->view, "setup-menu", info->page);
- if (!self->touch_menu)
+ if (!self->touch_menu) {
self->touch_menu = GTK_POPOVER (gtk_popover_new_from_model (GTK_WIDGET (info->tab), model));
- else
+
+ g_signal_connect_object (self->touch_menu, "notify::visible",
+ G_CALLBACK (touch_menu_visible_cb), self,
+ G_CONNECT_SWAPPED);
+ } else
gtk_popover_set_relative_to (self->touch_menu, GTK_WIDGET (info->tab));
gtk_popover_popup (self->touch_menu);
@@ -2030,6 +2046,8 @@ popup_menu_deactivate_cb (HdyTabBox *self)
{
self->hovering = FALSE;
update_hover (self);
+
+ g_signal_emit_by_name (self->view, "setup-menu", NULL);
}
static void
@@ -2043,7 +2061,7 @@ do_popup (HdyTabBox *self,
return;
// FIXME
- g_signal_emit_by_name (self->view, "setup-menu", info->page, NULL);
+ g_signal_emit_by_name (self->view, "setup-menu", info->page);
if (!self->context_menu) {
self->context_menu = GTK_MENU (gtk_menu_new_from_model (model));
diff --git a/src/hdy-tab-view.c b/src/hdy-tab-view.c
index 9a02380a..f7932ae1 100644
--- a/src/hdy-tab-view.c
+++ b/src/hdy-tab-view.c
@@ -528,7 +528,7 @@ detach_page (HdyTabView *self,
gtk_container_remove (GTK_CONTAINER (self->stack),
hdy_tab_page_get_content (page));
- g_signal_emit (self, signals[SIGNAL_PAGE_REMOVED], 0, page);
+ g_signal_emit (self, signals[SIGNAL_PAGE_REMOVED], 0, page, pos);
check_close_window (self);
}
@@ -929,6 +929,7 @@ hdy_tab_view_class_init (HdyTabViewClass *klass)
* HdyTabView::page-removed:
* @self: a #HdyTabView
* @page: TBD
+ * @position: TBD
*
* TBD
*
@@ -941,8 +942,8 @@ hdy_tab_view_class_init (HdyTabViewClass *klass)
0,
NULL, NULL, NULL,
G_TYPE_NONE,
- 1,
- HDY_TYPE_TAB_PAGE);
+ 2,
+ HDY_TYPE_TAB_PAGE, G_TYPE_INT);
/**
* HdyTabView::page-reordered:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]