#include "modest-hildon-sort-dialog.h"
#include <hildon/hildon-sound.h>
#include <osso-mem.h>
+#include "widgets/modest-details-dialog.h"
#ifdef MODEST_HAVE_MCE
#include <mce/dbus-names.h>
chars = gtk_editable_get_chars (editable, 0, -1);
chars_length = g_utf8_strlen (chars, -1);
+ g_free (chars);
/* Show WID-INF036 */
if (chars_length >= 20) {
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox),
hbox, FALSE, FALSE, 0);
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
- GTK_WINDOW (dialog));
+ GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
gtk_widget_show_all (GTK_WIDGET(dialog));
result = gtk_dialog_run (GTK_DIALOG(dialog));
static void
-on_destroy_dialog (GtkDialog *dialog)
+on_destroy_dialog (GtkWidget *dialog)
{
- gtk_widget_destroy (GTK_WIDGET(dialog));
+ /* This could happen when the dialogs get programatically
+ hidden or destroyed (for example when closing the
+ application while a dialog is being shown) */
+ if (!GTK_IS_WIDGET (dialog))
+ return;
+
+ gtk_widget_destroy (dialog);
+
if (gtk_events_pending ())
gtk_main_iteration ();
}
dialog = hildon_note_new_confirmation (parent_window, message);
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
- GTK_WINDOW (dialog));
+ GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
response = gtk_dialog_run (GTK_DIALOG (dialog));
- on_destroy_dialog (GTK_DIALOG(dialog));
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
+ on_destroy_dialog (dialog);
return response;
}
button_cancel, GTK_RESPONSE_CANCEL,
NULL);
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
- GTK_WINDOW (dialog));
+ GTK_WINDOW (dialog), GTK_WINDOW (parent_window));
response = gtk_dialog_run (GTK_DIALOG (dialog));
- on_destroy_dialog (GTK_DIALOG(dialog));
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
+ on_destroy_dialog (dialog);
return response;
}
-gint
-modest_platform_run_yes_no_dialog (GtkWindow *parent_window,
- const gchar *message)
-{
- GtkWidget *dialog;
- gint response;
-
- dialog = hildon_note_new_confirmation_add_buttons (parent_window, message,
- _("mcen_bd_yes"), GTK_RESPONSE_YES,
- _("mcen_bd_no"), GTK_RESPONSE_NO,
- NULL);
- modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog));
- response = gtk_dialog_run (GTK_DIALOG (dialog));
-
- on_destroy_dialog (GTK_DIALOG(dialog));
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
-
- return response;
-}
-
-
-
void
modest_platform_run_information_dialog (GtkWindow *parent_window,
const gchar *message,
note = hildon_note_new_information (parent_window, message);
if (block)
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
- GTK_WINDOW (note));
+ GTK_WINDOW (note), GTK_WINDOW (parent_window));
if (block) {
gtk_dialog_run (GTK_DIALOG (note));
- on_destroy_dialog (GTK_DIALOG (note));
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
+ on_destroy_dialog (note);
} else {
g_signal_connect_swapped (note,
"response",
const gchar *icon_name,
const gchar *text)
{
- GtkWidget *banner;
+ GtkWidget *banner, *banner_parent = NULL;
ModestWindowMgr *mgr = modest_runtime_get_window_mgr ();
if (modest_window_mgr_num_windows (mgr) == 0)
return;
- banner = hildon_banner_show_information (parent, icon_name, text);
+ if (parent && GTK_IS_WINDOW (parent)) {
+ /* If the window is the active one then show the
+ banner on top of this window */
+ if (gtk_window_is_active (GTK_WINDOW (parent)))
+ banner_parent = parent;
+ /* If the window is not the topmost but it's visible
+ (it's minimized for example) then show the banner
+ with no parent */
+ else if (GTK_WIDGET_VISIBLE (parent))
+ banner_parent = NULL;
+ /* If the window is hidden (like the main window when
+ running in the background) then do not show
+ anything */
+ else
+ return;
+ }
+
+
+ banner = hildon_banner_show_information (banner_parent, icon_name, text);
modest_window_mgr_register_banner (mgr);
g_object_ref (mgr);
gboolean
modest_platform_check_and_wait_for_account_is_online(TnyAccount *account)
{
+ gboolean is_online;
+
g_return_val_if_fail (account, FALSE);
printf ("DEBUG: %s: account id=%s\n", __FUNCTION__, tny_account_get_id (account));
g_main_loop_unref (data->loop);
/* g_main_context_unref (context); */
+ is_online = data->is_online;
g_slice_free (CheckAccountIdleData, data);
- return data->is_online;
+ return is_online;
}
(gpointer) certificate);
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
- GTK_WINDOW (note));
+ GTK_WINDOW (note), (GtkWindow *) main_win);
response = gtk_dialog_run(GTK_DIALOG(note));
- on_destroy_dialog (GTK_DIALOG(note));
+ on_destroy_dialog (note);
g_free (question);
return response == GTK_RESPONSE_OK;
GtkWidget *dialog = GTK_WIDGET (hildon_note_new_confirmation (GTK_WINDOW (main_win),
prompt));
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
- GTK_WINDOW (dialog));
+ GTK_WINDOW (dialog), (GtkWindow *) main_win);
const int response = gtk_dialog_run (GTK_DIALOG (dialog));
retval = (response == GTK_RESPONSE_YES) || (response == GTK_RESPONSE_OK);
- on_destroy_dialog (GTK_DIALOG(dialog));
+ on_destroy_dialog (dialog);
} else {
/* Just show the error text and use the default response: */
modest_platform_run_information_dialog (GTK_WINDOW (main_win),
}
GtkWidget *
-modest_platform_get_account_settings_dialog (ModestAccountSettings *settings)
-{
- ModestAccountSettingsDialog *dialog = modest_account_settings_dialog_new ();
-
- modest_account_settings_dialog_set_account (dialog, settings);
- return GTK_WIDGET (dialog);
-}
-
-GtkWidget *
modest_platform_get_account_settings_wizard (void)
{
ModestEasysetupWizardDialog *dialog = modest_easysetup_wizard_dialog_new ();
return retval;
}
-
-
gboolean
modest_platform_check_memory_low (ModestWindow *win,
gboolean visuals)
return lowmem;
}
+
+void
+modest_platform_run_folder_details_dialog (GtkWindow *parent_window,
+ TnyFolder *folder)
+{
+ GtkWidget *dialog;
+
+ /* Create dialog */
+ dialog = modest_details_dialog_new_with_folder (parent_window, folder);
+
+ /* Run dialog */
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ parent_window);
+ gtk_widget_show_all (dialog);
+
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+}
+
+void
+modest_platform_run_header_details_dialog (GtkWindow *parent_window,
+ TnyHeader *header)
+{
+ GtkWidget *dialog;
+
+ /* Create dialog */
+ dialog = modest_details_dialog_new_with_header (parent_window, header);
+
+ /* Run dialog */
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog),
+ parent_window);
+ gtk_widget_show_all (dialog);
+
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy),
+ dialog);
+}