diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2018-03-12 15:27:08 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2018-03-12 15:27:08 -0300 |
commit | 773e8419857ea2b508203202586bdfd02d36ffdd (patch) | |
tree | 0951089dd9be1ac7d5b9306b82f4a54c264540e5 | |
parent | 40b8df765eb3ec88bb6ac1b3d2f990d7bfe9d714 (diff) | |
download | glade-773e8419857ea2b508203202586bdfd02d36ffdd.tar.gz |
GladeWindow: hide intro button after its finished.
-rw-r--r-- | src/glade-window.c | 22 | ||||
-rw-r--r-- | src/glade.glade | 22 |
2 files changed, 38 insertions, 6 deletions
diff --git a/src/glade-window.c b/src/glade-window.c index 19806d6c..0f274b67 100644 --- a/src/glade-window.c +++ b/src/glade-window.c @@ -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); diff --git a/src/glade.glade b/src/glade.glade index 4eeb8c7d..d16431a2 100644 --- a/src/glade.glade +++ b/src/glade.glade @@ -1,5 +1,5 @@ <?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 @@ -96,13 +96,27 @@ Author: Juan Pablo Ugarte <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> + <property name="can_focus">True</property> + <property name="receives_default">True</property> <property name="action_name">app.preferences</property> <property name="text" translatable="yes">Preferences</property> </object> <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> |