[Xfce4-commits] [apps/mousepad] 04/05: Make mousepad-private.h the single required include

noreply at xfce.org noreply at xfce.org
Tue Jul 15 02:23:15 CEST 2014


This is an automated email from the git hooks/post-receive script.

mbrush pushed a commit to branch master
in repository apps/mousepad.

commit d87aa702873e5951f9d082d81fa1fb922be8157f
Author: Matthew Brush <mbrush at codebrainz.ca>
Date:   Mon Jul 14 16:50:22 2014 -0700

    Make mousepad-private.h the single required include
    
    To be placed at the top of every source file, providing config.h from
    the build system, some common standard library headers, the core GLib
    and GObject headers, i18n header, and various utility macros used
    in many places in the code.
    
    Also in a few places, remove #ifdef HAVE_FOO_H guards around standard
    library includes since we can pretty much assume they're there, that
    Autotools had provided them, or that the code will fail to compile
    anyway if they're not present (we don't use them to guard out the
    bits of code that use the symbols from those headers).
---
 mousepad/main.c                         |   19 ++++---------------
 mousepad/mousepad-action-group.c        |    7 ++-----
 mousepad/mousepad-application.c         |    4 ----
 mousepad/mousepad-dbus.c                |   18 +++++++-----------
 mousepad/mousepad-dialogs.c             |    4 ----
 mousepad/mousepad-document.c            |   20 ++++++--------------
 mousepad/mousepad-document.h            |    4 ++--
 mousepad/mousepad-encoding-dialog.c     |    9 ---------
 mousepad/mousepad-encoding.c            |   10 ----------
 mousepad/mousepad-file.c                |   25 ++++++++-----------------
 mousepad/mousepad-language-action.c     |    6 +-----
 mousepad/mousepad-prefs-dialog.c        |    4 ----
 mousepad/mousepad-print.c               |    6 ------
 mousepad/mousepad-print.h               |    2 ++
 mousepad/mousepad-private.h             |   14 ++++++++++++++
 mousepad/mousepad-replace-dialog.c      |    8 --------
 mousepad/mousepad-replace-dialog.h      |    2 ++
 mousepad/mousepad-search-bar.c          |    4 ----
 mousepad/mousepad-search-bar.h          |    2 ++
 mousepad/mousepad-settings-store.c      |    5 +----
 mousepad/mousepad-settings.c            |    6 +-----
 mousepad/mousepad-settings.h            |    1 -
 mousepad/mousepad-statusbar.c           |    4 ----
 mousepad/mousepad-style-scheme-action.c |    6 ++----
 mousepad/mousepad-util.c                |    8 --------
 mousepad/mousepad-view.c                |    8 --------
 mousepad/mousepad-window.c              |   25 ++++++++-----------------
 mousepad/mousepad-window.h              |    4 ++--
 28 files changed, 64 insertions(+), 171 deletions(-)

diff --git a/mousepad/main.c b/mousepad/main.c
index 4ad6c1d..da25e7a 100644
--- a/mousepad/main.c
+++ b/mousepad/main.c
@@ -14,27 +14,16 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STDIO_H
-#include <stdio.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_LIBINTL_H
-#include <libintl.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-application.h>
-
 #ifdef HAVE_DBUS
 #include <mousepad/mousepad-dbus.h>
 #endif
 
+#ifdef HAVE_LIBINTL_H
+#include <libintl.h>
+#endif
+
 
 /* globals */
 static gchar    **filenames = NULL;
diff --git a/mousepad/mousepad-action-group.c b/mousepad/mousepad-action-group.c
index 2edef9b..8362ea8 100644
--- a/mousepad/mousepad-action-group.c
+++ b/mousepad/mousepad-action-group.c
@@ -14,15 +14,12 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
+#include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-action-group.h>
 #include <mousepad/mousepad-language-action.h>
 #include <mousepad/mousepad-style-scheme-action.h>
 #include <mousepad/mousepad-settings.h>
-#include <glib/gi18n.h>
+
 #include <gtksourceview/gtksourcelanguagemanager.h>
 #include <gtksourceview/gtksourcestyleschememanager.h>
 
