[gnome-builder] libide/tweaks: add icon-name to subpage
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/tweaks: add icon-name to subpage
- Date: Sun, 31 Jul 2022 19:19:46 +0000 (UTC)
commit 019e73122797e08c2df115b4d4a445420ed66c96
Author: Christian Hergert <chergert redhat com>
Date: Sun Jul 31 12:19:07 2022 -0700
libide/tweaks: add icon-name to subpage
src/libide/tweaks/ide-tweaks-subpage.c | 34 ++++++++++++++++++++++++++++++++++
src/libide/tweaks/ide-tweaks-subpage.h | 13 +++++++++----
2 files changed, 43 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/tweaks/ide-tweaks-subpage.c b/src/libide/tweaks/ide-tweaks-subpage.c
index e04f8abc0..d947358e6 100644
--- a/src/libide/tweaks/ide-tweaks-subpage.c
+++ b/src/libide/tweaks/ide-tweaks-subpage.c
@@ -28,6 +28,7 @@
struct _IdeTweaksSubpage
{
IdeTweaksItem parent_instance;
+ char *icon_name;
char *title;
};
@@ -35,6 +36,7 @@ G_DEFINE_FINAL_TYPE (IdeTweaksSubpage, ide_tweaks_subpage, IDE_TYPE_TWEAKS_ITEM)
enum {
PROP_0,
+ PROP_ICON_NAME,
PROP_TITLE,
N_PROPS
};
@@ -59,6 +61,7 @@ ide_tweaks_subpage_dispose (GObject *object)
{
IdeTweaksSubpage *self = (IdeTweaksSubpage *)object;
+ g_clear_pointer (&self->icon_name, g_free);
g_clear_pointer (&self->title, g_free);
G_OBJECT_CLASS (ide_tweaks_subpage_parent_class)->dispose (object);
@@ -74,6 +77,10 @@ ide_tweaks_subpage_get_property (GObject *object,
switch (prop_id)
{
+ case PROP_ICON_NAME:
+ g_value_set_string (value, ide_tweaks_subpage_get_icon_name (self));
+ break;
+
case PROP_TITLE:
g_value_set_string (value, ide_tweaks_subpage_get_title (self));
break;
@@ -93,6 +100,10 @@ ide_tweaks_subpage_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_ICON_NAME:
+ ide_tweaks_subpage_set_icon_name (self, g_value_get_object (value));
+ break;
+
case PROP_TITLE:
ide_tweaks_subpage_set_title (self, g_value_get_string (value));
break;
@@ -114,6 +125,11 @@ ide_tweaks_subpage_class_init (IdeTweaksSubpageClass *klass)
item_class->accepts = ide_tweaks_subpage_accepts;
+ properties[PROP_ICON_NAME] =
+ g_param_spec_string ("icon-name", NULL, NULL,
+ NULL,
+ (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
+
properties [PROP_TITLE] =
g_param_spec_string ("title", NULL, NULL, NULL,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
@@ -143,3 +159,21 @@ ide_tweaks_subpage_set_title (IdeTweaksSubpage *self,
if (ide_set_string (&self->title, title))
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_TITLE]);
}
+
+const char *
+ide_tweaks_subpage_get_icon_name (IdeTweaksSubpage *self)
+{
+ g_return_val_if_fail (IDE_IS_TWEAKS_SUBPAGE (self), NULL);
+
+ return self->icon_name;
+}
+
+void
+ide_tweaks_subpage_set_icon_name (IdeTweaksSubpage *self,
+ const char *icon_name)
+{
+ g_return_if_fail (IDE_IS_TWEAKS_SUBPAGE (self));
+
+ if (ide_set_string (&self->icon_name, icon_name))
+ g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_ICON_NAME]);
+}
diff --git a/src/libide/tweaks/ide-tweaks-subpage.h b/src/libide/tweaks/ide-tweaks-subpage.h
index e667e9797..d9569bf37 100644
--- a/src/libide/tweaks/ide-tweaks-subpage.h
+++ b/src/libide/tweaks/ide-tweaks-subpage.h
@@ -30,11 +30,16 @@ IDE_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (IdeTweaksSubpage, ide_tweaks_subpage, IDE, TWEAKS_SUBPAGE, IdeTweaksItem)
IDE_AVAILABLE_IN_ALL
-IdeTweaksSubpage *ide_tweaks_subpage_new (void);
+IdeTweaksSubpage *ide_tweaks_subpage_new (void);
IDE_AVAILABLE_IN_ALL
-const char *ide_tweaks_subpage_get_title (IdeTweaksSubpage *self);
+const char *ide_tweaks_subpage_get_icon_name (IdeTweaksSubpage *self);
IDE_AVAILABLE_IN_ALL
-void ide_tweaks_subpage_set_title (IdeTweaksSubpage *self,
- const char *title);
+void ide_tweaks_subpage_set_icon_name (IdeTweaksSubpage *self,
+ const char *icon_name);
+IDE_AVAILABLE_IN_ALL
+const char *ide_tweaks_subpage_get_title (IdeTweaksSubpage *self);
+IDE_AVAILABLE_IN_ALL
+void ide_tweaks_subpage_set_title (IdeTweaksSubpage *self,
+ const char *title);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]