[evolution] I#237 - Run New Collection Account wizard in its own window
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#237 - Run New Collection Account wizard in its own window
- Date: Tue, 20 Nov 2018 16:23:01 +0000 (UTC)
commit a4dbea9f748458dbca48f1da7c1d64391d7a5cbc
Author: Milan Crha <mcrha redhat com>
Date: Tue Nov 20 17:21:54 2018 +0100
I#237 - Run New Collection Account wizard in its own window
Closes https://gitlab.gnome.org/GNOME/evolution/issues/237
src/e-util/e-collection-account-wizard.c | 29 ++++++++++++----------
.../accounts-window/e-collection-wizard-page.c | 21 ++++++++++++++++
2 files changed, 37 insertions(+), 13 deletions(-)
---
diff --git a/src/e-util/e-collection-account-wizard.c b/src/e-util/e-collection-account-wizard.c
index 5c5e865543..bd36ed5b96 100644
--- a/src/e-util/e-collection-account-wizard.c
+++ b/src/e-util/e-collection-account-wizard.c
@@ -90,7 +90,6 @@ G_DEFINE_TYPE (ECollectionAccountWizard, e_collection_account_wizard, GTK_TYPE_N
typedef struct _WizardWindowData {
GtkWidget *window;
- GtkWidget *close_button;
GtkWidget *prev_button;
GtkButton *next_button;
ECollectionAccountWizard *collection_wizard;
@@ -101,13 +100,7 @@ collection_wizard_window_update_button_captions (WizardWindowData *wwd)
{
g_return_if_fail (wwd != NULL);
- if (gtk_notebook_get_current_page (GTK_NOTEBOOK (wwd->collection_wizard))) {
- gtk_widget_hide (wwd->close_button);
- gtk_widget_show (wwd->prev_button);
- } else {
- gtk_widget_hide (wwd->prev_button);
- gtk_widget_show (wwd->close_button);
- }
+ gtk_widget_set_sensitive (wwd->prev_button, gtk_notebook_get_current_page (GTK_NOTEBOOK
(wwd->collection_wizard)) > 0);
if (e_collection_account_wizard_is_finish_page (wwd->collection_wizard))
gtk_button_set_label (wwd->next_button, _("_Finish"));
@@ -115,6 +108,18 @@ collection_wizard_window_update_button_captions (WizardWindowData *wwd)
gtk_button_set_label (wwd->next_button, _("_Next"));
}
+static void
+collection_wizard_window_cancel_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ WizardWindowData *wwd = user_data;
+
+ g_return_if_fail (wwd != NULL);
+
+ e_collection_account_wizard_abort (wwd->collection_wizard);
+ gtk_widget_destroy (wwd->window);
+}
+
static void
collection_wizard_window_back_button_clicked_cb (GtkButton *button,
gpointer user_data)
@@ -223,7 +228,7 @@ collection_account_wizard_create_window (GtkWindow *parent,
NULL);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- widget = e_dialog_button_new_with_icon ("window-close", _("_Close"));
+ widget = e_dialog_button_new_with_icon ("window-close", _("_Cancel"));
g_object_set (G_OBJECT (widget),
"hexpand", FALSE,
"halign", GTK_ALIGN_END,
@@ -240,10 +245,8 @@ collection_account_wizard_create_window (GtkWindow *parent,
GTK_ACCEL_VISIBLE);
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
- wwd->close_button = widget;
-
g_signal_connect (widget, "clicked",
- G_CALLBACK (collection_wizard_window_back_button_clicked_cb), wwd);
+ G_CALLBACK (collection_wizard_window_cancel_button_clicked_cb), wwd);
widget = e_dialog_button_new_with_icon ("go-previous", _("_Previous"));
g_object_set (G_OBJECT (widget),
@@ -251,7 +254,7 @@ collection_account_wizard_create_window (GtkWindow *parent,
"halign", GTK_ALIGN_END,
"vexpand", FALSE,
"valign", GTK_ALIGN_START,
- "visible", FALSE,
+ "visible", TRUE,
NULL);
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
diff --git a/src/modules/accounts-window/e-collection-wizard-page.c
b/src/modules/accounts-window/e-collection-wizard-page.c
index f41af817ca..8edc7b1291 100644
--- a/src/modules/accounts-window/e-collection-wizard-page.c
+++ b/src/modules/accounts-window/e-collection-wizard-page.c
@@ -24,6 +24,8 @@
#include "e-collection-wizard-page.h"
+/* #define RUN_INSIDE_ACCOUNTS_WINDOW 1 */
+
/* Standard GObject macros */
#define E_TYPE_COLLECTION_WIZARD_PAGE \
(e_collection_wizard_page_get_type ())
@@ -49,11 +51,13 @@ typedef struct _ECollectionWizardPageClass ECollectionWizardPageClass;
struct _ECollectionWizardPage {
EExtension parent;
+#ifdef RUN_INSIDE_ACCOUNTS_WINDOW
ECollectionAccountWizard *collection_wizard;
gint page_index;
GtkButton *prev_button; /* not referenced */
GtkButton *next_button; /* not referenced */
+#endif
};
struct _ECollectionWizardPageClass {
@@ -64,6 +68,7 @@ GType e_collection_wizard_page_get_type (void) G_GNUC_CONST;
G_DEFINE_DYNAMIC_TYPE (ECollectionWizardPage, e_collection_wizard_page, E_TYPE_EXTENSION)
+#ifdef RUN_INSIDE_ACCOUNTS_WINDOW
static void
collection_wizard_page_update_button_captions (ECollectionWizardPage *page)
{
@@ -79,6 +84,7 @@ collection_wizard_page_update_button_captions (ECollectionWizardPage *page)
else
gtk_button_set_label (page->next_button, _("_Next"));
}
+#endif
static gboolean
collection_wizard_page_add_source_cb (EAccountsWindow *accounts_window,
@@ -86,6 +92,9 @@ collection_wizard_page_add_source_cb (EAccountsWindow *accounts_window,
gpointer user_data)
{
ECollectionWizardPage *page = user_data;
+#ifndef RUN_INSIDE_ACCOUNTS_WINDOW
+ GtkWindow *window;
+#endif
g_return_val_if_fail (E_IS_ACCOUNTS_WINDOW (accounts_window), FALSE);
g_return_val_if_fail (E_IS_COLLECTION_WIZARD_PAGE (page), FALSE);
@@ -93,14 +102,21 @@ collection_wizard_page_add_source_cb (EAccountsWindow *accounts_window,
if (g_strcmp0 (kind, "collection") != 0)
return FALSE;
+#ifdef RUN_INSIDE_ACCOUNTS_WINDOW
e_collection_account_wizard_reset (page->collection_wizard);
collection_wizard_page_update_button_captions (page);
e_accounts_window_activate_page (accounts_window, page->page_index);
+#else
+ window = e_collection_account_wizard_new_window (GTK_WINDOW (accounts_window),
e_accounts_window_get_registry (accounts_window));
+
+ gtk_window_present (window);
+#endif
return TRUE;
}
+#ifdef RUN_INSIDE_ACCOUNTS_WINDOW
static void
collection_wizard_page_wizard_done (ECollectionWizardPage *page,
const gchar *uid)
@@ -161,14 +177,17 @@ collection_wizard_next_button_clicked_cb (GtkButton *button,
}
}
}
+#endif
static void
collection_wizard_page_constructed (GObject *object)
{
EAccountsWindow *accounts_window;
ECollectionWizardPage *page;
+#ifdef RUN_INSIDE_ACCOUNTS_WINDOW
GtkWidget *widget;
GtkWidget *vbox, *hbox;
+#endif
/* Chain up to parent's method. */
G_OBJECT_CLASS (e_collection_wizard_page_parent_class)->constructed (object);
@@ -179,6 +198,7 @@ collection_wizard_page_constructed (GObject *object)
g_signal_connect (accounts_window, "add-source",
G_CALLBACK (collection_wizard_page_add_source_cb), object);
+#ifdef RUN_INSIDE_ACCOUNTS_WINDOW
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_show (vbox);
@@ -245,6 +265,7 @@ collection_wizard_page_constructed (GObject *object)
page->page_index = e_accounts_window_add_page (accounts_window, vbox);
gtk_widget_grab_default (GTK_WIDGET (page->next_button));
+#endif
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]