ModestMsgViewWindow *obj);
static void modest_msg_view_window_disconnect_signals (ModestWindow *self);
-static void modest_msg_view_window_set_zoom (ModestWindow *window,
- gdouble zoom);
+
static gdouble modest_msg_view_window_get_zoom (ModestWindow *window);
-static gboolean modest_msg_view_window_zoom_minus (ModestWindow *window);
-static gboolean modest_msg_view_window_zoom_plus (ModestWindow *window);
static gboolean modest_msg_view_window_key_event (GtkWidget *window,
GdkEventKey *event,
gpointer userdata);
-static gboolean modest_msg_view_window_window_state_event (GtkWidget *widget,
- GdkEventWindowState *event,
- gpointer userdata);
+
static void modest_msg_view_window_update_priority (ModestMsgViewWindow *window);
static void modest_msg_view_window_show_toolbar (ModestWindow *window,
static const GtkToggleActionEntry msg_view_toggle_action_entries [] = {
{ "FindInMessage", MODEST_TOOLBAR_ICON_FIND, N_("qgn_toolb_gene_find"), NULL, NULL, G_CALLBACK (modest_msg_view_window_toggle_find_toolbar), FALSE },
- { "ToolsFindInMessage", NULL, N_("mcen_me_viewer_find"), "<CTRL>F", NULL, G_CALLBACK (modest_msg_view_window_toggle_find_toolbar), FALSE },
-};
-
-static const GtkRadioActionEntry msg_view_zoom_action_entries [] = {
- { "Zoom50", NULL, N_("mcen_me_viewer_50"), NULL, NULL, 50 },
- { "Zoom80", NULL, N_("mcen_me_viewer_80"), NULL, NULL, 80 },
- { "Zoom100", NULL, N_("mcen_me_viewer_100"), NULL, NULL, 100 },
- { "Zoom120", NULL, N_("mcen_me_viewer_120"), NULL, NULL, 120 },
- { "Zoom150", NULL, N_("mcen_me_viewer_150"), NULL, NULL, 150 },
- { "Zoom200", NULL, N_("mcen_me_viewer_200"), NULL, NULL, 200 }
};
typedef struct _ModestMsgViewWindowPrivate ModestMsgViewWindowPrivate;
MODEST_CONF_MSG_VIEW_WINDOW_KEY);
}
-
-static void
-restore_settings (ModestMsgViewWindow *self)
-{
- ModestConf *conf;
- ModestWindowPrivate *parent_priv = MODEST_WINDOW_GET_PRIVATE (self);
- GtkAction *action;
-
- 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));
- modest_widget_memory_restore (conf,
- G_OBJECT(self),
- MODEST_CONF_MSG_VIEW_WINDOW_KEY);
-}
-
-static gboolean modest_msg_view_window_scroll_child (ModestMsgViewWindow *self,
- GtkScrollType scroll_type,
- gboolean horizontal,
- gpointer userdata)
+static
+gboolean modest_msg_view_window_scroll_child (ModestMsgViewWindow *self,
+ GtkScrollType scroll_type,
+ gboolean horizontal,
+ gpointer userdata)
{
ModestMsgViewWindowPrivate *priv;
gboolean return_value;
parent_class = g_type_class_peek_parent (klass);
gobject_class->finalize = modest_msg_view_window_finalize;
- modest_window_class->set_zoom_func = modest_msg_view_window_set_zoom;
modest_window_class->get_zoom_func = modest_msg_view_window_get_zoom;
- modest_window_class->zoom_minus_func = modest_msg_view_window_zoom_minus;
- modest_window_class->zoom_plus_func = modest_msg_view_window_zoom_plus;
modest_window_class->show_toolbar_func = modest_msg_view_window_show_toolbar;
modest_window_class->disconnect_signals_func = modest_msg_view_window_disconnect_signals;
G_N_ELEMENTS (modest_action_entries),
obj);
gtk_action_group_add_toggle_actions (action_group,
- modest_toggle_action_entries,
- G_N_ELEMENTS (modest_toggle_action_entries),
- obj);
- gtk_action_group_add_toggle_actions (action_group,
msg_view_toggle_action_entries,
G_N_ELEMENTS (msg_view_toggle_action_entries),
obj);
- gtk_action_group_add_radio_actions (action_group,
- msg_view_zoom_action_entries,
- G_N_ELEMENTS (msg_view_zoom_action_entries),
- 100,
- G_CALLBACK (modest_ui_actions_on_change_zoom),
- obj);
gtk_ui_manager_insert_action_group (parent_priv->ui_manager, action_group, 0);
g_object_unref (action_group);
if (msg_is_visible (header, is_outbox)) {
next = gtk_tree_model_get_path (model, &tmp_iter);
*row_reference = gtk_tree_row_reference_new (model, next);
+ gtk_tree_path_free (next);
retval = TRUE;
finished = TRUE;
}
message */
finished = TRUE;
}
+ gtk_tree_path_free (next);
} else {
/* If there are no more messages and we don't
want to start again in the first one then
/* Free */
gtk_tree_path_free (path);
- if (next)
- gtk_tree_path_free (next);
return retval;
}
g_object_unref (toolbar_rules_group);
g_object_unref (clipboard_rules_group);
- restore_settings (MODEST_MSG_VIEW_WINDOW(obj));
-
/* g_signal_connect (G_OBJECT(obj), "delete-event", G_CALLBACK(on_delete_event), obj); */
priv->clipboard_change_handler = g_signal_connect (G_OBJECT (gtk_clipboard_get (GDK_SELECTION_PRIMARY)), "owner-change", G_CALLBACK (modest_msg_view_window_clipboard_owner_change), obj);
G_CALLBACK (modest_msg_view_window_key_event),
NULL);
- g_signal_connect (G_OBJECT (obj), "window-state-event",
- G_CALLBACK (modest_msg_view_window_window_state_event),
- NULL);
-
g_signal_connect (G_OBJECT (obj), "move-focus",
G_CALLBACK (on_move_focus), obj);
tny_msg_view_set_msg (TNY_MSG_VIEW (priv->msg_view), msg);
update_window_title (MODEST_MSG_VIEW_WINDOW (window));
- gtk_widget_show_all (GTK_WIDGET (window));
+ /* gtk_widget_show_all (GTK_WIDGET (window)); */
modest_msg_view_window_update_priority (window);
/* Check dimming rules */
tny_msg_view_set_msg (TNY_MSG_VIEW (priv->msg_view), msg);
update_window_title (window);
- gtk_widget_show_all (GTK_WIDGET (window));
+ /* gtk_widget_show_all (GTK_WIDGET (window));*/
modest_msg_view_window_update_priority (window);
/* Check dimming rules */
tny_msg_view_set_msg (TNY_MSG_VIEW (priv->msg_view), msg);
update_window_title (MODEST_MSG_VIEW_WINDOW (obj));
- gtk_widget_show_all (GTK_WIDGET (obj));
+ /* gtk_widget_show_all (GTK_WIDGET (obj)); */
/* Check dimming rules */
modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (obj));
hildon_find_toolbar_highlight_entry (HILDON_FIND_TOOLBAR (priv->find_toolbar), TRUE);
} else {
gtk_widget_hide (priv->find_toolbar);
+ modest_msg_view_grab_focus (MODEST_MSG_VIEW (priv->msg_view));
}
/* update the toggle buttons status */
action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/FindInMessage");
modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), is_active);
- action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ToolsMenu/ToolsFindInMessageMenu");
- modest_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), is_active);
-
}
static void
}
-static void
-modest_msg_view_window_set_zoom (ModestWindow *window,
- gdouble zoom)
-{
- ModestMsgViewWindowPrivate *priv;
- ModestWindowPrivate *parent_priv;
- GtkAction *action = NULL;
- gint int_zoom = (gint) rint (zoom*100.0+0.1);
-
- g_return_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window));
-
- priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
- parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
- modest_zoomable_set_zoom (MODEST_ZOOMABLE (priv->msg_view), zoom);
-
- action = gtk_ui_manager_get_action (parent_priv->ui_manager,
- "/MenuBar/ViewMenu/ZoomMenu/Zoom50Menu");
-
- gtk_radio_action_set_current_value (GTK_RADIO_ACTION (action), int_zoom);
-}
-
static gdouble
modest_msg_view_window_get_zoom (ModestWindow *window)
{
}
static gboolean
-modest_msg_view_window_zoom_plus (ModestWindow *window)
-{
- ModestWindowPrivate *parent_priv;
- GtkRadioAction *zoom_radio_action;
- GSList *group, *node;
-
- parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
- zoom_radio_action = GTK_RADIO_ACTION (gtk_ui_manager_get_action (parent_priv->ui_manager,
- "/MenuBar/ViewMenu/ZoomMenu/Zoom50Menu"));
-
- group = gtk_radio_action_get_group (zoom_radio_action);
-
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (group->data))) {
- hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_max_zoom_level_reached"));
- return FALSE;
- }
-
- for (node = group; node != NULL; node = g_slist_next (node)) {
- if ((node->next != NULL) && gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (node->next->data))) {
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (node->data), TRUE);
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static gboolean
-modest_msg_view_window_zoom_minus (ModestWindow *window)
-{
- ModestWindowPrivate *parent_priv;
- GtkRadioAction *zoom_radio_action;
- GSList *group, *node;
-
- parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
- zoom_radio_action = GTK_RADIO_ACTION (gtk_ui_manager_get_action (parent_priv->ui_manager,
- "/MenuBar/ViewMenu/ZoomMenu/Zoom50Menu"));
-
- group = gtk_radio_action_get_group (zoom_radio_action);
-
- for (node = group; node != NULL; node = g_slist_next (node)) {
- if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (node->data))) {
- if (node->next != NULL) {
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (node->next->data), TRUE);
- return TRUE;
- } else {
- hildon_banner_show_information (NULL, NULL, dgettext("hildon-common-strings", "ckct_ib_min_zoom_level_reached"));
- return FALSE;
- }
- break;
- }
- }
- return FALSE;
-}
-
-static gboolean
modest_msg_view_window_key_event (GtkWidget *window,
GdkEventKey *event,
gpointer userdata)
TnyHeader *header,
GtkTreeRowReference *row_reference)
{
- gboolean already_showing = FALSE;
- ModestWindow *msg_window = NULL;
ModestWindowMgr *mgr;
TnyAccount *account;
TnyFolder *folder;
g_return_val_if_fail (row_reference != NULL, FALSE);
mgr = modest_runtime_get_window_mgr ();
- already_showing = modest_window_mgr_find_registered_header (mgr, header, &msg_window);
- if (already_showing && (msg_window != MODEST_WINDOW (window))) {
- gboolean retval;
- if (msg_window)
- gtk_window_present (GTK_WINDOW (msg_window));
- g_signal_emit_by_name (G_OBJECT (window), "delete-event", NULL, &retval);
- return TRUE;
- }
-
/* Msg download completed */
if (!(tny_header_get_flags (header) & TNY_HEADER_FLAG_CACHED)) {
/* Ask the user if he wants to download the message if
}
-static gboolean
-modest_msg_view_window_window_state_event (GtkWidget *widget, GdkEventWindowState *event, gpointer userdata)
-{
- if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) {
- ModestWindowPrivate *parent_priv;
- ModestWindowMgr *mgr;
- gboolean is_fullscreen;
- GtkAction *fs_toggle_action;
- gboolean active;
-
- mgr = modest_runtime_get_window_mgr ();
- is_fullscreen = (modest_window_mgr_get_fullscreen_mode (mgr))?1:0;
-
- parent_priv = MODEST_WINDOW_GET_PRIVATE (widget);
-
- fs_toggle_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ViewToggleFullscreenMenu");
- active = (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (fs_toggle_action)))?1:0;
- if (is_fullscreen != active) {
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (fs_toggle_action), is_fullscreen);
- }
- toolbar_resize (MODEST_MSG_VIEW_WINDOW (widget));
- }
-
- return FALSE;
-
-}
-
static void
modest_msg_view_window_show_toolbar (ModestWindow *self,
gboolean show_toolbar)
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);
insert_index = gtk_toolbar_get_item_index(GTK_TOOLBAR (parent_priv->toolbar), GTK_TOOL_ITEM(placeholder));
gtk_container_add (GTK_CONTAINER (priv->progress_toolitem), priv->progress_bar);
gtk_toolbar_insert(GTK_TOOLBAR(parent_priv->toolbar), GTK_TOOL_ITEM (priv->progress_toolitem), insert_index);
-
+
/* Connect cancel 'clicked' signal to abort progress mode */
g_signal_connect(priv->cancel_toolitem, "clicked",
G_CALLBACK(cancel_progressbar),
self);
-
+
/* Add it to the observers list */
priv->progress_widgets = g_slist_prepend(priv->progress_widgets, priv->progress_bar);
hildon_window_add_toolbar (HILDON_WINDOW (self),
GTK_TOOLBAR (parent_priv->toolbar));
- /* Set reply button tap and hold menu */
+ /* Set reply button tap and hold menu */
reply_button = gtk_ui_manager_get_widget (parent_priv->ui_manager,
"/ToolBar/ToolbarMessageReply");
menu = gtk_ui_manager_get_widget (parent_priv->ui_manager,
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_utils_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action),
- show_toolbar);
}
static void
ModestWindowMgr *mgr;
ModestWindow *msg_win = NULL;
gboolean found;
-
+
header = tny_msg_get_header (TNY_MSG (mime_part));
- mgr = modest_runtime_get_window_mgr ();
+ mgr = modest_runtime_get_window_mgr ();
found = modest_window_mgr_find_registered_header (mgr, header, &msg_win);
if (found) {
- if (msg_win) /* there is already a window for this uid; top it */
- gtk_window_present (GTK_WINDOW(msg_win));
- else
- /* if it's found, but there is no msg_win, it's probably in the process of being created;
- * thus, we don't do anything */
- g_warning ("window for is already being created");
- } else {
+ /* if it's found, but there is no msg_win, it's probably in the process of being created;
+ * thus, we don't do anything */
+ g_warning ("window for is already being created");
+ } else {
/* it's not found, so create a new window for it */
modest_window_mgr_register_header (mgr, header, attachment_uid); /* register the uid before building the window */
gchar *account = g_strdup (modest_window_get_active_account (MODEST_WINDOW (window)));
if (!account)
account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr ());
msg_win = modest_msg_view_window_new_for_attachment (TNY_MSG (mime_part), account, attachment_uid);
- modest_window_set_zoom (MODEST_WINDOW (msg_win),
+ modest_window_set_zoom (MODEST_WINDOW (msg_win),
modest_window_get_zoom (MODEST_WINDOW (window)));
- modest_window_mgr_register_window (mgr, msg_win);
+ modest_window_mgr_register_window (mgr, msg_win, MODEST_WINDOW (window));
gtk_widget_show_all (GTK_WIDGET (msg_win));
}
}