[gnome-builder] newcomers: add language tags
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] newcomers: add language tags
- Date: Sun, 17 Dec 2017 23:28:58 +0000 (UTC)
commit 721b985c850471a5c07586723a81f02ffe3862e9
Author: Christian Hergert <chergert redhat com>
Date: Sun Dec 17 15:28:40 2017 -0800
newcomers: add language tags
src/plugins/newcomers/gbp-newcomers-project.c | 37 ++++++++++++++++++++++++
src/plugins/newcomers/gbp-newcomers-project.ui | 22 ++++++++++++--
src/plugins/newcomers/gbp-newcomers-section.ui | 11 +++++++
3 files changed, 67 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/newcomers/gbp-newcomers-project.c b/src/plugins/newcomers/gbp-newcomers-project.c
index 6131b32..9f04f04 100644
--- a/src/plugins/newcomers/gbp-newcomers-project.c
+++ b/src/plugins/newcomers/gbp-newcomers-project.c
@@ -18,6 +18,8 @@
#define G_LOG_DOMAIN "gbp-newcomers-project"
+#include <dazzle.h>
+
#include "gbp-newcomers-project.h"
struct _GbpNewcomersProject
@@ -28,11 +30,13 @@ struct _GbpNewcomersProject
GtkLabel *label;
GtkImage *icon;
+ GtkBox *tags_box;
};
enum {
PROP_0,
PROP_ICON_NAME,
+ PROP_LANGUAGES,
PROP_NAME,
PROP_URI,
N_PROPS
@@ -43,6 +47,27 @@ G_DEFINE_TYPE (GbpNewcomersProject, gbp_newcomers_project, GTK_TYPE_FLOW_BOX_CHI
static GParamSpec *properties [N_PROPS];
static void
+gbp_newcomers_project_set_languages (GbpNewcomersProject *self,
+ const gchar * const *languages)
+{
+ g_assert (GBP_IS_NEWCOMERS_PROJECT (self));
+
+ if (languages == NULL)
+ return;
+
+ for (guint i = 0; languages[i] != NULL; i++)
+ {
+ GtkWidget *tag;
+
+ tag = dzl_pill_box_new (languages[i]);
+ gtk_container_add_with_properties (GTK_CONTAINER (self->tags_box), tag,
+ "pack-type", GTK_PACK_END,
+ NULL);
+ gtk_widget_show (tag);
+ }
+}
+
+static void
gbp_newcomers_project_destroy (GtkWidget *widget)
{
GbpNewcomersProject *self = GBP_NEWCOMERS_PROJECT (widget);
@@ -89,6 +114,10 @@ gbp_newcomers_project_set_property (GObject *object,
self->uri = g_value_dup_string (value);
break;
+ case PROP_LANGUAGES:
+ gbp_newcomers_project_set_languages (self, g_value_get_boxed (value));
+ break;
+
case PROP_NAME:
gtk_label_set_label (self->label, g_value_get_string (value));
break;
@@ -127,6 +156,13 @@ gbp_newcomers_project_class_init (GbpNewcomersProjectClass *klass)
NULL,
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+ properties [PROP_LANGUAGES] =
+ g_param_spec_boxed ("languages",
+ "Languages",
+ "The programming languages of the newcomer project",
+ G_TYPE_STRV,
+ (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
properties [PROP_URI] =
g_param_spec_string ("uri",
"Uri",
@@ -140,6 +176,7 @@ gbp_newcomers_project_class_init (GbpNewcomersProjectClass *klass)
"/org/gnome/builder/plugins/newcomers-plugin/gbp-newcomers-project.ui");
gtk_widget_class_bind_template_child (widget_class, GbpNewcomersProject, label);
gtk_widget_class_bind_template_child (widget_class, GbpNewcomersProject, icon);
+ gtk_widget_class_bind_template_child (widget_class, GbpNewcomersProject, tags_box);
}
static void
diff --git a/src/plugins/newcomers/gbp-newcomers-project.ui b/src/plugins/newcomers/gbp-newcomers-project.ui
index 699c87a..c676308 100644
--- a/src/plugins/newcomers/gbp-newcomers-project.ui
+++ b/src/plugins/newcomers/gbp-newcomers-project.ui
@@ -9,10 +9,26 @@
<property name="spacing">6</property>
<property name="visible">true</property>
<child>
- <object class="GtkImage" id="icon">
- <property name="expand">true</property>
- <property name="pixel-size">96</property>
+ <object class="GtkOverlay">
<property name="visible">true</property>
+ <child>
+ <object class="GtkImage" id="icon">
+ <property name="expand">true</property>
+ <property name="pixel-size">96</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ <child type="overlay">
+ <object class="GtkBox" id="tags_box">
+ <property name="orientation">horizontal</property>
+ <property name="spacing">3</property>
+ <property name="margin-right">6</property>
+ <property name="margin-bottom">9</property>
+ <property name="valign">end</property>
+ <property name="vexpand">true</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
</object>
</child>
<child>
diff --git a/src/plugins/newcomers/gbp-newcomers-section.ui b/src/plugins/newcomers/gbp-newcomers-section.ui
index 0778a16..7380e2f 100644
--- a/src/plugins/newcomers/gbp-newcomers-section.ui
+++ b/src/plugins/newcomers/gbp-newcomers-section.ui
@@ -33,6 +33,8 @@
<property name="icon-name">org.gnome.Polari</property>
<property name="uri">https://gitlab.gnome.org/GNOME/polari.git</property>
<property name="visible">true</property>
+ <property name="languages">C
+JavaScript</property>
</object>
</child>
<child>
@@ -41,6 +43,8 @@
<property name="icon-name">org.gnome.Games</property>
<property name="uri">https://gitlab.gnome.org/GNOME/gnome-games.git</property>
<property name="visible">true</property>
+ <property name="languages">C
+Vala</property>
</object>
</child>
<child>
@@ -49,6 +53,8 @@
<property name="icon-name">org.gnome.Maps</property>
<property name="uri">https://git.gnome.org/browse/gnome-maps</property>
<property name="visible">true</property>
+ <property name="languages">C
+JavaScript</property>
</object>
</child>
<child>
@@ -57,6 +63,7 @@
<property name="icon-name">org.gnome.Todo</property>
<property name="uri">https://gitlab.gnome.org/GNOME/gnome-todo.git</property>
<property name="visible">true</property>
+ <property name="languages">C</property>
</object>
</child>
<child>
@@ -65,6 +72,7 @@
<property name="icon-name">org.gnome.Music</property>
<property name="uri">https://gitlab.gnome.org/GNOME/gnome-music.git</property>
<property name="visible">true</property>
+ <property name="languages">Python</property>
</object>
</child>
<child>
@@ -73,6 +81,7 @@
<property name="icon-name">org.gnome.Nautilus</property>
<property name="uri">https://gitlab.gnome.org/GNOME/nautilus.git</property>
<property name="visible">true</property>
+ <property name="languages">C</property>
</object>
</child>
<child>
@@ -81,6 +90,7 @@
<property name="icon-name">org.gnome.Photos</property>
<property name="uri">https://gitlab.gnome.org/GNOME/gnome-photos.git</property>
<property name="visible">true</property>
+ <property name="languages">C</property>
</object>
</child>
<child>
@@ -89,6 +99,7 @@
<property name="icon-name">org.gnome.Calendar</property>
<property name="uri">https://gitlab.gnome.org/GNOME/gnome-calendar.git</property>
<property name="visible">true</property>
+ <property name="languages">C</property>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]