G_CALLBACK (entry_changed),
dialog);
+
+ /* Some locales like pt_BR need this to get the full window
+ title shown */
+ gtk_widget_set_size_request (GTK_WIDGET (dialog), 300, -1);
+
/* Create the hbox */
hbox = gtk_hbox_new (FALSE, 12);
- gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
/* Add hbox to dialog */
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox),
hbox, FALSE, FALSE, 0);
-
- gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
- gtk_window_set_transient_for (GTK_WINDOW (dialog), parent_window);
-
- /* Some locales like pt_BR need this to get the full window
- title shown */
- gtk_widget_set_size_request (GTK_WIDGET (dialog), 300, -1);
+ modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
+ GTK_WINDOW (dialog));
+ gtk_widget_show_all (GTK_WIDGET(dialog));
result = gtk_dialog_run (GTK_DIALOG(dialog));
if (result == GTK_RESPONSE_ACCEPT)
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 ();
}
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;
}
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;
}
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 ();
+ on_destroy_dialog (dialog);
return response;
}
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",
}
/* Free */
- on_destroy_dialog (GTK_DIALOG(dialog));
+ on_destroy_dialog (dialog);
}
const gchar *icon_name,
const gchar *text)
{
- GtkWidget *banner;
+ GtkWidget *banner, *banner_parent = NULL;
ModestWindowMgr *mgr;
mgr = modest_runtime_get_window_mgr ();
- 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);
GTK_WINDOW (note));
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;
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),
gboolean
-modest_platform_check_memory_low (ModestWindow *win)
+modest_platform_check_memory_low (ModestWindow *win,
+ gboolean visuals)
{
gboolean lowmem;
-
- g_return_val_if_fail (win == NULL || MODEST_IS_WINDOW(win), FALSE);
/* are we in low memory state? */
lowmem = osso_mem_in_lowmem_state () ? TRUE : FALSE;
- if (win && lowmem)
+ if (win && lowmem && visuals)
modest_platform_run_information_dialog (
GTK_WINDOW(win),
dgettext("ke-recv","memr_ib_operation_disabled"),
TRUE);
if (lowmem)
- g_warning ("%s: low memory reached. disallowing some operations",
- __FUNCTION__);
+ g_debug ("%s: low memory reached. disallowing some operations",
+ __FUNCTION__);
return lowmem;
}