aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2010-07-02 01:59:59 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2010-07-02 01:59:59 +0000
commit3f6d55a10a2425aaf7936574686701dddaf3fc4b (patch)
tree3ad032f61867ea27dd49be07a3a56b8a40f4107b
parentdc5c4935c10e483a1863edb5e1626c7cfe914f38 (diff)
added write lock mode on summary view.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2597 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog7
-rw-r--r--src/folderview.c3
-rw-r--r--src/main.c4
-rw-r--r--src/plugin.c58
-rw-r--r--src/plugin.h4
-rw-r--r--src/summaryview.c44
-rw-r--r--src/summaryview.h9
7 files changed, 116 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 0d2bf6c1..a50e2846 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-07-02
+
+ * src/plugin.[ch]
+ src/main.c
+ src/summaryview.[ch]
+ src/folderview.c: added write lock mode on summary view.
+
2010-07-01
* src/foldersel.c: move up/collapse/expand row with left/right key.
diff --git a/src/folderview.c b/src/folderview.c
index ac971906..66ff0576 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -3146,6 +3146,9 @@ static gboolean folderview_drag_motion_cb(GtkWidget *widget,
} else
remove_auto_expand_timeout(folderview);
+ if (summary_is_locked(folderview->summaryview))
+ acceptable = FALSE;
+
gtk_tree_view_get_drag_dest_row(GTK_TREE_VIEW(widget),
&prev_path, NULL);
if (!path || (prev_path && gtk_tree_path_compare(path, prev_path) != 0))
diff --git a/src/main.c b/src/main.c
index 30ba2b69..fa725de5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1165,6 +1165,10 @@ static void plugin_init(void)
ADD_SYM(summary_lock);
ADD_SYM(summary_unlock);
ADD_SYM(summary_is_locked);
+ ADD_SYM(summary_is_read_locked);
+ ADD_SYM(summary_write_lock);
+ ADD_SYM(summary_write_unlock);
+ ADD_SYM(summary_is_write_locked);
ADD_SYM(messageview_create_with_new_window);
ADD_SYM(messageview_show);
diff --git a/src/plugin.c b/src/plugin.c
index 8c711d14..e428898c 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -724,7 +724,7 @@ void syl_plugin_summary_lock(void)
summary = syl_plugin_summary_view_get();
if (summary) {
- func = syl_plugin_lookup_symbol("summary_lock");
+ GETFUNC("summary_lock");
SAFE_CALL_ARG1(func, summary);
}
}
@@ -736,7 +736,7 @@ void syl_plugin_summary_unlock(void)
summary = syl_plugin_summary_view_get();
if (summary) {
- func = syl_plugin_lookup_symbol("summary_unlock");
+ GETFUNC("summary_unlock");
SAFE_CALL_ARG1(func, summary);
}
}
@@ -748,7 +748,59 @@ gboolean syl_plugin_summary_is_locked(void)
summary = syl_plugin_summary_view_get();
if (summary) {
- func = syl_plugin_lookup_symbol("summary_is_locked");
+ GETFUNC("summary_is_locked");
+ return SAFE_CALL_ARG1_RET_VAL(func, summary, FALSE);
+ }
+
+ return FALSE;
+}
+
+gboolean syl_plugin_summary_is_read_locked(void)
+{
+ gboolean (*func)(gpointer);
+ gpointer summary;
+
+ summary = syl_plugin_summary_view_get();
+ if (summary) {
+ GETFUNC("summary_is_read_locked");
+ return SAFE_CALL_ARG1_RET_VAL(func, summary, FALSE);
+ }
+
+ return FALSE;
+}
+
+void syl_plugin_summary_write_lock(void)
+{
+ void (*func)(gpointer);
+ gpointer summary;
+
+ summary = syl_plugin_summary_view_get();
+ if (summary) {
+ GETFUNC("summary_write_lock");
+ SAFE_CALL_ARG1(func, summary);
+ }
+}
+
+void syl_plugin_summary_write_unlock(void)
+{
+ void (*func)(gpointer);
+ gpointer summary;
+
+ summary = syl_plugin_summary_view_get();
+ if (summary) {
+ GETFUNC("summary_write_unlock");
+ SAFE_CALL_ARG1(func, summary);
+ }
+}
+
+gboolean syl_plugin_summary_is_write_locked(void)
+{
+ gboolean (*func)(gpointer);
+ gpointer summary;
+
+ summary = syl_plugin_summary_view_get();
+ if (summary) {
+ GETFUNC("summary_is_write_locked");
return SAFE_CALL_ARG1_RET_VAL(func, summary, FALSE);
}
diff --git a/src/plugin.h b/src/plugin.h
index 019ba0ec..5ec55af5 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -170,6 +170,10 @@ void syl_plugin_open_message (const gchar *folder_id,
void syl_plugin_summary_lock (void);
void syl_plugin_summary_unlock (void);
gboolean syl_plugin_summary_is_locked (void);
+gboolean syl_plugin_summary_is_read_locked (void);
+void syl_plugin_summary_write_lock (void);
+void syl_plugin_summary_write_unlock (void);
+gboolean syl_plugin_summary_is_write_locked (void);
/* MessageView */
gpointer syl_plugin_messageview_create_with_new_window
diff --git a/src/summaryview.c b/src/summaryview.c
index b705fbd9..89af50c4 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -1070,19 +1070,43 @@ void summary_show_queued_msgs(SummaryView *summaryview)
void summary_lock(SummaryView *summaryview)
{
summaryview->lock_count++;
+ summaryview->write_lock_count++;
}
void summary_unlock(SummaryView *summaryview)
{
if (summaryview->lock_count)
summaryview->lock_count--;
+ if (summaryview->write_lock_count)
+ summaryview->write_lock_count--;
}
gboolean summary_is_locked(SummaryView *summaryview)
{
+ return summaryview->lock_count > 0 || summaryview->write_lock_count > 0;
+}
+
+gboolean summary_is_read_locked(SummaryView *summaryview)
+{
return summaryview->lock_count > 0;
}
+void summary_write_lock(SummaryView *summaryview)
+{
+ summaryview->write_lock_count++;
+}
+
+void summary_write_unlock(SummaryView *summaryview)
+{
+ if (summaryview->write_lock_count)
+ summaryview->write_lock_count--;
+}
+
+gboolean summary_is_write_locked(SummaryView *summaryview)
+{
+ return summaryview->write_lock_count > 0;
+}
+
SummarySelection summary_get_selection_type(SummaryView *summaryview)
{
SummarySelection selection;
@@ -2638,7 +2662,7 @@ static void summary_display_msg_full(SummaryView *summaryview,
summary_row_is_displayed(summaryview, iter))
return;
- if (summary_is_locked(summaryview)) return;
+ if (summary_is_read_locked(summaryview)) return;
summary_lock(summaryview);
STATUSBAR_POP(summaryview->mainwin);
@@ -2741,7 +2765,7 @@ void summary_display_msg_selected(SummaryView *summaryview,
{
GtkTreeIter iter;
- if (summary_is_locked(summaryview)) return;
+ if (summary_is_read_locked(summaryview)) return;
if (summaryview->selected) {
if (gtkut_tree_row_reference_get_iter
@@ -2825,7 +2849,7 @@ gboolean summary_step(SummaryView *summaryview, GtkScrollType type)
GtkTreeModel *model = GTK_TREE_MODEL(summaryview->store);
GtkTreeIter iter;
- if (summary_is_locked(summaryview)) return FALSE;
+ if (summary_is_read_locked(summaryview)) return FALSE;
if (!gtkut_tree_row_reference_get_iter
(model, summaryview->selected, &iter))
@@ -2911,7 +2935,7 @@ void summary_mark(SummaryView *summaryview)
FolderSortType sort_type = SORT_ASCENDING;
if (FOLDER_TYPE(summaryview->folder_item->folder) == F_IMAP &&
- summary_is_locked(summaryview))
+ summary_is_read_locked(summaryview))
return;
SORT_BLOCK(SORT_BY_MARK);
@@ -2985,7 +3009,7 @@ void summary_mark_as_read(SummaryView *summaryview)
FolderSortType sort_type = SORT_ASCENDING;
if (FOLDER_TYPE(summaryview->folder_item->folder) == F_IMAP &&
- summary_is_locked(summaryview))
+ summary_is_read_locked(summaryview))
return;
SORT_BLOCK(SORT_BY_UNREAD);
@@ -3040,7 +3064,7 @@ void summary_mark_thread_as_read(SummaryView *summaryview)
FolderSortType sort_type = SORT_ASCENDING;
if (FOLDER_TYPE(summaryview->folder_item->folder) == F_IMAP &&
- summary_is_locked(summaryview))
+ summary_is_read_locked(summaryview))
return;
SORT_BLOCK(SORT_BY_UNREAD);
@@ -3119,7 +3143,7 @@ void summary_mark_all_read(SummaryView *summaryview)
FolderSortType sort_type = SORT_ASCENDING;
if (FOLDER_TYPE(summaryview->folder_item->folder) == F_IMAP &&
- summary_is_locked(summaryview))
+ summary_is_read_locked(summaryview))
return;
SORT_BLOCK(SORT_BY_UNREAD);
@@ -3200,7 +3224,7 @@ void summary_mark_as_unread(SummaryView *summaryview)
FolderSortType sort_type = SORT_ASCENDING;
if (FOLDER_TYPE(summaryview->folder_item->folder) == F_IMAP &&
- summary_is_locked(summaryview))
+ summary_is_read_locked(summaryview))
return;
SORT_BLOCK(SORT_BY_UNREAD);
@@ -3405,7 +3429,7 @@ void summary_unmark(SummaryView *summaryview)
FolderSortType sort_type = SORT_ASCENDING;
if (FOLDER_TYPE(summaryview->folder_item->folder) == F_IMAP &&
- summary_is_locked(summaryview))
+ summary_is_read_locked(summaryview))
return;
SORT_BLOCK(SORT_BY_MARK);
@@ -5667,7 +5691,7 @@ static gboolean summary_key_pressed(GtkWidget *widget, GdkEventKey *event,
GtkAdjustment *adj;
gboolean mod_pressed;
- if (summary_is_locked(summaryview)) return FALSE;
+ if (summary_is_read_locked(summaryview)) return FALSE;
if (!event) return FALSE;
switch (event->keyval) {
diff --git a/src/summaryview.h b/src/summaryview.h
index fdc1d9b7..c4f1523f 100644
--- a/src/summaryview.h
+++ b/src/summaryview.h
@@ -157,6 +157,8 @@ private:
/* unthreading */
GSList *pos_list;
+
+ guint write_lock_count;
};
SummaryView *summary_create(void);
@@ -170,9 +172,16 @@ void summary_clear_all (SummaryView *summaryview);
void summary_show_queued_msgs (SummaryView *summaryview);
+/* full lock */
void summary_lock (SummaryView *summaryview);
void summary_unlock (SummaryView *summaryview);
gboolean summary_is_locked (SummaryView *summaryview);
+gboolean summary_is_read_locked (SummaryView *summaryview);
+
+/* write lock (read only) */
+void summary_write_lock (SummaryView *summaryview);
+void summary_write_unlock (SummaryView *summaryview);
+gboolean summary_is_write_locked (SummaryView *summaryview);
SummarySelection summary_get_selection_type (SummaryView *summaryview);
GSList *summary_get_selected_msg_list (SummaryView *summaryview);