[gtksourceview/wip/gutter: 1/3] GutterRenderer: minor clean-up
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/gutter: 1/3] GutterRenderer: minor clean-up
- Date: Tue, 3 Sep 2013 21:27:10 +0000 (UTC)
commit 5aa105306fd5fb6ad1357c36840f9399488fe75c
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Sep 3 15:05:42 2013 +0200
GutterRenderer: minor clean-up
gtksourceview/gtksourcegutter.c | 8 ----
gtksourceview/gtksourcegutterrenderer.c | 47 +++++--------------------
gtksourceview/gtksourcegutterrendererlines.c | 9 -----
3 files changed, 10 insertions(+), 54 deletions(-)
---
diff --git a/gtksourceview/gtksourcegutter.c b/gtksourceview/gtksourcegutter.c
index 6585b83..b3bab2e 100644
--- a/gtksourceview/gtksourcegutter.c
+++ b/gtksourceview/gtksourcegutter.c
@@ -245,12 +245,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 +525,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 +667,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]