}
}
+typedef struct
+{
+ GtkWidget *folder_win;
+ gulong handler_id;
+} ShowHelper;
+
static void
modest_main_window_on_show (GtkWidget *self, gpointer user_data)
{
- GtkWidget *folder_win = (GtkWidget *) user_data;
+ ShowHelper *helper = (ShowHelper *) user_data;
+ GtkWidget *folder_win = helper->folder_win;
ModestMainWindowPrivate *priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
priv->folder_view = MODEST_FOLDER_VIEW (modest_platform_create_folder_view (NULL));
modest_account_mgr_free_account_names (accounts);
update_menus (MODEST_MAIN_WINDOW (self));
}
+
+ /* Never call this function again (NOTE that it could happen
+ as we hide the main window instead of closing it while
+ there are operations ongoing) and free the helper */
+ g_signal_handler_disconnect (self, helper->handler_id);
+ g_slice_free (ShowHelper, helper);
}
static void
ModestConf *conf = NULL;
GtkAction *action = NULL;
GdkPixbuf *window_icon;
+ ShowHelper *helper;
self = MODEST_MAIN_WINDOW(g_object_new(MODEST_TYPE_MAIN_WINDOW, NULL));
priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
g_signal_connect (G_OBJECT(app), "notify::is-topmost",
G_CALLBACK (on_hildon_program_is_topmost_notify), self);
- g_signal_connect (G_OBJECT(self), "show",
- G_CALLBACK (modest_main_window_on_show), folder_win);
+ /* Connect to "show" action. We delay the creation of some
+ elements until that moment */
+ helper = g_slice_new0 (ShowHelper);
+ helper->folder_win = folder_win;
+ helper->handler_id = g_signal_connect (G_OBJECT(self), "show",
+ G_CALLBACK (modest_main_window_on_show),
+ helper);
/* Set window icon */
window_icon = modest_platform_get_icon (MODEST_APP_ICON, MODEST_ICON_SIZE_BIG);
{
GtkTreeSelection *selection = NULL;
GtkTreePath *path = NULL;
- gboolean already_selected = FALSE;
+ gboolean already_selected = FALSE, already_opened = FALSE;
ModestTnySendQueueStatus status = MODEST_TNY_SEND_QUEUE_UNKNOWN;
if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(self), event->x, event->y, &path, NULL, NULL, NULL)) {
TNY_GTK_HEADER_LIST_MODEL_INSTANCE_COLUMN,
&value);
header = (TnyHeader *) g_value_get_object (&value);
- if (TNY_IS_HEADER (header))
+ if (TNY_IS_HEADER (header)) {
status = modest_tny_all_send_queues_get_msg_status (header);
+ already_opened = modest_window_mgr_find_registered_header (modest_runtime_get_window_mgr (),
+ header, NULL);
+ }
g_value_unset (&value);
}
}
- /* Enable drag and drop onlly if the user clicks on a row that
+ /* Enable drag and drop only if the user clicks on a row that
it's already selected. If not, let him select items using
- the pointer. If the message is in an outbos and in sending
+ the pointer. If the message is in an OUTBOX and in sending
status disable drag and drop as well */
- if (!already_selected || status == MODEST_TNY_SEND_QUEUE_SENDING)
+ if (!already_selected ||
+ status == MODEST_TNY_SEND_QUEUE_SENDING ||
+ already_opened)
disable_drag_and_drop(self);
if (path != NULL)
gtk_tree_path_free(path);
- return FALSE;
+ /* If it's already opened then do not let the button-press
+ event go on because it'll perform a message open because
+ we're clicking on to an already selected header */
+ return (already_opened) ? TRUE : FALSE;
}
static void