[gnome-builder/wip/gtk4-port: 917/1774] libide/gui: add API to remove items from headerbar
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 917/1774] libide/gui: add API to remove items from headerbar
- Date: Mon, 11 Jul 2022 22:31:28 +0000 (UTC)
commit 14d013582c36c2c6b1961a7da2231a6ee05e01fc
Author: Christian Hergert <chergert redhat com>
Date: Sun May 8 12:43:20 2022 -0700
libide/gui: add API to remove items from headerbar
src/libide/gui/ide-header-bar.c | 26 ++++++++++++++++++++++++++
src/libide/gui/ide-header-bar.h | 3 +++
2 files changed, 29 insertions(+)
---
diff --git a/src/libide/gui/ide-header-bar.c b/src/libide/gui/ide-header-bar.c
index 10bfbb885..fcab48110 100644
--- a/src/libide/gui/ide-header-bar.c
+++ b/src/libide/gui/ide-header-bar.c
@@ -379,3 +379,29 @@ ide_header_bar_add (IdeHeaderBar *self,
gtk_box_insert_child_after (box, widget, sibling);
}
}
+
+void
+ide_header_bar_remove (IdeHeaderBar *self,
+ GtkWidget *widget)
+{
+ IdeHeaderBarPrivate *priv = ide_header_bar_get_instance_private (self);
+ GtkBox *box;
+
+ g_return_if_fail (IDE_IS_HEADER_BAR (self));
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+ g_return_if_fail (gtk_widget_get_ancestor (widget, IDE_TYPE_HEADER_BAR) == GTK_WIDGET (self));
+
+ box = GTK_BOX (gtk_widget_get_ancestor (widget, GTK_TYPE_BOX));
+
+ if (box == priv->left ||
+ box == priv->right ||
+ box == priv->left_of_center ||
+ box == priv->right_of_center)
+ {
+ gtk_box_remove (box, widget);
+ return;
+ }
+
+ g_warning ("Failed to locate widget of type %s within headerbar",
+ G_OBJECT_TYPE_NAME (widget));
+}
diff --git a/src/libide/gui/ide-header-bar.h b/src/libide/gui/ide-header-bar.h
index 69be5e82d..c459d67d4 100644
--- a/src/libide/gui/ide-header-bar.h
+++ b/src/libide/gui/ide-header-bar.h
@@ -56,6 +56,9 @@ void ide_header_bar_add (IdeHeaderBar *self,
int priority,
GtkWidget *widget);
IDE_AVAILABLE_IN_ALL
+void ide_header_bar_remove (IdeHeaderBar *self,
+ GtkWidget *widget);
+IDE_AVAILABLE_IN_ALL
const char *ide_header_bar_get_menu_id (IdeHeaderBar *self);
IDE_AVAILABLE_IN_ALL
void ide_header_bar_set_menu_id (IdeHeaderBar *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]