+2005-09-08 [colin] 1.9.14cvs9
+
+ * src/compose.c
+ Alert when we can't save draft
+ Fix various wrap/color issues
+ Add mid-click pasting respecting wrap_paste option
+ * src/folder.c
+ * src/folder.h
+ * src/folder_item_prefs.c
+ * src/folder_item_prefs.h
+ * src/imap.c
+ * src/imap_gtk.c
+ * src/imap_gtk.h
+ * src/main.c
+ * src/mainwindow.c
+ * src/mainwindow.h
+ * src/news.c
+ * src/news_gtk.c
+ * src/news_gtk.h
+ * src/prefs_folder_item.c
+ Fix the impossibility to synchronise folders for
+ offline use (IMAP and NNTP are concerned)
+
2005-09-08 [colin] 1.9.14cvs8
* configure.ac
( cvs diff -u -r 1.5.2.1 -r 1.5.2.2 doc/manual/en/sylpheed-1.html; cvs diff -u -r 1.4 -r 1.5 doc/manual/en/sylpheed-10.html; cvs diff -u -r 1.5 -r 1.6 doc/manual/en/sylpheed-11.html; cvs diff -u -r 1.4.2.1 -r 1.4.2.2 doc/manual/en/sylpheed-12.html; cvs diff -u -r 1.4.2.1 -r 1.4.2.2 doc/manual/en/sylpheed-13.html; cvs diff -u -r 1.4.2.1 -r 1.4.2.2 doc/manual/en/sylpheed-14.html; cvs diff -u -r 1.4.2.1 -r 1.4.2.2 doc/manual/en/sylpheed-15.html; cvs diff -u -r 1.4.2.1 -r 1.4.2.2 doc/manual/en/sylpheed-16.html; cvs diff -u -r 1.4.2.1 -r 1.4.2.2 doc/manual/en/sylpheed-17.html; cvs diff -u -r 1.4.2.1 -r 1.4.2.2 doc/manual/en/sylpheed-18.html; cvs diff -u -r 1.4.2.1 -r 1.4.2.2 doc/manual/en/sylpheed-19.html; cvs diff -u -r 1.5.2.1 -r 1.5.2.2 doc/manual/en/sylpheed-2.html; cvs diff -u -r 1.5.2.1 -r 1.5.2.2 doc/manual/en/sylpheed-20.html; cvs diff -u -r 1.4.2.1 -r 1.4.2.2 doc/manual/en/sylpheed-21.html; cvs diff -u -r 1.1.4.1 -r 1.1.4.2 doc/manual/en/sylpheed-22.html; cvs diff -u -r 1.4 -r 1.5 doc/manual/en/sylpheed-3.html; cvs diff -u -r 1.6.2.1 -r 1.6.2.2 doc/manual/en/sylpheed-4.html; cvs diff -u -r 1.4.2.1 -r 1.4.2.2 doc/manual/en/sylpheed-5.html; cvs diff -u -r 1.5.2.1 -r 1.5.2.2 doc/manual/en/sylpheed-6.html; cvs diff -u -r 1.5.2.1 -r 1.5.2.2 doc/manual/en/sylpheed-7.html; cvs diff -u -r 1.5.2.1 -r 1.5.2.2 doc/manual/en/sylpheed-8.html; cvs diff -u -r 1.5.2.1 -r 1.5.2.2 doc/manual/en/sylpheed-9.html; cvs diff -u -r 1.5.2.1 -r 1.5.2.2 doc/manual/en/sylpheed.html; ) > 1.9.14cvs6.patchset
( cvs diff -u -r 1.5.2.2 -r 1.5.2.3 doc/manual/en/sylpheed-1.html; cvs diff -u -r 1.4.2.2 -r 1.4.2.3 doc/manual/en/sylpheed-18.html; cvs diff -u -r 1.4.2.2 -r 1.4.2.3 doc/manual/en/sylpheed-19.html; cvs diff -u -r 1.6.2.2 -r 1.6.2.3 doc/manual/en/sylpheed-4.html; cvs diff -u -r 1.5.2.2 -r 1.5.2.3 doc/manual/en/sylpheed-6.html; cvs diff -u -r 1.5.2.2 -r 1.5.2.3 doc/manual/en/sylpheed.html; cvs diff -u -r 1.274.2.60 -r 1.274.2.61 src/mainwindow.c; ) > 1.9.14cvs7.patchset
( cvs diff -u -r 1.654.2.818 -r 1.654.2.819 configure.ac; cvs diff -u -r 1.96.2.73 -r 1.96.2.74 src/textview.c; ) > 1.9.14cvs8.patchset
+( cvs diff -u -r 1.382.2.162 -r 1.382.2.163 src/compose.c; cvs diff -u -r 1.213.2.54 -r 1.213.2.55 src/folder.c; cvs diff -u -r 1.87.2.16 -r 1.87.2.17 src/folder.h; cvs diff -u -r 1.2.2.7 -r 1.2.2.8 src/folder_item_prefs.c; cvs diff -u -r 1.2.2.1 -r 1.2.2.2 src/folder_item_prefs.h; cvs diff -u -r 1.179.2.66 -r 1.179.2.67 src/imap.c; cvs diff -u -r 1.1.2.18 -r 1.1.2.19 src/imap_gtk.c; cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/imap_gtk.h; cvs diff -u -r 1.115.2.52 -r 1.115.2.53 src/main.c; cvs diff -u -r 1.274.2.61 -r 1.274.2.62 src/mainwindow.c; cvs diff -u -r 1.39.2.4 -r 1.39.2.5 src/mainwindow.h; cvs diff -u -r 1.101.2.13 -r 1.101.2.14 src/news.c; cvs diff -u -r 1.2.2.8 -r 1.2.2.9 src/news_gtk.c; cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/news_gtk.h; cvs diff -u -r 1.52.2.12 -r 1.52.2.13 src/prefs_folder_item.c; ) > 1.9.14cvs9.patchset
MICRO_VERSION=14
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=8
+EXTRA_VERSION=9
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
strcrchomp(buf);
gtk_text_buffer_insert(textbuf, &iter, buf, -1);
}
+ compose_wrap_all_full(compose, FALSE);
compose->autowrap = prev_autowrap;
fclose(fp);
}
goto colorize;
}
debug_print("compose_beautify_paragraph(): quote_str = '%s'\n", quote_str);
- startq_offset = gtk_text_iter_get_offset(&iter);
+ if (startq_offset == -1)
+ startq_offset = gtk_text_iter_get_offset(&iter);
} else {
if (startq_offset == -1)
noq_offset = gtk_text_iter_get_offset(&iter);
}
- if (prev_autowrap == FALSE && !force) {
+ if (prev_autowrap == FALSE && !force && !wrap_quote) {
goto colorize;
}
if (compose_get_line_break_pos(buffer, &iter, &break_pos,
prefs_common.linewrap_len,
quote_len)) {
GtkTextIter prev, next, cur;
-
- gtk_text_buffer_insert(buffer, &break_pos, "\n", 1);
+ if (prev_autowrap != FALSE || force)
+ gtk_text_buffer_insert(buffer, &break_pos, "\n", 1);
+ else if (quote_str && wrap_quote)
+ gtk_text_buffer_insert(buffer, &break_pos, "\n", 1);
+ else
+ goto colorize;
/* remove trailing spaces */
cur = break_pos;
gtk_text_iter_backward_char(&cur);
g_free(path);
}
+static void entry_paste_clipboard(Compose *compose, GtkWidget *entry, gboolean wrap,
+ GdkAtom clip);
+static gboolean text_clicked(GtkWidget *text, GdkEventButton *event,
+ Compose *compose)
+{
+ if (event->button == 2) {
+ entry_paste_clipboard(compose, compose->focused_editable,
+ prefs_common.linewrap_pastes,
+ GDK_SELECTION_PRIMARY);
+ return TRUE;
+ }
+ return FALSE;
+}
+
static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
{
Compose *compose;
G_CALLBACK(compose_grab_focus_cb), compose);
g_signal_connect(G_OBJECT(buffer), "insert_text",
G_CALLBACK(text_inserted), compose);
+ g_signal_connect(G_OBJECT(text), "button_press_event",
+ G_CALLBACK(text_clicked), compose);
/* drag and drop */
gtk_drag_dest_set(text, GTK_DEST_DEFAULT_ALL, compose_mime_types,
g_unlink(tmp);
g_free(tmp);
lock = FALSE;
+ if (action != COMPOSE_AUTO_SAVE)
+ alertpanel_error(_("Could not save draft."));
return;
}
g_free(tmp);
gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
}
-static void entry_paste_clipboard(GtkWidget *entry, gboolean wrap)
+static void entry_paste_clipboard(Compose *compose, GtkWidget *entry,
+ gboolean wrap, GdkAtom clip)
{
- if (GTK_IS_EDITABLE(entry))
- gtk_editable_paste_clipboard (GTK_EDITABLE(entry));
- else if (GTK_IS_TEXT_VIEW(entry)) {
+ if (GTK_IS_TEXT_VIEW(entry)) {
GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
GtkTextMark *mark_start = gtk_text_buffer_get_insert(buffer);
GtkTextIter start_iter, end_iter;
gint start, end;
- gchar *contents = gtk_clipboard_wait_for_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD));
+ gchar *contents = gtk_clipboard_wait_for_text(gtk_clipboard_get(clip));
if (contents == NULL)
return;
gtk_text_buffer_get_iter_at_offset(buffer, &start_iter, start);
gtk_text_buffer_get_iter_at_offset(buffer, &end_iter, end);
gtk_text_buffer_apply_tag_by_name(buffer, "no_wrap", &start_iter, &end_iter);
+ } else if (wrap && clip == GDK_SELECTION_PRIMARY) {
+ mark_start = gtk_text_buffer_get_insert(buffer);
+ gtk_text_buffer_get_iter_at_mark(buffer, &start_iter, mark_start);
+ gtk_text_iter_backward_char(&start_iter);
+ compose_beautify_paragraph(compose, &start_iter, TRUE);
}
- }
+ } else if (GTK_IS_EDITABLE(entry))
+ gtk_editable_paste_clipboard (GTK_EDITABLE(entry));
+
}
static void entry_allsel(GtkWidget *entry)
BLOCK_WRAP();
if (compose->focused_editable &&
GTK_WIDGET_HAS_FOCUS(compose->focused_editable))
- entry_paste_clipboard(compose->focused_editable, prefs_common.linewrap_pastes);
+ entry_paste_clipboard(compose, compose->focused_editable,
+ prefs_common.linewrap_pastes,
+ GDK_SELECTION_CLIPBOARD);
UNBLOCK_WRAP();
}
"paste_as_quotation",
GINT_TO_POINTER(paste_as_quotation + 1));
prefs_common.linewrap_quote = prefs_common.linewrap_pastes;
- entry_paste_clipboard(compose->focused_editable, prefs_common.linewrap_pastes);
+ entry_paste_clipboard(compose, compose->focused_editable,
+ prefs_common.linewrap_pastes,
+ GDK_SELECTION_CLIPBOARD);
prefs_common.linewrap_quote = wrap_quote;
}
}
BLOCK_WRAP();
if (compose->focused_editable &&
GTK_WIDGET_HAS_FOCUS(compose->focused_editable))
- entry_paste_clipboard(compose->focused_editable, FALSE);
+ entry_paste_clipboard(compose, compose->focused_editable, FALSE,
+ GDK_SELECTION_CLIPBOARD);
UNBLOCK_WRAP();
}
BLOCK_WRAP();
if (compose->focused_editable &&
GTK_WIDGET_HAS_FOCUS(compose->focused_editable))
- entry_paste_clipboard(compose->focused_editable, TRUE);
+ entry_paste_clipboard(compose, compose->focused_editable, TRUE,
+ GDK_SELECTION_CLIPBOARD);
UNBLOCK_WRAP();
}
}
}
+static void folder_item_synchronise_func(FolderItem *item, gpointer data)
+{
+ Folder *folder = (Folder *)data;
+ if (folder == NULL || item->folder == folder) {
+ if(item->prefs->offlinesync && item->folder->klass->synchronise)
+ item->folder->klass->synchronise(item);
+ }
+}
+
+void folder_synchronise(Folder *folder)
+{
+ folder_func_to_all_folders(folder_item_synchronise_func, folder);
+}
+
+typedef struct _WantSyncData {
+ Folder *folder;
+ gboolean want_sync;
+} WantSyncData;
+
+static void folder_item_want_synchronise_func(FolderItem *item, gpointer data)
+{
+ WantSyncData *want_sync_data = (WantSyncData *)data;
+
+ if (want_sync_data->folder == NULL || item->folder == want_sync_data->folder) {
+ if(item->prefs->offlinesync && item->folder->klass->synchronise)
+ want_sync_data->want_sync = TRUE;
+ else
+ want_sync_data->want_sync = FALSE;
+ }
+}
+
+gboolean folder_want_synchronise(Folder *folder)
+{
+ WantSyncData *want_sync_data = g_new0(WantSyncData, 1);
+ gboolean result;
+ want_sync_data->folder = folder;
+
+ folder_func_to_all_folders(folder_item_want_synchronise_func, want_sync_data);
+ result = want_sync_data->want_sync;
+ g_free(want_sync_data);
+ debug_print("Folder %s wants sync: %d\n", folder->name, result);
+ return result;
+}
+
void folder_item_set_batch (FolderItem *item, gboolean batch)
{
if (item->folder->klass->set_batch) {
void (*set_batch) (Folder *folder,
FolderItem *item,
gboolean batch);
+ void (*synchronise) (FolderItem *item);
};
struct _FolderItem
void folder_item_update_thaw (void);
void folder_item_set_batch (FolderItem *item, gboolean batch);
gboolean folder_has_parent_of_type (FolderItem *item, SpecialFolderItemType type);
+void folder_synchronise (Folder *folder);
+gboolean folder_want_synchronise (Folder *folder);
+
#endif /* __FOLDER_H__ */
NULL, NULL, NULL},
{"newmailcheck", "TRUE", &tmp_prefs.newmailcheck, P_BOOL,
NULL, NULL, NULL},
+ {"offlinesync", "FALSE", &tmp_prefs.offlinesync, P_BOOL,
+ NULL, NULL, NULL},
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
};
prefs->processing = NULL;
prefs->newmailcheck = TRUE;
+ prefs->offlinesync = FALSE;
return prefs;
}
tmp_prefs.enable_thread = src->prefs->enable_thread;
tmp_prefs.enable_processing = src->prefs->enable_processing;
tmp_prefs.newmailcheck = src->prefs->newmailcheck;
+ tmp_prefs.offlinesync = src->prefs->offlinesync;
prefs_matcher_read_config();
GSList * processing;
int newmailcheck;
+ int offlinesync;
gboolean request_return_receipt;
gboolean enable_default_to;
const gchar *path);
static gchar *imap_get_real_path (IMAPFolder *folder,
const gchar *path);
+static void imap_synchronise (FolderItem *item);
static void imap_free_capabilities (IMAPSession *session);
imap_class.change_flags = imap_change_flags;
imap_class.get_flags = imap_get_flags;
imap_class.set_batch = imap_set_batch;
+ imap_class.synchronise = imap_synchronise;
#ifdef USE_PTREAD
pthread_mutex_init(&imap_mutex, NULL);
#endif
return &imap_class;
}
#endif
+
+void imap_synchronise(FolderItem *item)
+{
+ imap_gtk_synchronise(item);
+}
static void delete_folder_cb(FolderView *folderview, guint action, GtkWidget *widget);
static void update_tree_cb(FolderView *folderview, guint action, GtkWidget *widget);
static void download_cb(FolderView *folderview, guint action, GtkWidget *widget);
+static void sync_cb(FolderView *folderview, guint action, GtkWidget *widget);
static GtkItemFactoryEntry imap_popup_entries[] =
{
{N_("/M_ove folder..."), NULL, move_folder_cb, 0, NULL},
{N_("/_Delete folder"), NULL, delete_folder_cb, 0, NULL},
{N_("/---"), NULL, NULL, 0, "<Separator>"},
+ {N_("/Synchronise"), NULL, sync_cb, 0, NULL},
{N_("/Down_load messages"), NULL, download_cb, 0, NULL},
{N_("/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Check for new messages"), NULL, update_tree_cb, 0, NULL},
folderview_rescan_tree(item->folder);
}
-static void download_cb(FolderView *folderview, guint action,
- GtkWidget *widget)
+static void sync_cb(FolderView *folderview, guint action,
+ GtkWidget *widget)
{
- GtkCTree *ctree = GTK_CTREE(folderview->ctree);
- MainWindow *mainwin = folderview->mainwin;
FolderItem *item;
- if (!folderview->selected) return;
+ item = folderview_get_selected_item(folderview);
+ g_return_if_fail(item != NULL);
+ folder_synchronise(item->folder);
+}
- item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
+void imap_gtk_synchronise(FolderItem *item)
+{
+ MainWindow *mainwin = mainwindow_get_mainwindow();
+ FolderView *folderview = mainwin->folderview;
+
g_return_if_fail(item != NULL);
g_return_if_fail(item->folder != NULL);
main_window_unlock(mainwin);
inc_unlock();
main_window_cursor_normal(mainwin);
+
+}
+static void download_cb(FolderView *folderview, guint action,
+ GtkWidget *widget)
+{
+ GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+ FolderItem *item;
+
+ if (!folderview->selected) return;
+
+ item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
+ imap_gtk_synchronise(item);
}
gboolean imap_gtk_should_override(void)
if (prefs_common.work_offline) {
if (time(NULL) - overridden_yes < 600)
return TRUE;
- else if (time(NULL) - overridden_no < 3)
+ else if (time(NULL) - overridden_no < 600)
return FALSE;
answer = (alertpanel(_("Offline warning"),
#ifndef IMAP_GTK_H
#define IMAP_GTK_H
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+
#include <glib.h>
+#include "folder.h"
void imap_gtk_init(void);
+void imap_gtk_synchronise(FolderItem *item);
gboolean imap_gtk_should_override(void);
#endif /* IMAP_GTK_H */
signal(SIGPIPE, SIG_IGN);
#endif
if (cmd.online_mode == ONLINE_MODE_OFFLINE)
- main_window_toggle_work_offline(mainwin, TRUE);
+ main_window_toggle_work_offline(mainwin, TRUE, FALSE);
if (cmd.online_mode == ONLINE_MODE_ONLINE)
- main_window_toggle_work_offline(mainwin, FALSE);
+ main_window_toggle_work_offline(mainwin, FALSE, FALSE);
if (cmd.status_folders) {
g_ptr_array_free(cmd.status_folders, TRUE);
} else if (!strncmp(buf, "send", 4)) {
send_queue();
} else if (!strncmp(buf, "online", 6)) {
- main_window_toggle_work_offline(mainwin, FALSE);
+ main_window_toggle_work_offline(mainwin, FALSE, FALSE);
} else if (!strncmp(buf, "offline", 7)) {
- main_window_toggle_work_offline(mainwin, TRUE);
+ main_window_toggle_work_offline(mainwin, TRUE, FALSE);
} else if (!strncmp(buf, "status-full", 11) ||
!strncmp(buf, "status", 6)) {
gchar *status;
static void addr_harvest_msg_cb ( MainWindow *mainwin,
guint action,
GtkWidget *widget );
+static void sync_cb ( MainWindow *mainwin,
+ guint action,
+ GtkWidget *widget );
static gboolean mainwindow_focus_in_event (GtkWidget *widget,
GdkEventFocus *focus,
NULL, inc_cancel_cb, 0, NULL},
{N_("/_Message/Recei_ve/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Message/_Send queued messages"), NULL, send_queue_cb, 0, NULL},
+ {N_("/_Message/Synchronise folders"), "<control><shift>S", sync_cb, 0, NULL},
{N_("/_Message/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Message/Compose a_n email message"), "<control>M", compose_mail_cb, 0, NULL},
{N_("/_Message/Compose a news message"), NULL, compose_news_cb, 0, NULL},
{N_("/_Help/_About"), NULL, about_show, 0, NULL}
};
+static gboolean offline_ask_sync = TRUE;
+
static gboolean main_window_accel_activate (GtkAccelGroup *accelgroup,
GObject *arg1,
guint value,
gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
ifactory = gtk_item_factory_from_widget(menubar);
- menu_set_sensitive(ifactory, "/Help/Manual (Local)", manual_available(MANUAL_MANUAL_LOCAL));
- menu_set_sensitive(ifactory, "/Help/FAQ (Local)", manual_available(MANUAL_FAQ_LOCAL));
+ menu_set_sensitive(ifactory, "/Help/Manual", manual_available(MANUAL_MANUAL_LOCAL));
+ menu_set_sensitive(ifactory, "/Help/FAQ", manual_available(MANUAL_FAQ_LOCAL));
if (prefs_common.toolbar_detachable) {
handlebox = gtk_handle_box_new();
prefs_common.sep_msg = (type & SEPARATE_MESSAGE) != 0;
}
-void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline)
+void main_window_toggle_work_offline (MainWindow *mainwin, gboolean offline,
+ gboolean ask_sync)
{
+ offline_ask_sync = ask_sync;
if (offline)
online_switch_clicked (GTK_BUTTON(mainwin->online_switch), mainwin);
else
online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
+ offline_ask_sync = TRUE;
}
static void toggle_work_offline_cb (MainWindow *mainwin, guint action, GtkWidget *widget)
{
- main_window_toggle_work_offline(mainwin, GTK_CHECK_MENU_ITEM(widget)->active);
+ main_window_toggle_work_offline(mainwin, GTK_CHECK_MENU_ITEM(widget)->active, TRUE);
+}
+
+static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
+{
+ GList *folderlist = folder_get_list();
+ gboolean found = FALSE;
+
+ /* see if there are synchronised folders */
+ for (; folderlist; folderlist = folderlist->next) {
+ Folder *folder = (Folder *)folderlist->data;
+ if (folder_want_synchronise(folder)) {
+ found = TRUE;
+ break;
+ }
+ }
+
+ if (!found)
+ return;
+
+ if (offline_ask_sync && ask && alertpanel(_("Folder synchronisation"),
+ _("Do you want to synchronise your folders now?"),
+ GTK_STOCK_YES, GTK_STOCK_NO, NULL) != G_ALERTDEFAULT)
+ return;
+
+ folder_synchronise(NULL);
}
static void online_switch_clicked (GtkButton *btn, gpointer data)
if (btn == GTK_BUTTON(mainwin->online_switch)) {
/* go offline */
+ mainwindow_check_synchronise(mainwin, TRUE);
gtk_widget_hide (mainwin->online_switch);
gtk_widget_show (mainwin->offline_switch);
menuitem->active = TRUE;
return FALSE;
}
+static void sync_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
+{
+ mainwindow_check_synchronise(mainwin, FALSE);
+}
+
/*
* End of Source.
*/
void main_window_destroy_all (void);
void main_window_toggle_work_offline (MainWindow *mainwin,
- gboolean offline);
+ gboolean offline,
+ gboolean ask_sync);
/* public so it can be disabled from summaryview */
gboolean mainwindow_key_pressed (GtkWidget *widget,
static gchar *news_folder_get_path (Folder *folder);
gchar *news_item_get_path (Folder *folder,
FolderItem *item);
+static void news_synchronise (FolderItem *item);
static FolderClass news_class;
news_class.get_msginfo = news_get_msginfo;
news_class.get_msginfos = news_get_msginfos;
news_class.fetch_msg = news_fetch_msg;
+ news_class.synchronise = news_synchronise;
};
return &news_class;
{
return TRUE;
}
+
+void news_synchronise(FolderItem *item)
+{
+ news_gtk_synchronise(item);
+}
static void remove_news_server_cb(FolderView *folderview, guint action, GtkWidget *widget);
static void update_tree_cb(FolderView *folderview, guint action, GtkWidget *widget);
static void download_cb(FolderView *folderview, guint action, GtkWidget *widget);
+static void sync_cb(FolderView *folderview, guint action, GtkWidget *widget);
static GtkItemFactoryEntry news_popup_entries[] =
{
{N_("/_Subscribe to newsgroup..."), NULL, subscribe_newsgroup_cb, 0, NULL},
{N_("/_Unsubscribe newsgroup"), NULL, unsubscribe_newsgroup_cb, 0, NULL},
{N_("/---"), NULL, NULL, 0, "<Separator>"},
- {N_("/Down_load"), NULL, download_cb, 0, NULL},
+ {N_("/Synchronise"), NULL, sync_cb, 0, NULL},
+ {N_("/Down_load messages"), NULL, download_cb, 0, NULL},
{N_("/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Check for new messages"), NULL, update_tree_cb, 0, NULL},
{N_("/---"), NULL, NULL, 0, "<Separator>"},
folderview_check_new(item->folder);
}
-static void download_cb(FolderView *folderview, guint action,
- GtkWidget *widget)
+static void sync_cb(FolderView *folderview, guint action,
+ GtkWidget *widget)
{
- GtkCTree *ctree = GTK_CTREE(folderview->ctree);
- MainWindow *mainwin = folderview->mainwin;
FolderItem *item;
- if (!folderview->selected) return;
+ item = folderview_get_selected_item(folderview);
+ g_return_if_fail(item != NULL);
+ folder_synchronise(item->folder);
+}
- item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
+void news_gtk_synchronise(FolderItem *item)
+{
+ MainWindow *mainwin = mainwindow_get_mainwindow();
+ FolderView *folderview = mainwin->folderview;
+
g_return_if_fail(item != NULL);
g_return_if_fail(item->folder != NULL);
- if (prefs_common.work_offline && !news_gtk_should_override())
- return;
-
main_window_cursor_wait(mainwin);
inc_lock();
main_window_lock(mainwin);
inc_unlock();
main_window_cursor_normal(mainwin);
}
+
+static void download_cb(FolderView *folderview, guint action,
+ GtkWidget *widget)
+{
+ GtkCTree *ctree = GTK_CTREE(folderview->ctree);
+ FolderItem *item;
+
+ if (!folderview->selected) return;
+
+ item = gtk_ctree_node_get_row_data(ctree, folderview->selected);
+ news_gtk_synchronise(item);
+}
#ifndef NEWS_GTK_H
#define NEWS_GTK_H
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "folder.h"
+
void news_gtk_init(void);
gboolean news_gtk_should_override(void);
-
+void news_gtk_synchronise(FolderItem *item);
#endif /* NEWS_GTK_H */
GtkWidget *folder_color_btn;
GtkWidget *checkbtn_enable_processing;
GtkWidget *checkbtn_newmailcheck;
+ GtkWidget *checkbtn_offlinesync;
/* appy to sub folders */
GtkWidget *simplify_subject_rec_checkbtn;
GtkWidget *folder_color_rec_checkbtn;
GtkWidget *enable_processing_rec_checkbtn;
GtkWidget *newmailcheck_rec_checkbtn;
+ GtkWidget *offlinesync_rec_checkbtn;
gint folder_color;
};
GtkWidget *folder_color_btn;
GtkWidget *checkbtn_enable_processing;
GtkWidget *checkbtn_newmailcheck;
+ GtkWidget *checkbtn_offlinesync;
GtkWidget *simplify_subject_rec_checkbtn;
GtkWidget *folder_chmod_rec_checkbtn;
GtkWidget *folder_color_rec_checkbtn;
GtkWidget *enable_processing_rec_checkbtn;
GtkWidget *newmailcheck_rec_checkbtn;
-
+ GtkWidget *offlinesync_rec_checkbtn;
+
page->item = item;
/* Table */
- table = gtk_table_new(5, 2, FALSE);
+ table = gtk_table_new(6, 2, FALSE);
gtk_table_set_row_spacings(GTK_TABLE(table), 4);
gtk_table_set_col_spacings(GTK_TABLE(table), 4);
rowcount = 0;
rowcount++;
+ /* Synchronise folder for offline use */
+ checkbtn_offlinesync = gtk_check_button_new_with_label(_("Synchronise for offline use"));
+ gtk_table_attach(GTK_TABLE(table), checkbtn_offlinesync, 0, 2,
+ rowcount, rowcount+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+
+ offlinesync_rec_checkbtn = gtk_check_button_new();
+ gtk_table_attach(GTK_TABLE(table), offlinesync_rec_checkbtn, 2, 3,
+ rowcount, rowcount + 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
+
+ if (item->folder && (item->folder->klass->type != F_IMAP &&
+ item->folder->klass->type != F_NEWS)) {
+ item->prefs->offlinesync = TRUE;
+ gtk_widget_set_sensitive(GTK_WIDGET(checkbtn_offlinesync),
+ FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(offlinesync_rec_checkbtn),
+ FALSE);
+
+ }
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_offlinesync),
+ item->prefs->offlinesync);
+ rowcount++;
+
gtk_widget_show_all(table);
page->table = table;
page->folder_color_btn = folder_color_btn;
page->checkbtn_enable_processing = checkbtn_enable_processing;
page->checkbtn_newmailcheck = checkbtn_newmailcheck;
+ page->checkbtn_offlinesync = checkbtn_offlinesync;
page->simplify_subject_rec_checkbtn = simplify_subject_rec_checkbtn;
page->folder_chmod_rec_checkbtn = folder_chmod_rec_checkbtn;
page->folder_color_rec_checkbtn = folder_color_rec_checkbtn;
page->enable_processing_rec_checkbtn = enable_processing_rec_checkbtn;
page->newmailcheck_rec_checkbtn = newmailcheck_rec_checkbtn;
+ page->offlinesync_rec_checkbtn = offlinesync_rec_checkbtn;
page->page.widget = table;
}
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_newmailcheck));
}
+ if (all || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->offlinesync_rec_checkbtn))) {
+ prefs->offlinesync =
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->checkbtn_offlinesync));
+ }
+
folder_item_prefs_save_config(folder);
}
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->folder_chmod_rec_checkbtn)) ||
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->folder_color_rec_checkbtn)) ||
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->enable_processing_rec_checkbtn)) ||
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->newmailcheck_rec_checkbtn))))
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->newmailcheck_rec_checkbtn)) ||
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->offlinesync_rec_checkbtn))))
return TRUE;
else
return FALSE;