[gnome-logs/wip/monospace: 5/13] Move CSS parsing-error handler to separate file



commit 643c9f4165f7c97fc24d2d9ad3ac22f77963a27b
Author: David King <davidk gnome org>
Date:   Thu Oct 10 10:14:11 2013 +0100

    Move CSS parsing-error handler to separate file

 Makefile.am     |    2 ++
 src/gl-util.c   |   33 +++++++++++++++++++++++++++++++++
 src/gl-util.h   |   34 ++++++++++++++++++++++++++++++++++
 src/gl-window.c |   16 +++-------------
 4 files changed, 72 insertions(+), 13 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 5a9bcdd..01204b2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,6 +26,7 @@ gnome_logs_SOURCES = \
        src/gl-eventview.c \
        src/gl-journal.c \
        src/gl-main.c \
+       src/gl-util.c \
        src/gl-window.c
 
 nodist_gnome_logs_SOURCES = \
@@ -46,6 +47,7 @@ noinst_gnome_logs_headers = \
        src/gl-eventtoolbar.h \
        src/gl-eventview.h \
        src/gl-journal.h \
+       src/gl-util.h \
        src/gl-window.h
 
 nodist_gnome_logs_headers = \
diff --git a/src/gl-util.c b/src/gl-util.c
new file mode 100644
index 0000000..2ee98fc
--- /dev/null
+++ b/src/gl-util.c
@@ -0,0 +1,33 @@
+/*
+ *  GNOME Logs - View and search logs
+ *  Copyright (C) 2013  Red Hat, Inc.
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gl-util.h"
+
+void
+gl_util_on_css_provider_parsing_error (GtkCssProvider *provider,
+                                       GtkCssSection *section,
+                                       GError *error,
+                                       G_GNUC_UNUSED gpointer user_data)
+{
+    g_critical ("Error while parsing CSS style (line: %u, character: %u): %s",
+                gtk_css_section_get_end_line (section) + 1,
+                gtk_css_section_get_end_position (section) + 1,
+                error->message);
+}
+
+
diff --git a/src/gl-util.h b/src/gl-util.h
new file mode 100644
index 0000000..bc6eaba
--- /dev/null
+++ b/src/gl-util.h
@@ -0,0 +1,34 @@
+/*
+ *  GNOME Logs - View and search logs
+ *  Copyright (C) 2013  Red Hat, Inc.
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GL_UTIL_H_
+#define GL_UTIL_H_
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+void gl_util_on_css_provider_parsing_error (GtkCssProvider *provider,
+                                            GtkCssSection *section,
+                                            GError *error,
+                                            G_GNUC_UNUSED gpointer user_data);
+
+
+G_END_DECLS
+
+#endif /* GL_UTIL_H_ */
diff --git a/src/gl-window.c b/src/gl-window.c
index cee2813..f7378f1 100644
--- a/src/gl-window.c
+++ b/src/gl-window.c
@@ -24,6 +24,7 @@
 #include "gl-eventtoolbar.h"
 #include "gl-eventview.h"
 #include "gl-enums.h"
+#include "gl-util.h"
 
 typedef struct
 {
@@ -239,18 +240,6 @@ on_gl_window_search_bar_notify_search_mode_enabled (GtkSearchBar *search_bar,
                            g_variant_new_boolean (gtk_search_bar_get_search_mode (search_bar)));
 }
 
-static void
-on_provider_parsing_error (GtkCssProvider *provider,
-                           GtkCssSection *section,
-                           GError *error,
-                           gpointer user_data)
-{
-    g_critical ("Error while parsing CSS style (line: %u, character: %u): %s",
-                gtk_css_section_get_end_line (section) + 1,
-                gtk_css_section_get_end_position (section) + 1,
-                error->message);
-}
-
 static GActionEntry actions[] = {
     { "category", on_action_radio, "s", "'important'", on_category },
     { "view-mode", on_action_radio, "s", "'list'", on_view_mode },
@@ -299,7 +288,8 @@ gl_window_init (GlWindow *window)
     file = g_file_new_for_uri ("resource:///org/gnome/Logs/gl-style.css");
     provider = gtk_css_provider_new ();
     g_signal_connect (provider, "parsing-error",
-                      G_CALLBACK (on_provider_parsing_error), NULL);
+                      G_CALLBACK (gl_util_on_css_provider_parsing_error),
+                      NULL);
     gtk_css_provider_load_from_file (provider, file, &err);
 
     if (err != NULL)


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