[libpanel/wip/chergert/fix-14] layout: stub out layout widget



commit cddf4ed768eaaa258c70d2c78050dba8c8753af2
Author: Christian Hergert <chergert redhat com>
Date:   Sat Sep 10 18:06:21 2022 -0700

    layout: stub out layout widget

 src/libpanel.h     |  1 +
 src/meson.build    |  2 ++
 src/panel-layout.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/panel-layout.h | 39 ++++++++++++++++++++++++++++
 4 files changed, 118 insertions(+)
---
diff --git a/src/libpanel.h b/src/libpanel.h
index 5d01ccb..550057a 100644
--- a/src/libpanel.h
+++ b/src/libpanel.h
@@ -31,6 +31,7 @@
 # include "panel-grid.h"
 # include "panel-grid-column.h"
 # include "panel-init.h"
+# include "panel-layout.h"
 # include "panel-omni-bar.h"
 # include "panel-paned.h"
 # include "panel-position.h"
diff --git a/src/meson.build b/src/meson.build
index b018115..a625a0b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -40,6 +40,7 @@ libpanel_sources = [
   'panel-grid.c',
   'panel-grid-column.c',
   'panel-init.c',
+  'panel-layout.c',
   'panel-omni-bar.c',
   'panel-paned.c',
   'panel-position.c',
@@ -62,6 +63,7 @@ libpanel_headers = [
   'panel-grid.h',
   'panel-grid-column.h',
   'panel-init.h',
+  'panel-layout.h',
   'panel-omni-bar.h',
   'panel-paned.h',
   'panel-position.h',
diff --git a/src/panel-layout.c b/src/panel-layout.c
new file mode 100644
index 0000000..e2abed3
--- /dev/null
+++ b/src/panel-layout.c
@@ -0,0 +1,76 @@
+/* panel-layout.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
+ */
+
+#include "config.h"
+
+#include "panel-layout.h"
+
+struct _PanelLayout
+{
+  GObject    parent_instance;
+  GPtrArray *widgets;
+};
+
+G_DEFINE_FINAL_TYPE (PanelLayout, panel_layout, G_TYPE_OBJECT)
+
+static void
+panel_layout_dispose (GObject *object)
+{
+  PanelLayout *self = (PanelLayout *)object;
+
+  g_clear_pointer (&self->widgets, g_ptr_array_unref);
+
+  G_OBJECT_CLASS (panel_layout_parent_class)->dispose (object);
+}
+
+static void
+panel_layout_class_init (PanelLayoutClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->dispose = panel_layout_dispose;
+}
+
+static void
+panel_layout_init (PanelLayout *self)
+{
+  self->widgets = g_ptr_array_new ();
+}
+
+GVariant *
+panel_layout_to_variant (PanelLayout *self)
+{
+  g_return_val_if_fail (PANEL_IS_LAYOUT (self), NULL);
+
+  return NULL;
+}
+
+PanelLayout *
+panel_layout_new_from_variant (GVariant *variant)
+{
+  PanelLayout *self;
+
+  g_return_val_if_fail (variant != NULL, NULL);
+  g_return_val_if_fail (g_variant_is_of_type (variant, G_VARIANT_TYPE_VARDICT), NULL);
+
+  self = g_object_new (PANEL_TYPE_LAYOUT, NULL);
+
+  return self;
+}
diff --git a/src/panel-layout.h b/src/panel-layout.h
new file mode 100644
index 0000000..e1b9509
--- /dev/null
+++ b/src/panel-layout.h
@@ -0,0 +1,39 @@
+/* panel-layout.h
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This file is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option)
+ * any later version.
+ *
+ * This file 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 Lesser 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: LGPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <glib-object.h>
+
+#include "panel-version-macros.h"
+
+G_BEGIN_DECLS
+
+#define PANEL_TYPE_LAYOUT (panel_layout_get_type())
+
+PANEL_AVAILABLE_IN_ALL
+G_DECLARE_FINAL_TYPE (PanelLayout, panel_layout, PANEL, LAYOUT, GObject)
+
+PANEL_AVAILABLE_IN_ALL
+PanelLayout *panel_layout_new_from_variant (GVariant    *variant);
+PANEL_AVAILABLE_IN_ALL
+GVariant    *panel_layout_to_variant       (PanelLayout *self);
+
+G_END_DECLS


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