pidgin/pidgin

9389ba16cf40
Parents 645607090674
Children 2dbfbaeefe40
Rename options.[ch] to purpleoptions.[ch]

* Rename the files
* Move the doc comments from the source to header files
* Namespaced the callback functions

Testing Done:
Compiled, ran `ninja pidgin-pot`, and verified the output of `ninja libpurple-doc`.

Reviewed at https://reviews.imfreedom.org/r/447/
--- a/doc/reference/libpurple/libpurple-docs.xml Sat Jan 23 20:31:28 2021 -0600
+++ b/doc/reference/libpurple/libpurple-docs.xml Sun Jan 24 02:46:43 2021 -0600
@@ -60,7 +60,6 @@
<xi:include href="xml/nat-pmp.xml" />
<xi:include href="xml/network.xml" />
<xi:include href="xml/notify.xml" />
- <xi:include href="xml/options.xml" />
<xi:include href="xml/plugins.xml" />
<xi:include href="xml/prefs.xml" />
<xi:include href="xml/pluginpref.xml" />
@@ -79,6 +78,7 @@
<xi:include href="xml/purpleimconversation.xml" />
<xi:include href="xml/purplekeyvaluepair.xml" />
<xi:include href="xml/purplemarkup.xml" />
+ <xi:include href="xml/purpleoptions.xml" />
<xi:include href="xml/purplepresence.xml" />
<xi:include href="xml/purpleprotocolattention.xml" />
<xi:include href="xml/purpleprotocolchat.xml" />
--- a/libpurple/meson.build Sat Jan 23 20:31:28 2021 -0600
+++ b/libpurple/meson.build Sun Jan 24 02:46:43 2021 -0600
@@ -36,7 +36,6 @@
'nat-pmp.c',
'network.c',
'notify.c',
- 'options.c',
'plugins.c',
'pluginpref.c',
'prefs.c',
@@ -57,6 +56,7 @@
'purplekeyvaluepair.c',
'purplemarkup.c',
'purplemessage.c',
+ 'purpleoptions.c',
'purplepresence.c',
'purpleprotocolattention.c',
'purpleprotocolchat.c',
@@ -126,7 +126,6 @@
'nat-pmp.h',
'network.h',
'notify.h',
- 'options.h',
'plugins.h',
'pluginpref.h',
'prefs.h',
@@ -147,6 +146,7 @@
'purplekeyvaluepair.h',
'purplemarkup.h',
'purplemessage.h',
+ 'purpleoptions.h',
'purplepresence.h',
'purpleprotocolattention.h',
'purpleprotocolchat.h',
--- a/libpurple/options.c Sat Jan 23 20:31:28 2021 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/* purple
- *
- * Purple 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
- */
-
-#include <glib/gi18n-lib.h>
-
-#include "internal.h"
-
-#include "options.h"
-
-#include "debug.h"
-#include "network.h"
-#include "util.h"
-
-/******************************************************************************
- * Callbacks
- *****************************************************************************/
-static gboolean
-debug_cb(const gchar *option_name, const gchar *value,
- gpointer data, GError **error)
-{
- purple_debug_set_enabled(TRUE);
-
- if (purple_strequal(value, "colored")) {
- purple_debug_set_colored(TRUE);
- }
-
- return TRUE;
-}
-
-static gboolean
-force_online_cb(const gchar *option_name, const gchar *value,
- gpointer data, GError **error)
-{
- purple_network_force_online();
-
- return TRUE;
-}
-
-/******************************************************************************
- * API
- *****************************************************************************/
-
-/**
- * purple_get_option_group:
- *
- * Returns a #GOptionGroup for the commandline arguments recognized by
- * LibPurple. You should add this option group to your #GOptionContext with
- * g_option_context_add_group(), if you are using g_option_context_parse() to
- * parse your commandline arguments.
- *
- * Return Value: (transfer full): a #GOptionGroup for the commandline arguments
- * recognized by LibPurple.
- */
-GOptionGroup *
-purple_get_option_group(void) {
- GOptionGroup *group = NULL;
- GOptionEntry entries[] = {
- {
- "debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
- G_OPTION_ARG_CALLBACK, &debug_cb,
- _("print debugging messages to stdout"),
- _("[colored]")
- }, {
- "force-online", 'f', G_OPTION_FLAG_NO_ARG,
- G_OPTION_ARG_CALLBACK, &force_online_cb,
- _("force online, regardless of network status"),
- NULL
- }, {
- NULL
- },
- };
-
- group = g_option_group_new(
- "libpurple",
- _("LibPurple options"),
- _("Show LibPurple Options"),
- NULL,
- NULL
- );
-
- g_option_group_add_entries(group, entries);
-
- return group;
-}
--- a/libpurple/options.h Sat Jan 23 20:31:28 2021 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/* purple
- *
- * Purple 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
- */
-
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#endif
-
-#ifndef PURPLE_OPTIONS_H
-#define PURPLE_OPTIONS_H
-
-/**
- * SECTION:options
- * @section_id: libpurple-options
- * @short_description: <filename>options.h</filename>
- * @title: Options API
- *
- * The functions defined here are to help in handling command line options.
- */
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-GOptionGroup *purple_get_option_group(void);
-
-G_END_DECLS
-
-#endif /* PURPLE_OPTIONS_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/purpleoptions.c Sun Jan 24 02:46:43 2021 -0600
@@ -0,0 +1,89 @@
+/*
+ * Purple - Internet Messaging Library
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * Purple 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 <https://www.gnu.org/licenses/>.
+ */
+
+#include <glib/gi18n-lib.h>
+
+#include "purpleoptions.h"
+
+#include "debug.h"
+#include "network.h"
+#include "util.h"
+
+/******************************************************************************
+ * Callbacks
+ *****************************************************************************/
+static gboolean
+purple_options_debug_cb(const gchar *option_name, const gchar *value,
+ gpointer data, GError **error)
+{
+ purple_debug_set_enabled(TRUE);
+
+ if (purple_strequal(value, "colored")) {
+ purple_debug_set_colored(TRUE);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+purple_options_force_online_cb(const gchar *option_name, const gchar *value,
+ gpointer data, GError **error)
+{
+ purple_network_force_online();
+
+ return TRUE;
+}
+
+/******************************************************************************
+ * Public API
+ *****************************************************************************/
+GOptionGroup *
+purple_get_option_group(void) {
+ GOptionGroup *group = NULL;
+ GOptionEntry entries[] = {
+ {
+ "debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
+ G_OPTION_ARG_CALLBACK, &purple_options_debug_cb,
+ _("print debugging messages to stdout"),
+ _("[colored]")
+ }, {
+ "force-online", 'f', G_OPTION_FLAG_NO_ARG,
+ G_OPTION_ARG_CALLBACK, &purple_options_force_online_cb,
+ _("force online, regardless of network status"),
+ NULL
+ }, {
+ NULL
+ },
+ };
+
+ group = g_option_group_new(
+ "libpurple",
+ _("LibPurple options"),
+ _("Show LibPurple Options"),
+ NULL,
+ NULL
+ );
+
+ g_option_group_add_entries(group, entries);
+
+ return group;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/purpleoptions.h Sun Jan 24 02:46:43 2021 -0600
@@ -0,0 +1,58 @@
+/*
+ * Purple - Internet Messaging Library
+ * Copyright (C) Pidgin Developers <devel@pidgin.im>
+ *
+ * Purple 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 <https://www.gnu.org/licenses/>.
+ */
+
+#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
+# error "only <purple.h> may be included directly"
+#endif
+
+#ifndef PURPLE_OPTIONS_H
+#define PURPLE_OPTIONS_H
+
+/**
+ * SECTION:purpleoptions
+ * @section_id: libpurple-purpleoptions
+ * @short_description: Command line argument integration
+ * @title: Command Line Argument Integration
+ *
+ * The functions defined here are to help in handling command line options.
+ */
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/**
+ * purple_get_option_group:
+ *
+ * Returns a #GOptionGroup for the commandline arguments recognized by
+ * LibPurple. You should add this option group to your #GOptionContext with
+ * g_option_context_add_group(), if you are using g_option_context_parse() to
+ * parse your commandline arguments.
+ *
+ * Returns: (transfer full): a #GOptionGroup for the commandline arguments
+ * recognized by LibPurple.
+ */
+GOptionGroup *purple_get_option_group(void);
+
+G_END_DECLS
+
+#endif /* PURPLE_OPTIONS_H */
--- a/po/POTFILES.in Sat Jan 23 20:31:28 2021 -0600
+++ b/po/POTFILES.in Sun Jan 24 02:46:43 2021 -0600
@@ -61,7 +61,6 @@
libpurple/nat-pmp.c
libpurple/network.c
libpurple/notify.c
-libpurple/options.c
libpurple/pluginpref.c
libpurple/plugins/autoaccept.c
libpurple/plugins/buddynote.c
@@ -254,6 +253,7 @@
libpurple/purplekeyvaluepair.c
libpurple/purplemarkup.c
libpurple/purplemessage.c
+libpurple/purpleoptions.c
libpurple/purplepresence.c
libpurple/purpleprotocolattention.c
libpurple/purpleprotocolchat.c