Fri, 20 May 2022 15:13:02 -0500
Cleanup pidgin prefs
Some bits were moved to the separate widgets and are no longer needed in this file.
Testing Done:
Compile only.
Reviewed at https://reviews.imfreedom.org/r/1464/
--- a/ChangeLog.API Fri May 20 02:55:51 2022 -0500 +++ b/ChangeLog.API Fri May 20 15:13:02 2022 -0500 @@ -966,6 +966,8 @@ * pidgin_pounces_init * pidgin_pounces_manager_hide * pidgin_pounces_manager_show + * pidgin_prefs_labeled_entry + * pidgin_prefs_labeled_password * pidgin_protocol_option_menu_get_selected * pidgin_save_accels * pidgin_save_accels_cb
--- a/pidgin/prefs/pidginprefs.c Fri May 20 02:55:51 2022 -0500 +++ b/pidgin/prefs/pidginprefs.c Fri May 20 15:13:02 2022 -0500 @@ -1,4 +1,6 @@ -/* pidgin +/* + * 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 @@ -15,9 +17,7 @@ * 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 - * + * along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H @@ -29,28 +29,16 @@ #include <glib/gi18n-lib.h> #include <glib/gstdio.h> -#include <nice.h> -#include <talkatu.h> #include <purple.h> -#include "gtkblist.h" -#include "gtkconv.h" -#include "gtkdialogs.h" +#include "pidginprefs.h" +#include "pidginprefsinternal.h" #include "gtkutils.h" #include "pidgincore.h" -#include "pidgindebug.h" -#include "pidginprefs.h" -#include "pidginprefsinternal.h" #ifdef USE_VV #include "pidginvvprefs.h" #endif -#include <libsoup/soup.h> - -#define PREFS_OPTIMAL_ICON_SIZE 32 - -/* 25MB */ -#define PREFS_MAX_DOWNLOADED_THEME_SIZE 26214400 struct _PidginPrefsWindow { GtkDialog parent; @@ -62,12 +50,11 @@ /* Main dialog */ static PidginPrefsWindow *prefs = NULL; -/* - * PROTOTYPES - */ G_DEFINE_TYPE(PidginPrefsWindow, pidgin_prefs_window, GTK_TYPE_DIALOG); -static void delete_prefs(GtkWidget *, void *); +/****************************************************************************** + * Helpers + *****************************************************************************/ static void update_spin_value(GtkWidget *w, GtkWidget *spin) { @@ -126,24 +113,6 @@ purple_prefs_set_string(key, gtk_entry_get_text(entry)); } -GtkWidget * -pidgin_prefs_labeled_entry(GtkWidget *page, const gchar *title, - const char *key, GtkSizeGroup *sg) -{ - GtkWidget *entry; - const gchar *value; - - value = purple_prefs_get_string(key); - - entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(entry), value); - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(entry_set), (char*)key); - gtk_widget_show(entry); - - return pidgin_add_widget_to_vbox(GTK_BOX(page), title, sg, entry, TRUE, NULL); -} - void pidgin_prefs_bind_entry(const char *key, GtkWidget *entry) { @@ -156,25 +125,6 @@ (char*)key); } -GtkWidget * -pidgin_prefs_labeled_password(GtkWidget *page, const gchar *title, - const char *key, GtkSizeGroup *sg) -{ - GtkWidget *entry; - const gchar *value; - - value = purple_prefs_get_string(key); - - entry = gtk_entry_new(); - gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); - gtk_entry_set_text(GTK_ENTRY(entry), value); - g_signal_connect(G_OBJECT(entry), "changed", - G_CALLBACK(entry_set), (char*)key); - gtk_widget_show(entry); - - return pidgin_add_widget_to_vbox(GTK_BOX(page), title, sg, entry, TRUE, NULL); -} - static void dropdown_set(GtkComboBox *combo_box, G_GNUC_UNUSED gpointer data) { @@ -462,7 +412,6 @@ { /* Close any request dialogs */ purple_request_close_with_handle(prefs); - purple_notify_close_with_handle(prefs); /* Unregister callbacks. */ @@ -485,6 +434,9 @@ } #endif +/****************************************************************************** + * GObject Implementation + *****************************************************************************/ static void pidgin_prefs_window_class_init(PidginPrefsWindowClass *klass) { @@ -507,13 +459,7 @@ #ifdef USE_VV GtkWidget *vv = NULL; #endif - /* copy the preferences to tmp values... - * I liked "take affect immediately" Oh well :-( */ - /* (that should have been "effect," right?) */ - /* Back to instant-apply! I win! BU-HAHAHA! */ - - /* Create the window */ gtk_widget_init_template(GTK_WIDGET(win)); #ifdef USE_VV @@ -524,6 +470,9 @@ #endif } +/****************************************************************************** + * API + *****************************************************************************/ void pidgin_prefs_show(void) {
--- a/pidgin/prefs/pidginprefs.h Fri May 20 02:55:51 2022 -0500 +++ b/pidgin/prefs/pidginprefs.h Fri May 20 15:13:02 2022 -0500 @@ -1,4 +1,6 @@ -/* pidgin +/* + * 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 @@ -15,9 +17,7 @@ * 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 - * + * along with this program; if not, see <https://www.gnu.org/licenses/>. */ #if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION) @@ -27,12 +27,15 @@ #ifndef PIDGIN_PREFS_H #define PIDGIN_PREFS_H +#include <glib.h> #include <purple.h> +#include <gtk/gtk.h> G_BEGIN_DECLS #define PIDGIN_TYPE_PREFS_WINDOW (pidgin_prefs_window_get_type()) -G_DECLARE_FINAL_TYPE(PidginPrefsWindow, pidgin_prefs_window, PIDGIN, PREFS_WINDOW, GtkDialog) +G_DECLARE_FINAL_TYPE(PidginPrefsWindow, pidgin_prefs_window, PIDGIN, + PREFS_WINDOW, GtkDialog) /** * pidgin_prefs_init: @@ -80,39 +83,6 @@ const gchar *title, const char *key, int min, int max, GtkSizeGroup *sg); /** - * pidgin_prefs_labeled_entry: - * @page: The page to which the entry will be added - * @title: The text to be displayed as the entry label - * @key: The key of the string pref that will be represented by the entry - * @sg: If not NULL, the size group to which the entry will be added - * - * Add a new entry representing a string preference - * - * Returns: (transfer full) :An hbox containing both the label and the entry. Can be used to set - * the widgets to sensitive or insensitive based on the value of a - * checkbox. - */ -GtkWidget *pidgin_prefs_labeled_entry(GtkWidget *page, const gchar *title, - const char *key, GtkSizeGroup *sg); - -/** - * pidgin_prefs_labeled_password: - * @page: The page to which the entry will be added - * @title: The text to be displayed as the entry label - * @key: The key of the string pref that will be represented by the entry - * @sg: If not NULL, the size group to which the entry will be added - * - * Add a new entry representing a password (string) preference - * The entry will use a password-style text entry (the text is substituted) - * - * Returns: (transfer full): An hbox containing both the label and the entry. Can be used to set - * the widgets to sensitive or insensitive based on the value of a - * checkbox. - */ -GtkWidget *pidgin_prefs_labeled_password(GtkWidget *page, const gchar *title, - const char *key, GtkSizeGroup *sg); - -/** * pidgin_prefs_dropdown: * @page: The page to which the dropdown will be added * @title: The text to be displayed as the dropdown label