[gtksourceview/wip/gutter: 1/3] Gutter: clean-up
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/gutter: 1/3] Gutter: clean-up
- Date: Wed, 4 Sep 2013 12:33:34 +0000 (UTC)
commit d145e0e74a4c5ea97091c93ebece2bdf6f095ea8
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Sep 3 15:05:42 2013 +0200
Gutter: clean-up
gtksourceview/gtksourcegutter.c | 10 -----
gtksourceview/gtksourcegutterrenderer.c | 47 +++++--------------------
gtksourceview/gtksourcegutterrendererlines.c | 9 -----
gtksourceview/gtksourceview.c | 14 +------
4 files changed, 12 insertions(+), 68 deletions(-)
---
diff --git a/gtksourceview/gtksourcegutter.c b/gtksourceview/gtksourcegutter.c
index 6585b83..5577f4b 100644
--- a/gtksourceview/gtksourcegutter.c
+++ b/gtksourceview/gtksourcegutter.c
@@ -27,8 +27,6 @@
#include "gtksourcegutterrenderer.h"
#include "gtksourcegutterrenderer-private.h"
-#include <gobject/gvaluecollector.h>
-
/**
* SECTION:gutter
* @Short_description: Gutter object for #GtkSourceView
@@ -245,12 +243,6 @@ renderer_free (Renderer *renderer)
}
static void
-gtk_source_gutter_finalize (GObject *object)
-{
- G_OBJECT_CLASS (gtk_source_gutter_parent_class)->finalize (object);
-}
-
-static void
gtk_source_gutter_dispose (GObject *object)
{
GtkSourceGutter *gutter = GTK_SOURCE_GUTTER (object);
@@ -531,7 +523,6 @@ gtk_source_gutter_class_init (GtkSourceGutterClass *klass)
object_class->set_property = gtk_source_gutter_set_property;
object_class->get_property = gtk_source_gutter_get_property;
- object_class->finalize = gtk_source_gutter_finalize;
object_class->dispose = gtk_source_gutter_dispose;
object_class->constructed = gtk_source_gutter_constructed;
@@ -674,7 +665,6 @@ gtk_source_gutter_get_window (GtkSourceGutter *gutter)
* Since: 3.0
*
**/
-
gboolean
gtk_source_gutter_insert (GtkSourceGutter *gutter,
GtkSourceGutterRenderer *renderer,
diff --git a/gtksourceview/gtksourcegutterrenderer.c b/gtksourceview/gtksourcegutterrenderer.c
index 508e686..c080b0e 100644
--- a/gtksourceview/gtksourcegutterrenderer.c
+++ b/gtksourceview/gtksourcegutterrenderer.c
@@ -28,7 +28,6 @@
enum
{
ACTIVATE,
- SIZE_CHANGED,
QUEUE_DRAW,
QUERY_TOOLTIP,
QUERY_DATA,
@@ -95,13 +94,6 @@ set_buffer (GtkSourceGutterRenderer *renderer,
}
renderer->priv->buffer = buffer;
-
-}
-
-static void
-gtk_source_gutter_renderer_finalize (GObject *object)
-{
- G_OBJECT_CLASS (gtk_source_gutter_renderer_parent_class)->finalize (object);
}
static void
@@ -173,24 +165,21 @@ gtk_source_gutter_renderer_dispose (GObject *object)
G_OBJECT_CLASS (gtk_source_gutter_renderer_parent_class)->dispose (object);
}
-static gboolean
+static void
set_visible (GtkSourceGutterRenderer *renderer,
gboolean visible)
{
- if (renderer->priv->visible == visible)
- {
- return FALSE;
- }
+ visible = visible != FALSE;
- renderer->priv->visible = visible;
- g_object_notify (G_OBJECT (renderer), "visible");
-
- gtk_source_gutter_renderer_queue_draw (renderer);
+ if (renderer->priv->visible != visible)
+ {
+ renderer->priv->visible = visible;
+ g_object_notify (G_OBJECT (renderer), "visible");
- return TRUE;
+ gtk_source_gutter_renderer_queue_draw (renderer);
+ }
}
-
static gboolean
set_padding (GtkSourceGutterRenderer *renderer,
gint *field,
@@ -459,7 +448,6 @@ gtk_source_gutter_renderer_class_init (GtkSourceGutterRendererClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = gtk_source_gutter_renderer_finalize;
object_class->dispose = gtk_source_gutter_renderer_dispose;
object_class->get_property = gtk_source_gutter_renderer_get_property;
@@ -1029,14 +1017,7 @@ gtk_source_gutter_renderer_set_visible (GtkSourceGutterRenderer *renderer,
{
g_return_if_fail (GTK_SOURCE_IS_GUTTER_RENDERER (renderer));
- if (visible != renderer->priv->visible)
- {
- renderer->priv->visible = visible;
-
- g_object_notify (G_OBJECT (renderer), "visible");
-
- gtk_source_gutter_renderer_queue_draw (renderer);
- }
+ set_visible (renderer, visible);
}
/**
@@ -1322,15 +1303,7 @@ _gtk_source_gutter_renderer_set_view (GtkSourceGutterRenderer *renderer,
old_view = renderer->priv->view;
renderer->priv->window_type = window_type;
-
- if (view)
- {
- renderer->priv->view = g_object_ref (view);
- }
- else
- {
- renderer->priv->view = NULL;
- }
+ renderer->priv->view = view != NULL ? g_object_ref (view) : NULL;
if (GTK_SOURCE_GUTTER_RENDERER_GET_CLASS (renderer)->change_view)
{
diff --git a/gtksourceview/gtksourcegutterrendererlines.c b/gtksourceview/gtksourcegutterrendererlines.c
index d2dbbcf..581289a 100644
--- a/gtksourceview/gtksourcegutterrendererlines.c
+++ b/gtksourceview/gtksourcegutterrendererlines.c
@@ -31,12 +31,6 @@ struct _GtkSourceGutterRendererLinesPrivate
G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceGutterRendererLines, gtk_source_gutter_renderer_lines,
GTK_SOURCE_TYPE_GUTTER_RENDERER_TEXT)
-static void
-gtk_source_gutter_renderer_lines_finalize (GObject *object)
-{
- G_OBJECT_CLASS (gtk_source_gutter_renderer_lines_parent_class)->finalize (object);
-}
-
static GtkTextBuffer *
get_buffer (GtkSourceGutterRendererLines *renderer)
{
@@ -315,11 +309,8 @@ gutter_renderer_query_activatable (GtkSourceGutterRenderer *renderer,
static void
gtk_source_gutter_renderer_lines_class_init (GtkSourceGutterRendererLinesClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkSourceGutterRendererClass *renderer_class = GTK_SOURCE_GUTTER_RENDERER_CLASS (klass);
- object_class->finalize = gtk_source_gutter_renderer_lines_finalize;
-
renderer_class->query_data = gutter_renderer_query_data;
renderer_class->query_activatable = gutter_renderer_query_activatable;
renderer_class->activate = gutter_renderer_activate;
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 381a381..94f4356 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -2556,18 +2556,14 @@ gtk_source_view_set_show_line_numbers (GtkSourceView *view,
"yalign", 0.5,
"xalign", 1.0,
"xpad", 3,
- "visible", show,
NULL);
gtk_source_gutter_insert (gutter,
view->priv->line_renderer,
GTK_SOURCE_VIEW_GUTTER_POSITION_LINES);
}
- else
- {
- gtk_source_gutter_renderer_set_visible (view->priv->line_renderer, show);
- }
+ gtk_source_gutter_renderer_set_visible (view->priv->line_renderer, show);
view->priv->show_line_numbers = show;
g_object_notify (G_OBJECT (view), "show_line_numbers");
@@ -2634,9 +2630,6 @@ gtk_source_view_set_show_line_marks (GtkSourceView *view,
gutter = gtk_source_view_get_gutter (view, GTK_TEXT_WINDOW_LEFT);
view->priv->marks_renderer = gtk_source_gutter_renderer_marks_new ();
- g_object_set (view->priv->marks_renderer,
- "visible", show,
- NULL);
gtk_source_gutter_insert (gutter,
view->priv->marks_renderer,
@@ -2647,11 +2640,8 @@ gtk_source_view_set_show_line_marks (GtkSourceView *view,
G_CALLBACK (gutter_renderer_marks_activate),
view);
}
- else
- {
- gtk_source_gutter_renderer_set_visible (view->priv->marks_renderer, show);
- }
+ gtk_source_gutter_renderer_set_visible (view->priv->marks_renderer, show);
view->priv->show_line_marks = show;
g_object_notify (G_OBJECT (view), "show_line_marks");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]