2007-04-05 Murray Cumming <murrayc@murrayc.com>
+ * src/maemo/easysetup/Makefile.am:
+ * src/maemo/easysetup/modest-easysetup-country-combo-box.c:
+ (load_from_file):
+ * src/maemo/easysetup/modest-easysetup-wizard.c:
+ (modest_easysetup_wizard_dialog_init):
+ Try to get the source directory from the build system,
+ instead of hard-coding "./" into the source code, when opening our local
+ copies of the configuration files.
+ But this still fails when opening the wizard from the Accounts window,
+ maybe because the working directory seems to change at runtime.
+ So the wizard will fail the second time unless you copy the files into their
+ proper locations - see the stdout warnings for the paths.
+
+ (create_page_account_details),(on_before_next):
+ Check for existing non-server accounts instead of server accounts,
+ so the default account name is useful again, and to prevent trying to
+ recreate accounts.
+
+ * src/maemo/modest-account-view-window.c: (on_new_button_clicked):
+ Show the wizard when New is clicked.
+
+ * src/widgets/modest-account-view.c: (on_account_default_toggled),
+ (init_view): Show the column headers, and show the columns that are
+ specified in the UI specs. However, something in Maemo's GTK+ prevents
+ us from handling the GtkCellRendererToggle::toggled signal, so we cannot
+ change the default account. This is despite unsetting the special properties.
+
+2007-04-05 Murray Cumming <murrayc@murrayc.com>
+
* docs/reference/modest-design.sgml: Corrected spelling mistake.
* src/maemo/easysetup/modest-easysetup-wizard.c: (create_account):
Create the 2 server accounts and then create the account, using the names of the 2 server accounts.
/* Set a default account title, choosing one that does not already exist: */
gchar* default_acount_name = g_strdup (_("mcen_ia_emailsetup_defaultname"));
while (modest_account_mgr_account_exists (self->account_manager,
- default_acount_name, TRUE /* server_account */)) {
+ default_acount_name, FALSE /* server_account */)) {
gchar * default_account_name2 = util_increment_name (default_acount_name);
g_free (default_acount_name);
priv->presets = modest_presets_new (filepath); /* TODO: the actual filepath. */
if (!(priv->presets))
{
- const gchar* filepath_hack = "./src/maemo/easysetup/provider-data-test.keyfile";
+ const gchar* filepath_hack = HACK_TOP_SRCDIR "src/maemo/easysetup/provider-data-test.keyfile";
g_warning ("Could not locate the official provider data keyfile from %s, "
"so attempting to load it instead from %s", filepath, filepath_hack);
priv->presets = modest_presets_new (filepath_hack); /* TODO: the actual filepath. */
gboolean name_in_use = FALSE;
name_in_use = modest_account_mgr_account_exists (account_wizard->account_manager,
- account_name, TRUE /* server_account */);
+ account_name, FALSE /* server_account */);
if (name_in_use) {
/* Warn the user via a dialog: */
#include <string.h>
#include "modest-account-assistant.h"
#include "modest-tny-platform-factory.h"
+#include "maemo/easysetup/modest-easysetup-wizard.h"
/* 'private'/'protected' functions */
static void modest_account_view_window_class_init (ModestAccountViewWindowClass *klass);
static void
on_new_button_clicked (GtkWidget *button, ModestAccountViewWindow *self)
{
- GtkWidget *notebook, *assistant;
- ModestAccountViewWindowPrivate *priv;
-
- /* TODO: */
- modest_runtime_not_implemented (GTK_WINDOW(self));
- return;
-
- priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
-
- notebook = modest_account_assistant_new (modest_runtime_get_account_mgr());
- assistant = hildon_wizard_dialog_new (GTK_WINDOW(self), _("Account setup wizard"),
- GTK_NOTEBOOK(notebook));
-
- gtk_dialog_run (GTK_DIALOG(assistant));
- gtk_widget_destroy (assistant);
+ /* Show the easy-setup wizard: */
+ ModestEasysetupWizardDialog *wizard = modest_easysetup_wizard_dialog_new ();
+ gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (self));
+ gtk_dialog_run (GTK_DIALOG (wizard));
+ gtk_widget_destroy (GTK_WIDGET (wizard));
}
on_account_changed (account_mgr, account, NULL, server_account, self);
}
-
-
-
+#if 0
static void
on_account_enable_toggled (GtkCellRendererToggle *cell_renderer, gchar *path,
ModestAccountView *self)
modest_account_mgr_set_enabled (priv->account_mgr, account_name, !enabled);
g_free (account_name);
}
+#endif
+
+static void
+on_account_default_toggled (GtkCellRendererToggle *cell_renderer, gchar *path,
+ ModestAccountView *self)
+{
+ printf ("debug: on_account_default_toggled\n");
+ gboolean is_default = gtk_cell_renderer_toggle_get_active (cell_renderer);
+ printf ("debug: is_default: %d\n", is_default);
+ if (!is_default) {
+ /* Do not allow an account to be marked non-default.
+ * Only allow this to be changed by setting another account to default: */
+ gtk_cell_renderer_toggle_set_active (cell_renderer, TRUE);
+ return;
+ }
+
+ ModestAccountViewPrivate *priv = MODEST_ACCOUNT_VIEW_GET_PRIVATE(self);
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW(self));
+
+ GtkTreeIter iter;
+ if (!gtk_tree_model_get_iter_from_string (model, &iter, path)) {
+ g_printerr ("modest: cannot find iterator\n");
+ return;
+ }
+
+ gchar *account_name = NULL;
+ gtk_tree_model_get (model, &iter, MODEST_ACCOUNT_VIEW_NAME_COLUMN, &account_name,
+ -1);
+
+ /* toggle: */
+ if (is_default) {
+ printf ("debug2: is_default: %d\n", is_default);
+ /* TODO: Will the model will be updated */
+ modest_account_mgr_set_default_account (priv->account_mgr, account_name);
+ }
+
+ /* toggle: */
+ if (is_default)
+ modest_account_mgr_set_default_account (priv->account_mgr, account_name);
+ g_free (account_name);
+}
void
bold_if_default_cell_data (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
toggle_renderer = gtk_cell_renderer_toggle_new ();
text_renderer = gtk_cell_renderer_text_new ();
- /* the is_enabled column */
- g_object_set (G_OBJECT(toggle_renderer), "activatable", TRUE,"radio", FALSE, NULL);
- g_signal_connect (G_OBJECT(toggle_renderer), "toggled", G_CALLBACK(on_account_enable_toggled),
- self);
+ /* the is_default column */
+ g_object_set (G_OBJECT(toggle_renderer), "activatable", TRUE, "radio", FALSE, NULL);
+ printf("debug: connecting to toggled signal.\n");
gtk_tree_view_append_column (GTK_TREE_VIEW(self),
gtk_tree_view_column_new_with_attributes (
- _("Enabled"), toggle_renderer,
- "active", MODEST_ACCOUNT_VIEW_IS_ENABLED_COLUMN, NULL));
+ _(" mcen_ti_default"), toggle_renderer,
+ "active", MODEST_ACCOUNT_VIEW_IS_DEFAULT_COLUMN, NULL));
+
+ /* Disable the Maemo GtkTreeView::allow-checkbox-mode Maemo modification,
+ * which causes the model column to be updated automatically when the row is clicked.
+ * Making this the default in Maemo's GTK+ is obviously a bug:
+ * https://maemo.org/bugzilla/show_bug.cgi?id=146
+ *
+ * This also stops the application's own signal handler from being called,
+ * though unsetting the Maemo properties does not seem to fix that:
+ */
+ g_object_set(G_OBJECT(self), "allow-checkbox-mode", FALSE, NULL);
+ g_object_set(G_OBJECT(toggle_renderer), "checkbox-mode", FALSE, NULL);
+ g_signal_connect (G_OBJECT(toggle_renderer), "toggled", G_CALLBACK(on_account_default_toggled),
+ self);
/* account name */
- column = gtk_tree_view_column_new_with_attributes (_("Account"), text_renderer,"text",
+ column = gtk_tree_view_column_new_with_attributes (_("mcen_ti_account"), text_renderer, "text",
MODEST_ACCOUNT_VIEW_DISPLAY_NAME_COLUMN, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW(self),column);
- gtk_tree_view_column_set_cell_data_func(column, text_renderer, bold_if_default_cell_data,
- NULL, NULL);
-
- /* account type */
- column = gtk_tree_view_column_new_with_attributes (_("Type"), text_renderer,"text",
- MODEST_ACCOUNT_VIEW_PROTO_COLUMN, NULL);
- gtk_tree_view_append_column (GTK_TREE_VIEW(self),column);
+ gtk_tree_view_append_column (GTK_TREE_VIEW(self), column);
gtk_tree_view_column_set_cell_data_func(column, text_renderer, bold_if_default_cell_data,
NULL, NULL);
/* last update for this account */
- column = gtk_tree_view_column_new_with_attributes (_("Last update"), text_renderer,"text",
+ column = gtk_tree_view_column_new_with_attributes (_("mcen_ti_lastupdated"), text_renderer,"text",
MODEST_ACCOUNT_VIEW_LAST_UPDATED_COLUMN, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW(self),column);
gtk_tree_view_column_set_cell_data_func(column, text_renderer, bold_if_default_cell_data,
NULL, NULL);
+
+ /* Show the column headers,
+ * which does not seem to be the default on Maemo.
+ */
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(self), TRUE);
priv->sig1 = g_signal_connect (G_OBJECT(priv->account_mgr),"account_removed",
G_CALLBACK(on_account_removed), self);