pidgin/pidgin

create a global header for finch

2020-08-13, Gary Kramlich
2ebcb8eb5c01
Parents 77d7bc9e5151
Children 6748a5ec6644
create a global header for finch

create a global include file for finch

protect all the finch header files and update the plugins to use the global header

Reviewed at https://reviews.imfreedom.org/r/61/
--- a/finch/finch.h Thu Aug 13 21:07:35 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * finch
- *
- * Finch is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * 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 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#ifndef FINCH_H
-#define FINCH_H
-
-/**
- * SECTION:finch
- * @section_id: finch-finch
- * @short_description: <filename>finch.h</filename>
- * @title: UI Definitions and Includes
- */
-
-#include <glib.h>
-
-#define FINCH_UI "gnt-purple"
-
-#define FINCH_PREFS_ROOT "/finch"
-
-/**
- * finch_start:
- * @argc: Address of the argc parameter of your main() function (or 0 if argv
- * is %NULL). This will be changed if any arguments were handled.
- * @argv: Address of the argv parameter of main(), or %NULL. Any options
- * understood by Finch are stripped before return.
- *
- * Start finch with the given command line arguments.
- */
-gboolean finch_start(int *argc, char ***argv);
-
-#endif /* FINCH_H */
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/finch/finch.h.in Thu Aug 13 21:10:22 2020 -0500
@@ -0,0 +1,33 @@
+/*
+ * finch
+ *
+ * Finch is the legal property of its developers, whose names are too numerous
+ * to list here. Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * 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 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 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 FINCH_H
+#define FINCH_H
+
+#ifndef FINCH_GLOBAL_HEADER_INSIDE
+#define FINCH_GLOBAL_HEADER_INSIDE
+#endif
+
+@FINCH_H_INCLUDES@
+
+#undef FINCH_GLOBAL_HEADER_INSIDE
+
+#endif /* FINCH_H */
--- a/finch/gntaccount.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntaccount.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_ACCOUNT_H
#define FINCH_ACCOUNT_H
--- a/finch/gntblist.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntblist.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_BLIST_H
#define FINCH_BLIST_H
--- a/finch/gntconn.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntconn.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_CONN_H
#define FINCH_CONN_H
--- a/finch/gntconv.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntconv.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_CONV_H
#define FINCH_CONV_H
--- a/finch/gntdebug.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntdebug.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_DEBUG_H
#define FINCH_DEBUG_H
--- a/finch/gntidle.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntidle.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_IDLE_H
#define FINCH_IDLE_H
--- a/finch/gntlog.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntlog.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_LOG_H
#define FINCH_LOG_H
--- a/finch/gntmedia.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntmedia.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_MEDIA_H
#define FINCH_MEDIA_H
--- a/finch/gntmenuutil.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntmenuutil.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_MENUUTIL_H
#define FINCH_MENUUTIL_H
--- a/finch/gntnotify.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntnotify.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_NOTIFY_H
#define FINCH_NOTIFY_H
--- a/finch/gntplugin.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntplugin.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_PLUGIN_H
#define FINCH_PLUGIN_H
--- a/finch/gntpounce.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntpounce.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_POUNCE_H
#define FINCH_POUNCE_H
--- a/finch/gntprefs.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntprefs.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_PREFS_H
#define FINCH_PREFS_H
--- a/finch/gntrequest.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntrequest.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_REQUEST_H
#define FINCH_REQUEST_H
--- a/finch/gntroomlist.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntroomlist.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_ROOMLIST_H
#define FINCH_ROOMLIST_H
--- a/finch/gntsound.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntsound.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_SOUND_H
#define FINCH_SOUND_H
--- a/finch/gntstatus.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntstatus.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_STATUS_H
#define FINCH_STATUS_H
--- a/finch/gntui.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntui.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_UI_H
#define FINCH_UI_H
--- a/finch/gntxfer.h Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/gntxfer.h Thu Aug 13 21:10:22 2020 -0500
@@ -20,6 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
#ifndef FINCH_XFER_H
#define FINCH_XFER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/finch/libfinch.h Thu Aug 13 21:10:22 2020 -0500
@@ -0,0 +1,57 @@
+/*
+ * finch
+ *
+ * Finch is the legal property of its developers, whose names are too numerous
+ * to list here. Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * 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 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 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/>.
+ */
+
+#if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION)
+# error "only <finch.h> may be included directly"
+#endif
+
+#ifndef LIBFINCH_H
+#define LIBFINCH_H
+
+#include <glib.h>
+
+#define FINCH_UI "gnt-purple"
+
+#define FINCH_PREFS_ROOT "/finch"
+
+/**
+ * SECTION:finch
+ * @section_id: finch-finch
+ * @short_description: <filename>libfinch.h</filename>
+ * @title: UI Definitions and Includes
+ */
+
+G_BEGIN_DECLS
+
+/**
+ * finch_start:
+ * @argc: Address of the argc parameter of your main() function (or 0 if argv
+ * is %NULL). This will be changed if any arguments were handled.
+ * @argv: Address of the argv parameter of main(), or %NULL. Any options
+ * understood by Finch are stripped before return.
+ *
+ * Start finch with the given command line arguments.
+ */
+gboolean finch_start(int *argc, char ***argv);
+
+G_END_DECLS
+
+#endif /* LIBFINCH_H */
--- a/finch/meson.build Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/meson.build Thu Aug 13 21:10:22 2020 -0500
@@ -128,7 +128,6 @@
'gntconn.h',
'gntconv.h',
'gntdebug.h',
- 'finch.h',
'gntidle.h',
'gntlog.h',
'gntmedia.h',
@@ -142,7 +141,8 @@
'gntsound.h',
'gntstatus.h',
'gntui.h',
- 'gntxfer.h'
+ 'gntxfer.h',
+ 'libfinch.h'
]
finch_SOURCES = [
@@ -167,12 +167,26 @@
endif
if enable_consoleui
+ FINCH_H_INCLUDES = []
+ foreach header : libfinch_headers
+ FINCH_H_INCLUDES += '#include <finch/@0@>'.format(header)
+ endforeach
+ finch_h_conf = configuration_data()
+ finch_h_conf.set('FINCH_H_INCLUDES', '\n'.join(FINCH_H_INCLUDES))
+
+ finch_h = configure_file(input : 'finch.h.in',
+ output : 'finch.h',
+ configuration : finch_h_conf,
+ install : true,
+ install_dir : join_paths(get_option('includedir'),
+ 'finch-3'))
+
install_headers(libfinch_headers, subdir : 'finch-3')
libfinch_inc = include_directories('.')
libfinch = shared_library('finch3',
libfinch_SOURCES,
- c_args : ['-DSTANDALONE', '-DGNTSEAL_ENABLE', ncurses_header],
+ c_args : ['-DSTANDALONE', '-DGNTSEAL_ENABLE', '-DFINCH_COMPILATION', ncurses_header],
include_directories : [toplevel_inc],
version : PURPLE_LIB_VERSION,
dependencies : [libpurple_dep, libgnt_dep, ncurses, glib, winmm],
@@ -214,7 +228,7 @@
gplugin_include_directories,
],
install : true,
- extra_args : ['--quiet'])
+ extra_args : ['-DFINCH_COMPILATION', '--quiet'])
endif
subdir('plugins')
--- a/finch/plugins/gntclipboard.c Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/plugins/gntclipboard.c Thu Aug 13 21:10:22 2020 -0500
@@ -39,7 +39,7 @@
#include <gnt.h>
#include <gntwm.h>
-#include <gntplugin.h>
+#include <finch.h>
#ifdef HAVE_X11
static pid_t child = 0;
--- a/finch/plugins/gntgf.c Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/plugins/gntgf.c Thu Aug 13 21:10:22 2020 -0500
@@ -50,8 +50,7 @@
#include <gntlabel.h>
#include <gnttree.h>
-#include "gntplugin.h"
-#include "gntconv.h"
+#include <finch.h>
typedef struct
{
--- a/finch/plugins/gnthistory.c Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/plugins/gnthistory.c Thu Aug 13 21:10:22 2020 -0500
@@ -22,9 +22,7 @@
#include <purple.h>
-#include "gntconv.h"
-#include "gntplugin.h"
-#include "gntrequest.h"
+#include <finch.h>
#define HISTORY_PLUGIN_ID "gnt-history"
--- a/finch/plugins/gnttinyurl.c Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/plugins/gnttinyurl.c Thu Aug 13 21:10:22 2020 -0500
@@ -30,14 +30,13 @@
#include <glib.h>
-#include <gntconv.h>
-
-#include <gntplugin.h>
-
#include <gntlabel.h>
#include <gnttextview.h>
#include <gntwindow.h>
+#include <finch.h>
+
+
static int tag_num = 0;
static SoupSession *session = NULL;
static GHashTable *tinyurl_cache = NULL;
--- a/finch/plugins/grouping.c Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/plugins/grouping.c Thu Aug 13 21:10:22 2020 -0500
@@ -20,10 +20,10 @@
#include <purple.h>
-#include "gntblist.h"
-#include "gntplugin.h"
+#include "gnttree.h"
-#include "gnttree.h"
+#include <finch.h>
+
#define FINCH_TYPE_GROUPING_NODE (finch_grouping_node_get_type())
#define FINCH_GROUPING_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), FINCH_TYPE_GROUPING_NODE, FinchGroupingNode))
--- a/finch/plugins/lastlog.c Thu Aug 13 21:07:35 2020 -0500
+++ b/finch/plugins/lastlog.c Thu Aug 13 21:10:22 2020 -0500
@@ -26,8 +26,7 @@
#include <gnttextview.h>
#include <gntwindow.h>
-#include <gntconv.h>
-#include <gntplugin.h>
+#include <finch.h>
static PurpleCmdId cmd;