}
}
-/* Debugging */
-/* static void */
-/* on_window_destroy (ModestWindow *window, */
-/* ModestWindowMgr *self) */
-/* { */
-/* ModestMainWindow *mw = NULL; */
-/* ModestMainWindowPrivate *priv = NULL; */
-
-/* mw = MODEST_MAIN_WINDOW (window); */
-/* priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self); */
-
-/* g_print ("\tMW: %d\n", ((GObject*)mw)->ref_count); */
-/* g_print ("\tHV: %d\n", ((GObject*)priv->header_view)->ref_count); */
-/* g_print ("\tFV: %d\n", ((GObject*)priv->folder_view)->ref_count); */
-/* } */
-
ModestWindow *
modest_main_window_new (void)
{
restore_settings (MODEST_MAIN_WINDOW(self), FALSE);
-/* { */
-/* g_signal_connect (self, "destroy", */
-/* G_CALLBACK (on_window_destroy), self); */
-/* } */
-
return MODEST_WINDOW(self);
}
modest_msg_view_window_update_priority (self);
update_window_title (MODEST_MSG_VIEW_WINDOW (self));
modest_msg_view_grab_focus (MODEST_MSG_VIEW (priv->msg_view));
+
+ /* Free new references */
+ g_object_unref (self);
}
TnyFolderType
void
modest_platform_on_new_msg (void)
{
- return; /* TODO: Reenable this later. I disabled it to avoid having one notification per email. */
-#ifndef MODEST_HILDON_VERSION_0
- HildonNotification *not;
-
- /* Create a new notification. FIXME put the right values, need
- some more specs */
- not = hildon_notification_new ("TODO: (new email) Summary",
- "TODO: (new email) Description",
- "qgn_contact_group_chat_invitation",
- "system.note.dialog");
-
- /* Play sound SR-SND-18. TODO: play the right file */
+/* HildonNotification *not; */
+
+/* /\* Create a new notification. FIXME put the right values, need */
+/* some more specs *\/ */
+/* not = hildon_notification_new ("TODO: (new email) Summary", */
+/* "TODO: (new email) Description", */
+/* "qgn_contact_group_chat_invitation", */
+/* "system.note.dialog"); */
+
+/* /\* Play sound SR-SND-18. TODO: play the right file *\/ */
/* hildon_notification_set_sound (not, "/usr/share/sounds/ui-new_email.wav"); */
- /* Set the led pattern */
- notify_notification_set_hint_int32 (NOTIFY_NOTIFICATION (not), "led-pattern", 3);
+/* /\* Set the led pattern *\/ */
+/* notify_notification_set_hint_int32 (NOTIFY_NOTIFICATION (not), "led-pattern", 3); */
- /* Notify. We need to do this in an idle because this function
- could be called from a thread */
- if (!notify_notification_show (NOTIFY_NOTIFICATION (not), NULL))
- g_error ("Failed to send notification");
+/* /\* Notify. We need to do this in an idle because this function */
+/* could be called from a thread *\/ */
+/* if (!notify_notification_show (NOTIFY_NOTIFICATION (not), NULL)) */
+/* g_error ("Failed to send notification"); */
- g_object_unref (not);
-#endif /*MODEST_HILDON_VERSION_0*/
+/* g_object_unref (not); */
}
cleanup:
/* Free */
g_free(account);
+ g_object_unref (parent_win);
g_object_unref (msg);
g_object_unref (folder);
g_object_unref (header);
modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL,
error->message);
+ g_object_unref (win);
}
}
modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL,
_("mail_in_ui_folder_delete_error"));
+ g_object_unref (win);
}
static void
/* TODO: show error message */
modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL,
_("mail_in_ui_folder_move_target_error"));
+ g_object_unref (win);
}
/*
gchar *local_account_name;
gchar *visible_account_id;
ModestFolderViewStyle style;
+
+ gboolean reselect; /* we use this to force a reselection of the INBOX */
};
#define MODEST_FOLDER_VIEW_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), \
priv->clipboard = modest_runtime_get_email_clipboard ();
priv->hidding_ids = NULL;
priv->n_selected = 0;
+ priv->reselect = FALSE;
/* Build treeview */
add_columns (GTK_WIDGET (obj));
title != NULL);
}
+static gboolean
+modest_folder_view_on_map (ModestFolderView *self,
+ GdkEventExpose *event,
+ gpointer data)
+{
+ ModestFolderViewPrivate *priv;
+
+ priv = MODEST_FOLDER_VIEW_GET_PRIVATE (self);
+
+ /* This won't happen often */
+ if (G_UNLIKELY (priv->reselect)) {
+ /* Select the first inbox or the local account if not found */
+ modest_folder_view_select_first_inbox_or_local (self);
+ priv->reselect = FALSE;
+ }
+ return FALSE;
+}
+
GtkWidget*
modest_folder_view_new (TnyFolderStoreQuery *query)
{
priv->changed_signal = g_signal_connect (sel, "changed",
G_CALLBACK (on_selection_changed), self);
+ g_signal_connect (self, "expose-event", G_CALLBACK (modest_folder_view_on_map), NULL);
+
return GTK_WIDGET(self);
}
gtk_tree_view_set_model (GTK_TREE_VIEW(self), filter_model);
/* gtk_tree_view_set_model (GTK_TREE_VIEW(self), */
/* (filter_model) ? filter_model : sortable); */
- expand_root_items (self); /* expand all account folders */
-
+
g_object_unref (model);
-
g_object_unref (filter_model);
/* if (filter_model) */
/* g_object_unref (filter_model); */
g_object_unref (sortable);
- /* Select the first inbox or the local account if not found */
- modest_folder_view_select_first_inbox_or_local (self);
+ /* Force a reselection of the INBOX next time the widget is shown */
+ priv->reselect = TRUE;
return TRUE;
}
G_OBJECT_CLASS(parent_class)->dispose (obj);
}
-
-
static void
modest_header_view_finalize (GObject *obj)
{
g_mutex_lock (priv->observers_lock);
tny_folder_remove_observer (priv->folder, TNY_FOLDER_OBSERVER (self));
g_object_unref (priv->folder);
-/* g_print ("---------- REMAINING %d\n", ((GObject*)priv->folder)->ref_count); */
priv->folder = NULL;
g_mutex_unlock (priv->observers_lock);
}