diff --git a/mousepad/mousepad-application.c b/mousepad/mousepad-application.c
index f0f389c..b2e09aa 100644
--- a/mousepad/mousepad-application.c
+++ b/mousepad/mousepad-application.c
@@ -14,10 +14,6 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-settings.h>
 #include <mousepad/mousepad-application.h>
diff --git a/mousepad/mousepad-dbus.c b/mousepad/mousepad-dbus.c
index d1ab443..cb222da 100644
--- a/mousepad/mousepad-dbus.c
+++ b/mousepad/mousepad-dbus.c
@@ -14,17 +14,6 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-dbus.h>
 #include <mousepad/mousepad-application.h>
@@ -33,6 +22,13 @@
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus.h>
 
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 
 
 #define MOUSEPAD_DBUS_PATH      "/org/xfce/Mousepad"
diff --git a/mousepad/mousepad-dialogs.c b/mousepad/mousepad-dialogs.c
index 5ee23f5..1739822 100644
--- a/mousepad/mousepad-dialogs.c
+++ b/mousepad/mousepad-dialogs.c
@@ -14,10 +14,6 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-dialogs.h>
 #include <mousepad/mousepad-util.h>
diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index 62d5989..11974c1 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -14,20 +14,6 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_MEMORY_H
-#include <memory.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_TIME_H
-#include <time.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-settings.h>
 #include <mousepad/mousepad-util.h>
@@ -38,6 +24,12 @@
 
 #include <gtksourceview/gtksourcebuffer.h>
 
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+
+#include <time.h>
+
 
 
 #define MOUSEPAD_DOCUMENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MOUSEPAD_TYPE_DOCUMENT, MousepadDocumentPrivate))
diff --git a/mousepad/mousepad-document.h b/mousepad/mousepad-document.h
index 41a720e..e936f3b 100644
--- a/mousepad/mousepad-document.h
+++ b/mousepad/mousepad-document.h
@@ -17,12 +17,12 @@
 #ifndef __MOUSEPAD_DOCUMENT_H__
 #define __MOUSEPAD_DOCUMENT_H__
 
-G_BEGIN_DECLS
-
 #include <mousepad/mousepad-util.h>
 #include <mousepad/mousepad-file.h>
 #include <mousepad/mousepad-view.h>
 
+G_BEGIN_DECLS
+
 typedef struct _MousepadDocumentPrivate MousepadDocumentPrivate;
 typedef struct _MousepadDocumentClass   MousepadDocumentClass;
 typedef struct _MousepadDocument        MousepadDocument;
diff --git a/mousepad/mousepad-encoding-dialog.c b/mousepad/mousepad-encoding-dialog.c
index 922b284..7441e8a 100644
--- a/mousepad/mousepad-encoding-dialog.c
+++ b/mousepad/mousepad-encoding-dialog.c
@@ -14,21 +14,12 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-document.h>
 #include <mousepad/mousepad-encoding.h>
 #include <mousepad/mousepad-encoding-dialog.h>
 #include <mousepad/mousepad-util.h>
 
-#include <glib.h>
 #include <glib/gstdio.h>
 #include <gtksourceview/gtksourceview.h>
 
diff --git a/mousepad/mousepad-encoding.c b/mousepad/mousepad-encoding.c
index 1968769..2627e9d 100644
--- a/mousepad/mousepad-encoding.c
+++ b/mousepad/mousepad-encoding.c
@@ -14,19 +14,9 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-encoding.h>
 
-#include <glib.h>
-
 
 
 const MousepadEncodingInfo encoding_infos[] =
diff --git a/mousepad/mousepad-file.c b/mousepad/mousepad-file.c
index 596e3b4..d48ee61 100644
--- a/mousepad/mousepad-file.c
+++ b/mousepad/mousepad-file.c
@@ -14,9 +14,13 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include <mousepad/mousepad-private.h>
+#include <mousepad/mousepad-file.h>
+
+#include <glib/gstdio.h>
+#include <gtksourceview/gtksourcebuffer.h>
+#include <gtksourceview/gtksourcelanguage.h>
+#include <gtksourceview/gtksourcelanguagemanager.h>
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -30,21 +34,8 @@
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-
-#include <mousepad/mousepad-private.h>
-#include <mousepad/mousepad-file.h>
-
-#include <glib/gstdio.h>
-#include <gtksourceview/gtksourcebuffer.h>
-#include <gtksourceview/gtksourcelanguage.h>
-#include <gtksourceview/gtksourcelanguagemanager.h>
 
