Fri, 13 May 2022 00:39:03 -0500
Expose prefs binding functions internally
This will allow splitting apart the Pidgin prefs source file.
Testing Done:
Compile only.
Reviewed at https://reviews.imfreedom.org/r/1436/
| pidgin/prefs/pidginprefs.c | file | annotate | diff | comparison | revisions | |
| pidgin/prefs/pidginprefsinternal.h | file | annotate | diff | comparison | revisions |
--- a/pidgin/prefs/pidginprefs.c Fri May 13 00:37:49 2022 -0500 +++ b/pidgin/prefs/pidginprefs.c Fri May 13 00:39:03 2022 -0500 @@ -42,6 +42,7 @@ #include "pidgincore.h" #include "pidgindebug.h" #include "pidginprefs.h" +#include "pidginprefsinternal.h" #include <libsoup/soup.h> #define PREFS_OPTIMAL_ICON_SIZE 32 @@ -49,25 +50,6 @@ /* 25MB */ #define PREFS_MAX_DOWNLOADED_THEME_SIZE 26214400 -typedef struct _PidginPrefCombo PidginPrefCombo; - -typedef void (*PidginPrefsBindDropdownCallback)(GtkComboBox *combo_box, - PidginPrefCombo *combo); - -struct _PidginPrefCombo { - GtkWidget *combo; - PurplePrefType type; - const gchar *key; - union { - const char *string; - int integer; - gboolean boolean; - } value; - gint previously_active; - gint current_active; - PidginPrefsBindDropdownCallback cb; -}; - struct _PidginPrefsWindow { GtkDialog parent; @@ -205,7 +187,7 @@ return pidgin_add_widget_to_vbox(GTK_BOX(box), title, sg, spin, FALSE, NULL); } -static void +void pidgin_prefs_bind_spin_button(const char *key, GtkWidget *spin) { GtkAdjustment *adjust; @@ -246,7 +228,7 @@ return pidgin_add_widget_to_vbox(GTK_BOX(page), title, sg, entry, TRUE, NULL); } -static void +void pidgin_prefs_bind_entry(const char *key, GtkWidget *entry) { const gchar *value; @@ -556,7 +538,7 @@ combo->cb(combo_box, combo); } -static void +void pidgin_prefs_bind_dropdown_from_list(PidginPrefCombo *combo, GList *menuitems) { gchar *text; @@ -634,7 +616,7 @@ G_CALLBACK(bind_dropdown_set), combo); } -static void +void pidgin_prefs_bind_dropdown(PidginPrefCombo *combo) { GtkTreeModel *store = NULL; @@ -728,7 +710,7 @@ return button; } -static void +void pidgin_prefs_bind_checkbox(const char *key, GtkWidget *button) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidgin/prefs/pidginprefsinternal.h Fri May 13 00:39:03 2022 -0500 @@ -0,0 +1,70 @@ +/* + * Pidgin - Internet Messenger + * Copyright (C) Pidgin Developers <devel@pidgin.im> + * + * Pidgin 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(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION) +# error "only <pidgin.h> may be included directly" +#endif + +#ifndef PIDGIN_PREFS_INTERNAL_H +#define PIDGIN_PREFS_INTERNAL_H + +#include <purple.h> + +typedef struct _PidginPrefCombo PidginPrefCombo; + +typedef void (*PidginPrefsBindDropdownCallback)(GtkComboBox *combo_box, + PidginPrefCombo *combo); + +struct _PidginPrefCombo { + GtkWidget *combo; + PurplePrefType type; + const gchar *key; + union { + const char *string; + int integer; + gboolean boolean; + } value; + gint previously_active; + gint current_active; + PidginPrefsBindDropdownCallback cb; +}; + +G_BEGIN_DECLS + +G_GNUC_INTERNAL +void pidgin_prefs_bind_checkbox(const char *key, GtkWidget *button); + +G_GNUC_INTERNAL +void pidgin_prefs_bind_dropdown(PidginPrefCombo *combo); + +G_GNUC_INTERNAL +void pidgin_prefs_bind_dropdown_from_list(PidginPrefCombo *combo, GList *menuitems); + +G_GNUC_INTERNAL +void pidgin_prefs_bind_entry(const char *key, GtkWidget *entry); + +G_GNUC_INTERNAL +void pidgin_prefs_bind_spin_button(const char *key, GtkWidget *spin); + +G_END_DECLS + +#endif /* PIDGIN_PREFS_INTERNAL_H */