#endif
}
+#ifdef MAEMO
+const gchar *prefs_common_get_data_root(void);
+gchar *last_data_root = NULL;
+#endif
+
const gchar *get_news_cache_dir(void)
{
static gchar *news_cache_dir = NULL;
-
+#ifdef MAEMO
+ const gchar *data_root = prefs_common_get_data_root();
+ if (strcmp2(data_root, last_data_root)) {
+ g_free(news_cache_dir);
+ news_cache_dir = NULL;
+ }
+#endif
if (!news_cache_dir)
+#ifndef MAEMO
news_cache_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
NEWS_CACHE_DIR, NULL);
-
+#else
+ {
+ if (data_root) {
+ news_cache_dir = g_strconcat(data_root, G_DIR_SEPARATOR_S,
+ "Claws", G_DIR_SEPARATOR_S,
+ g_get_user_name(), G_DIR_SEPARATOR_S,
+ NEWS_CACHE_DIR, NULL);
+ g_free(last_data_root);
+ last_data_root = g_strdup(last_data_root);
+ } else {
+ news_cache_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+ NEWS_CACHE_DIR, NULL);
+ g_free(last_data_root);
+ last_data_root = NULL;
+ }
+ }
+#endif
return news_cache_dir;
}
const gchar *get_imap_cache_dir(void)
{
static gchar *imap_cache_dir = NULL;
+#ifdef MAEMO
+ const gchar *data_root = prefs_common_get_data_root();
+ if (strcmp2(data_root, last_data_root)) {
+ g_free(imap_cache_dir);
+ imap_cache_dir = NULL;
+ }
+#endif
if (!imap_cache_dir)
+#ifndef MAEMO
imap_cache_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
IMAP_CACHE_DIR, NULL);
+#else
+ {
+ if (data_root) {
+ imap_cache_dir = g_strconcat(data_root, G_DIR_SEPARATOR_S,
+ "Claws", G_DIR_SEPARATOR_S,
+ g_get_user_name(), G_DIR_SEPARATOR_S,
+ IMAP_CACHE_DIR, NULL);
+ g_free(last_data_root);
+ last_data_root = g_strdup(last_data_root);
+ } else {
+ imap_cache_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+ IMAP_CACHE_DIR, NULL);
+ g_free(last_data_root);
+ last_data_root = NULL;
+ }
+ }
+#endif
return imap_cache_dir;
}
const gchar *get_mbox_cache_dir(void)
{
static gchar *mbox_cache_dir = NULL;
-
+#ifdef MAEMO
+ const gchar *data_root = prefs_common_get_data_root();
+ if (strcmp2(data_root, last_data_root)) {
+ g_free(mbox_cache_dir);
+ mbox_cache_dir = NULL;
+ }
+#endif
if (!mbox_cache_dir)
+#ifndef MAEMO
mbox_cache_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
MBOX_CACHE_DIR, NULL);
+#else
+ {
+ if (data_root) {
+ mbox_cache_dir = g_strconcat(data_root, G_DIR_SEPARATOR_S,
+ "Claws", G_DIR_SEPARATOR_S,
+ g_get_user_name(), G_DIR_SEPARATOR_S,
+ MBOX_CACHE_DIR, NULL);
+ g_free(last_data_root);
+ last_data_root = g_strdup(last_data_root);
+ } else {
+ mbox_cache_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+ MBOX_CACHE_DIR, NULL);
+ g_free(last_data_root);
+ last_data_root = NULL;
+ }
+ }
+#endif
return mbox_cache_dir;
}
#include <hildon-widgets/hildon-program.h>
#include <gtk/gtkmain.h>
#include <libosso.h>
+#include <libgnomevfs/gnome-vfs-volume.h>
+#include <libgnomevfs/gnome-vfs-volume-monitor.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
#define OSSO_NAME "claws_mail"
#define OSSO_SERVICE "com.nokia."OSSO_NAME
HildonWindow *window;
osso_context_t *osso_context;
};
+
+static GnomeVFSVolumeMonitor *volmon;
#endif
gchar *prog_version;
show_at_startup = show;
}
+#ifdef MAEMO
+static void main_vol_mount_cb(GnomeVFSVolumeMonitor *vfs, GnomeVFSVolume *vol, MainWindow *mainwin)
+{
+ gchar *uri = gnome_vfs_volume_get_activation_uri (vol);
+ gchar *mount_path = uri?gnome_vfs_get_local_path_from_uri (uri):NULL;
+ g_free (uri);
+ if (mount_path) {
+ if(!strcmp(mount_path, prefs_common.data_root)) {
+ gtk_widget_set_sensitive(mainwin->window, TRUE);
+ inc_unlock();
+ }
+ }
+ g_free(mount_path);
+}
+static void main_vol_unmount_cb(GnomeVFSVolumeMonitor *vfs, GnomeVFSVolume *vol, MainWindow *mainwin)
+{
+ gchar *uri = gnome_vfs_volume_get_activation_uri (vol);
+ gchar *mount_path = uri?gnome_vfs_get_local_path_from_uri (uri):NULL;
+ g_free (uri);
+ if (mount_path) {
+ if(!strcmp(mount_path, prefs_common.data_root)) {
+ gtk_widget_set_sensitive(mainwin->window, FALSE);
+ inc_lock();
+ }
+ }
+ g_free(mount_path);
+}
+#endif
+
int main(int argc, char *argv[])
{
#ifdef MAEMO
static_mainwindow = mainwin;
+#ifdef MAEMO
+ if (prefs_common.data_root != NULL && *prefs_common.data_root != '\0') {
+ GnomeVFSVolume *vol = NULL;
+ gchar *uri, *mount_path;
+
+ volmon = gnome_vfs_get_volume_monitor();
+ vol = gnome_vfs_volume_monitor_get_volume_for_path(volmon, prefs_common.data_root);
+
+ uri = gnome_vfs_volume_get_activation_uri (vol);
+ mount_path = uri?gnome_vfs_get_local_path_from_uri (uri):NULL;
+ g_free(uri);
+
+ if (vol == NULL || !gnome_vfs_volume_is_mounted(vol)
+ || strcmp(mount_path, prefs_common.data_root)) {
+ alertpanel_error(_("Claws Mail can not start without its data volume (%s)."),
+ prefs_common.data_root);
+ exit_claws(mainwin);
+ exit(1);
+ }
+ g_free(mount_path);
+ gnome_vfs_volume_unref(vol);
+ g_signal_connect(G_OBJECT(volmon),
+ "volume-mounted", G_CALLBACK(main_vol_mount_cb), mainwin);
+ g_signal_connect(G_OBJECT(volmon),
+ "volume-unmounted", G_CALLBACK(main_vol_unmount_cb), mainwin);
+ }
+#endif
+
#ifdef HAVE_STARTUP_NOTIFICATION
startup_notification_complete(FALSE);
#endif
#endif
#include "prefs_common.h"
+#ifdef MAEMO
+#include <libgnomevfs/gnome-vfs-volume.h>
+#include <libgnomevfs/gnome-vfs-volume-monitor.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
+#endif
+
typedef enum
{
GO_BACK,
GtkWidget *organization;
GtkWidget *mailbox_name;
+ GtkWidget *mailbox_label;
GtkWidget *smtp_server;
GtkWidget *smtp_auth;
GtkWidget *smtp_use_tls;
GtkWidget *recv_use_tls;
#endif
-
+
+#ifdef MAEMO
+ GtkWidget *data_root_nokia_radiobtn;
+ GtkWidget *data_root_mmc1_radiobtn;
+ GtkWidget *data_root_mmc2_radiobtn;
+ GnomeVFSVolumeMonitor *volmon;
+ gulong volmon_mount_sigid;
+ gulong volmon_unmount_sigid;
+ GnomeVFSVolume *vol_mmc1;
+ GnomeVFSVolume *vol_mmc2;
+#endif
gboolean create_mailbox;
gboolean finished;
gboolean result;
return FALSE;
}
+#ifdef MAEMO
+ g_free(prefs_common.data_root);
+ if (gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(wizard->data_root_nokia_radiobtn)))
+ prefs_common.data_root = NULL;
+ else if (gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(wizard->data_root_mmc1_radiobtn)))
+ prefs_common.data_root = g_strdup(MMC1_PATH);
+ else if (gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(wizard->data_root_mmc2_radiobtn)))
+ prefs_common.data_root = g_strdup(MMC2_PATH);
+ if (wizard->volmon_mount_sigid)
+ g_signal_handler_disconnect(
+ G_OBJECT(wizard->volmon),
+ wizard->volmon_mount_sigid);
+ if (wizard->volmon_unmount_sigid)
+ g_signal_handler_disconnect(
+ G_OBJECT(wizard->volmon),
+ wizard->volmon_unmount_sigid);
+#endif
+
if (!mailbox_ok) {
if (wizard->create_mailbox && prefs_account->protocol != A_IMAP4) {
mailbox_ok = setup_write_mailbox_path(wizard->mainwin,
return table;
}
+#ifdef MAEMO
+static void wizard_vol_mount_cb(GnomeVFSVolumeMonitor *vfs, GnomeVFSVolume *vol, WizardWindow *wizard)
+{
+ gchar *uri = gnome_vfs_volume_get_activation_uri (vol);
+ gchar *mount_path = uri?gnome_vfs_get_local_path_from_uri (uri):NULL;
+ g_free (uri);
+ if (mount_path) {
+ if(!strcmp(mount_path, MMC1_PATH)) {
+ gtk_widget_set_sensitive(wizard->data_root_mmc1_radiobtn, TRUE);
+ }
+ if(!strcmp(mount_path, MMC2_PATH)) {
+ gtk_widget_set_sensitive(wizard->data_root_mmc2_radiobtn, TRUE);
+ }
+ }
+ g_free(mount_path);
+}
+static void wizard_vol_unmount_cb(GnomeVFSVolumeMonitor *vfs, GnomeVFSVolume *vol, WizardWindow *wizard)
+{
+ gchar *uri = gnome_vfs_volume_get_activation_uri (vol);
+ gchar *mount_path = uri?gnome_vfs_get_local_path_from_uri (uri):NULL;
+ g_free (uri);
+ if (mount_path) {
+ if(!strcmp(mount_path, MMC1_PATH)) {
+ gtk_widget_set_sensitive(wizard->data_root_mmc1_radiobtn, FALSE);
+ if (gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(wizard->data_root_mmc1_radiobtn))) {
+ gtk_toggle_button_set_active(
+ GTK_TOGGLE_BUTTON(wizard->data_root_nokia_radiobtn), TRUE);
+ }
+ }
+ if(!strcmp(mount_path, MMC2_PATH)) {
+ gtk_widget_set_sensitive(wizard->data_root_mmc2_radiobtn, FALSE);
+ if (gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(wizard->data_root_mmc2_radiobtn))) {
+ gtk_toggle_button_set_active(
+ GTK_TOGGLE_BUTTON(wizard->data_root_nokia_radiobtn), TRUE);
+ }
+ }
+ }
+ g_free(mount_path);
+}
+
+void data_root_changed (GtkToggleButton *toggle_btn,
+ WizardWindow *wizard)
+{
+ gchar *name = g_path_get_basename(gtk_entry_get_text(GTK_ENTRY(wizard->mailbox_name)));
+ gchar *path = NULL;
+ if (gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(wizard->data_root_nokia_radiobtn)))
+ gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), name);
+ else if (gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(wizard->data_root_mmc1_radiobtn))) {
+ path = g_strconcat(MMC1_PATH, G_DIR_SEPARATOR_S,
+ "Claws", G_DIR_SEPARATOR_S,
+ g_get_user_name(), G_DIR_SEPARATOR_S,
+ name, NULL);
+ gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), path);
+ g_free(path);
+ } else if (gtk_toggle_button_get_active(
+ GTK_TOGGLE_BUTTON(wizard->data_root_mmc2_radiobtn))) {
+ path = g_strconcat(MMC2_PATH, G_DIR_SEPARATOR_S,
+ "Claws", G_DIR_SEPARATOR_S,
+ g_get_user_name(), G_DIR_SEPARATOR_S,
+ name, NULL);
+ gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), path);
+ g_free(path);
+ }
+ g_free(name);
+}
+#endif
+
static GtkWidget* mailbox_page (WizardWindow * wizard)
{
GtkWidget *table = gtk_table_new(1,1, FALSE);
GtkWidget *vbox;
+#ifdef MAEMO
+ GtkWidget *vbox2;
+ gchar *uri, *mount_path;
+#endif
GtkWidget *hbox;
GtkTooltips *tips = gtk_tooltips_new();
hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+
+ wizard->mailbox_label = gtk_label_new(_("<span weight=\"bold\">Mailbox name:</span>"));
+ gtk_label_set_use_markup(GTK_LABEL(wizard->mailbox_label), TRUE);
+ if (GTK_IS_MISC(wizard->mailbox_label))
+ gtk_misc_set_alignment(GTK_MISC(wizard->mailbox_label), 1, 0.5);
wizard->mailbox_name = gtk_entry_new();
+
gtk_entry_set_text(GTK_ENTRY(wizard->mailbox_name), tmpl.mailbox?tmpl.mailbox:"");
gtk_tooltips_set_tip(GTK_TOOLTIPS(tips), wizard->mailbox_name,
"\"/home/john/Documents/Mail\""),
NULL);
- PACK_BOX(hbox, _("<span weight=\"bold\">Mailbox name:</span>"),
- wizard->mailbox_name);
+ gtk_box_pack_start(GTK_BOX(hbox), wizard->mailbox_label, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), wizard->mailbox_name, TRUE, TRUE, 0);
+
+#ifdef MAEMO
+ wizard->data_root_nokia_radiobtn = gtk_radio_button_new_with_label(NULL,
+ _("on internal memory"));
+ wizard->data_root_mmc1_radiobtn = gtk_radio_button_new_with_label_from_widget(
+ GTK_RADIO_BUTTON(wizard->data_root_nokia_radiobtn),
+ _("on /media/mmc1"));
+ wizard->data_root_mmc2_radiobtn = gtk_radio_button_new_with_label_from_widget(
+ GTK_RADIO_BUTTON(wizard->data_root_nokia_radiobtn),
+ _("on /media/mmc2"));
+
+ g_signal_connect(G_OBJECT(wizard->data_root_nokia_radiobtn), "toggled",
+ G_CALLBACK(data_root_changed), wizard);
+ g_signal_connect(G_OBJECT(wizard->data_root_mmc1_radiobtn), "toggled",
+ G_CALLBACK(data_root_changed), wizard);
+ g_signal_connect(G_OBJECT(wizard->data_root_mmc2_radiobtn), "toggled",
+ G_CALLBACK(data_root_changed), wizard);
+
+ wizard->volmon = gnome_vfs_get_volume_monitor();
+ wizard->vol_mmc1 = gnome_vfs_volume_monitor_get_volume_for_path(wizard->volmon, MMC1_PATH);
+ wizard->vol_mmc2 = gnome_vfs_volume_monitor_get_volume_for_path(wizard->volmon, MMC2_PATH);
+
+ uri = gnome_vfs_volume_get_activation_uri (wizard->vol_mmc1);
+ mount_path = uri?gnome_vfs_get_local_path_from_uri (uri):NULL;
+ g_free(uri);
+ if (wizard->vol_mmc1 == NULL || !gnome_vfs_volume_is_mounted(wizard->vol_mmc1)
+ || strcmp(mount_path, MMC1_PATH)) {
+ gtk_widget_set_sensitive(wizard->data_root_mmc1_radiobtn, FALSE);
+ }
+ g_free(mount_path);
+
+ uri = gnome_vfs_volume_get_activation_uri (wizard->vol_mmc2);
+ mount_path = uri?gnome_vfs_get_local_path_from_uri (uri):NULL;
+ g_free(uri);
+ if (wizard->vol_mmc2 == NULL || !gnome_vfs_volume_is_mounted(wizard->vol_mmc2)
+ || strcmp(mount_path, MMC2_PATH)) {
+ gtk_widget_set_sensitive(wizard->data_root_mmc2_radiobtn, FALSE);
+ }
+ g_free(mount_path);
+ gnome_vfs_volume_unref(wizard->vol_mmc1);
+ gnome_vfs_volume_unref(wizard->vol_mmc2);
+ wizard->vol_mmc1 = NULL;
+ wizard->vol_mmc2 = NULL;
+
+ wizard->volmon_mount_sigid = g_signal_connect(G_OBJECT(wizard->volmon),
+ "volume-mounted", G_CALLBACK(wizard_vol_mount_cb), wizard);
+ wizard->volmon_unmount_sigid = g_signal_connect(G_OBJECT(wizard->volmon),
+ "volume-unmounted", G_CALLBACK(wizard_vol_unmount_cb), wizard);
+
+ vbox2 = gtk_vbox_new(FALSE, VSPACING_NARROW);
+ gtk_box_pack_start (GTK_BOX(vbox2), wizard->data_root_nokia_radiobtn, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(vbox2), wizard->data_root_mmc1_radiobtn, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(vbox2), wizard->data_root_mmc2_radiobtn, FALSE, FALSE, 0);
+
+ hbox = gtk_hbox_new(FALSE, VSPACING_NARROW);
+ gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+ PACK_BOX(hbox, _("<span weight=\"bold\">Store data</span>"),
+ vbox2);
+#endif
+
return table;
}
gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
g_free(text);
+ gtk_widget_show(wizard->mailbox_label);
+ gtk_widget_show(wizard->mailbox_name);
} else if (protocol == A_IMAP4) {
#ifdef HAVE_LIBETPAN
text = get_default_server(wizard, "imap");
gtk_label_set_use_markup(GTK_LABEL(wizard->recv_label), TRUE);
gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
g_free(text);
+ gtk_widget_hide(wizard->mailbox_label);
+ gtk_widget_hide(wizard->mailbox_name);
#else
gtk_widget_hide(wizard->recv_imap_label);
gtk_widget_hide(wizard->recv_imap_subdir);
gtk_widget_hide(wizard->recv_username_label);
gtk_widget_hide(wizard->recv_password_label);
gtk_widget_show(wizard->no_imap_warning);
+ gtk_widget_hide(wizard->mailbox_label);
+ gtk_widget_hide(wizard->mailbox_name);
#ifdef USE_OPENSSL
gtk_widget_hide(wizard->recv_use_ssl);
gtk_widget_hide(wizard->recv_use_tls);
gtk_widget_hide(wizard->recv_use_ssl);
gtk_widget_hide(wizard->recv_use_tls);
#endif
+ gtk_widget_show(wizard->mailbox_label);
+ gtk_widget_show(wizard->mailbox_name);
gtk_dialog_set_response_sensitive (GTK_DIALOG(wizard->window), GO_FORWARD, TRUE);
}
}
(g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
gboolean skip_mailbox_page = FALSE;
+#ifndef MAEMO
if (protocol == A_IMAP4) {
skip_mailbox_page = TRUE;
}
-
+#endif
+
num_pages = g_slist_length(wizard->pages);
current_page = gtk_notebook_get_current_page (