#define COMMON_FOLDER_DIALOG_ENTRY "entry"
#define COMMON_FOLDER_DIALOG_ACCOUNT_PICKER "account-picker"
#define FOLDER_PICKER_CURRENT_FOLDER "current-folder"
+#define MODEST_ALARMD_APPID PACKAGE_NAME
static void _modest_platform_play_email_tone (void);
*/
if (!name || strlen(name) == 0)
return NULL;
-
+
current_theme = gtk_icon_theme_get_default ();
pixbuf = gtk_icon_theme_load_icon (current_theme, name, icon_size,
GTK_ICON_LOOKUP_NO_SVG,
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (userdata.dialog)->vbox), pannable);
gtk_container_add (GTK_CONTAINER (pannable), folder_view);
+ gtk_widget_set_size_request (pannable, -1, 320);
+
gtk_widget_show (folder_view);
gtk_widget_show (pannable);
- gtk_widget_show_all (userdata.dialog);
- gtk_widget_set_size_request (pannable, -1, 320);
+ gtk_widget_show (userdata.dialog);
g_signal_connect (G_OBJECT (folder_view), "folder-activated",
G_CALLBACK (folder_chooser_activated),
(gpointer) &userdata);
TnyFolderStore **parent)
{
GtkWidget *accept_btn = NULL;
- GtkWidget *dialog, *entry, *label_entry, *label_location, *hbox;
- GtkWidget *account_picker;
+ GtkWidget *dialog, *entry = NULL, *label_entry = NULL, *label_location = NULL, *hbox;
+ GtkWidget *account_picker = NULL;
GList *buttons = NULL;
gint result;
GtkSizeGroup *sizegroup;
ModestFolderView *folder_view;
+ ModestWindow *folder_window;
+ ModestHildon2WindowMgr *window_mgr;
- g_return_val_if_fail (MODEST_IS_FOLDER_WINDOW (parent_window), GTK_RESPONSE_NONE);
+ window_mgr = (ModestHildon2WindowMgr *) modest_runtime_get_window_mgr ();
+ folder_window = modest_hildon2_window_mgr_get_folder_window (window_mgr);
+ g_return_val_if_fail (MODEST_IS_FOLDER_WINDOW (folder_window), GTK_RESPONSE_NONE);
- folder_view = modest_folder_window_get_folder_view (MODEST_FOLDER_WINDOW (parent_window));
+ folder_view = modest_folder_window_get_folder_view (MODEST_FOLDER_WINDOW (folder_window));
/* Ask the user for the folder name */
dialog = gtk_dialog_new_with_buttons (dialog_title,
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
GTK_WINDOW (dialog), parent_window);
gtk_widget_show_all (GTK_WIDGET(dialog));
-
+
result = gtk_dialog_run (GTK_DIALOG(dialog));
if (result == GTK_RESPONSE_ACCEPT) {
if (show_name)
{
gchar *real_suggested_name = NULL, *tmp = NULL;
gint result;
+ ModestTnyAccountStore *acc_store;
+ TnyAccount *account;
if(suggested_name == NULL)
{
}
/* In hildon 2.2 we always suggest the archive folder as parent */
- suggested_folder = TNY_FOLDER_STORE (
- modest_tny_account_get_special_folder
- (modest_tny_account_store_get_local_folders_account (modest_runtime_get_account_store ()),
- TNY_FOLDER_TYPE_ARCHIVE));
+ acc_store = modest_runtime_get_account_store ();
+ account = modest_tny_account_store_get_mmc_folders_account (acc_store);
+ if (account) {
+ suggested_folder = (TnyFolderStore *)
+ modest_tny_account_get_special_folder (account,
+ TNY_FOLDER_TYPE_ARCHIVE);
+ g_object_unref (account);
+ account = NULL;
+ }
+
+ /* If there is not archive folder then fallback to local folders account */
+ if (!suggested_folder)
+ suggested_folder = (TnyFolderStore *)
+ modest_tny_account_store_get_local_folders_account (acc_store);
tmp = g_strconcat (_("mcen_fi_new_folder_name"), ":", NULL);
result = modest_platform_run_folder_common_dialog (parent_window,
/* Delete any existing alarm,
* because we will replace it: */
if (alarm_cookie) {
- if (alarmd_event_del(alarm_cookie) != 1)
+ if (alarmd_event_del(alarm_cookie) != 0)
g_warning ("%s: alarm %d was not on the queue", __FUNCTION__, (int)alarm_cookie);
alarm_cookie = 0;
modest_conf_set_int (conf, MODEST_CONF_ALARM_ID, 0, NULL);
alarm_event_t *event = alarm_event_create ();
alarm_event_add_actions (event, 1);
alarm_action_t *action = alarm_event_get_action (event, 0);
+ alarm_event_set_alarm_appid (event, MODEST_ALARMD_APPID);
event->alarm_time = minutes * 60; /* seconds */
/* Set recurrence every few minutes: */
action->dbus_interface = g_strdup (MODEST_DBUS_IFACE);
action->dbus_service = g_strdup (MODEST_DBUS_SERVICE);
action->dbus_name = g_strdup (MODEST_DBUS_METHOD_SEND_RECEIVE);
- action->flags = ALARM_ACTION_TYPE_DBUS | ALARM_ACTION_DBUS_USE_ACTIVATION;
+ action->flags = ALARM_ACTION_WHEN_TRIGGERED | ALARM_ACTION_TYPE_DBUS | ALARM_ACTION_DBUS_USE_ACTIVATION;
/* Use ALARM_EVENT_NO_DIALOG: Otherwise, a dialog will be shown if
* exec_name or dbus_path is NULL, even though we have specified no dialog text.
void
modest_platform_push_email_notification(void)
{
- gboolean screen_on = TRUE, app_in_foreground;
+ gboolean screen_on, app_in_foreground;
/* Get the window status */
app_in_foreground = hildon_program_get_is_topmost (hildon_program_get_instance ());
+ screen_on = modest_window_mgr_screen_is_on (modest_runtime_get_window_mgr ());
+
/* If the screen is on and the app is in the
foreground we don't show anything */
if (!(screen_on && app_in_foreground)) {
gchar *question = g_strdup_printf (_("mcen_nc_unknown_certificate"),
server_name);
-
+
/* We use GTK_RESPONSE_APPLY because we want the button in the
middle of OK and CANCEL the same as the browser does for
example. With GTK_RESPONSE_HELP the view button is aligned
_HL("wdgt_bd_view"), GTK_RESPONSE_APPLY, /* abusing this... */
_HL("wdgt_bd_no"), GTK_RESPONSE_CANCEL,
NULL, NULL);
-
+
g_signal_connect (G_OBJECT(note), "response",
G_CALLBACK(on_cert_dialog_response),
(gpointer) certificate);
-
+
response = gtk_dialog_run(GTK_DIALOG(note));
on_destroy_dialog (note);
g_free (question);
-
+
return response == GTK_RESPONSE_OK;
}
gboolean
-modest_platform_run_alert_dialog (const gchar* prompt,
+modest_platform_run_alert_dialog (const gchar* prompt,
gboolean is_question)
-{
- ModestWindow *main_win;
+{
+ ModestWindow *top_win;
+ HildonWindowStack *stack;
- if (!modest_window_mgr_main_window_exists (modest_runtime_get_window_mgr())) {
- g_warning ("%s:\n'%s'\ndon't show dialogs if there's no main window;"
- " assuming 'Cancel' for questions, 'Ok' otherwise", prompt, __FUNCTION__);
- return is_question ? FALSE : TRUE;
+ stack = hildon_window_stack_get_default ();
+ top_win = MODEST_WINDOW (hildon_window_stack_peek (stack));
+
+ if (!top_win) {
+ g_warning ("%s: don't show dialogs if there's no window shown; assuming 'Cancel'",
+ __FUNCTION__);
+ return FALSE;
}
- 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 */
-
gboolean retval = TRUE;
if (is_question) {
- /* The Tinymail documentation says that we should show Yes and No buttons,
+ /* The Tinymail documentation says that we should show Yes and No buttons,
* when it is a question.
* Obviously, we need tinymail to use more specific error codes instead,
* so we know what buttons to show. */
- GtkWidget *dialog = GTK_WIDGET (hildon_note_new_confirmation (GTK_WINDOW (main_win),
+ GtkWidget *dialog = GTK_WIDGET (hildon_note_new_confirmation (GTK_WINDOW (top_win),
prompt));
modest_window_mgr_set_modal (modest_runtime_get_window_mgr (),
- GTK_WINDOW (dialog), GTK_WINDOW (main_win));
-
+ GTK_WINDOW (dialog), GTK_WINDOW (top_win));
+
const int response = gtk_dialog_run (GTK_DIALOG (dialog));
retval = (response == GTK_RESPONSE_YES) || (response == GTK_RESPONSE_OK);
-
- on_destroy_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),
+ modest_platform_run_information_dialog (GTK_WINDOW (top_win),
prompt, FALSE);
}
return retval;
TnyList *
modest_platform_get_list_to_move (ModestWindow *window)
{
+ TnyList *list = NULL;
+
if (MODEST_IS_HEADER_WINDOW (window)) {
ModestHeaderView *header_view;
header_view = modest_header_window_get_header_view (MODEST_HEADER_WINDOW (window));
-
- return modest_header_view_get_selected_headers (header_view);
+ list = modest_header_view_get_selected_headers (header_view);
} else if (MODEST_IS_FOLDER_WINDOW (window)) {
ModestFolderView *folder_view;
TnyFolderStore *selected_folder;
- TnyList *list;
list = TNY_LIST (tny_simple_list_new ());
folder_view = modest_folder_window_get_folder_view (MODEST_FOLDER_WINDOW (window));
g_object_unref (selected_folder);
}
return list;
+ } else if (MODEST_IS_MSG_VIEW_WINDOW (window)) {
+ TnyHeader *header;
+
+ header = modest_msg_view_window_get_header (MODEST_MSG_VIEW_WINDOW (window));
+ if (header) {
+ list = TNY_LIST (tny_simple_list_new ());
+ tny_list_prepend (list, G_OBJECT (header));
+ g_object_unref (header);
+ }
} else {
- return NULL;
+ g_return_val_if_reached (NULL);
}
+
+ return list;
}