GtkTreeModel *model;
GtkTreeIter iter;
gboolean has_selection;
- gchar *account_name;
- gchar *default_account_name;
priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
has_selection =
gtk_tree_selection_get_selected (sel, &model, &iter);
+ /* Set the status of the buttons */
gtk_widget_set_sensitive (priv->edit_button, has_selection);
gtk_widget_set_sensitive (priv->delete_button, has_selection);
-
- account_name = modest_account_view_get_selected_account (priv->account_view);
- default_account_name = modest_account_mgr_get_default_account(
- modest_runtime_get_account_mgr());
-
- g_free (account_name);
- g_free (default_account_name);
}
/** Check whether any connections are active, and cancel them if
return button_box;
}
-
static GtkWidget*
window_vbox_new (ModestAccountViewWindow *self)
{
GtkWidget *main_hbox = gtk_hbox_new (FALSE, 6);
priv->account_view = modest_account_view_new (modest_runtime_get_account_mgr());
+
gtk_widget_set_size_request (GTK_WIDGET(priv->account_view), 300, 400);
gtk_widget_show (GTK_WIDGET (priv->account_view));
static void
modest_account_view_window_init (ModestAccountViewWindow *obj)
{
-/*
- ModestAccountViewWindowPrivate *priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(obj);
-*/
gtk_box_pack_start (GTK_BOX((GTK_DIALOG (obj)->vbox)), GTK_WIDGET (window_vbox_new (obj)),
TRUE, TRUE, 2);
gtk_window_set_title (GTK_WINDOW (obj), _("mcen_ti_emailsetup_accounts"));
}
-
GtkWidget*
modest_account_view_window_new (void)
{
key, event, conn_id);
}
-
static GConfValueType
modest_conf_type_to_gconf_type (ModestConfValueType value_type, GError **err)
{
/* Add the namespace to the list of the namespaces that will
be observed */
- gconf_client_add_dir (priv->gconf_client, namespace,
+ gconf_client_add_dir (priv->gconf_client,
+ namespace,
GCONF_CLIENT_PRELOAD_NONE,
&error);
- if (error)
+ if (error) {
return 0;
+ }
/* Notify every change under namespace */
notification_id = gconf_client_notify_add (priv->gconf_client,
self,
NULL,
&error);
- if (error)
+
+ if (error) {
return 0;
- else
+ } else {
return notification_id;
+ }
}
void
void modest_conf_forget_namespace (ModestConf *self,
const gchar *namespace,
ModestConfNotificationId id);
-
G_END_DECLS
#endif /* __MODEST_CONF_H__ */
g_thread_init (NULL);
gdk_threads_init ();
- gdk_threads_enter (); /* CHECKED */
+ gdk_threads_enter ();
- if (!gtk_init_check(&argc, &argv)) {
+ if (!gtk_init_check (&argc, &argv)) {
g_printerr ("modest: failed to initialize gtk\n");
retval = 1;
goto cleanup;
}
/* Usually, we only show the UI when we get the "top_application" D-Bus method.
- * This allows modest to start via D-Bus activation to provide a service,
+ * This allows modest to start via D-Bus activation to provide a service,
* without showing the UI.
* The UI will be shown later (or just after starting if no otehr D-Bus method was used),
* when we receive the "top_application" D-Bus method.
if (show_ui_without_top_application_method)
gtk_widget_show_all (GTK_WIDGET(win));
-
- gtk_main ();
- retval = 0;
+ gtk_main ();
cleanup:
- gdk_threads_leave (); /* CHECKED */
+ gdk_threads_leave ();
if (!modest_init_uninit ()) {
g_printerr ("modest: modest_init_uninit failed\n");
return retval;
}
-
#include <tny-simple-list.h>
#include <tny-camel-folder.h>
#include <tny-merge-folder.h>
-#include <camel/camel-folder.h>
#include <modest-protocol-info.h>
#include <modest-runtime.h>
#include <modest-tny-account-store.h>
save_settings_folder_view (ModestConf *conf, ModestFolderView *folder_view,
const gchar *name)
{
- gchar *key;
- const gchar* account_id;
-
- /* Save the visible account */
- key = _modest_widget_memory_get_keyname (name, "visible_server_account_id");
-
- account_id = modest_folder_view_get_account_id_of_visible_server_account (folder_view);
- if (account_id)
- modest_conf_set_string (conf, key, account_id, NULL);
- else
- modest_conf_remove_key (conf, key, NULL);
- g_free (key);
-
return TRUE;
}
ModestFolderView *folder_view,
const gchar *name)
{
- /* Don't restore the visible account but always show the default account
- * as specified in section 4.1 of the email UI specification */
ModestAccountMgr *mgr;
gchar *default_acc;
- /* If there is no visible account id in the
- configuration then pick the default account as
- visible account */
+ /* Always show the default account as visible server account */
mgr = modest_runtime_get_account_mgr ();
default_acc = modest_account_mgr_get_default_account (mgr);
if (default_acc) {
ModestAccountData *acc_data;
const gchar *server_acc_id;
- gchar *key = NULL;
acc_data = modest_account_mgr_get_account_data (mgr, (const gchar*) default_acc);
server_acc_id = (const gchar *) acc_data->store_account->account_name;
- key = _modest_widget_memory_get_keyname (name, "visible_server_account_id");
- modest_conf_set_string (conf, key, server_acc_id, NULL);
modest_folder_view_set_account_id_of_visible_server_account (folder_view, server_acc_id);
- g_free (key);
g_free (default_acc);
}
-
return TRUE;
}
model = GTK_LIST_STORE(gtk_tree_view_get_model (GTK_TREE_VIEW(view)));
- /* Get the ID of the currently-selected account,
+ /* Get the ID of the currently-selected account,
* so we can select it again after rebuilding the list.
* Note that the name doesn't change even when the display name changes.
*/
gtk_list_store_clear (model);
/* Note: We do not show disabled accounts.
- * Of course, this means that there is no UI to enable or disable
- * accounts. That is OK for maemo where no such feature or UI is
- * specified, so the "enabled" property is used internally to avoid
- * showing unfinished accounts. If a user-visible "enabled" is
- * needed in the future, we must use a second property for the
+ * Of course, this means that there is no UI to enable or disable
+ * accounts. That is OK for maemo where no such feature or UI is
+ * specified, so the "enabled" property is used internally to avoid
+ * showing unfinished accounts. If a user-visible "enabled" is
+ * needed in the future, we must use a second property for the
* current use instead */
cursor = account_names = modest_account_mgr_account_names (account_mgr,
TRUE /* only enabled accounts. */);
{
ModestAccountView *self = NULL;
ModestAccountViewPrivate *priv = NULL;
- TnyTransportAccount *transport_account = NULL;
- ModestTnySendQueue *send_queue = NULL;
g_return_if_fail (MODEST_IS_ACCOUNT_VIEW (user_data));
g_return_if_fail (account);
g_warning ("account changed: %s", tny_account_get_id(account));
/* Update account view */
- update_account_view (priv->account_mgr, self);
-
- /* Get transport account */
- const gchar *modest_account_name =
- modest_tny_account_get_parent_modest_account_name_for_server_account (account);
- g_return_if_fail (modest_account_name);
-
- transport_account = (TnyTransportAccount*)
- modest_tny_account_store_get_transport_account_for_open_connection (modest_runtime_get_account_store(),
- modest_account_name);
-
- /* Restart send queue */
- if (transport_account) {
- g_return_if_fail (TNY_IS_TRANSPORT_ACCOUNT(transport_account));
- send_queue = modest_runtime_get_send_queue (transport_account);
- g_return_if_fail (MODEST_IS_TNY_SEND_QUEUE(send_queue));
- modest_tny_send_queue_try_to_send (send_queue);
-
- g_object_unref (transport_account);
- }
+/* update_account_view (priv->account_mgr, self); */
}
}
static void
-on_account_default_toggled (GtkCellRendererToggle *cell_renderer, gchar *path,
- ModestAccountView *self)
+on_account_default_toggled (GtkCellRendererToggle *cell_renderer,
+ gchar *path,
+ ModestAccountView *self)
{
+ ModestAccountViewPrivate *priv;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *account_name = NULL;
g_return_if_fail (MODEST_IS_ACCOUNT_VIEW (self));
- gboolean is_default = gtk_cell_renderer_toggle_get_active (cell_renderer);
- 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);
+ /* If it's active then do nothing, no need to reenable it as
+ default account */
+ if (gtk_cell_renderer_toggle_get_active (cell_renderer))
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;
- }
+ priv = MODEST_ACCOUNT_VIEW_GET_PRIVATE(self);
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW(self));
+ gtk_tree_model_get_iter_from_string (model, &iter, path);
- gchar *account_name = NULL;
gtk_tree_model_get (model, &iter,
MODEST_ACCOUNT_VIEW_NAME_COLUMN,
&account_name, -1);
-
- /* Set this previously-non-default account as the default: */
+
+ /* Set this previously-non-default account as the default */
if (modest_account_mgr_set_default_account (priv->account_mgr, account_name)) {
- /* Explicitely set default column because we are ignoring gconf changes */
GtkTreeIter old_default_iter;
- if (find_default_account (self, &old_default_iter)) {
- gtk_list_store_set (GTK_LIST_STORE (model), &old_default_iter,
- MODEST_ACCOUNT_VIEW_IS_DEFAULT_COLUMN, FALSE, -1);
- } else {
- g_warning ("%s: Did not find old default account in view", __FUNCTION__);
- }
+
+ find_default_account (self, &old_default_iter);
+ gtk_list_store_set (GTK_LIST_STORE (model), &old_default_iter,
+ MODEST_ACCOUNT_VIEW_IS_DEFAULT_COLUMN, FALSE, -1);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
MODEST_ACCOUNT_VIEW_IS_DEFAULT_COLUMN, TRUE, -1);
}
-
g_free (account_name);
}
g_object_set(G_OBJECT(toggle_renderer), "checkbox-mode", FALSE, NULL);
#endif /* MODEST_HAVE_HILDON0_WIDGETS */
- g_signal_connect (G_OBJECT(toggle_renderer), "toggled", G_CALLBACK(on_account_default_toggled),
+ g_signal_connect (G_OBJECT(toggle_renderer), "toggled",
+ G_CALLBACK(on_account_default_toggled),
self);
/* account name */
*/
priv->notification_id = modest_conf_listen_to_namespace (conf,
MODEST_CONF_NAMESPACE);
+
priv->conf_key_signal = g_signal_connect (G_OBJECT(conf),
"key_changed",
G_CALLBACK(on_configuration_key_changed),
/* If this is a move to dialog, hide Sent, Outbox and Drafts
folder as no message can be move there according to UI specs */
- if (!priv->show_non_move)
- {
- switch (type)
- {
+ if (!priv->show_non_move) {
+ switch (type) {
case TNY_FOLDER_TYPE_OUTBOX:
case TNY_FOLDER_TYPE_SENT:
case TNY_FOLDER_TYPE_DRAFTS:
case TNY_FOLDER_TYPE_UNKNOWN:
case TNY_FOLDER_TYPE_NORMAL:
type = modest_tny_folder_guess_folder_type(TNY_FOLDER(instance));
- if (type == TNY_FOLDER_TYPE_OUTBOX || type == TNY_FOLDER_TYPE_SENT
- || type == TNY_FOLDER_TYPE_DRAFTS)
- {
+ if (type == TNY_FOLDER_TYPE_OUTBOX ||
+ type == TNY_FOLDER_TYPE_SENT
+ || type == TNY_FOLDER_TYPE_DRAFTS)
retval = FALSE;
- }
break;
default:
- break;
- }
+ break;
+ }
}
/* Free */