+#include <errno.h>
 
 
 enum
diff --git a/mousepad/mousepad-language-action.c b/mousepad/mousepad-language-action.c
index 46bac0e..a97840d 100644
--- a/mousepad/mousepad-language-action.c
+++ b/mousepad/mousepad-language-action.c
@@ -14,13 +14,9 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
+#include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-language-action.h>
 #include <mousepad/mousepad-util.h>
-#include <glib/gi18n.h>
 
 
 
diff --git a/mousepad/mousepad-prefs-dialog.c b/mousepad/mousepad-prefs-dialog.c
index dc1eda8..6a9aad4 100644
--- a/mousepad/mousepad-prefs-dialog.c
+++ b/mousepad/mousepad-prefs-dialog.c
@@ -14,10 +14,6 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-prefs-dialog.h>
 #include <mousepad/mousepad-prefs-dialog-ui.h>
diff --git a/mousepad/mousepad-print.c b/mousepad/mousepad-print.c
index cb3581b..acdcd67 100644
--- a/mousepad/mousepad-print.c
+++ b/mousepad/mousepad-print.c
@@ -14,17 +14,11 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-document.h>
 #include <mousepad/mousepad-util.h>
 #include <mousepad/mousepad-print.h>
 
-#include <pango/pango.h>
-#include <cairo.h>
 #include <gtksourceview/gtksourceprintcompositor.h>
 
 #define DOCUMENT_SPACING (10)
diff --git a/mousepad/mousepad-print.h b/mousepad/mousepad-print.h
index 3806d7b..8535a90 100644
--- a/mousepad/mousepad-print.h
+++ b/mousepad/mousepad-print.h
@@ -17,6 +17,8 @@
 #ifndef __MOUSEPAD_PRINT_H__
 #define __MOUSEPAD_PRINT_H__
 
+#include <gtk/gtk.h>
+
 G_BEGIN_DECLS
 
 typedef struct _MousepadPrintClass MousepadPrintClass;
diff --git a/mousepad/mousepad-private.h b/mousepad/mousepad-private.h
index 4bf90a9..5be9432 100644
--- a/mousepad/mousepad-private.h
+++ b/mousepad/mousepad-private.h
@@ -14,9 +14,23 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+/* Include this file at the top of every source file. Never include it in
+ * any other headers. */
+
 #ifndef __MOUSEPAD_PRIVATE_H__
 #define __MOUSEPAD_PRIVATE_H__
 
+/* Our configuration header from the build system */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+/* Some really common stdlib headers */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+/* In non-debug mode, turn off g_return_*()/g_assert*() debugging checks. */
 #ifdef NDEBUG
 # define G_DISABLE_CHECKS
 # define G_DISABLE_ASSERT
diff --git a/mousepad/mousepad-replace-dialog.c b/mousepad/mousepad-replace-dialog.c
index df4b655..b5edfe8 100644
--- a/mousepad/mousepad-replace-dialog.c
+++ b/mousepad/mousepad-replace-dialog.c
@@ -14,14 +14,6 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-settings.h>
 #include <mousepad/mousepad-document.h>
diff --git a/mousepad/mousepad-replace-dialog.h b/mousepad/mousepad-replace-dialog.h
index 15db2ce..8d92f67 100644
--- a/mousepad/mousepad-replace-dialog.h
+++ b/mousepad/mousepad-replace-dialog.h
@@ -17,6 +17,8 @@
 #ifndef __MOUSEPAD_REPLACE_DIALOG_H__
 #define __MOUSEPAD_REPLACE_DIALOG_H__
 
+#include <gtk/gtk.h>
+
 G_BEGIN_DECLS
 
 #define MOUSEPAD_TYPE_REPLACE_DIALOG            (mousepad_replace_dialog_get_type ())
diff --git a/mousepad/mousepad-search-bar.c b/mousepad/mousepad-search-bar.c
index 2f883b0..539495d 100644
--- a/mousepad/mousepad-search-bar.c
+++ b/mousepad/mousepad-search-bar.c
@@ -14,10 +14,6 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-settings.h>
 #include <mousepad/mousepad-marshal.h>
