[recipes] Add a special welcome dialog
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Add a special welcome dialog
- Date: Fri, 14 Jul 2017 21:26:49 +0000 (UTC)
commit 3956fed3474240b2b5d50b79578d54de1b1f9e7f
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jul 14 17:16:42 2017 -0400
Add a special welcome dialog
Wrap the present.
po/POTFILES.in | 1 +
src/gr-app.c | 2 +
src/gr-window.c | 38 ++++++++++++++++++++++++++
src/gr-window.h | 1 +
src/recipe-surprise.ui | 65 +++++++++++++++++++++++++++++++++++++++++++++
src/recipes.gresource.xml | 2 +
src/surprise.jpg | Bin 0 -> 15567 bytes
7 files changed, 109 insertions(+), 0 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1b03ea1..4f79491 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -31,6 +31,7 @@ src/menus.ui
src/recipe-conflict-dialog.ui
src/recipe-export-dialog.ui
src/recipe-whats-new-dialog.ui
+src/recipe-surprise.ui
src/gr-about-dialog.c
src/gr-account.c
src/gr-app.c
diff --git a/src/gr-app.c b/src/gr-app.c
index 09ed38b..f019b94 100644
--- a/src/gr-app.c
+++ b/src/gr-app.c
@@ -68,6 +68,8 @@ gr_app_activate (GApplication *app)
if (!win)
win = GTK_WINDOW (gr_window_new (GR_APP (app)));
gtk_window_present (win);
+
+ gr_window_show_surprise (win);
}
static void
diff --git a/src/gr-window.c b/src/gr-window.c
index 2603a0a..cb97462 100644
--- a/src/gr-window.c
+++ b/src/gr-window.c
@@ -1500,6 +1500,44 @@ gr_release_info_new (const char *version,
return box;
}
+static gboolean
+should_show_surprise (void)
+{
+ g_autoptr(GDateTime) now = NULL;
+ g_autoptr(GDateTime) start = NULL;
+ g_autoptr(GDateTime) end = NULL;
+
+ if (g_getenv ("SHOW_SURPRISE"))
+ return TRUE;
+
+ now = g_date_time_new_now_utc ();
+ start = g_date_time_new_utc (2017, 7, 27, 0, 0, 0);
+ end = g_date_time_new_utc (2017, 12, 31, 0, 0, 0);
+
+ if (g_date_time_compare (start, now) < 0 && g_date_time_compare (now, end) < 0)
+ return TRUE;
+
+ return FALSE;
+}
+
+void
+gr_window_show_surprise (GrWindow *window)
+{
+ g_autoptr(GtkBuilder) builder = NULL;
+ GtkWindow *dialog;
+ GtkWidget *button;
+
+ if (!should_show_surprise ())
+ return;
+
+ 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)
{
diff --git a/src/gr-window.h b/src/gr-window.h
index 4bd2640..8120fae 100644
--- a/src/gr-window.h
+++ b/src/gr-window.h
@@ -76,6 +76,7 @@ void gr_window_show_my_chef_information (GrWindow *window);
void gr_window_show_about_dialog (GrWindow *window);
void gr_window_show_report_issue (GrWindow *window);
void gr_window_show_news (GrWindow *window);
+void gr_window_show_surprise (GrWindow *window);
void gr_window_load_recipe (GrWindow *window,
GFile *file);
diff --git a/src/recipe-surprise.ui b/src/recipe-surprise.ui
new file mode 100644
index 0000000..d612f61
--- /dev/null
+++ b/src/recipe-surprise.ui
@@ -0,0 +1,65 @@
+<?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="type-hint">dialog</property>
+ <property name="destroy-with-parent">1</property>
+ <style>
+ <class name="view"/>
+ </style>
+ <child type="titlebar">
+ <object class="GtkHeaderBar">
+ <property name="visible">0</property>
+ <property name="title">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="orientation">vertical</property>
+ <style>
+ <class name="view"/>
+ </style>
+ <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="GtkImage">
+ <property name="visible">1</property>
+ <property name="resource">/org/gnome/Recipes/surprise.jpg</property>
+ </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 present to GNOME for its 20th birthday.
We invite 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="margin-top">20</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.gresource.xml b/src/recipes.gresource.xml
index dab6a2b..2b66091 100644
--- a/src/recipes.gresource.xml
+++ b/src/recipes.gresource.xml
@@ -32,7 +32,9 @@
<file preprocess="xml-stripblanks">recipe-conflict-dialog.ui</file>
<file preprocess="xml-stripblanks">recipe-export-dialog.ui</file>
<file preprocess="xml-stripblanks">recipe-whats-new-dialog.ui</file>
+ <file preprocess="xml-stripblanks">recipe-surprise.ui</file>
<file preprocess="xml-stripblanks">menus.ui</file>
+ <file>surprise.jpg</file>
<file>recipes.css</file>
<file>recipes-light.css</file>
<file>recipes-dark.css</file>
diff --git a/src/surprise.jpg b/src/surprise.jpg
new file mode 100644
index 0000000..1a6ecb0
Binary files /dev/null and b/src/surprise.jpg differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]