[gnome-builder] libide/tweaks: add IdeTweaksPanelList



commit 4e73230dec3a97a207d7cce8aeb642450d546269
Author: Christian Hergert <chergert redhat com>
Date:   Mon Aug 1 19:02:33 2022 -0700

    libide/tweaks: add IdeTweaksPanelList
    
    Adds scaffolding for panel list for sidebar.

 src/libide/tweaks/ide-tweaks-panel-list-private.h |  33 +++++++
 src/libide/tweaks/ide-tweaks-panel-list.c         | 102 ++++++++++++++++++++++
 src/libide/tweaks/ide-tweaks-panel-list.ui        |  23 +++++
 src/libide/tweaks/ide-tweaks-window.c             |   2 +
 src/libide/tweaks/ide-tweaks-window.ui            |   3 +
 src/libide/tweaks/libide-tweaks.gresource.xml     |   1 +
 src/libide/tweaks/meson.build                     |   1 +
 7 files changed, 165 insertions(+)
---
diff --git a/src/libide/tweaks/ide-tweaks-panel-list-private.h 
b/src/libide/tweaks/ide-tweaks-panel-list-private.h
new file mode 100644
index 000000000..a7cef389a
--- /dev/null
+++ b/src/libide/tweaks/ide-tweaks-panel-list-private.h
@@ -0,0 +1,33 @@
+/* ide-tweaks-panel-list-private.h
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <adwaita.h>
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_TWEAKS_PANEL_LIST (ide_tweaks_panel_list_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeTweaksPanelList, ide_tweaks_panel_list, IDE, TWEAKS_PANEL_LIST, AdwBin)
+
+GtkWidget *ide_tweaks_panel_list_new (void);
+
+G_END_DECLS
diff --git a/src/libide/tweaks/ide-tweaks-panel-list.c b/src/libide/tweaks/ide-tweaks-panel-list.c
new file mode 100644
index 000000000..f024809d2
--- /dev/null
+++ b/src/libide/tweaks/ide-tweaks-panel-list.c
@@ -0,0 +1,102 @@
+/* ide-tweaks-panel-list.c
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "ide-tweaks-panel-list"
+
+#include "config.h"
+
+#include "ide-tweaks-panel-list-private.h"
+
+struct _IdeTweaksPanelList
+{
+  AdwBin parent_instance;
+};
+
+enum {
+  PROP_0,
+  N_PROPS
+};
+
+G_DEFINE_FINAL_TYPE (IdeTweaksPanelList, ide_tweaks_panel_list, ADW_TYPE_BIN)
+
+static GParamSpec *properties [N_PROPS];
+
+static void
+ide_tweaks_panel_list_dispose (GObject *object)
+{
+  IdeTweaksPanelList *self = (IdeTweaksPanelList *)object;
+
+  G_OBJECT_CLASS (ide_tweaks_panel_list_parent_class)->dispose (object);
+}
+
+static void
+ide_tweaks_panel_list_get_property (GObject    *object,
+                                    guint       prop_id,
+                                    GValue     *value,
+                                    GParamSpec *pspec)
+{
+  IdeTweaksPanelList *self = IDE_TWEAKS_PANEL_LIST (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_tweaks_panel_list_set_property (GObject      *object,
+                                    guint         prop_id,
+                                    const GValue *value,
+                                    GParamSpec   *pspec)
+{
+  IdeTweaksPanelList *self = IDE_TWEAKS_PANEL_LIST (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_tweaks_panel_list_class_init (IdeTweaksPanelListClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->dispose = ide_tweaks_panel_list_dispose;
+  object_class->get_property = ide_tweaks_panel_list_get_property;
+  object_class->set_property = ide_tweaks_panel_list_set_property;
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/libide-tweaks/ide-tweaks-panel-list.ui");
+}
+
+static void
+ide_tweaks_panel_list_init (IdeTweaksPanelList *self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+GtkWidget *
+ide_tweaks_panel_list_new (void)
+{
+  return g_object_new (IDE_TYPE_TWEAKS_PANEL_LIST, NULL);
+}
diff --git a/src/libide/tweaks/ide-tweaks-panel-list.ui b/src/libide/tweaks/ide-tweaks-panel-list.ui
new file mode 100644
index 000000000..67eb9d7be
--- /dev/null
+++ b/src/libide/tweaks/ide-tweaks-panel-list.ui
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="IdeTweaksPanelList" parent="AdwBin">
+    <child>
+      <object class="GtkStack" id="stack">
+        <property name="vhomogeneous">False</property>
+        <property name="hhomogeneous">True</property>
+        <property name="transition-type">slide-left-right</property>
+        <child>
+          <object class="GtkStackPage">
+            <property name="child">
+              <object class="GtkListBox" id="main_list">
+                <style>
+                  <class name="navigation-sidebar"/>
+                </style>
+              </object>
+            </property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/libide/tweaks/ide-tweaks-window.c b/src/libide/tweaks/ide-tweaks-window.c
index 873eb12b4..c943d2f96 100644
--- a/src/libide/tweaks/ide-tweaks-window.c
+++ b/src/libide/tweaks/ide-tweaks-window.c
@@ -23,6 +23,7 @@
 #include "config.h"
 
 #include "ide-tweaks-panel-private.h"
+#include "ide-tweaks-panel-list-private.h"
 #include "ide-tweaks-window.h"
 
 struct _IdeTweaksWindow
@@ -109,6 +110,7 @@ ide_tweaks_window_class_init (IdeTweaksWindowClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/libide-tweaks/ide-tweaks-window.ui");
 
   g_type_ensure (IDE_TYPE_TWEAKS_PANEL);
+  g_type_ensure (IDE_TYPE_TWEAKS_PANEL_LIST);
 }
 
 static void
diff --git a/src/libide/tweaks/ide-tweaks-window.ui b/src/libide/tweaks/ide-tweaks-window.ui
index 535738505..c676807db 100644
--- a/src/libide/tweaks/ide-tweaks-window.ui
+++ b/src/libide/tweaks/ide-tweaks-window.ui
@@ -81,6 +81,9 @@
                 <child>
                   <object class="GtkViewport">
                     <property name="scroll-to-focus">true</property>
+                    <child>
+                      <object class="IdeTweaksPanelList" id="list"/>
+                    </child>
                   </object>
                 </child>
               </object>
diff --git a/src/libide/tweaks/libide-tweaks.gresource.xml b/src/libide/tweaks/libide-tweaks.gresource.xml
index 3703ace42..87955e1a8 100644
--- a/src/libide/tweaks/libide-tweaks.gresource.xml
+++ b/src/libide/tweaks/libide-tweaks.gresource.xml
@@ -2,6 +2,7 @@
 <gresources>
   <gresource prefix="/org/gnome/libide-tweaks">
     <file preprocess="xml-stripblanks">ide-tweaks-panel.ui</file>
+    <file preprocess="xml-stripblanks">ide-tweaks-panel-list.ui</file>
     <file preprocess="xml-stripblanks">ide-tweaks-window.ui</file>
   </gresource>
 </gresources>
diff --git a/src/libide/tweaks/meson.build b/src/libide/tweaks/meson.build
index 880d48fa3..a6a5762fa 100644
--- a/src/libide/tweaks/meson.build
+++ b/src/libide/tweaks/meson.build
@@ -42,6 +42,7 @@ libide_tweaks_public_sources = [
 libide_tweaks_private_sources = [
   'ide-tweaks-init.c',
   'ide-tweaks-panel.c',
+  'ide-tweaks-panel-list.c',
 ]
 
 #


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]