$(MODEST_OGS_CFLAGS) \
-I ${top_srcdir}/src/widgets \
-I ${top_srcdir}/src \
+ -I ${top_srcdir}/src/$(MODEST_TOOLKIT_DIR) \
-DPREFIX=\"@prefix@\" \
-DMAEMO_CHANGES \
-DPIXMAP_PREFIX=\"${datadir}/pixmaps/modest/\" \
#include <string.h>
#include <glib/gstdio.h>
#ifdef MODEST_HAVE_HILDON0_WIDGETS
+#include <hildon-widgets/hildon-program.h>
#include <libgnomevfs/gnome-vfs-mime-utils.h>
#else
+#include <hildon/hildon-program.h>
#include <libgnomevfs/gnome-vfs-mime.h>
#endif
#include <tny-fs-stream.h>
+#ifdef MODEST_TOOLKIT_HILDON2
+#include <modest-accounts-window.h>
+#include <modest-folder-window.h>
+#endif
+
+
#include <tny-list.h>
#include <tny-iterator.h>
#include <tny-simple-list.h>
{
TnyHeader *header;
ModestWindow *main_win = NULL, *msg_view = NULL;
- ModestHeaderView *header_view;
header = (TnyHeader *) user_data;
}
g_object_unref (header);
- /* Refilter the header view explicitly */
- header_view = (ModestHeaderView *)
- modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(main_win),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
- if (header_view && MODEST_IS_HEADER_VIEW (header_view))
- modest_header_view_refilter (header_view);
+ /* Refilter the header views explicitely */
+
+ /* TODO: call modest_window_mgr_refilter_header_views */
+ /* this call will go through all the windows, get the header views and refilter them */
}
static gpointer
return OSSO_OK;
}
+#ifdef MODEST_TOOLKIT_HILDON2
+static gboolean
+on_idle_top_application (gpointer user_data)
+{
+ HildonProgram *program;
+ GtkWidget *window;
+
+ /* This is a GDK lock because we are an idle callback and
+ * the code below is or does Gtk+ code */
+
+ gdk_threads_enter (); /* CHECKED */
+
+ program = hildon_program_get_instance ();
+ window = GTK_WIDGET (hildon_program_peek_window_stack (program));
+
+ if (window) {
+ gtk_window_present (GTK_WINDOW (window));
+ } else {
+ ModestAccountMgr *mgr;
+ GSList *account_names;
+ gint count;
+
+ mgr = modest_runtime_get_account_mgr ();
+ account_names = modest_account_mgr_account_names (mgr,TRUE);
+ count = g_slist_length (account_names);
+
+ if (count > 1) {
+ window = GTK_WIDGET (modest_accounts_window_new ());
+ } else {
+ window = GTK_WIDGET (modest_folder_window_new (NULL));
+ modest_folder_window_set_account (MODEST_FOLDER_WINDOW (window),
+ account_names->data);
+ }
+
+ modest_account_mgr_free_account_names (account_names);
+ gtk_widget_show (window);
+ }
+
+ gdk_threads_leave (); /* CHECKED */
+
+ return FALSE; /* Do not call this callback again. */
+}
+#else
static gboolean
on_idle_top_application (gpointer user_data)
{
gdk_threads_enter (); /* CHECKED */
-#ifdef MODEST_TOOLKIT_HILDON2
- main_win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (),
- TRUE);
- new_window = TRUE;
-#else
main_win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (),
FALSE);
TRUE);
new_window = TRUE;
}
-#endif
if (main_win) {
/* If we're showing an already existing window then
}
}
-#ifndef MODEST_TOOLKIT_HILDON2
if (main_win) {
gtk_widget_show_all (GTK_WIDGET (main_win));
gtk_window_present (GTK_WINDOW (main_win));
}
-#endif
gdk_threads_leave (); /* CHECKED */
return FALSE; /* Do not call this callback again. */
}
+#endif
static gint
on_top_application(GArray * arguments, gpointer data, osso_rpc_t * retval)
GCallback callback);
static void setup_menu (ModestHeaderWindow *self);
static GtkWidget *create_empty_view (void);
-static GtkWidget *create_header_view (TnyFolder *folder);
+static GtkWidget *create_header_view (ModestWindow *progress_window,
+ TnyFolder *folder);
static void update_view (ModestHeaderWindow *self,
TnyFolderChange *change);
}
static GtkWidget *
-create_header_view (TnyFolder *folder)
+create_header_view (ModestWindow *progress_window, TnyFolder *folder)
{
GtkWidget *header_view;
header_view = modest_header_view_new (NULL, MODEST_HEADER_VIEW_STYLE_TWOLINES);
modest_header_view_set_folder (MODEST_HEADER_VIEW (header_view), folder,
- TRUE, NULL, NULL);
+ TRUE, progress_window, NULL, NULL);
modest_widget_memory_restore (modest_runtime_get_conf (), G_OBJECT(header_view),
MODEST_CONF_HEADER_VIEW_KEY);
pannable = hildon_pannable_area_new ();
- priv->header_view = create_header_view (folder);
+ priv->header_view = create_header_view (MODEST_WINDOW (self), folder);
priv->empty_view = create_empty_view ();
g_object_ref (priv->header_view);
g_object_ref (priv->empty_view);
GList *win;
ModestHildon2WindowMgrPrivate *priv;
gint *handler_id;
- ModestWindow *main_window;
HildonProgram *program;
GtkWidget *current_top;
*handler_id = g_signal_connect (window, "delete-event", G_CALLBACK (on_window_destroy), self);
g_hash_table_insert (priv->destroy_handlers, window, handler_id);
- main_window = modest_window_mgr_get_main_window (self, FALSE);
- /* If there is a msg view window, let the main window listen the msg-changed signal */
- if (MODEST_IS_MSG_VIEW_WINDOW(window) && main_window) {
- gulong *handler;
- handler = g_malloc0 (sizeof (gulong));
- *handler = g_signal_connect (window, "msg-changed",
- G_CALLBACK (modest_main_window_on_msg_view_window_msg_changed),
- main_window);
- g_hash_table_insert (priv->viewer_handlers, window, handler);
- }
-
/* Show toolbar always */
modest_window_show_toolbar (window, TRUE);
g_return_val_if_fail (MODEST_IS_HILDON2_WINDOW_MGR (self), NULL);
priv = MODEST_HILDON2_WINDOW_MGR_GET_PRIVATE (self);
+
+ /* TODO: make this return NULL always */
result = MODEST_WINDOW_MGR_CLASS (parent_class)->get_main_window (self, FALSE);
/* create the main window, if it hasn't been created yet */
-1);
if (folder_store && TNY_IS_FOLDER (folder_store)) {
modest_header_view_set_folder (MODEST_HEADER_VIEW (priv->header_view),
- TNY_FOLDER (folder_store), TRUE,
+ TNY_FOLDER (folder_store), TRUE, MODEST_WINDOW (self),
NULL, NULL);
modest_main_window_set_contents_style (MODEST_MAIN_WINDOW (self),
MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
#include <errno.h>
#include <glib/gstdio.h>
#include <modest-debug.h>
+#include <modest-header-window.h>
#define DEFAULT_FOLDER "MyDocs/.documents"
modest_msg_view_window_disconnect_signals (ModestWindow *self)
{
ModestMsgViewWindowPrivate *priv;
- ModestHeaderView *header_view = NULL;
- ModestWindow *main_window = NULL;
+ GtkWidget *header_view = NULL;
+ GtkWindow *parent_window = NULL;
priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
modest_signal_mgr_disconnect_all_and_destroy (priv->sighandlers);
priv->sighandlers = NULL;
-
- main_window = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr(),
- FALSE); /* don't create */
- if (!main_window)
- return;
-
- header_view = MODEST_HEADER_VIEW(
- modest_main_window_get_child_widget(
- MODEST_MAIN_WINDOW(main_window),
- MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW));
- if (header_view == NULL)
- return;
-
- modest_header_view_remove_observer(header_view,
- MODEST_HEADER_VIEW_OBSERVER(self));
+
+ parent_window = gtk_window_get_transient_for (GTK_WINDOW (self));
+ if (parent_window && MODEST_IS_HEADER_WINDOW (parent_window)) {
+ header_view = GTK_WIDGET (modest_header_window_get_header_view (MODEST_HEADER_WINDOW (parent_window)));
+ if (header_view) {
+ modest_header_view_remove_observer(MODEST_HEADER_VIEW (header_view),
+ MODEST_HEADER_VIEW_OBSERVER(self));
+ }
+ }
}
static void
modest_platform_push_email_notification(void)
{
gboolean play_sound;
- ModestWindow *main_window;
gboolean screen_on = TRUE, app_in_foreground;
/* Check whether or not we should play a sound */
NULL);
/* Get the screen status */
- main_window = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (), FALSE);
- if (main_window)
- screen_on = modest_main_window_screen_is_on (MODEST_MAIN_WINDOW (main_window));
+ /* TODO :obtain properly the screen_is_on status */
/* Get the window status */
app_in_foreground = hildon_program_get_is_topmost (hildon_program_get_instance ());
{
GtkWidget *note;
gint response;
- ModestWindow *main_win;
-
- if (!modest_window_mgr_main_window_exists (modest_runtime_get_window_mgr())) {
- g_warning ("%s: don't show dialogs if there's no main window; assuming 'Cancel'",
+ ModestWindow *win;
+
+ win = MODEST_WINDOW (hildon_program_peek_window_stack (hildon_program_get_instance ()));
+
+ if (!win) {
+ g_warning ("%s: don't show dialogs if there's no window shown; assuming 'Cancel'",
__FUNCTION__);
return FALSE;
}
- /* don't create it */
- main_win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr(), FALSE);
- g_return_val_if_fail (main_win, FALSE); /* should not happen */
-
-
gchar *question = g_strdup_printf (_("mcen_nc_unknown_certificate"),
server_name);
example. With GTK_RESPONSE_HELP the view button is aligned
to the left while the other two to the right */
note = hildon_note_new_confirmation_add_buttons (
- GTK_WINDOW(main_win),
+ NULL,
question,
_("mcen_bd_dialog_ok"), GTK_RESPONSE_OK,
_("mcen_bd_view"), GTK_RESPONSE_APPLY, /* abusing this... */
G_CALLBACK(on_cert_dialog_response),
(gpointer) certificate);
- modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
- GTK_WINDOW (note), GTK_WINDOW (main_win));
response = gtk_dialog_run(GTK_DIALOG(note));
on_destroy_dialog (note);
#include "modest-platform.h"
#include "modest-ui-actions.h"
#include <widgets/modest-main-window.h>
+#ifdef MODEST_TOOLKIT_HILDON2
+#include <modest-accounts-window.h>
+#include <modest-folder-window.h>
+#endif
typedef struct {
gulong queue_handler;
* when we receive the "top_application" D-Bus method.
*/
if (show_ui_without_top_application_method) {
- ModestWindow *main_win;
+ ModestWindow *window;
+
+#ifdef MODEST_TOOLKIT_HILDON2
+ ModestAccountMgr *mgr;
+ GSList *account_names;
+ gint count;
+
+ mgr = modest_runtime_get_account_mgr ();
+ account_names = modest_account_mgr_account_names (mgr,TRUE);
+ count = g_slist_length (account_names);
+
+ if (count > 1) {
+ window = MODEST_WINDOW (modest_accounts_window_new ());
+ } else {
+ window = MODEST_WINDOW (modest_folder_window_new (NULL));
+ if (count == 1)
+ modest_folder_window_set_account (MODEST_FOLDER_WINDOW (window),
+ account_names->data);
+ }
+ modest_account_mgr_free_account_names (account_names);
+ modest_window_mgr_register_window (modest_runtime_get_window_mgr (), window, NULL);
+ gtk_widget_show (GTK_WIDGET (window));
+#else
/* this will create & register the window */
- main_win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr(),
- TRUE);
- if (!main_win) {
+ window = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr(),
+ TRUE);
+ if (!window) {
g_printerr ("modest: failed to get main window instance\n");
retval = 1;
goto cleanup;
}
-
+#endif
/* Remove new mail notifications if exist */
modest_platform_remove_new_mail_notifications (FALSE);
}
if (folder_store)
g_object_unref (folder_store);
- }
+ /* Refresh the active account. Force the connection if needed
+ and poke the status of all folders */
+ modest_ui_actions_do_send_receive (NULL, TRUE, TRUE, TRUE, win);
+ } else {
+ const gchar *active_account;
+ active_account = modest_window_get_active_account (MODEST_WINDOW (win));
+
+ modest_ui_actions_do_send_receive (active_account, TRUE, TRUE, TRUE, win);
+ }
- /* Refresh the active account. Force the connection if needed
- and poke the status of all folders */
- modest_ui_actions_do_send_receive (NULL, TRUE, TRUE, TRUE, win);
}
modest_header_view_set_folder (MODEST_HEADER_VIEW(header_view),
TNY_FOLDER (folder_store),
TRUE,
+ MODEST_WINDOW (main_window),
folder_refreshed_cb,
main_window);
gpointer user_data)
{
ModestMsgEditWindow *edit_window;
+
+ /* TODO: in hildon 2 we have to dim and undim the header views while we're saving */
+#ifndef MODEST_TOOLKIT_HILDON2
ModestMainWindow *win;
/* FIXME. Make the header view sensitive again. This is a
win, MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW);
if (hdrview) gtk_widget_set_sensitive(hdrview, TRUE);
}
+#endif
edit_window = MODEST_MSG_EDIT_WINDOW (user_data);
modest_header_view_set_folder (ModestHeaderView *self,
TnyFolder *folder,
gboolean refresh,
+ ModestWindow *progress_window,
RefreshAsyncUserCallback callback,
gpointer user_data)
{
ModestHeaderViewPrivate *priv;
- ModestWindow *main_win;
g_return_if_fail (self);
priv = MODEST_HEADER_VIEW_GET_PRIVATE(self);
- main_win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (),
- FALSE); /* don't create */
- if (!main_win) {
- g_warning ("%s: BUG: no main window", __FUNCTION__);
- return;
- }
-
if (priv->folder) {
if (priv->status_timeout) {
g_source_remove (priv->status_timeout);
info->user_data = user_data;
/* Create the mail operation (source will be the parent widget) */
- mail_op = modest_mail_operation_new_with_error_handling (G_OBJECT(main_win),
- refresh_folder_error_handler,
- NULL, NULL);
+ if (progress_window)
+ mail_op = modest_mail_operation_new_with_error_handling (G_OBJECT(progress_window),
+ refresh_folder_error_handler,
+ NULL, NULL);
if (refresh) {
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
mail_op);
{
g_return_if_fail (self && MODEST_IS_HEADER_VIEW(self));
- modest_header_view_set_folder (self, NULL, FALSE, NULL, NULL);
+ modest_header_view_set_folder (self, NULL, FALSE, NULL, NULL, NULL);
}
void
void modest_header_view_set_folder (ModestHeaderView *self,
TnyFolder *folder,
gboolean refresh,
+ ModestWindow *progress_window,
RefreshAsyncUserCallback callback,
gpointer user_data);