summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2022-09-05 21:45:57 -0500
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2022-09-05 21:45:57 -0500
commit9edc7657f3fa05de44c7ff01d03de45415ae2e9d (patch)
tree9a04ea8f58b3bca3576ac4b91ea342ad4aec27f8
parent947408366a4083a27136872ed1e8802b13f44eab (diff)
downloadpidgin-9edc7657f3fa05de44c7ff01d03de45415ae2e9d.tar.gz
Remove PidginProtocolStore
It is no longer needed now that `PurpleProtocolManager` implements `GListModel`, and `PidginProtocolChooser` uses it directly. Testing Done: Compiled only. Reviewed at https://reviews.imfreedom.org/r/1724/
-rw-r--r--pidgin/meson.build3
-rw-r--r--pidgin/pidginprotocolstore.c171
-rw-r--r--pidgin/pidginprotocolstore.h87
-rw-r--r--po/POTFILES.in1
4 files changed, 0 insertions, 262 deletions
diff --git a/pidgin/meson.build b/pidgin/meson.build
index 57fd1b93e8..8ec47c3fcc 100644
--- a/pidgin/meson.build
+++ b/pidgin/meson.build
@@ -52,7 +52,6 @@ libpidgin_SOURCES = [
'pidginpluginsmenu.c',
'pidginpresenceicon.c',
'pidginprotocolchooser.c',
- 'pidginprotocolstore.c',
'pidginproxyoptions.c',
'pidginstatusbox.c',
'pidginstatuseditor.c',
@@ -123,7 +122,6 @@ libpidgin_headers = [
'pidginpluginsmenu.h',
'pidginpresenceicon.h',
'pidginprotocolchooser.h',
- 'pidginprotocolstore.h',
'pidginproxyoptions.h',
'pidginstatusbox.h',
'pidginstatuseditor.h',
@@ -150,7 +148,6 @@ libpidgin_enum_headers = [
'gtkconv.h',
'gtkutils.h',
'pidginaccountstore.h',
- 'pidginprotocolstore.h',
]
pidgin_SOURCES = [
diff --git a/pidgin/pidginprotocolstore.c b/pidgin/pidginprotocolstore.c
deleted file mode 100644
index 8628ac924a..0000000000
--- a/pidgin/pidginprotocolstore.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#include "pidgin/pidginprotocolstore.h"
-
-#include "gtkutils.h"
-
-struct _PidginProtocolStore {
- GtkListStore parent;
-};
-
-/******************************************************************************
- * Helpers
- *****************************************************************************/
-static void
-pidgin_protocol_store_add_protocol(PidginProtocolStore *store,
- PurpleProtocol *protocol)
-{
- GtkTreeIter iter;
- const gchar *icon_name = NULL;
-
- icon_name = purple_protocol_get_icon_name(protocol);
-
- gtk_list_store_append(GTK_LIST_STORE(store), &iter);
- gtk_list_store_set(
- GTK_LIST_STORE(store),
- &iter,
- PIDGIN_PROTOCOL_STORE_COLUMN_PROTOCOL, protocol,
- PIDGIN_PROTOCOL_STORE_COLUMN_ID, purple_protocol_get_id(protocol),
- PIDGIN_PROTOCOL_STORE_COLUMN_NAME, purple_protocol_get_name(protocol),
- PIDGIN_PROTOCOL_STORE_COLUMN_ICON_NAME, icon_name,
- -1
- );
-}
-
-static void
-pidgin_protocol_store_add_protocol_helper(gpointer data, gpointer user_data) {
- if(PURPLE_IS_PROTOCOL(data)) {
- pidgin_protocol_store_add_protocol(PIDGIN_PROTOCOL_STORE(user_data),
- PURPLE_PROTOCOL(data));
- }
-}
-
-static void
-pidgin_protocol_store_add_protocols(PidginProtocolStore *store) {
- PurpleProtocolManager *manager = purple_protocol_manager_get_default();
- GList *protocols = NULL;
-
- protocols = purple_protocol_manager_get_all(manager);
- g_list_foreach(protocols, pidgin_protocol_store_add_protocol_helper,
- store);
- g_list_free(protocols);
-}
-
-static void
-pidgin_protocol_store_remove_protocol(PidginProtocolStore *store,
- PurpleProtocol *protocol)
-{
- GtkTreeIter iter;
-
- if(gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter) == FALSE) {
- purple_debug_warning("protocol-store",
- "protocol %s was removed but not in the store",
- purple_protocol_get_name(protocol));
- return;
- }
-
- /* walk through the store and look for the protocol to remove */
- do {
- PurpleProtocol *prpl = NULL;
-
- gtk_tree_model_get(
- GTK_TREE_MODEL(store),
- &iter,
- PIDGIN_PROTOCOL_STORE_COLUMN_PROTOCOL, &prpl,
- -1
- );
-
- if(prpl == protocol) {
- g_object_unref(G_OBJECT(prpl));
-
- gtk_list_store_remove(GTK_LIST_STORE(store), &iter);
-
- return;
- }
- } while(gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter));
-}
-
-/******************************************************************************
- * Callbacks
- *****************************************************************************/
-static void
-pidgin_protocol_store_registered_cb(PurpleProtocolManager *manager,
- PurpleProtocol *protocol, gpointer data)
-{
- pidgin_protocol_store_add_protocol(PIDGIN_PROTOCOL_STORE(data), protocol);
-}
-
-static void
-pidgin_protocol_store_unregistered_cb(PurpleProtocolManager *manager,
- PurpleProtocol *protocol, gpointer data)
-{
- pidgin_protocol_store_remove_protocol(PIDGIN_PROTOCOL_STORE(data),
- protocol);
-}
-
-/******************************************************************************
- * GObject Implementation
- *****************************************************************************/
-G_DEFINE_TYPE(PidginProtocolStore, pidgin_protocol_store, GTK_TYPE_LIST_STORE)
-
-static void
-pidgin_protocol_store_init(PidginProtocolStore *store) {
- PurpleProtocolManager *manager = NULL;
- GType types[PIDGIN_PROTOCOL_STORE_N_COLUMNS] = {
- PURPLE_TYPE_PROTOCOL,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_STRING,
- };
-
- gtk_list_store_set_column_types(
- GTK_LIST_STORE(store),
- PIDGIN_PROTOCOL_STORE_N_COLUMNS,
- types
- );
-
- /* add the known protocols */
- pidgin_protocol_store_add_protocols(store);
-
- /* add the signal handlers to dynamically add/remove protocols */
- manager = purple_protocol_manager_get_default();
- g_signal_connect_object(G_OBJECT(manager), "registered",
- G_CALLBACK(pidgin_protocol_store_registered_cb),
- store, 0);
- g_signal_connect_object(G_OBJECT(manager), "unregistered",
- G_CALLBACK(pidgin_protocol_store_unregistered_cb),
- store, 0);
-}
-
-static void
-pidgin_protocol_store_class_init(PidginProtocolStoreClass *klass) {
-}
-
-/******************************************************************************
- * API
- *****************************************************************************/
-GtkListStore *
-pidgin_protocol_store_new(void) {
- return GTK_LIST_STORE(g_object_new(PIDGIN_TYPE_PROTOCOL_STORE, NULL));
-}
diff --git a/pidgin/pidginprotocolstore.h b/pidgin/pidginprotocolstore.h
deleted file mode 100644
index 27b43a6105..0000000000
--- a/pidgin/pidginprotocolstore.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* pidgin
- *
- * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
-# error "only <pidgin.h> may be included directly"
-#endif
-
-#ifndef PIDGIN_PROTOCOL_STORE_H
-#define PIDGIN_PROTOCOL_STORE_H
-
-/**
- * PidginProtocolStore:
- *
- * #PidginProtocolStore is a #GtkListStore that automatically keeps track of
- * what protocols are currently available in libpurple. It's intended to be
- * used any time that you need to present a protocol selection to the user.
- *
- * Since: 3.0.0
- */
-
-#include <gtk/gtk.h>
-
-#include <purple.h>
-
-/**
- * PidginProtocolStoreColumn:
- * @PIDGIN_PROTOCOL_STORE_COLUMN_PROTOCOL: This column holds a reference to a
- * #PurpleProtocol.
- * @PIDGIN_PROTOCOL_STORE_COLUMN_ID: This column holds the id of the protocol.
- * @PIDGIN_PROTOCOL_STORE_COLUMN_NAME: This column holds the name of the
- * protocol which is used for display.
- * @PIDGIN_PROTOCOL_STORE_COLUMN_ICON: This column holds a #GdkPixbuf of the
- * logo of the protocol.
- *
- * Constants for accessing columns in a #PidginProtocolStore.
- *
- * Since: 3.0.0
- */
-typedef enum {
- PIDGIN_PROTOCOL_STORE_COLUMN_PROTOCOL,
- PIDGIN_PROTOCOL_STORE_COLUMN_ID,
- PIDGIN_PROTOCOL_STORE_COLUMN_NAME,
- PIDGIN_PROTOCOL_STORE_COLUMN_ICON_NAME,
- /*< private >*/
- PIDGIN_PROTOCOL_STORE_N_COLUMNS,
-} PidginProtocolStoreColumn;
-
-G_BEGIN_DECLS
-
-#define PIDGIN_TYPE_PROTOCOL_STORE pidgin_protocol_store_get_type()
-
-G_DECLARE_FINAL_TYPE(PidginProtocolStore, pidgin_protocol_store, PIDGIN,
- PROTOCOL_STORE, GtkListStore)
-
-/**
- * pidgin_protocol_store_new:
- *
- * Creates a new #PidginProtocolStore that can be used anywhere a #GtkListStore
- * can be used.
- *
- * Returns: (transfer full): The new #PidginProtocolStore instance.
- *
- * Since: 3.0.0
- */
-GtkListStore *pidgin_protocol_store_new(void);
-
-G_END_DECLS
-
-#endif /* PIDGIN_PROTOCOL_STORE_H */
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2d539341a1..c42940bce9 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -366,7 +366,6 @@ pidgin/pidginpluginsdialog.c
pidgin/pidginpluginsmenu.c
pidgin/pidginpresenceicon.c
pidgin/pidginprotocolchooser.c
-pidgin/pidginprotocolstore.c
pidgin/pidginproxyoptions.c
pidgin/pidginstatusbox.c
pidgin/pidginstatuseditor.c