[recipes/welcome-dialog: 3/3] Add another dialog
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes/welcome-dialog: 3/3] Add another dialog
- Date: Sun, 7 May 2017 19:26:26 +0000 (UTC)
commit a5aeabbee837f6326d74a2027f5d5ca8cfcf83bc
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 25 20:56:52 2017 -0500
Add another dialog
Similar to the other ones, for a special occasion.
src/gr-window.c | 20 ++++++++++++-
src/recipe-surprise.ui | 59 ++++++++++++++++++++++++++++++++++++++
src/recipes-images.gresource.xml | 1 +
src/recipes-ui.gresource.xml | 1 +
src/surprise.png | Bin 0 -> 70016 bytes
5 files changed, 80 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-window.c b/src/gr-window.c
index 18991bc..ee47677 100644
--- a/src/gr-window.c
+++ b/src/gr-window.c
@@ -1199,6 +1199,21 @@ gr_window_show_welcome (GrWindow *window)
gr_window_present_dialog (window, dialog);
}
+static void
+gr_window_show_surprise (GrWindow *window)
+{
+ g_autoptr(GtkBuilder) builder = NULL;
+ GtkWindow *dialog;
+ GtkWidget *button;
+
+ builder = gtk_builder_new_from_resource ("/org/gnome/Recipes/recipe-surprise.ui");
+ dialog = GTK_WINDOW (gtk_builder_get_object (builder, "dialog"));
+ button = GTK_WIDGET (gtk_builder_get_object (builder, "close_button"));
+ g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), dialog);
+ gtk_window_set_transient_for (dialog, GTK_WINDOW (window));
+ gr_window_present_dialog (window, dialog);
+}
+
void
gr_window_show_news (GrWindow *window)
{
@@ -1281,7 +1296,10 @@ show_welcome_or_news (gpointer data)
g_autofree char *new = NULL;
load_versions (&new, &old);
- if (new == NULL && old == NULL) {
+ if (g_getenv ("SURPRISE")) {
+ gr_window_show_surprise (window);
+ }
+ else if (new == NULL && old == NULL) {
save_versions (PACKAGE_VERSION, NULL);
gr_window_show_welcome (window);
}
diff --git a/src/recipe-surprise.ui b/src/recipe-surprise.ui
new file mode 100644
index 0000000..5bd575a
--- /dev/null
+++ b/src/recipe-surprise.ui
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="gnome-recipes">
+ <object class="GtkWindow" id="dialog">
+ <property name="modal">1</property>
+ <property name="resizable">0</property>
+ <property name="title" translatable="yes">Welcome</property>
+ <property name="destroy-with-parent">1</property>
+ <child type="titlebar">
+ <object class="GtkHeaderBar">
+ <property name="visible">1</property>
+ <property name="title" translatable="yes">Welcome</property>
+ <property name="show-close-button">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">1</property>
+ <property name="margin">20</property>
+ <property name="spacing">20</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="resource">/org/gnome/Recipes/surprise.png</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="label" translatable="yes">GNOME turns 20!</property>
+ <style>
+ <class name="welcome"/>
+ <class name="heading"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">1</property>
+ <property name="wrap">1</property>
+ <property name="max-width-chars">55</property>
+ <property name="width-chars">55</property>
+ <property name="label" translatable="yes">Recipes is a birthday present for GNOME for its 20th
birthday. We invitee the GNOME community all over the world to share recipes and enjoy a good meal
together.</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="close_button">
+ <property name="visible">1</property>
+ <property name="halign">center</property>
+ <property name="label" translatable="yes">Let's Party</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/src/recipes-images.gresource.xml b/src/recipes-images.gresource.xml
index fa754f1..75b6602 100644
--- a/src/recipes-images.gresource.xml
+++ b/src/recipes-images.gresource.xml
@@ -38,5 +38,6 @@
<file>help-esc-key.png</file>
<file>help-key-double-press.png</file>
<file>help-key-press.png</file>
+ <file>surprise.png</file>
</gresource>
</gresources>
diff --git a/src/recipes-ui.gresource.xml b/src/recipes-ui.gresource.xml
index ae503a5..8361db1 100644
--- a/src/recipes-ui.gresource.xml
+++ b/src/recipes-ui.gresource.xml
@@ -31,6 +31,7 @@
<file preprocess="xml-stripblanks">recipe-export-dialog.ui</file>
<file preprocess="xml-stripblanks">recipe-welcome-dialog.ui</file>
<file preprocess="xml-stripblanks">recipe-whats-new-dialog.ui</file>
+ <file preprocess="xml-stripblanks">recipe-surprise.ui</file>
</gresource>
<gresource prefix="/org/gnome/Recipes/gtk">
<file preprocess="xml-stripblanks">menus.ui</file>
diff --git a/src/surprise.png b/src/surprise.png
new file mode 100644
index 0000000..31f7b09
Binary files /dev/null and b/src/surprise.png differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]