[gedit] Scroll to cursor when the document is loaded.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gedit] Scroll to cursor when the document is loaded.
- Date: Thu, 15 Oct 2009 15:35:08 +0000 (UTC)
commit aafbce96c112e42cae461a225f8aa65cb41cbd40
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu Oct 15 17:33:53 2009 +0200
Scroll to cursor when the document is loaded.
This should fix bug #598082
gedit/gedit-tab.c | 3 +++
gedit/gedit-view.c | 29 +----------------------------
2 files changed, 4 insertions(+), 28 deletions(-)
---
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index fa0c65e..d4a7a35 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -1025,6 +1025,9 @@ document_loaded (GeditDocument *document,
mime);
g_free (mime);
+ /* Scroll to the cursor when the document is loaded */
+ gedit_view_scroll_to_cursor (GEDIT_VIEW (tab->priv->view));
+
all_documents = gedit_app_get_documents (gedit_app_get_default ());
for (l = all_documents; l != NULL; l = g_list_next (l))
diff --git a/gedit/gedit-view.c b/gedit/gedit-view.c
index 03f29b9..b999d29 100644
--- a/gedit/gedit-view.c
+++ b/gedit/gedit-view.c
@@ -69,9 +69,6 @@ enum
struct _GeditViewPrivate
{
- /* idle hack to make open-at-line work */
- guint scroll_idle;
-
SearchMode search_mode;
GtkTextIter start_search_iter;
@@ -289,15 +286,6 @@ gedit_view_class_init (GeditViewClass *klass)
G_TYPE_INT, 1);
}
-static gboolean
-scroll_to_cursor_on_init (GeditView *view)
-{
- gedit_view_scroll_to_cursor (view);
-
- view->priv->scroll_idle = 0;
- return FALSE;
-}
-
static void
current_buffer_removed (GeditView *view)
{
@@ -384,16 +372,7 @@ gedit_view_init (GeditView *view)
"indent_on_tab", TRUE,
NULL);
- /* Make sure that the view is scrolled to the cursor so
- * that "gedit +100 foo.txt" works.
- * We would like to this on the first expose handler so that
- * it would look instantaneous, but this isn't currently
- * possible: see bug #172277 and bug #311728.
- * So we need to do this in an idle handler.
- */
- view->priv->scroll_idle = g_idle_add ((GSourceFunc) scroll_to_cursor_on_init, view);
-
- view->priv->typeselect_flush_timeout = 0;
+ view->priv->typeselect_flush_timeout = 0;
view->priv->wrap_around = TRUE;
/* Drag and drop support */
@@ -416,12 +395,6 @@ gedit_view_destroy (GtkObject *object)
view = GEDIT_VIEW (object);
- if (view->priv->scroll_idle > 0)
- {
- g_source_remove (view->priv->scroll_idle);
- view->priv->scroll_idle = 0;
- }
-
if (view->priv->search_window != NULL)
{
gtk_widget_destroy (view->priv->search_window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]