[gnome-builder] libide/tweaks: add IdeTweaksPanelList::page-activated signal
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/tweaks: add IdeTweaksPanelList::page-activated signal
- Date: Wed, 3 Aug 2022 05:49:32 +0000 (UTC)
commit bed154e4cbe5e5460abf371c888d7532bed32831
Author: Christian Hergert <chergert redhat com>
Date: Tue Aug 2 22:28:38 2022 -0700
libide/tweaks: add IdeTweaksPanelList::page-activated signal
src/libide/tweaks/ide-tweaks-panel-list.c | 35 ++++++++++++++++++++++++++++++
src/libide/tweaks/ide-tweaks-panel-list.ui | 1 +
2 files changed, 36 insertions(+)
---
diff --git a/src/libide/tweaks/ide-tweaks-panel-list.c b/src/libide/tweaks/ide-tweaks-panel-list.c
index 30ebeec44..803fb39db 100644
--- a/src/libide/tweaks/ide-tweaks-panel-list.c
+++ b/src/libide/tweaks/ide-tweaks-panel-list.c
@@ -44,9 +44,15 @@ enum {
N_PROPS
};
+enum {
+ PAGE_ACTIVATED,
+ N_SIGNALS
+};
+
G_DEFINE_FINAL_TYPE (IdeTweaksPanelList, ide_tweaks_panel_list, ADW_TYPE_BIN)
static GParamSpec *properties [N_PROPS];
+static guint signals [N_SIGNALS];
static void
ide_tweaks_panel_list_header_func (IdeTweaksPanelListRow *row,
@@ -73,6 +79,25 @@ ide_tweaks_panel_list_header_func (IdeTweaksPanelListRow *row,
gtk_list_box_row_set_header (GTK_LIST_BOX_ROW (row), header);
}
+static void
+ide_tweaks_panel_list_row_activated_cb (IdeTweaksPanelList *self,
+ IdeTweaksPanelListRow *row,
+ GtkListBox *list_box)
+{
+ IdeTweaksItem *page;
+
+ g_assert (IDE_IS_TWEAKS_PANEL_LIST (self));
+ g_assert (IDE_IS_TWEAKS_PANEL_LIST_ROW (row));
+ g_assert (GTK_IS_LIST_BOX (list_box));
+
+ page = ide_tweaks_panel_list_row_get_item (row);
+
+ g_assert (page != NULL);
+ g_assert (IDE_IS_TWEAKS_PAGE (page));
+
+ g_signal_emit (self, signals [PAGE_ACTIVATED], 0, page);
+}
+
static void
ide_tweaks_panel_list_dispose (GObject *object)
{
@@ -138,6 +163,16 @@ ide_tweaks_panel_list_class_init (IdeTweaksPanelListClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/libide-tweaks/ide-tweaks-panel-list.ui");
gtk_widget_class_bind_template_child (widget_class, IdeTweaksPanelList, list_box);
+ gtk_widget_class_bind_template_callback (widget_class, ide_tweaks_panel_list_row_activated_cb);
+
+ signals [PAGE_ACTIVATED] =
+ g_signal_new ("page-activated",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE, 1, IDE_TYPE_TWEAKS_PAGE);
}
static void
diff --git a/src/libide/tweaks/ide-tweaks-panel-list.ui b/src/libide/tweaks/ide-tweaks-panel-list.ui
index 48b59b133..ddf1e5837 100644
--- a/src/libide/tweaks/ide-tweaks-panel-list.ui
+++ b/src/libide/tweaks/ide-tweaks-panel-list.ui
@@ -6,6 +6,7 @@
<property name="hscrollbar-policy">never</property>
<child>
<object class="GtkListBox" id="list_box">
+ <signal name="row-activated" handler="ide_tweaks_panel_list_row_activated_cb" swapped="true"
object="IdeTweaksPanelList"/>
<style>
<class name="navigation-sidebar"/>
</style>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]