Commit 773e8419 authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte
Browse files

GladeWindow: hide intro button after its finished.

parent 40b8df76
......@@ -72,6 +72,9 @@
#define CONFIG_KEY_AUTOSAVE "autosave"
#define CONFIG_KEY_AUTOSAVE_SECONDS "autosave-seconds"
#define CONFIG_INTRO_GROUP "Intro"
#define CONFIG_INTRO_DONE "intro-done"
#define GLADE_WINDOW_ACTIVE_VIEW(w) ((GladeDesignView *) gtk_stack_get_visible_child (w->priv->view_stack))
struct _GladeWindowPrivate
......@@ -88,6 +91,7 @@ struct _GladeWindowPrivate
GtkWidget *start_page;
GtkLabel *version_label;
GtkWidget *intro_button;
GladeAdaptorChooser *adaptor_chooser;
GtkStack *inspectors_stack; /* Cached per project inspectors */
......@@ -2035,6 +2039,10 @@ glade_window_config_load (GladeWindow *window)
/* Paned positions */
load_paned_position (config, window->priv->left_paned, "left_pane", 200);
load_paned_position (config, window->priv->center_paned, "center_pane", 400);
/* Intro button */
if (g_key_file_get_boolean (config, CONFIG_INTRO_GROUP, CONFIG_INTRO_DONE, FALSE))
gtk_widget_hide (window->priv->intro_button);
}
static void
......@@ -2103,6 +2111,7 @@ static void
on_intro_action_activate (GSimpleAction *action, GVariant *p, gpointer data)
{
GladeWindow *window = data;
gtk_widget_show (window->priv->intro_button);
glade_intro_play (window->priv->intro);
}
......@@ -2271,6 +2280,14 @@ on_intro_hide_node (GladeIntro *intro,
g_list_free (children);
}
else if (!g_strcmp0 (node, "done"))
{
gtk_widget_hide (window->priv->intro_button);
g_key_file_set_boolean (glade_app_get_config (),
CONFIG_INTRO_GROUP,
CONFIG_INTRO_DONE,
TRUE);
}
else if (!g_strcmp0 (node, "add-project") ||
!g_strcmp0 (node, "add-window") ||
!g_strcmp0 (node, "add-grid") ||
......@@ -2318,8 +2335,8 @@ glade_window_populate_intro (GladeWindow *window)
ADD_NODE ("add-grid", "intro-button", BOTTOM, 3, _("Try adding a grid"));
ADD_NODE ("add-button", "intro-button", BOTTOM, 3, _("and a button"));
ADD_NODE (NULL, "intro-button", BOTTOM, 3, _("Quite easy! Isn't it?"));
ADD_NODE (NULL, "intro-button", BOTTOM, 2, _("Enjoy!"));
ADD_NODE (NULL, "intro-button", BOTTOM, 3, _("Quite easy! Isn't it?"));
ADD_NODE ("done", "intro-button", BOTTOM, 2, _("Enjoy!"));
g_signal_connect (window->priv->intro, "show-node",
G_CALLBACK (on_intro_show_node),
......@@ -2467,6 +2484,7 @@ glade_window_class_init (GladeWindowClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, about_dialog);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, start_page);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, version_label);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, intro_button);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, center_paned);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, left_paned);
gtk_widget_class_bind_template_child_private (widget_class, GladeWindow, open_button_box);
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0
<!-- Generated with glade 3.21.0
Glade - A user interface designer for GTK+ and GNOME.
Copyright (C) 2012-2017 Juan Pablo Ugarte
......@@ -91,6 +91,20 @@ Author: Juan Pablo Ugarte
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="action_name">app.intro</property>
<property name="text" translatable="yes">Interactive Intro</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkModelButton">
<property name="visible">True</property>
......@@ -102,7 +116,7 @@ Author: Juan Pablo Ugarte
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
<property name="position">5</property>
</packing>
</child>
<child>
......@@ -113,7 +127,7 @@ Author: Juan Pablo Ugarte
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
<property name="position">6</property>
</packing>
</child>
<child>
......@@ -127,7 +141,7 @@ Author: Juan Pablo Ugarte
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="position">7</property>
</packing>
</child>
</object>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment