[gnome-autoar] Make all internal functions private



commit 28066be1fb73d647508a192b6da858832522ad88
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Sun May 11 03:07:06 2014 +0800

    Make all internal functions private
    
    All internal functions in autoar-common is moved to autoar-private, and
    their documentation are not generated now. Public functions and data types
    in autoar-common are moved to autoar-misc.

 Makefile.am                                        |    9 +++-
 docs/reference/Makefile.am                         |    6 +++
 docs/reference/gnome-autoar-docs.xml               |    2 +-
 gnome-autoar/autoar-create.c                       |    5 +-
 gnome-autoar/autoar-extract.c                      |    4 +-
 gnome-autoar/autoar-misc.c                         |   48 ++++++++++++++++++++
 gnome-autoar/autoar-misc.h                         |   47 +++++++++++++++++++
 gnome-autoar/{autoar-common.c => autoar-private.c} |   35 ++++++---------
 gnome-autoar/{autoar-common.h => autoar-private.h} |   24 +++-------
 gnome-autoar/autoar.h                              |    2 +-
 10 files changed, 136 insertions(+), 46 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 73d105a..2970c80 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,19 +22,23 @@ EXTRA_DIST += \
        $(NULL)
 
 libgnome_autoar_la_headers = \
-       gnome-autoar/autoar-common.h            \
        gnome-autoar/autoar-create.h            \
        gnome-autoar/autoar-extract.h           \
        gnome-autoar/autoar-format-filter.h     \
+       gnome-autoar/autoar-misc.h              \
        gnome-autoar/autoar-pref.h              \
        $(NULL)
 libgnome_autoar_la_sources = \
-       gnome-autoar/autoar-common.c            \
        gnome-autoar/autoar-create.c            \
        gnome-autoar/autoar-extract.c           \
        gnome-autoar/autoar-format-filter.c     \
+       gnome-autoar/autoar-misc.c              \
        gnome-autoar/autoar-pref.c              \
        $(NULL)
+libgnome_autoar_la_private_files = \
+       gnome-autoar/autoar-private.h           \
+       gnome-autoar/autoar-private.c           \
+       $(NULL)
 libgnome_autoar_la_generated_files = \
        gnome-autoar/autoar-enum-types.h        \
        gnome-autoar/autoar-enum-types.c        \
@@ -63,6 +67,7 @@ autoarinclude_HEADERS = \
 
 gnome_autoar_libgnome_autoar_la_SOURCES = \
        $(libgnome_autoar_la_generated_files)   \
+       $(libgnome_autoar_la_private_files)     \
        $(libgnome_autoar_la_headers)           \
        $(libgnome_autoar_la_sources)           \
        $(NULL)
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index f2e4903..8667e5d 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -17,6 +17,12 @@ IGNORE_HFILES = \
        autoar.h \
        autoar-gtk.h \
        autoar-enum-types.h \
+       autoar-private.h \
+       $(NULL)
+
+IGNORE_CFILES = \
+       autoar-enum-types.c \
+       autoar-private.c \
        $(NULL)
 
 GTKDOC_CFLAGS = \
diff --git a/docs/reference/gnome-autoar-docs.xml b/docs/reference/gnome-autoar-docs.xml
index ead4aa4..ec38f72 100644
--- a/docs/reference/gnome-autoar-docs.xml
+++ b/docs/reference/gnome-autoar-docs.xml
@@ -23,7 +23,7 @@
   <chapter>
     <title>gnome-autoar Utilities</title>
     <xi:include href="xml/autoar-format-filter.xml"/>
-    <xi:include href="xml/autoar-common.xml"/>
+    <xi:include href="xml/autoar-misc.xml"/>
   </chapter>
   <chapter>
     <title>gnome-autoar GTK+ Widgets</title>
diff --git a/gnome-autoar/autoar-create.c b/gnome-autoar/autoar-create.c
index 68ca0cf..b76678b 100644
--- a/gnome-autoar/autoar-create.c
+++ b/gnome-autoar/autoar-create.c
@@ -24,9 +24,10 @@
  */
 
 #include "config.h"
-
 #include "autoar-create.h"
-#include "autoar-common.h"
+
+#include "autoar-misc.h"
+#include "autoar-private.h"
 #include "autoar-pref.h"
 
 #include <archive.h>
diff --git a/gnome-autoar/autoar-extract.c b/gnome-autoar/autoar-extract.c
index 384f506..bfdfd9d 100644
--- a/gnome-autoar/autoar-extract.c
+++ b/gnome-autoar/autoar-extract.c
@@ -24,10 +24,10 @@
  */
 
 #include "config.h"
-
 #include "autoar-extract.h"
 
-#include "autoar-common.h"
+#include "autoar-misc.h"
+#include "autoar-private.h"
 #include "autoar-pref.h"
 
 #include <archive.h>
diff --git a/gnome-autoar/autoar-misc.c b/gnome-autoar/autoar-misc.c
new file mode 100644
index 0000000..0467fa9
--- /dev/null
+++ b/gnome-autoar/autoar-misc.c
@@ -0,0 +1,48 @@
+/* vim: set sw=2 ts=2 sts=2 et: */
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * autoar-misc.c
+ * Miscellaneous functions and shared data types used by gnome-autoar
+ *
+ * Copyright (C) 2014  Ting-Wei Lan
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "autoar-misc.h"
+
+#include <glib.h>
+
+/**
+ * SECTION:autoar-misc
+ * @Short_description: Miscellaneous functions and shared data types used
+ *  by gnome-autoar
+ * @Title: autoar-misc
+ * @Include: gnome-autoar/autoar.h
+ *
+ * Public utility functions and data types used by gnome-autoar;
+ **/
+
+/**
+ * autoar_libarchive_quark:
+ *
+ * Gets the libarchive Error Quark.
+ *
+ * Returns: a #GQuark.
+ **/
+G_DEFINE_QUARK (libarchive-quark, autoar_libarchive)
diff --git a/gnome-autoar/autoar-misc.h b/gnome-autoar/autoar-misc.h
new file mode 100644
index 0000000..6038452
--- /dev/null
+++ b/gnome-autoar/autoar-misc.h
@@ -0,0 +1,47 @@
+/* vim: set sw=2 ts=2 sts=2 et: */
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * autoar-misc.h
+ * Miscellaneous functions and shared data types used by gnome-autoar
+ *
+ * Copyright (C) 2014  Ting-Wei Lan
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ *
+ */
+
+#ifndef AUTOAR_MISC_H
+#define AUTOAR_MISC_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/**
+ * AUTOAR_LIBARCHIVE_ERROR:
+ *
+ * Error domain for libarchive. Error returned by functions in libarchive uses
+ * this domain. Error code and messages are got using archive_errno() and
+ * archive_error_string() functions provided by libarchive.
+ **/
+
+#define AUTOAR_LIBARCHIVE_ERROR autoar_libarchive_quark()
+
+GQuark    autoar_libarchive_quark                      (void);
+
+G_END_DECLS
+
+#endif /* AUTOAR_COMMON_H */
diff --git a/gnome-autoar/autoar-common.c b/gnome-autoar/autoar-private.c
similarity index 94%
rename from gnome-autoar/autoar-common.c
rename to gnome-autoar/autoar-private.c
index fc4f2fb..d80e5e7 100644
--- a/gnome-autoar/autoar-common.c
+++ b/gnome-autoar/autoar-private.c
@@ -1,11 +1,12 @@
 /* vim: set sw=2 ts=2 sts=2 et: */
 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
- * autoar-common.c
- * Some common functions used in several classes of autoarchive
- * This file does NOT declare any new classes!
+ * autoar-private.c
+ * Some common functions used in several classes of gnome-autoar
+ * This file does NOT declare any new classes and it should NOT
+ * be used outside the library itself!
  *
- * Copyright (C) 2013  Ting-Wei Lan
+ * Copyright (C) 2013, 2014  Ting-Wei Lan
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,8 +26,9 @@
  */
 
 #include "config.h"
+#include "autoar-private.h"
 
-#include "autoar-common.h"
+#include "autoar-misc.h"
 
 #include <glib.h>
 #include <gobject/gvaluecollector.h>
@@ -52,15 +54,6 @@ struct _AutoarCommonSignalData
 };
 
 /**
- * autoar_common_libarchive_quark:
- *
- * Gets the libarchive Error Quark.
- *
- * Returns: a #GQuark.
- **/
-G_DEFINE_QUARK (libarchive-quark, autoar_common_libarchive)
-
-/**
  * autoar_common_get_filename_extension:
  * @filename: a filename
  *
@@ -68,7 +61,7 @@ G_DEFINE_QUARK (libarchive-quark, autoar_common_libarchive)
  *
  * Returns: (transfer none): a pointer to the extension of the filename
  **/
