X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmaemo%2Fmodest-main-window.c;h=80abed1dc0d386cfcab8d7a6449c91f58d3dee48;hp=c9170fd6c813ba4222cbae5c81100bda89422398;hb=6dfdd25404174f69b0b3b5da601b070b4450a047;hpb=39bc2119c112ea185927454139dc646200ca8b1c
diff --git a/src/maemo/modest-main-window.c b/src/maemo/modest-main-window.c
index c9170fd..80abed1 100644
--- a/src/maemo/modest-main-window.c
+++ b/src/maemo/modest-main-window.c
@@ -214,6 +214,7 @@ struct _ModestMainWindowPrivate {
ModestMainWindowStyle style;
ModestMainWindowContentsStyle contents_style;
+ gboolean wait_for_settings;
guint progress_bar_timeout;
guint restore_paned_timeout;
@@ -345,6 +346,7 @@ modest_main_window_init (ModestMainWindow *obj)
priv->progress_bar = NULL;
priv->current_toolbar_mode = TOOLBAR_MODE_NORMAL;
priv->style = MODEST_MAIN_WINDOW_STYLE_SPLIT;
+ priv->wait_for_settings = TRUE;
priv->contents_style = -1; /* invalid contents style. We need this to select it for the first time */
priv->merge_ids = NULL;
priv->optimized_view = FALSE;
@@ -704,14 +706,11 @@ update_menus (ModestMainWindow* self)
if (num_accounts > 1) {
GtkWidget *label = gtk_label_new(NULL);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- if (default_account && (strcmp(account_name, default_account) == 0))
- {
+ if (default_account && (strcmp(account_name, default_account) == 0)) {
gchar *escaped = g_markup_printf_escaped ("%s", display_name);
gtk_label_set_markup (GTK_LABEL (label), escaped);
g_free (escaped);
- }
- else
- {
+ } else {
gtk_label_set_text (GTK_LABEL (label), display_name);
}
@@ -739,46 +738,54 @@ update_menus (ModestMainWindow* self)
* group being inserted. This makes the default account appear in bold.
* I agree it is a rather ugly way, but I don't see another possibility. armin. */
for (i = 0; i < num_accounts; i++) {
- ModestAccountSettings *settings = (ModestAccountSettings *) g_slist_nth_data (accounts, i);
+ gchar *item_name, *path;
+ GtkWidget *item;
+ ModestAccountSettings *settings;
const gchar *account_name;
+ gboolean is_default;
+ settings = (ModestAccountSettings *) g_slist_nth_data (accounts, i);
account_name = modest_account_settings_get_account_name (settings);
+ is_default = (account_name && default_account && !strcmp (account_name, default_account));
- if(account_name && default_account &&
- strcmp (account_name, default_account) == 0) {
- gchar *item_name = g_strconcat (account_name, "Menu", NULL);
-
- gchar *path = g_strconcat ("/MenuBar/ViewMenu/ViewMenuAdditions/", item_name, NULL);
- GtkWidget *item = gtk_ui_manager_get_widget (parent_priv->ui_manager, path);
- g_free(path);
-
- if (item) {
- GtkWidget *child = gtk_bin_get_child (GTK_BIN (item));
- if (GTK_IS_LABEL (child)) {
- const gchar *cur_name = gtk_label_get_text (GTK_LABEL (child));
+ /* Get the item of the view menu */
+ item_name = g_strconcat (account_name, "Menu", NULL);
+ path = g_strconcat ("/MenuBar/ViewMenu/ViewMenuAdditions/", item_name, NULL);
+ item = gtk_ui_manager_get_widget (parent_priv->ui_manager, path);
+ g_free(path);
+
+ if (item) {
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (item));
+ if (GTK_IS_LABEL (child)) {
+ const gchar *cur_name = gtk_label_get_text (GTK_LABEL (child));
+ if (is_default) {
gchar *bold_name = g_markup_printf_escaped("%s", cur_name);
gtk_label_set_markup (GTK_LABEL (child), bold_name);
g_free (bold_name);
}
+ gtk_label_set_ellipsize (GTK_LABEL (child), PANGO_ELLIPSIZE_END);
}
+ }
- path = g_strconcat("/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsMenuAdditions/", item_name, NULL);
- item = gtk_ui_manager_get_widget (parent_priv->ui_manager, path);
- g_free (path);
-
- if (item) {
- GtkWidget *child = gtk_bin_get_child (GTK_BIN (item));
- if (GTK_IS_LABEL (child)) {
- const gchar *cur_name = gtk_label_get_text (GTK_LABEL (child));
+ /* Get the item of the tools menu */
+ path = g_strconcat("/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsMenuAdditions/", item_name, NULL);
+ item = gtk_ui_manager_get_widget (parent_priv->ui_manager, path);
+ g_free (path);
+
+ if (item) {
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (item));
+ if (GTK_IS_LABEL (child)) {
+ const gchar *cur_name = gtk_label_get_text (GTK_LABEL (child));
+ if (is_default) {
gchar *bold_name = g_markup_printf_escaped("%s", cur_name);
gtk_label_set_markup (GTK_LABEL (child), bold_name);
g_free (bold_name);
}
+ gtk_label_set_ellipsize (GTK_LABEL (child), PANGO_ELLIPSIZE_END);
}
-
- g_free(item_name);
}
+ g_free(item_name);
g_object_unref (settings);
}
@@ -1076,7 +1083,9 @@ modest_main_window_on_show (GtkWidget *self, gpointer user_data)
modest_osso_load_state ();
/* Restore window & widget settings */
+ priv->wait_for_settings = TRUE;
restore_settings (MODEST_MAIN_WINDOW(self), TRUE);
+ priv->wait_for_settings = FALSE;
/* Check if accounts exist and show the account wizard if not */
gboolean accounts_exist =
@@ -1324,6 +1333,10 @@ modest_main_window_set_style (ModestMainWindow *self,
priv->style = style;
switch (style) {
case MODEST_MAIN_WINDOW_STYLE_SIMPLE:
+
+ if (!priv->wait_for_settings)
+ modest_widget_memory_save (modest_runtime_get_conf (), G_OBJECT (priv->main_paned),
+ MODEST_CONF_MAIN_PANED_KEY);
/* Remove main paned */
g_object_ref (priv->main_paned);
gtk_container_remove (GTK_CONTAINER (priv->main_vbox), priv->main_paned);
@@ -1341,6 +1354,8 @@ modest_main_window_set_style (ModestMainWindow *self,
gtk_paned_add2 (GTK_PANED (priv->main_paned), priv->contents_widget);
gtk_container_add (GTK_CONTAINER (priv->main_vbox), priv->main_paned);
+ g_timeout_add (500, (GSourceFunc) restore_paned_timeout_handler, self);
+
break;
default:
g_return_if_reached ();
@@ -1908,7 +1923,7 @@ on_msg_count_changed (ModestHeaderView *header_view,
/* Play a sound (if configured) and make the LED blink */
if (changed & TNY_FOLDER_CHANGE_CHANGED_ADDED_HEADERS) {
- modest_platform_on_new_headers_received (NULL, FALSE);
+ modest_platform_push_email_notification ();
}
}
@@ -2218,6 +2233,7 @@ get_toolbar_mode_from_mail_operation (ModestMainWindow *self,
/* Get toolbar mode from operation id*/
switch (modest_mail_operation_get_type_operation (mail_op)) {
+ case MODEST_MAIL_OPERATION_TYPE_SEND_AND_RECEIVE:
case MODEST_MAIL_OPERATION_TYPE_RECEIVE:
case MODEST_MAIL_OPERATION_TYPE_OPEN:
mode = TOOLBAR_MODE_TRANSFER;
@@ -2679,6 +2695,8 @@ modest_main_window_screen_is_on (ModestMainWindow *self)
{
ModestMainWindowPrivate *priv = NULL;
+ g_return_val_if_fail (MODEST_IS_MAIN_WINDOW(self), FALSE);
+
priv = MODEST_MAIN_WINDOW_GET_PRIVATE (self);
return (priv->display_state == OSSO_DISPLAY_ON) ? TRUE : FALSE;