[gtksourceview] Various small code clean-ups



commit 57295dd428f291ce15bfd9046645b252e658742a
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Aug 13 17:36:25 2014 +0200

    Various small code clean-ups

 gtksourceview/gtksourcegutter.c             |    3 +-
 gtksourceview/gtksourcestylescheme.c        |    4 +-
 gtksourceview/gtksourceundomanager.c        |    2 +-
 gtksourceview/gtksourceundomanager.h        |    4 +-
 gtksourceview/gtksourceundomanagerdefault.c |   64 ++++++++++++++-------------
 gtksourceview/gtksourceundomanagerdefault.h |    4 +-
 6 files changed, 40 insertions(+), 41 deletions(-)
---
diff --git a/gtksourceview/gtksourcegutter.c b/gtksourceview/gtksourcegutter.c
index 90ea9d1..1cff5c7 100644
--- a/gtksourceview/gtksourcegutter.c
+++ b/gtksourceview/gtksourcegutter.c
@@ -968,8 +968,6 @@ on_view_draw (GtkSourceView   *view,
 
        gtk_cairo_transform_to_window (cr, GTK_WIDGET (view), window);
 
-       text_view = GTK_TEXT_VIEW (view);
-
        if (!gdk_cairo_get_clip_rectangle (cr, &clip))
        {
                return FALSE;
@@ -977,6 +975,7 @@ on_view_draw (GtkSourceView   *view,
 
        gutter->priv->is_drawing = TRUE;
 
+       text_view = GTK_TEXT_VIEW (view);
        buffer = gtk_text_view_get_buffer (text_view);
 
        y1 = clip.y;
diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c
index 55a8725..357f0ad 100644
--- a/gtksourceview/gtksourcestylescheme.c
+++ b/gtksourceview/gtksourcestylescheme.c
@@ -792,7 +792,7 @@ get_css_color_style (GtkSourceStyle *style,
        {
                gchar *bg_color;
                bg_color = gdk_rgba_to_string (&color);
-               *bg = g_strdup_printf ("%s: %s;\n", "background-color", bg_color);
+               *bg = g_strdup_printf ("background-color: %s;\n", bg_color);
                g_free (bg_color);
        }
        else
@@ -804,7 +804,7 @@ get_css_color_style (GtkSourceStyle *style,
        {
                gchar *text_color;
                text_color = gdk_rgba_to_string (&color);
-               *text = g_strdup_printf ("%s: %s;\n", "color", text_color);
+               *text = g_strdup_printf ("color: %s;\n", text_color);
                g_free (text_color);
        }
        else
diff --git a/gtksourceview/gtksourceundomanager.c b/gtksourceview/gtksourceundomanager.c
index 4a9d965..140fe00 100644
--- a/gtksourceview/gtksourceundomanager.c
+++ b/gtksourceview/gtksourceundomanager.c
@@ -16,7 +16,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
-
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
diff --git a/gtksourceview/gtksourceundomanager.h b/gtksourceview/gtksourceundomanager.h
index 490499c..a782799 100644
--- a/gtksourceview/gtksourceundomanager.h
+++ b/gtksourceview/gtksourceundomanager.h
@@ -16,7 +16,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
-
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
@@ -73,5 +73,3 @@ void      gtk_source_undo_manager_can_redo_changed          (GtkSourceUndoManage
 G_END_DECLS
 
 #endif /* __GTK_SOURCE_UNDO_MANAGER_H__ */
-
-
diff --git a/gtksourceview/gtksourceundomanagerdefault.c b/gtksourceview/gtksourceundomanagerdefault.c
index adc0aa4..2163f3a 100644
--- a/gtksourceview/gtksourceundomanagerdefault.c
+++ b/gtksourceview/gtksourceundomanagerdefault.c
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * gtksourceundomanager.c
+ * gtksourceundomanagerdefault.c
  * This file is part of GtkSourceView
  *
  * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
@@ -16,7 +16,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
-
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
@@ -26,11 +26,12 @@
 #include <config.h>
 #endif
 
+#include "gtksourceundomanagerdefault.h"
+
 #include <glib.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "gtksourceundomanagerdefault.h"
 #include "gtksourceundomanager.h"
 #include "gtksourceview-i18n.h"
 
@@ -107,6 +108,13 @@ struct _GtkSourceUndoAction
 
 enum
 {
+       PROP_0,
+       PROP_BUFFER,
+       PROP_MAX_UNDO_LEVELS
+};
+
+enum
+{
        INSERT_TEXT,
        DELETE_RANGE,
        BEGIN_USER_ACTION,
@@ -141,41 +149,35 @@ struct _GtkSourceUndoManagerDefaultPrivate
        guint buffer_signals[NUM_SIGNALS];
 };
 
-/* Properties */
-enum
-{
-       PROP_0,
-       PROP_BUFFER,
-       PROP_MAX_UNDO_LEVELS
-};
+static void insert_text_handler       (GtkTextBuffer               *buffer,
+                                       GtkTextIter                 *pos,
+                                       const gchar                 *text,
+                                       gint                         length,
+                                       GtkSourceUndoManagerDefault *um);
+
+static void delete_range_handler      (GtkTextBuffer               *buffer,
+                                       GtkTextIter                 *start,
+                                       GtkTextIter                 *end,
+                                       GtkSourceUndoManagerDefault *um);
 
-static void insert_text_handler       (GtkTextBuffer             *buffer,
-                                       GtkTextIter               *pos,
-                                       const gchar               *text,
-                                       gint                       length,
-                                       GtkSourceUndoManagerDefault      *um);
+static void begin_user_action_handler (GtkTextBuffer               *buffer,
+                                       GtkSourceUndoManagerDefault *um);
 
-static void delete_range_handler      (GtkTextBuffer             *buffer,
-                                       GtkTextIter               *start,
-                                       GtkTextIter               *end,
-                                       GtkSourceUndoManagerDefault      *um);
+static void modified_changed_handler  (GtkTextBuffer               *buffer,
+                                       GtkSourceUndoManagerDefault *um);
 
-static void begin_user_action_handler (GtkTextBuffer             *buffer,
-                                       GtkSourceUndoManagerDefault      *um);
+static void free_action_list          (GtkSourceUndoManagerDefault *um);
 
-static void modified_changed_handler  (GtkTextBuffer             *buffer,
-                                       GtkSourceUndoManagerDefault      *um);
+static void add_action                (GtkSourceUndoManagerDefault *um,
+                                       const GtkSourceUndoAction   *undo_action);
 
-static void free_action_list          (GtkSourceUndoManagerDefault      *um);
+static void free_first_n_actions      (GtkSourceUndoManagerDefault *um,
+                                       gint                         n);
 
-static void add_action                (GtkSourceUndoManagerDefault      *um,
-                                       const GtkSourceUndoAction *undo_action);
-static void free_first_n_actions      (GtkSourceUndoManagerDefault      *um,
-                                       gint                       n);
-static void check_list_size           (GtkSourceUndoManagerDefault      *um);
+static void check_list_size           (GtkSourceUndoManagerDefault *um);
 
-static gboolean merge_action          (GtkSourceUndoManagerDefault      *um,
-                                       const GtkSourceUndoAction *undo_action);
+static gboolean merge_action          (GtkSourceUndoManagerDefault *um,
+                                       const GtkSourceUndoAction   *undo_action);
 
 static void gtk_source_undo_manager_iface_init (GtkSourceUndoManagerIface *iface);
 
diff --git a/gtksourceview/gtksourceundomanagerdefault.h b/gtksourceview/gtksourceundomanagerdefault.h
index 66a6cf6..9477d6e 100644
--- a/gtksourceview/gtksourceundomanagerdefault.h
+++ b/gtksourceview/gtksourceundomanagerdefault.h
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
- * gtksourceundomanager_defaultdefault.h
+ * gtksourceundomanagerdefault.h
  * This file is part of GtkSourceView
  *
  * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
@@ -16,7 +16,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
-
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]