-char*
+G_GNUC_INTERNAL char*
 autoar_common_get_filename_extension (const char *filename)
 {
   char *dot_location;
@@ -95,7 +88,7 @@ autoar_common_get_filename_extension (const char *filename)
  * Returns: (transfer full): a new filename without extension. Free the
  * returned string with g_free().
  **/
-char*
+G_GNUC_INTERNAL char*
 autoar_common_get_basename_remove_extension (const char *filename)
 {
   char *dot_location;
@@ -156,7 +149,7 @@ autoar_common_g_signal_emit_main_context (void *data)
  * wait for the signal emission job to be completed. Hence, the signal
  * may emitted after autoar_common_g_signal_emit() is returned.
  **/
-void
+G_GNUC_INTERNAL void
 autoar_common_g_signal_emit (gpointer instance,
                              gboolean in_thread,
                              guint signal_id,
@@ -220,7 +213,7 @@ autoar_common_g_signal_emit (gpointer instance,
  * This is a wrapper for g_object_unref(). If @object is %NULL, this function
  * does nothing. Otherwise, it will call g_object_unref() on the @object.
  **/
-void
+G_GNUC_INTERNAL void
 autoar_common_g_object_unref (gpointer object)
 {
   if (object != NULL)
@@ -236,7 +229,7 @@ autoar_common_g_object_unref (gpointer object)
  *
  * Returns: (transfer full): a #GError. Free with g_error_free().
  **/
-GError*
+G_GNUC_INTERNAL GError*
 autoar_common_g_error_new_a (struct archive *a,
                              const char *pathname)
 {
@@ -260,7 +253,7 @@ autoar_common_g_error_new_a (struct archive *a,
  *
  * Returns: (transfer full): a #GError. Free with g_error_free().
  **/
-GError*
+G_GNUC_INTERNAL GError*
 autoar_common_g_error_new_a_entry (struct archive *a,
                                    struct archive_entry *entry)
 {
@@ -277,7 +270,7 @@ autoar_common_g_error_new_a_entry (struct archive *a,
  * Returns: (transfer full): a string represents the file. Free the string
  * with g_free().
  **/
-char*
+G_GNUC_INTERNAL char*
 autoar_common_g_file_get_name (GFile *file)
 {
   char *name;
diff --git a/gnome-autoar/autoar-common.h b/gnome-autoar/autoar-private.h
similarity index 78%
rename from gnome-autoar/autoar-common.h
rename to gnome-autoar/autoar-private.h
index 2070c55..0b5e49a 100644
--- a/gnome-autoar/autoar-common.h
+++ b/gnome-autoar/autoar-private.h
@@ -1,11 +1,12 @@
 /* vim: set sw=2 ts=2 sts=2 et: */
 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /*
- * autoar-common.h
- * Some common functions used in several classes of autoarchive
- * This file does NOT declare any new classes!
+ * autoar-private.h
+ * Some common functions used in several classes of gnome-autoar
+ * This file does NOT declare any new classes and it should NOT
+ * be used outside the library itself!
  *
- * Copyright (C) 2013  Ting-Wei Lan
+ * Copyright (C) 2013, 2014  Ting-Wei Lan
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -24,8 +25,8 @@
  *
  */
 
-#ifndef AUTOAR_COMMON_H
-#define AUTOAR_COMMON_H
+#ifndef AUTOAR_PRIVATE_H
+#define AUTOAR_PRIVATE_H
 
 /* archive.h use time_t */
 #include <time.h>
@@ -38,17 +39,6 @@
 
 G_BEGIN_DECLS
 
-/**
- * AUTOAR_LIBARCHIVE_ERROR:
- *
- * Error domain for libarchive. Error returned by functions in libarchive uses
- * this domain. Error code and messages are got using archive_errno() and
- * archive_error_string().
- **/
-#define AUTOAR_LIBARCHIVE_ERROR autoar_common_libarchive_quark()
-
-GQuark    autoar_common_libarchive_quark               (void);
-
 char*     autoar_common_get_basename_remove_extension  (const char *filename);
 char*     autoar_common_get_filename_extension         (const char *filename);
 
diff --git a/gnome-autoar/autoar.h b/gnome-autoar/autoar.h
index 2556546..ce558f9 100644
--- a/gnome-autoar/autoar.h
+++ b/gnome-autoar/autoar.h
@@ -23,10 +23,10 @@
 #ifndef AUTOARCHIVE_H
 #define AUTOARHICVE_H
 
-#include <gnome-autoar/autoar-common.h>
 #include <gnome-autoar/autoar-create.h>
 #include <gnome-autoar/autoar-format-filter.h>
 #include <gnome-autoar/autoar-extract.h>
+#include <gnome-autoar/autoar-misc.h>
 #include <gnome-autoar/autoar-pref.h>
 
 #endif /* AUTOARCHIVE_H */


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