GdkEventFocus *event,
gpointer userdata);
-static void modest_main_window_on_folder_selection_changed (ModestFolderView *folder_view,
- TnyFolderStore *folder_store,
- gboolean selected,
- ModestMainWindow *main_window);
+static void on_folder_selection_changed (ModestFolderView *folder_view,
+ TnyFolderStore *folder_store,
+ gboolean selected,
+ ModestMainWindow *main_window);
static void set_at_least_one_account_visible(ModestMainWindow *self);
priv->updating_banner_timeout = 0;
}
+ if (priv->updating_banner) {
+ gtk_widget_destroy (priv->updating_banner);
+ priv->updating_banner = NULL;
+ }
+
if (priv->restore_paned_timeout > 0) {
g_source_remove (priv->restore_paned_timeout);
priv->restore_paned_timeout = 0;
ModestMainWindowPrivate *priv = MODEST_MAIN_WINDOW_GET_PRIVATE (main_window);
ModestConf *conf;
+ /* Timeouts are outside the main lock */
+ gdk_threads_enter ();
if (GTK_WIDGET_VISIBLE (main_window)) {
conf = modest_runtime_get_conf ();
modest_widget_memory_restore (conf, G_OBJECT(priv->main_paned),
MODEST_CONF_MAIN_PANED_KEY);
}
+ gdk_threads_leave ();
+
return FALSE;
}
gint i, num_accounts;
GList *groups;
gchar *default_account;
+ const gchar *active_account_name;
GtkWidget *send_receive_button, *item;
GtkAction *send_receive_all = NULL;
GSList *radio_group;
/* Create a new action group */
default_account = modest_account_mgr_get_default_account (mgr);
+ active_account_name = modest_window_get_active_account (MODEST_WINDOW (self));
+
+ if (!active_account_name)
+ modest_window_set_active_account (MODEST_WINDOW (self), default_account);
+
priv->view_additions_group = gtk_action_group_new (MODEST_MAIN_WINDOW_ACTION_GROUP_ADDITIONS);
radio_group = NULL;
for (i = 0; i < num_accounts; i++) {
gchar *display_name = NULL;
ModestAccountData *account_data = (ModestAccountData *) g_slist_nth_data (accounts, i);
+ if (!account_data) {
+ g_warning ("%s: BUG: account_data == NULL", __FUNCTION__);
+ continue;
+ }
+
if (default_account && account_data->account_name &&
- !(strcmp (default_account, account_data->account_name) == 0)) {
+ !(strcmp (default_account, account_data->account_name) == 0)) {
display_name = g_strdup_printf (_("mcen_me_toolbar_sendreceive_default"),
account_data->display_name);
- }
- else {
+ } else {
display_name = g_strdup_printf (_("mcen_me_toolbar_sendreceive_mailbox_n"),
account_data->display_name);
}
-
+
/* Create action and add it to the action group. The
action name must be the account name, this way we
could know in the handlers the account to show */
- if(account_data && account_data->account_name) {
+ if (account_data && account_data->account_name) {
gchar* item_name, *refresh_action_name;
guint8 merge_id = 0;
GtkAction *view_account_action, *refresh_account_action;
gtk_radio_action_set_group (GTK_RADIO_ACTION (view_account_action), radio_group);
radio_group = gtk_radio_action_get_group (GTK_RADIO_ACTION (view_account_action));
- if (default_account && account_data->account_name &&
- (strcmp (default_account, account_data->account_name) == 0)) {
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (view_account_action), TRUE);
+ if (active_account_name) {
+ if (active_account_name && account_data->account_name &&
+ (strcmp (active_account_name, account_data->account_name) == 0)) {
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (view_account_action), TRUE);
+ }
}
/* Add ui from account data. We allow 2^9-1 account
G_OBJECT(priv->folder_view), "key-press-event",
G_CALLBACK(on_inner_widgets_key_pressed), self);
priv->sighandlers =
- modest_signal_mgr_connect (priv->sighandlers, G_OBJECT(priv->folder_view), "folder_selection_changed",
- G_CALLBACK (modest_main_window_on_folder_selection_changed), self);
+ modest_signal_mgr_connect (priv->sighandlers, G_OBJECT(priv->folder_view),
+ "folder_selection_changed",
+ G_CALLBACK (on_folder_selection_changed),
+ self);
priv->sighandlers =
- modest_signal_mgr_connect (priv->sighandlers,G_OBJECT(priv->folder_view), "folder-display-name-changed",
- G_CALLBACK (modest_ui_actions_on_folder_display_name_changed), self);
+ modest_signal_mgr_connect (priv->sighandlers,G_OBJECT(priv->folder_view),
+ "folder-display-name-changed",
+ G_CALLBACK (modest_ui_actions_on_folder_display_name_changed),
+ self);
priv->sighandlers =
- modest_signal_mgr_connect (priv->sighandlers,G_OBJECT (priv->folder_view), "focus-in-event",
- G_CALLBACK (on_folder_view_focus_in), self);
+ modest_signal_mgr_connect (priv->sighandlers,G_OBJECT (priv->folder_view),
+ "focus-in-event",
+ G_CALLBACK (on_folder_view_focus_in),
+ self);
/* Folder view CSM */
menu = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/FolderViewCSM");
priv->folder_view = MODEST_FOLDER_VIEW (modest_platform_create_folder_view (NULL));
wrap_in_scrolled_window (folder_win, GTK_WIDGET(priv->folder_view));
-/* wrap_in_scrolled_window (priv->contents_widget, GTK_WIDGET(priv->header_view)); */
gtk_widget_show (GTK_WIDGET (priv->folder_view));
/* Restore window & widget settings */
restore_settings (MODEST_MAIN_WINDOW(self), TRUE);
-/* /\* The UI spec wants us to show a connection dialog when the application is */
-/* * started by the user, if there is no connection. */
-/* * Do this before showing the account wizard, */
-/* * because wizard needs a connection to discover capabilities. *\/ */
-/* modest_platform_connect_and_wait (GTK_WINDOW (self), NULL); */
-
/* Check if accounts exist and show the account wizard if not */
gboolean accounts_exist =
modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE);
"/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsSendReceiveAllMenu");
gtk_action_set_visible (send_receive_all, g_slist_length (accounts) > 1);
modest_account_mgr_free_account_names (accounts);
+ update_menus (MODEST_MAIN_WINDOW (self));
}
}
static gchar *
get_gray_color_markup (GtkWidget *styled_widget)
{
- gchar *gray_color_markup;
-
+ gchar *gray_color_markup = NULL;
+#ifndef MODEST_HAVE_HILDON0_WIDGETS
/* Obtain the secondary text color. We need a realized widget, that's why
we get styled_widget from outside */
-#ifndef MODEST_HAVE_HILDON0_WIDGETS
GdkColor color;
- gtk_style_lookup_color (styled_widget->style, "SecondaryTextColor", &color);
- gray_color_markup = modest_text_utils_get_color_string (&color);
-#else
- gray_color_markup = g_strdup ("#BBBBBB");
-#endif
+ if (gtk_style_lookup_color (styled_widget->style, "SecondaryTextColor", &color))
+ gray_color_markup = modest_text_utils_get_color_string (&color);
+#endif /*MODEST_HAVE_HILDON0_WIDGETS*/
+
+ if (!gray_color_markup)
+ gray_color_markup = g_strdup ("#BBBBBB");
+
return gray_color_markup;
}
}
const gchar *active_server_account_name =
- modest_folder_view_get_account_id_of_visible_server_account (priv->folder_view);
+ modest_folder_view_get_account_id_of_visible_server_account (priv->folder_view);
+
if (!active_server_account_name ||
!modest_account_mgr_account_exists (account_mgr, active_server_account_name, TRUE))
{
gchar* first_modest_name = modest_account_mgr_get_first_account_name (account_mgr);
- if (first_modest_name) {
+ gchar* default_modest_name = modest_account_mgr_get_default_account (account_mgr);
+ if (default_modest_name) {
+ set_account_visible (self, default_modest_name);
+ } else if (first_modest_name) {
set_account_visible (self, first_modest_name);
- g_free (first_modest_name);
}
+ g_free (first_modest_name);
+ g_free (default_modest_name);
}
}
}
static gboolean
-on_folder_view_focus_in (GtkWidget *widget,
- GdkEventFocus *event,
- gpointer userdata)
+on_folder_view_focus_in (GtkWidget *widget, GdkEventFocus *event, gpointer userdata)
{
ModestMainWindow *main_window = NULL;
gpointer userdata)
{
ModestMainWindow *main_window = NULL;
- ModestMainWindowPrivate *priv = NULL;
g_return_val_if_fail (MODEST_IS_MAIN_WINDOW (userdata), FALSE);
+
main_window = MODEST_MAIN_WINDOW (userdata);
- priv = MODEST_MAIN_WINDOW_GET_PRIVATE (main_window);
/* Update toolbar dimming state */
modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (main_window));
}
static void
-modest_main_window_on_folder_selection_changed (ModestFolderView *folder_view,
- TnyFolderStore *folder_store,
- gboolean selected,
- ModestMainWindow *main_window)
+on_folder_selection_changed (ModestFolderView *folder_view,
+ TnyFolderStore *folder_store,
+ gboolean selected,
+ ModestMainWindow *main_window)
{
ModestWindowPrivate *parent_priv = MODEST_WINDOW_GET_PRIVATE (main_window);
GtkAction *action = NULL;
priv = MODEST_MAIN_WINDOW_GET_PRIVATE (user_data);
- priv->updating_banner =
- modest_platform_animation_banner (GTK_WIDGET (user_data), NULL,
- _CS ("ckdg_pb_updating"));
+ if (priv->updating_banner == NULL) {
+
+ /* We're outside the main lock */
+ gdk_threads_enter ();
+ priv->updating_banner =
+ modest_platform_animation_banner (GTK_WIDGET (user_data), NULL,
+ _CS ("ckdg_pb_updating"));
+ gdk_threads_leave ();
+ }
/* Remove timeout */
priv->updating_banner_timeout = 0;
ModestMainWindowPrivate *priv = NULL;
priv = MODEST_MAIN_WINDOW_GET_PRIVATE (user_data);
-
+
/* Remove old timeout */
if (priv->updating_banner_timeout > 0) {
g_source_remove (priv->updating_banner_timeout);