- win = modest_main_window_new ();
- gtk_widget_show_all (GTK_WIDGET(win));
-
- if (!win) {
- g_printerr ("modest: failed to create main window\n");
- retval = 1;
- goto cleanup;
- }
+ /* Connect to the queue-emtpy signal */
+ g_signal_connect (modest_runtime_get_mail_operation_queue (),
+ "queue-empty",
+ G_CALLBACK (on_queue_empty),
+ NULL);
+
+ g_signal_connect (modest_runtime_get_window_mgr (),
+ "window-list-empty",
+ G_CALLBACK (on_window_list_empty),
+ NULL);
+
+ /* Usually, we only show the UI when we get the "top_application" D-Bus method.
+ * This allows modest to start via D-Bus activation to provide a service,
+ * without showing the UI.
+ * The UI will be shown later (or just after starting if no otehr D-Bus method was used),
+ * when we receive the "top_application" D-Bus method.
+ */
+ if (show_ui_without_top_application_method) {
+ ModestWindow *main_win;
+
+ /* this will create & register the window */
+ main_win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr(),
+ TRUE);
+ if (!main_win) {
+ g_printerr ("modest: failed to get main window instance\n");
+ retval = 1;
+ goto cleanup;
+ }