--- a/pidgin/meson.build Tue Jul 19 23:36:25 2022 -0500
+++ b/pidgin/meson.build Thu Jul 21 00:34:31 2022 -0500
@@ -23,6 +23,7 @@
'pidginaccountfilterconnected.c',
'pidginaccountfilterprotocol.c',
'pidginaccountmanager.c',
+ 'pidginaccountsdisabledmenu.c', 'pidginaccountsenabledmenu.c',
@@ -39,7 +40,6 @@
- 'pidgininactiveaccountsmenu.c',
@@ -99,6 +99,7 @@
'pidginaccountfilterconnected.h',
'pidginaccountfilterprotocol.h',
'pidginaccountmanager.h',
+ 'pidginaccountsdisabledmenu.h', 'pidginaccountsenabledmenu.h',
@@ -115,7 +116,6 @@
- 'pidgininactiveaccountsmenu.h',
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/pidginaccountsdisabledmenu.c Thu Jul 21 00:34:31 2022 -0500
@@ -0,0 +1,217 @@
+ * 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 + * 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 "pidginaccountsdisabledmenu.h" +struct _PidginAccountsDisabledMenu { +G_DEFINE_TYPE(PidginAccountsDisabledMenu, pidgin_accounts_disabled_menu, +/****************************************************************************** + *****************************************************************************/ +pidgin_accounts_disabled_menu_refresh(PidginAccountsDisabledMenu *menu) { + PurpleAccountManager *manager = NULL; + gint removed = 0, added = 0; + /* When refreshing we're always removing at least 1 item because of the + * "no disabled accounts" item that we put in place when all accounts + removed = MAX(1, g_list_length(menu->accounts)); + /* Grab the manager and get all the disabled accounts. */ + manager = purple_account_manager_get_default(); + g_list_free(menu->accounts); + menu->accounts = purple_account_manager_get_inactive(manager); + /* Similar to the aboved note about removed items, if every account is + * enabled, we add an item saying "no disabled accounts". + added = MAX(1, g_list_length(menu->accounts)); + /* Tell any listeners that our menu has changed. */ + g_menu_model_items_changed(G_MENU_MODEL(menu), 0, removed, added); +pidgin_accounts_disabled_menu_changed_cb(G_GNUC_UNUSED PurpleAccount *account, + PidginAccountsDisabledMenu *menu = data; + pidgin_accounts_disabled_menu_refresh(menu); +/****************************************************************************** + * GMenuModel Implementation + *****************************************************************************/ +pidgin_accounts_disabled_menu_is_mutable(GMenuModel *model) { +pidgin_accounts_disabled_menu_get_n_items(GMenuModel *model) { + PidginAccountsDisabledMenu *menu = NULL; + menu = PIDGIN_ACCOUNTS_DISABLED_MENU(model); + if(menu->accounts == NULL) { + return g_list_length(menu->accounts); +pidgin_accounts_disabled_menu_get_item_attributes(GMenuModel *model, + GHashTable **attributes) + PidginAccountsDisabledMenu *menu = NULL; + PurpleAccount *account = NULL; + PurpleProtocol *protocol = NULL; + GVariant *value = NULL; + const gchar *account_name = NULL, *protocol_name = NULL; + menu = PIDGIN_ACCOUNTS_DISABLED_MENU(model); + /* Create our hash table of attributes to return. */ + *attributes = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, + (GDestroyNotify)g_variant_unref); + /* If we don't have any disabled accounts, just return a single item, + if(menu->accounts == NULL) { + value = g_variant_new_string(_("No disabled accounts")); + g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_LABEL, + g_variant_ref_sink(value)); + value = g_variant_new_string("disabled"); + g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ACTION, + g_variant_ref_sink(value)); + account = g_list_nth_data(menu->accounts, index); + account_name = purple_account_get_username(account); + protocol_name = purple_account_get_protocol_name(account); + /* translators: This format string is intended to contain the account + * name followed by the protocol name to uniquely identify a specific + value = g_variant_new_printf(_("%s (%s)"), account_name, protocol_name); + g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_LABEL, + g_variant_ref_sink(value)); + value = g_variant_new_string("app.enable-account"); + g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ACTION, + g_variant_ref_sink(value)); + value = g_variant_new_printf("%s", purple_account_get_id(account)); + g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_TARGET, + g_variant_ref_sink(value)); + protocol = purple_account_get_protocol(account); + value = g_variant_new_printf("%s", purple_protocol_get_icon_name(protocol)); + g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ICON, + g_variant_ref_sink(value)); +pidgin_accounts_disabled_menu_get_item_links(GMenuModel *model, gint index, + *links = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, +/****************************************************************************** + * GObject Implementation + *****************************************************************************/ +pidgin_accounts_disabled_menu_dispose(GObject *obj) { + purple_signals_disconnect_by_handle(obj); + G_OBJECT_CLASS(pidgin_accounts_disabled_menu_parent_class)->dispose(obj); +pidgin_accounts_disabled_menu_constructed(GObject *obj) { + G_OBJECT_CLASS(pidgin_accounts_disabled_menu_parent_class)->constructed(obj); + pidgin_accounts_disabled_menu_refresh(PIDGIN_ACCOUNTS_DISABLED_MENU(obj)); +pidgin_accounts_disabled_menu_init(PidginAccountsDisabledMenu *menu) { + gpointer handle = NULL; + /* Wire up the purple signals we care about. */ + handle = purple_accounts_get_handle(); + purple_signal_connect(handle, "account-enabled", menu, + G_CALLBACK(pidgin_accounts_disabled_menu_changed_cb), + purple_signal_connect(handle, "account-disabled", menu, + G_CALLBACK(pidgin_accounts_disabled_menu_changed_cb), +pidgin_accounts_disabled_menu_class_init(PidginAccountsDisabledMenuClass *klass) { + GObjectClass *obj_class = G_OBJECT_CLASS(klass); + GMenuModelClass *model_class = G_MENU_MODEL_CLASS(klass); + obj_class->constructed = pidgin_accounts_disabled_menu_constructed; + obj_class->dispose = pidgin_accounts_disabled_menu_dispose; + model_class->is_mutable = pidgin_accounts_disabled_menu_is_mutable; + model_class->get_n_items = pidgin_accounts_disabled_menu_get_n_items; + model_class->get_item_attributes = pidgin_accounts_disabled_menu_get_item_attributes; + model_class->get_item_links = pidgin_accounts_disabled_menu_get_item_links; +/****************************************************************************** + *****************************************************************************/ +pidgin_accounts_disabled_menu_new(void) { + return g_object_new(PIDGIN_TYPE_ACCOUNTS_DISABLED_MENU, NULL); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/pidginaccountsdisabledmenu.h Thu Jul 21 00:34:31 2022 -0500
@@ -0,0 +1,55 @@
+ * 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 + * 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" +#ifndef PIDGIN_ACCOUNTS_DISABLED_MENU_H +#define PIDGIN_ACCOUNTS_DISABLED_MENU_H +#define PIDGIN_TYPE_ACCOUNTS_DISABLED_MENU (pidgin_accounts_disabled_menu_get_type()) +G_DECLARE_FINAL_TYPE(PidginAccountsDisabledMenu, pidgin_accounts_disabled_menu, + PIDGIN, ACCOUNTS_DISABLED_MENU, GMenuModel) + * pidgin_accounts_disabled_menu_new: + * Creates a menu that will automatically update itself to include accounts + * that are disabled in libpurple. + * Returns: (transfer full): The new menu instance. +GMenuModel *pidgin_accounts_disabled_menu_new(void); +#endif /* PIDGIN_ACCOUNTS_DISABLED_MENU_H */ \ No newline at end of file
--- a/pidgin/pidginapplication.c Tue Jul 19 23:36:25 2022 -0500
+++ b/pidgin/pidginapplication.c Thu Jul 21 00:34:31 2022 -0500
@@ -44,11 +44,11 @@
#include "pidginaccountmanager.h"
+#include "pidginaccountsdisabledmenu.h" #include "pidginaccountsenabledmenu.h"
#include "pidginconversationwindow.h"
-#include "pidgininactiveaccountsmenu.h"
#include "pidginmooddialog.h"
#include "pidginpluginsdialog.h"
#include "pidginpluginsmenu.h"
@@ -124,10 +124,10 @@
GMenu *source = NULL, *target = NULL;
GMenuModel *model = NULL;
- /* Link the InactiveAccountsMenu into its proper location. */
- model = pidgin_inactive_accounts_menu_new();
+ /* Link the AccountsDisabledMenu into its proper location. */ + model = pidgin_accounts_disabled_menu_new(); target = gtk_application_get_menu_by_id(GTK_APPLICATION(application),
g_menu_append_section(target, NULL, model);
/* Link the AccountsEnabledMenu into its proper location. */
--- a/pidgin/pidgininactiveaccountsmenu.c Tue Jul 19 23:36:25 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,217 +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
- * 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 "pidgininactiveaccountsmenu.h"
-struct _PidginInactiveAccountsMenu {
-G_DEFINE_TYPE(PidginInactiveAccountsMenu, pidgin_inactive_accounts_menu,
-/******************************************************************************
- *****************************************************************************/
-pidgin_inactive_accounts_menu_refresh(PidginInactiveAccountsMenu *menu) {
- PurpleAccountManager *manager = NULL;
- gint removed = 0, added = 0;
- /* When refreshing we're always removing at least 1 item because of the
- * "no disabled accounts" item that we put in place when all accounts
- removed = MAX(1, g_list_length(menu->accounts));
- /* Grab the manager and get all the disabled accounts. */
- manager = purple_account_manager_get_default();
- g_list_free(menu->accounts);
- menu->accounts = purple_account_manager_get_inactive(manager);
- /* Similar to the aboved note about removed items, if every account is
- * enabled, we add an item saying "no disabled accounts".
- added = MAX(1, g_list_length(menu->accounts));
- /* Tell any listeners that our menu has changed. */
- g_menu_model_items_changed(G_MENU_MODEL(menu), 0, removed, added);
-pidgin_inactive_accounts_menu_changed_cb(G_GNUC_UNUSED PurpleAccount *account,
- PidginInactiveAccountsMenu *menu = data;
- pidgin_inactive_accounts_menu_refresh(menu);
-/******************************************************************************
- * GMenuModel Implementation
- *****************************************************************************/
-pidgin_inactive_accounts_menu_is_mutable(GMenuModel *model) {
-pidgin_inactive_accounts_menu_get_n_items(GMenuModel *model) {
- PidginInactiveAccountsMenu *menu = NULL;
- menu = PIDGIN_INACTIVE_ACCOUNTS_MENU(model);
- if(menu->accounts == NULL) {
- return g_list_length(menu->accounts);
-pidgin_inactive_accounts_menu_get_item_attributes(GMenuModel *model,
- GHashTable **attributes)
- PidginInactiveAccountsMenu *menu = NULL;
- PurpleAccount *account = NULL;
- PurpleProtocol *protocol = NULL;
- GVariant *value = NULL;
- const gchar *account_name = NULL, *protocol_name = NULL;
- menu = PIDGIN_INACTIVE_ACCOUNTS_MENU(model);
- /* Create our hash table of attributes to return. */
- *attributes = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
- (GDestroyNotify)g_variant_unref);
- /* If we don't have any disabled accounts, just return a single item,
- if(menu->accounts == NULL) {
- value = g_variant_new_string(_("No disabled accounts"));
- g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_LABEL,
- g_variant_ref_sink(value));
- value = g_variant_new_string("disabled");
- g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ACTION,
- g_variant_ref_sink(value));
- account = g_list_nth_data(menu->accounts, index);
- account_name = purple_account_get_username(account);
- protocol_name = purple_account_get_protocol_name(account);
- /* translators: This format string is intended to contain the account
- * name followed by the protocol name to uniquely identify a specific
- value = g_variant_new_printf(_("%s (%s)"), account_name, protocol_name);
- g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_LABEL,
- g_variant_ref_sink(value));
- value = g_variant_new_string("app.enable-account");
- g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ACTION,
- g_variant_ref_sink(value));
- value = g_variant_new_printf("%s", purple_account_get_id(account));
- g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_TARGET,
- g_variant_ref_sink(value));
- protocol = purple_account_get_protocol(account);
- value = g_variant_new_printf("%s", purple_protocol_get_icon_name(protocol));
- g_hash_table_insert(*attributes, G_MENU_ATTRIBUTE_ICON,
- g_variant_ref_sink(value));
-pidgin_inactive_accounts_menu_get_item_links(GMenuModel *model, gint index,
- *links = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
-/******************************************************************************
- * GObject Implementation
- *****************************************************************************/
-pidgin_inactive_accounts_menu_dispose(GObject *obj) {
- purple_signals_disconnect_by_handle(obj);
- G_OBJECT_CLASS(pidgin_inactive_accounts_menu_parent_class)->dispose(obj);
-pidgin_inactive_accounts_menu_constructed(GObject *obj) {
- G_OBJECT_CLASS(pidgin_inactive_accounts_menu_parent_class)->constructed(obj);
- pidgin_inactive_accounts_menu_refresh(PIDGIN_INACTIVE_ACCOUNTS_MENU(obj));
-pidgin_inactive_accounts_menu_init(PidginInactiveAccountsMenu *menu) {
- gpointer handle = NULL;
- /* Wire up the purple signals we care about. */
- handle = purple_accounts_get_handle();
- purple_signal_connect(handle, "account-enabled", menu,
- G_CALLBACK(pidgin_inactive_accounts_menu_changed_cb),
- purple_signal_connect(handle, "account-disabled", menu,
- G_CALLBACK(pidgin_inactive_accounts_menu_changed_cb),
-pidgin_inactive_accounts_menu_class_init(PidginInactiveAccountsMenuClass *klass) {
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
- GMenuModelClass *model_class = G_MENU_MODEL_CLASS(klass);
- obj_class->constructed = pidgin_inactive_accounts_menu_constructed;
- obj_class->dispose = pidgin_inactive_accounts_menu_dispose;
- model_class->is_mutable = pidgin_inactive_accounts_menu_is_mutable;
- model_class->get_n_items = pidgin_inactive_accounts_menu_get_n_items;
- model_class->get_item_attributes = pidgin_inactive_accounts_menu_get_item_attributes;
- model_class->get_item_links = pidgin_inactive_accounts_menu_get_item_links;
-/******************************************************************************
- *****************************************************************************/
-pidgin_inactive_accounts_menu_new(void) {
- return g_object_new(PIDGIN_TYPE_INACTIVE_ACCOUNTS_MENU, NULL);
--- a/pidgin/pidgininactiveaccountsmenu.h Tue Jul 19 23:36:25 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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
- * 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"
-#ifndef PIDGIN_INACTIVE_ACCOUNTS_MENU_H
-#define PIDGIN_INACTIVE_ACCOUNTS_MENU_H
-#define PIDGIN_TYPE_INACTIVE_ACCOUNTS_MENU (pidgin_inactive_accounts_menu_get_type())
-G_DECLARE_FINAL_TYPE(PidginInactiveAccountsMenu, pidgin_inactive_accounts_menu,
- PIDGIN, INACTIVE_ACCOUNTS_MENU, GMenuModel)
- * pidgin_inactive_accounts_menu_new:
- * Creates a menu that will automatically update itself to include accounts
- * that are inactive in libpurple.
- * Returns: (transfer full): The new menu instance.
-GMenuModel *pidgin_inactive_accounts_menu_new(void);
-#endif /* PIDGIN_INACTIVE_ACCOUNTS_MENU_H */
\ No newline at end of file
--- a/pidgin/resources/gtk/menus.ui Tue Jul 19 23:36:25 2022 -0500
+++ b/pidgin/resources/gtk/menus.ui Thu Jul 21 00:34:31 2022 -0500
@@ -184,7 +184,7 @@
<attribute name="label" translatable="yes">_Enable Account</attribute>
- <section id="inactive-accounts"/>
+ <section id="disabled-accounts"/> <section id="enabled-accounts"/>
--- a/po/POTFILES.in Tue Jul 19 23:36:25 2022 -0500
+++ b/po/POTFILES.in Thu Jul 21 00:34:31 2022 -0500
@@ -339,6 +339,7 @@
pidgin/pidginaccountfilterconnected.c
pidgin/pidginaccountfilterprotocol.c
pidgin/pidginaccountmanager.c
+pidgin/pidginaccountsdisabledmenu.c pidgin/pidginaccountsenabledmenu.c
pidgin/pidginaccountsmenu.c
pidgin/pidginaccountstore.c
@@ -356,7 +357,6 @@
-pidgin/pidgininactiveaccountsmenu.c
pidgin/pidgininvitedialog.c