diff --git a/mousepad/mousepad-search-bar.h b/mousepad/mousepad-search-bar.h
index d2ea0e3..62b8a3c 100644
--- a/mousepad/mousepad-search-bar.h
+++ b/mousepad/mousepad-search-bar.h
@@ -17,6 +17,8 @@
 #ifndef __MOUSEPAD_SEARCH_BAR_H__
 #define __MOUSEPAD_SEARCH_BAR_H__
 
+#include <gtk/gtk.h>
+
 G_BEGIN_DECLS
 
 #define MOUSEPAD_TYPE_SEARCH_BAR            (mousepad_search_bar_get_type ())
diff --git a/mousepad/mousepad-settings-store.c b/mousepad/mousepad-settings-store.c
index 35a6fc2..8e7c3a4 100644
--- a/mousepad/mousepad-settings-store.c
+++ b/mousepad/mousepad-settings-store.c
@@ -14,10 +14,7 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
+#include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-settings-store.h>
 
 
diff --git a/mousepad/mousepad-settings.c b/mousepad/mousepad-settings.c
index a750161..13cead5 100644
--- a/mousepad/mousepad-settings.c
+++ b/mousepad/mousepad-settings.c
@@ -14,14 +14,10 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-settings.h>
 #include <mousepad/mousepad-settings-store.h>
-#include <stdlib.h>
+
 #include <ctype.h>
 
 
diff --git a/mousepad/mousepad-settings.h b/mousepad/mousepad-settings.h
index d09ecb7..4993045 100644
--- a/mousepad/mousepad-settings.h
+++ b/mousepad/mousepad-settings.h
@@ -17,7 +17,6 @@
 #ifndef __MOUSEPAD_SETTINGS_H__
 #define __MOUSEPAD_SETTINGS_H__ 1
 
-#include <glib-object.h>
 #include <gio/gio.h>
 
 G_BEGIN_DECLS
diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index cdc6ca6..027770d 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -14,10 +14,6 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-statusbar.h>
 #include <mousepad/mousepad-window.h>
diff --git a/mousepad/mousepad-style-scheme-action.c b/mousepad/mousepad-style-scheme-action.c
index 074fdc6..2d8793e 100644
--- a/mousepad/mousepad-style-scheme-action.c
+++ b/mousepad/mousepad-style-scheme-action.c
@@ -14,11 +14,9 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
+#include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-style-scheme-action.h>
+
 #include <glib/gi18n.h>
 #include <gtksourceview/gtksourcestyleschememanager.h>
 
diff --git a/mousepad/mousepad-util.c b/mousepad/mousepad-util.c
index 3ea42f9..bc85ba7 100644
--- a/mousepad/mousepad-util.c
+++ b/mousepad/mousepad-util.c
@@ -14,14 +14,6 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-util.h>
 
diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index 3ba671a..60bf1d5 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -14,14 +14,6 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-settings.h>
 #include <mousepad/mousepad-util.h>
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 0b3bd8a..08d58de 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -14,23 +14,6 @@
  * Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
 #include <mousepad/mousepad-private.h>
 #include <mousepad/mousepad-settings.h>
 #include <mousepad/mousepad-action-group.h>
@@ -51,6 +34,14 @@
 #include <gtksourceview/gtksourcelanguagemanager.h>
 #include <gtksourceview/gtksourcebuffer.h>
 
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 
 
 #define PADDING                   (2)
diff --git a/mousepad/mousepad-window.h b/mousepad/mousepad-window.h
index 4bd85e9..9cef2ec 100644
--- a/mousepad/mousepad-window.h
+++ b/mousepad/mousepad-window.h
@@ -17,10 +17,10 @@
 #ifndef __MOUSEPAD_WINDOW_H__
 #define __MOUSEPAD_WINDOW_H__
 
-G_BEGIN_DECLS
-
 #include <mousepad/mousepad-document.h>
 
+G_BEGIN_DECLS
+
 #define MOUSEPAD_TYPE_WINDOW            (mousepad_window_get_type ())
 #define MOUSEPAD_WINDOW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOUSEPAD_TYPE_WINDOW, MousepadWindow))
 #define MOUSEPAD_WINDOW_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MOUSEPAD_TYPE_WINDOW, MousepadWindowClass))

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list