summaryrefslogtreecommitdiff
path: root/src/glade-window.c
diff options
context:
space:
mode:
authorJuan Pablo Ugarte <juanpablougarte@gmail.com>2014-03-17 20:25:21 -0300
committerJuan Pablo Ugarte <juanpablougarte@gmail.com>2014-03-17 20:28:35 -0300
commit5716cbb64b281e2325d21bb4ae53a4ba7a07e906 (patch)
tree12e01b998269963dcddb330e799f04b03f03a343 /src/glade-window.c
parenta126b58570d36a8a670908c7a9546e84b22a6bbf (diff)
downloadglade-5716cbb64b281e2325d21bb4ae53a4ba7a07e906.tar.gz
Added message dialog at startup to advertise the user survey.
The dialog will be shown until the user either completes the survey or checks the "Do not show this dialog again" check button
Diffstat (limited to 'src/glade-window.c')
-rw-r--r--src/glade-window.c61
1 files changed, 55 insertions, 6 deletions
diff --git a/src/glade-window.c b/src/glade-window.c
index 64b49614..b659f919 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -115,6 +115,7 @@ struct _GladeWindowPrivate
GladeEditor *editor; /* The editor */
GtkWidget *statusbar; /* A pointer to the status bar. */
+ guint statusbar_context_id; /* The context id of general messages */
guint statusbar_menu_context_id; /* The context id of the menu bar */
guint statusbar_actions_context_id; /* The context id of actions messages */
@@ -2545,12 +2546,7 @@ static void
on_registration_action_activate (GtkAction *action,
GladeWindow *window)
{
- GladeWindowPrivate *priv = window->priv;
-
- if (!priv->registration)
- priv->registration = glade_registration_new ();
-
- gtk_window_present (GTK_WINDOW (priv->registration));
+ gtk_window_present (GTK_WINDOW (window->priv->registration));
}
void
@@ -3176,6 +3172,8 @@ glade_window_init (GladeWindow *window)
glade_init ();
gtk_widget_init_template (GTK_WIDGET (window));
+
+ priv->registration = glade_registration_new ();
}
static void
@@ -3220,6 +3218,7 @@ glade_window_constructed (GObject *object)
_("Properties"), "properties", priv->right_paned, FALSE);
/* status bar */
+ priv->statusbar_context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (priv->statusbar), "general");
priv->statusbar_menu_context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (priv->statusbar), "menu");
priv->statusbar_actions_context_id = gtk_statusbar_get_context_id (GTK_STATUSBAR (priv->statusbar), "actions");
@@ -3452,3 +3451,53 @@ glade_window_check_devhelp (GladeWindow *window)
if (glade_util_have_devhelp ())
g_signal_connect (glade_app_get (), "doc-search", G_CALLBACK (doc_search_cb), window);
}
+
+void
+glade_window_registration_notify_user (GladeWindow *window)
+{
+ gboolean skip_reminder, completed;
+ GladeWindowPrivate *priv;
+
+ g_return_if_fail (GLADE_IS_WINDOW (window));
+ priv = window->priv;
+
+ g_object_get (priv->registration,
+ "completed", &completed,
+ "skip-reminder", &skip_reminder,
+ NULL);
+
+ if (!completed && !skip_reminder)
+ {
+ GtkWidget *dialog, *check;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (glade_app_get_window ()),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ "%s",
+ "We are conducting a user survey\n would you like to take it now?");
+
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s",
+ _("If not, you can always find it in the Help menu."));
+
+ check = gtk_check_button_new_with_label ("Do not show this dialog again");
+ gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
+ check, FALSE, FALSE, 4);
+ gtk_widget_set_halign (check, GTK_ALIGN_START);
+ gtk_widget_show (check);
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES)
+ gtk_window_present (GTK_WINDOW (priv->registration));
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)))
+ {
+ g_object_set (priv->registration, "skip-reminder", TRUE, NULL);
+ glade_app_config_save ();
+ }
+
+ gtk_widget_destroy (dialog);
+ }
+ else if (!completed)
+ glade_util_flash_message (priv->statusbar, priv->statusbar_context_id, "%s",
+ _("Go to Help -> Registration & User Survey and complete our survey!"));
+}