[recipes/recipe-link: 1/8] Add a built-with-builder logo
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes/recipe-link: 1/8] Add a built-with-builder logo
- Date: Thu, 29 Dec 2016 16:21:13 +0000 (UTC)
commit 4073153ff2effa7bcab100948acfc2805ffbbbfe
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 29 08:42:14 2016 -0500
Add a built-with-builder logo
We're doing some pretty bad things to get this into GtkAboutDialog
here. This needs to be properly integrated eventually.
src/built-with-builder.png | Bin 0 -> 1672 bytes
src/gr-app.c | 76 ++++++++++++++++++++++++++++++++++++-
src/recipes-images.gresource.xml | 1 +
3 files changed, 74 insertions(+), 3 deletions(-)
---
diff --git a/src/built-with-builder.png b/src/built-with-builder.png
new file mode 100644
index 0000000..e8636fc
Binary files /dev/null and b/src/built-with-builder.png differ
diff --git a/src/gr-app.c b/src/gr-app.c
index e1c798d..1b9d507 100644
--- a/src/gr-app.c
+++ b/src/gr-app.c
@@ -75,6 +75,71 @@ preferences_activated (GSimpleAction *action,
gtk_window_present (GTK_WINDOW (prefs));
}
+static GtkWidget *
+find_child_with_name (GtkWidget *parent,
+ const char *name)
+{
+ GList *children, *l;
+ GtkWidget *result = NULL;
+
+ children = gtk_container_get_children (GTK_CONTAINER (parent));
+ for (l = children; l; l = l->next) {
+ GtkWidget *child = l->data;
+
+ if (g_strcmp0 (gtk_buildable_get_name (GTK_BUILDABLE (child)), name) == 0) {
+ result = child;
+ break;
+ }
+ }
+ g_list_free (children);
+
+ if (result == NULL)
+ g_warning ("Didn't find %s in GtkAboutDialog\n", name);
+ return result;
+}
+
+static void
+add_built_logo (GtkAboutDialog *about)
+{
+ GtkWidget *content;
+ GtkWidget *box;
+ GtkWidget *stack;
+ GtkWidget *page_vbox;
+ GtkWidget *license_label;
+ GtkWidget *copyright_label;
+ GtkWidget *image;
+
+ content = gtk_dialog_get_content_area (GTK_DIALOG (about));
+ box = find_child_with_name (content, "box");
+ stack = find_child_with_name (box, "stack");
+ page_vbox = find_child_with_name (stack, "page_vbox");
+ license_label = find_child_with_name (page_vbox, "license_label");
+ copyright_label = find_child_with_name (page_vbox, "copyright_label");
+
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
+ gtk_widget_show (box);
+ image = gtk_image_new_from_resource ("/org/gnome/Recipes/built-with-builder.png");
+ gtk_widget_set_valign (image, GTK_ALIGN_END);
+ gtk_widget_show (image);
+ gtk_box_pack_start (GTK_BOX (box), image, FALSE, TRUE, 0);
+
+ g_object_ref (license_label);
+ g_object_ref (copyright_label);
+
+ gtk_container_remove (GTK_CONTAINER (page_vbox), license_label);
+ gtk_container_remove (GTK_CONTAINER (page_vbox), copyright_label);
+
+ gtk_box_pack_start (GTK_BOX (box), license_label, TRUE, TRUE, 0);
+ gtk_label_set_justify (GTK_LABEL (license_label), GTK_JUSTIFY_LEFT);
+ gtk_widget_set_valign (license_label, GTK_ALIGN_END);
+
+ gtk_container_add (GTK_CONTAINER (page_vbox), copyright_label);
+ gtk_container_add (GTK_CONTAINER (page_vbox), box);
+
+ g_object_unref (license_label);
+ g_object_unref (copyright_label);
+}
+
static void
about_activated (GSimpleAction *action,
GVariant *parameter,
@@ -122,13 +187,18 @@ about_activated (GSimpleAction *action,
"translator-credits", _("translator-credits"),
"logo", logo,
"title", _("About GNOME Recipes"),
+ "website", "https://wiki.gnome.org/Apps/Recipes",
+ "website-label", _("Learn more about GNOME Recipes"),
NULL);
if (first_time) {
+ GtkAboutDialog *dialog;
+
first_time = FALSE;
- gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (g_object_get_data (G_OBJECT (win),
"gtk-about-dialog")),
- _("Recipes by"),
- recipe_authors);
+
+ dialog = GTK_ABOUT_DIALOG (g_object_get_data (G_OBJECT (win), "gtk-about-dialog"));
+ gtk_about_dialog_add_credit_section (dialog, _("Recipes by"), recipe_authors);
+ add_built_logo (dialog);
}
}
diff --git a/src/recipes-images.gresource.xml b/src/recipes-images.gresource.xml
index bf642a7..b0d307d 100644
--- a/src/recipes-images.gresource.xml
+++ b/src/recipes-images.gresource.xml
@@ -24,5 +24,6 @@
<file>icons/32x32/apps/spicy-content-symbolic.symbolic.png</file>
<file>icons/48x48/apps/spicy-content-symbolic.symbolic.png</file>
<file>icons/symbolic/apps/spicy-content-symbolic.svg</file>
+ <file>built-with-builder.png</file>
</gresource>
</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]