{
GtkWidget *main_menu;
GtkWidget *menubar;
- GList *iter;
+ GList *iter, *children;
/* Create new main menu */
main_menu = gtk_menu_new();
/* Get the menubar from the UI manager */
menubar = gtk_ui_manager_get_widget (ui_manager, "/MenuBar");
- iter = gtk_container_get_children (GTK_CONTAINER (menubar));
+ iter = children = gtk_container_get_children (GTK_CONTAINER (menubar));
while (iter) {
GtkWidget *menu;
menu = GTK_WIDGET (iter->data);
gtk_widget_reparent(menu, main_menu);
-
+
iter = g_list_next (iter);
}
+ g_list_free (children);
+
return main_menu;
}
GtkWidget *main_vbox;
ModestMsgViewWindowPrivate *priv;
ModestWindowPrivate *parent_priv;
-
+ ModestConf *conf;
+ GtkAction *action = NULL;
+
priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
/* Menubar */
parent_priv->menubar = menubar_to_menu (parent_priv->ui_manager);
- gtk_widget_show_all (GTK_WIDGET(parent_priv->menubar));
+ conf = modest_runtime_get_conf ();
+ action = gtk_ui_manager_get_action (parent_priv->ui_manager,
+ "/MenuBar/ViewMenu/ViewShowToolbarMenu/ViewShowToolbarNormalScreenMenu");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ modest_conf_get_bool (conf, MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR, NULL));
+ action = gtk_ui_manager_get_action (parent_priv->ui_manager,
+ "/MenuBar/ViewMenu/ViewShowToolbarMenu/ViewShowToolbarFullScreenMenu");
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ modest_conf_get_bool (conf, MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR_FULLSCREEN, NULL));
hildon_window_set_menu (HILDON_WINDOW(obj), GTK_MENU(parent_priv->menubar));
+ gtk_widget_show (GTK_WIDGET(parent_priv->menubar));
priv->main_scroll = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->main_scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
if (tny_header_get_flags (header) & TNY_HEADER_FLAG_CACHED) {
op_type = MODEST_MAIL_OPERATION_TYPE_OPEN;
} else {
- TnyFolder *folder;
- GtkResponseType response;
-
op_type = MODEST_MAIL_OPERATION_TYPE_RECEIVE;
- /* Ask the user if he wants to download the message */
- response = modest_platform_run_confirmation_dialog (GTK_WINDOW (window),
- _("mcen_nc_get_msg"));
- if (response == GTK_RESPONSE_CANCEL)
- return FALSE;
+ /* Ask the user if he wants to download the message if
+ we're not online */
+ if (!tny_device_is_online (modest_runtime_get_device())) {
+ TnyFolder *folder = NULL;
+ GtkResponseType response;
+
+ response = modest_platform_run_confirmation_dialog (GTK_WINDOW (window),
+ _("mcen_nc_get_msg"));
+ if (response == GTK_RESPONSE_CANCEL)
+ return FALSE;
- /* Offer the connection dialog if necessary */
- /* FIXME: should this stuff go directly to the mail
- operation instead of spread it all over the
- code? */
- folder = tny_header_get_folder (header);
- if (folder) {
- if (!modest_platform_connect_and_wait_if_network_folderstore (NULL, TNY_FOLDER_STORE (folder))) {
+ /* Offer the connection dialog if necessary */
+ folder = tny_header_get_folder (header);
+ if (folder) {
+ if (!modest_platform_connect_and_wait_if_network_folderstore (NULL,
+ TNY_FOLDER_STORE (folder))) {
+ g_object_unref (folder);
+ return FALSE;
+ }
g_object_unref (folder);
- return FALSE;
}
- g_object_unref (folder);
}
}
}
-void
-modest_msg_view_window_toggle_fullscreen (ModestMsgViewWindow *window)
-{
- ModestWindowPrivate *parent_priv;
- GtkAction *fs_toggle_action;
- parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
-
- fs_toggle_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ViewToggleFullscreenMenu");
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (fs_toggle_action),
- !gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (fs_toggle_action)));
-}
-
static void
set_homogeneous (GtkWidget *widget,
gpointer data)
GtkWidget *reply_button = NULL, *menu = NULL;
GtkWidget *placeholder = NULL;
gint insert_index;
+ const gchar *action_name;
+ GtkAction *action;
parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(self);
if (!parent_priv->toolbar) {
parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager,
"/ToolBar");
+ gtk_widget_set_no_show_all (parent_priv->toolbar, TRUE);
/* Set homogeneous toolbar */
gtk_container_foreach (GTK_CONTAINER (parent_priv->toolbar),
gtk_widget_set_no_show_all (parent_priv->toolbar, TRUE);
gtk_widget_hide (GTK_WIDGET (parent_priv->toolbar));
}
+
+ /* Update also the actions (to update the toggles in the
+ menus), we have to do it manually because some other window
+ of the same time could have changed it (remember that the
+ toolbar fullscreen mode is shared by all the windows of the
+ same type */
+ if (modest_window_mgr_get_fullscreen_mode (modest_runtime_get_window_mgr ()))
+ action_name = "/MenuBar/ViewMenu/ViewShowToolbarMenu/ViewShowToolbarFullScreenMenu";
+ else
+ action_name = "/MenuBar/ViewMenu/ViewShowToolbarMenu/ViewShowToolbarNormalScreenMenu";
+
+ action = gtk_ui_manager_get_action (parent_priv->ui_manager, action_name);
+ modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action),
+ show_toolbar);
}
static void
if (!TNY_IS_MSG (mime_part)) {
gchar *filepath = NULL;
const gchar *att_filename = tny_mime_part_get_filename (mime_part);
- gchar *extension = NULL;
TnyFsStream *temp_stream = NULL;
- if (att_filename) {
- extension = g_strrstr (att_filename, ".");
- if (extension != NULL)
- extension++;
- }
-
- temp_stream = modest_maemo_utils_create_temp_stream (extension, &filepath);
-
+ temp_stream = modest_maemo_utils_create_temp_stream (att_filename, &filepath);
+
if (temp_stream) {
const gchar *content_type;
content_type = tny_mime_part_get_content_type (mime_part);
modest_platform_activate_file (filepath, content_type);
g_object_unref (temp_stream);
g_free (filepath);
- /* TODO: delete temporary file */
+ /* NOTE: files in the temporary area will be automatically
+ * cleaned after some time if they are no longer in use */
}
} else {
/* message attachment */