aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-12-13 02:57:38 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-12-13 02:57:38 +0000
commitf239571c2ad97975edaceb80845b97c5daa77593 (patch)
treea5f5a85ff0c14714eebd91cac08684c005573ec1
parenta8d64a7a84ace27e2a92cf571ee11a138ab37a0e (diff)
In reedit mode, place cursor at the top of the text. Set the default focus to To or Subject entry if they're empty.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1416 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.ja6
-rw-r--r--src/compose.c24
3 files changed, 34 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a8e9e60..f3de9116 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-12-13
+
+ * src/compose.c: compose_reedit(): place cursor at the top of the
+ text. Set the default focus to To or Subject entry if they're empty.
+
2006-12-12
* libsylph/ssl.[ch]
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 94fd8ed8..42c9feb0 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,9 @@
+2006-12-13
+
+ * src/compose.c: compose_reedit(): カーソルをテキストの先頭に配置
+ するようにした。 To または Subject が空の場合はそれらのエントリに
+ デフォルトでフォーカスするようにした。
+
2006-12-12
* libsylph/ssl.[ch]
diff --git a/src/compose.c b/src/compose.c
index a92db7df..1621c9fa 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1056,6 +1056,8 @@ void compose_reedit(MsgInfo *msginfo)
GtkTextIter iter;
FILE *fp;
gchar buf[BUFFSIZE];
+ const gchar *str;
+ GtkWidget *focus_widget = NULL;
g_return_if_fail(msginfo != NULL);
g_return_if_fail(msginfo->folder != NULL);
@@ -1105,7 +1107,27 @@ void compose_reedit(MsgInfo *msginfo)
}
compose_attach_parts(compose, msginfo);
- gtk_widget_grab_focus(compose->text);
+ gtk_text_buffer_get_start_iter(buffer, &iter);
+ gtk_text_buffer_place_cursor(buffer, &iter);
+
+ if (account->protocol != A_NNTP) {
+ str = gtk_entry_get_text(GTK_ENTRY(compose->to_entry));
+ if (!str || *str == '\0')
+ focus_widget = compose->to_entry;
+ } else {
+ str = gtk_entry_get_text(GTK_ENTRY(compose->newsgroups_entry));
+ if (!str || *str == '\0')
+ focus_widget = compose->newsgroups_entry;
+ }
+ if (!focus_widget) {
+ str = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry));
+ if (!str || *str == '\0')
+ focus_widget = compose->subject_entry;
+ }
+ if (focus_widget)
+ gtk_widget_grab_focus(focus_widget);
+ else
+ gtk_widget_grab_focus(compose->text);
undo_unblock(compose->undostruct);