diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-08-16 04:56:20 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-08-16 04:56:20 +0000 |
commit | 2bec9e15edfdc196dd9bc9999d1c29046764c63d (patch) | |
tree | 76d9b7f0dc35ef336241ba28546e057ac2a4fb4b | |
parent | fd4fa414a182c6ca1a75ec7244cc8e6ad409c56a (diff) |
sourcewindow.c: fixed scrolling problem on first click.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1126 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ChangeLog.ja | 4 | ||||
-rw-r--r-- | src/sourcewindow.c | 23 |
3 files changed, 31 insertions, 0 deletions
@@ -1,3 +1,7 @@ +2006-08-16 + + * src/sourcewindow.c: fixed scrolling problem on first click. + 2006-08-15 * libsylph/prefs_common.[ch] diff --git a/ChangeLog.ja b/ChangeLog.ja index 16c4a7b3..0ddccee1 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,7 @@ +2006-08-16 + + * src/sourcewindow.c: 初回のクリックでのスクロールの問題を修正。 + 2006-08-15 * libsylph/prefs_common.[ch] diff --git a/src/sourcewindow.c b/src/sourcewindow.c index a135899a..b1926fe7 100644 --- a/src/sourcewindow.c +++ b/src/sourcewindow.c @@ -47,6 +47,9 @@ static gboolean key_pressed (GtkWidget *widget, GdkEventKey *event, SourceWindow *sourcewin); +static void adj_value_changed (GtkAdjustment *adj, + SourceWindow *sourcewin); + static void source_window_init() { } @@ -96,6 +99,10 @@ SourceWindow *source_window_create(void) gtk_container_add(GTK_CONTAINER(scrolledwin), text); gtk_widget_show(text); + g_signal_connect(G_OBJECT(GTK_TEXT_VIEW(text)->vadjustment), + "value-changed", + G_CALLBACK(adj_value_changed), sourcewin); + sourcewin->window = window; sourcewin->scrolledwin = scrolledwin; sourcewin->text = text; @@ -122,6 +129,8 @@ void source_window_show_msg(SourceWindow *sourcewin, MsgInfo *msginfo) gchar *title; FILE *fp; gchar buf[BUFFSIZE]; + GtkTextBuffer *buffer; + GtkTextIter iter; g_return_if_fail(msginfo != NULL); @@ -145,6 +154,10 @@ void source_window_show_msg(SourceWindow *sourcewin, MsgInfo *msginfo) source_window_append(sourcewin, buf); fclose(fp); + + buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(sourcewin->text)); + gtk_text_buffer_get_start_iter(buffer, &iter); + gtk_text_buffer_place_cursor(buffer, &iter); } void source_window_append(SourceWindow *sourcewin, const gchar *str) @@ -187,3 +200,13 @@ static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, } return FALSE; } + +static void adj_value_changed(GtkAdjustment *adj, SourceWindow *sourcewin) +{ + GtkTextBuffer *buffer; + + buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(sourcewin->text)); + if (gtk_text_buffer_get_selection_bounds(buffer, NULL, NULL)) + return; + gtk_text_view_place_cursor_onscreen(GTK_TEXT_VIEW(sourcewin->text)); +} |