pidgin/pidgin

Parents 13b1e211d865
Children 228284223862
Create a new ContactList that will eventually fully replace PidginBuddyList

Create a new PidginContactList window and move the application actions to PidginApplication.

Testing Done:
* Verified menus are properly disabled while offline
* Verified menu items that require a protocol with chats enables the chat menu items as well as the room list menu items
* Verified that the menu items can become enabled while the menus are opened
* Verified that the application actions are activatable via dbus
* Verified that the plugin manager action was migrated successfully
* Verified that the account manager action was migrated successfully

Reviewed at https://reviews.imfreedom.org/r/174/
--- a/pidgin/glade/pidgin3.xml.in Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/glade/pidgin3.xml.in Sat Nov 14 03:15:43 2020 -0600
@@ -6,6 +6,7 @@
<glade-widget-class name="PidginAccountStore" generic-name="account_store" title="AccountStore"/>
<glade-widget-class name="PidginAccountFilterConnected" generic-name="account_filter_connected" title="FilterConnected"/>
<glade-widget-class name="PidginAccountFilterProtocol" generic-name="account_filter_protocol" title="FilterProtocol"/>
+ <glade-widget-class name="PidginBuddyListMenu" generic-name="buddy_list_menu" title="BuddyListMenu"/>
<glade-widget-class name="PidginCloseButton" generic-name="close-button" title="CloseButton"/>
<glade-widget-class name="PidginConversationWindow" generic-name="conversation_window" title="ConversationWindow"/>
<glade-widget-class name="PidginDialog" generic-name="dialog" title="Dialog"/>
@@ -13,6 +14,7 @@
<glade-widget-class name="PidginMenuTray" generic-name="menu_tray" title="MenuTray"/>
<glade-widget-class name="PidginPluginsMenu" generic-name="plugins_menu" title="PluginsMenu"/>
<glade-widget-class name="PidginScrollBook" generic-name="scroll_book" title="ScrollBook"/>
+ <glade-widget-class name="PidginStatusBox" generic-name="status_box" title="StatusBox"/>
<glade-widget-class name="PidginWindow" generic-name="window" title="Window"/>
</glade-widget-classes>
<glade-widget-group name="pidgin" title="Pidgin">
@@ -21,6 +23,7 @@
<glade-widget-class-ref name="PidginAccountStore"/>
<glade-widget-class-ref name="PidginAccountFilterConnected"/>
<glade-widget-class-ref name="PidginAccountFilterProtocol"/>
+ <glade-widget-class-ref name="PidginBuddyListMenu"/>
<glade-widget-class-ref name="PidginCloseButton"/>
<glade-widget-class-ref name="PidginConversationWindow"/>
<glade-widget-class-ref name="PidginDialog"/>
@@ -28,6 +31,7 @@
<glade-widget-class-ref name="PidginMenuTray"/>
<glade-widget-class-ref name="PidginPluginsMenu"/>
<glade-widget-class-ref name="PidginScrollBook"/>
+ <glade-widget-class-ref name="PidginStatusBox"/>
<glade-widget-class-ref name="PidginWindow"/>
</glade-widget-group>
</glade-catalog>
--- a/pidgin/gtkblist.c Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/gtkblist.c Sat Nov 14 03:15:43 2020 -0600
@@ -48,6 +48,7 @@
#include "pidgin/pidginbuddylistmenu.h"
#include "pidgin/pidgincellrendererexpander.h"
#include "pidgin/pidginclosebutton.h"
+#include "pidgin/pidgincontactlist.h"
#include "pidgin/pidgincore.h"
#include "pidgin/pidgindebug.h"
#include "pidgin/pidgingdkpixbuf.h"
@@ -5225,15 +5226,16 @@
gtkblist->empty_avatar = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32);
gdk_pixbuf_fill(gtkblist->empty_avatar, 0x00000000);
- gtkblist->window = pidgin_window_new(_("Buddy List"), 0, "buddy_list", TRUE);
+ gtkblist->window = pidgin_contact_list_new();
g_signal_connect(G_OBJECT(gtkblist->window), "focus-in-event",
G_CALLBACK(blist_focus_cb), gtkblist);
g_signal_connect(G_OBJECT(gtkblist->window), "focus-out-event",
G_CALLBACK(blist_focus_cb), gtkblist);
- gtkblist->main_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- gtk_widget_show(gtkblist->main_vbox);
- gtk_container_add(GTK_CONTAINER(gtkblist->window), gtkblist->main_vbox);
+ /* the main vbox is already packed and shown via glade, we just need a
+ * reference to it to pack the rest of our widgets here.
+ */
+ gtkblist->main_vbox = pidgin_contact_list_get_vbox(PIDGIN_CONTACT_LIST(gtkblist->window));
g_signal_connect(G_OBJECT(gtkblist->window), "delete_event", G_CALLBACK(gtk_blist_delete_cb), NULL);
g_signal_connect(G_OBJECT(gtkblist->window), "hide",
@@ -5248,10 +5250,6 @@
gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK);
/******************************* Menu bar *************************************/
- actions = pidgin_action_group_new();
- gtk_widget_insert_action_group(gtkblist->window, "blist",
- G_ACTION_GROUP(actions));
-
gtkblist->menu = pidgin_buddy_list_menu_new();
gtk_box_pack_start(GTK_BOX(gtkblist->main_vbox), gtkblist->menu, FALSE,
FALSE, 0);
--- a/pidgin/libpidgin.c Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/libpidgin.c Sat Nov 14 03:15:43 2020 -0600
@@ -369,6 +369,7 @@
#endif
app = pidgin_application_new();
+ g_application_set_default(app);
ret = g_application_run(app, argc, argv);
--- a/pidgin/meson.build Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/meson.build Sat Nov 14 03:15:43 2020 -0600
@@ -45,6 +45,7 @@
'pidginclosebutton.c',
'pidgincontactcompletion.c',
'pidginconversationwindow.c',
+ 'pidgincontactlist.c',
'pidgindebug.c',
'pidgindialog.c',
'pidgingdkpixbuf.c',
@@ -112,6 +113,7 @@
'pidginclosebutton.h',
'pidgincontactcompletion.h',
'pidginconversationwindow.h',
+ 'pidgincontactlist.h',
'pidgincore.h',
'pidgindialog.h',
'pidgindebug.h',
--- a/pidgin/pidginaccountsmenu.c Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/pidginaccountsmenu.c Sat Nov 14 03:15:43 2020 -0600
@@ -26,7 +26,6 @@
#include "pidginaccountactionsmenu.h"
-#include "gtkaccount.h"
#include "pidgincore.h"
struct _PidginAccountsMenu {
@@ -44,11 +43,6 @@
* GSignal Handlers
*****************************************************************************/
static void
-pidgin_accounts_menu_open_manager_cb(GtkMenuItem *item, gpointer data) {
- pidgin_accounts_window_show();
-}
-
-static void
pidgin_accounts_menu_enable_account(GtkMenuItem *item, gpointer data) {
PurpleAccount *account = PURPLE_ACCOUNT(data);
@@ -253,9 +247,6 @@
disabled_menu);
gtk_widget_class_bind_template_child(widget_class, PidginAccountsMenu,
separator);
-
- gtk_widget_class_bind_template_callback(widget_class,
- pidgin_accounts_menu_open_manager_cb);
}
/******************************************************************************
--- a/pidgin/pidginactiongroup.c Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/pidginactiongroup.c Sat Nov 14 03:15:43 2020 -0600
@@ -24,51 +24,13 @@
#include <purple.h>
-#include "gtkblist.h"
-#include "gtkdialogs.h"
-#include "gtkpounce.h"
-#include "gtkprefs.h"
-#include "gtkprivacy.h"
-#include "gtkroomlist.h"
-#include "gtksmiley-manager.h"
-#include "gtkxfer.h"
-#include "pidginabout.h"
#include "pidgincore.h"
-#include "pidginlog.h"
-#include "pidginmooddialog.h"
struct _PidginActionGroup {
GSimpleActionGroup parent;
};
/******************************************************************************
- * Globals
- *****************************************************************************/
-
-/**< private >
- * online_actions:
- *
- * This list keeps track of which actions should only be enabled while online.
- */
-static const gchar *pidgin_action_group_online_actions[] = {
- PIDGIN_ACTION_ADD_BUDDY,
- PIDGIN_ACTION_ADD_GROUP,
- PIDGIN_ACTION_GET_USER_INFO,
- PIDGIN_ACTION_NEW_MESSAGE,
- PIDGIN_ACTION_PRIVACY,
- PIDGIN_ACTION_SET_MOOD,
-};
-
-static const gchar *pidgin_action_group_chat_actions[] = {
- PIDGIN_ACTION_ADD_CHAT,
- PIDGIN_ACTION_JOIN_CHAT,
-};
-
-static const gchar *pidgin_action_group_room_list_actions[] = {
- PIDGIN_ACTION_ROOM_LIST,
-};
-
-/******************************************************************************
* Helpers
*****************************************************************************/
@@ -198,188 +160,6 @@
purple_prefs_connect_callback(group, pref_name, callback, group);
}
-/*< private >
- * pidgin_action_group_actions_set_enable:
- * @group: The #PidginActionGroup instance.
- * @actions: The action names.
- * @n_actions: The number of @actions.
- * @enabled: Whether or not to enable the actions.
- *
- * Sets the enabled property of the named actions to @enabled.
- */
-static void
-pidgin_action_group_actions_set_enable(PidginActionGroup *group,
- const gchar *const *actions,
- gint n_actions,
- gboolean enabled)
-{
- gint i = 0;
-
- for(i = 0; i < n_actions; i++) {
- GAction *action = NULL;
- const gchar *name = actions[i];
-
- action = g_action_map_lookup_action(G_ACTION_MAP(group), name);
-
- if(action != NULL) {
- g_simple_action_set_enabled(G_SIMPLE_ACTION(action), enabled);
- } else {
- g_warning("Failed to find action named %s", name);
- }
- }
-}
-
-/*< private >
- * pidgin_action_group_online_actions_set_enable:
- * @group: The #PidginActionGroup instance.
- * @enabled: %TRUE to enable the actions, %FALSE to disable them.
- *
- * Enables/disables the actions that require being online to use.
- */
-static void
-pidgin_action_group_online_actions_set_enable(PidginActionGroup *group,
- gboolean enabled)
-{
- gint n_actions = G_N_ELEMENTS(pidgin_action_group_online_actions);
-
- pidgin_action_group_actions_set_enable(group,
- pidgin_action_group_online_actions,
- n_actions,
- enabled);
-}
-
-/*< private >
- * pidgin_action_group_chat_actions_set_enable:
- * @group: The #PidginActionGroup instance.
- * @enabled: Whether or not to enable/disable the actions.
- *
- * Sets the enabled state of the chat specific actions to the value of @enabled.
- */
-static void
-pidgin_action_group_chat_actions_set_enable(PidginActionGroup *group,
- gboolean enabled)
-{
- gint n_actions = G_N_ELEMENTS(pidgin_action_group_chat_actions);
-
- pidgin_action_group_actions_set_enable(group,
- pidgin_action_group_chat_actions,
- n_actions,
- enabled);
-}
-
-/*< private >
- * pidgin_action_group_room_list_actions_set_enable:
- * @group: The #PidginActionGroup instance.
- * @enabled: Whether or not to enable/disable the actions.
- *
- * Sets the enabled state of the room list specific actions to the value of
- * @enabled.
- */
-static void
-pidgin_action_group_room_list_actions_set_enable(PidginActionGroup *group,
- gboolean enabled)
-{
- gint n_actions = G_N_ELEMENTS(pidgin_action_group_room_list_actions);
-
- pidgin_action_group_actions_set_enable(group,
- pidgin_action_group_room_list_actions,
- n_actions,
- enabled);
-}
-
-/******************************************************************************
- * Purple Signal Callbacks
- *****************************************************************************/
-static void
-pidgin_action_group_online_cb(gpointer data) {
- pidgin_action_group_online_actions_set_enable(PIDGIN_ACTION_GROUP(data),
- TRUE);
-}
-
-static void
-pidgin_action_group_offline_cb(gpointer data) {
- pidgin_action_group_online_actions_set_enable(PIDGIN_ACTION_GROUP(data),
- FALSE);
-}
-
-static void
-pidgin_action_group_signed_on_cb(PurpleAccount *account, gpointer data) {
- PidginActionGroup *group = PIDGIN_ACTION_GROUP(data);
- PurpleProtocol *protocol = NULL;
- const gchar *protocol_id = NULL;
- gboolean should_enable_chat = FALSE, should_enable_room_list = FALSE;
-
- protocol_id = purple_account_get_protocol_id(account);
- protocol = purple_protocols_find(protocol_id);
-
- /* We assume that the current state is correct, so we don't bother changing
- * state unless the newly connected account implements the chat interface,
- * which would cause a state change.
- */
- should_enable_chat = PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, info);
- if(should_enable_chat) {
- pidgin_action_group_chat_actions_set_enable(group, TRUE);
- }
-
- /* likewise, for the room list, we only care about enabling in this
- * handler.
- */
- should_enable_room_list = PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST,
- get_list);
- if(should_enable_room_list) {
- pidgin_action_group_room_list_actions_set_enable(group, TRUE);
- }
-}
-
-static void
-pidgin_action_group_signed_off_cb(PurpleAccount *account, gpointer data) {
- gboolean should_disable_chat = TRUE, should_disable_room_list = TRUE;
- GList *connections = NULL, *l = NULL;
-
- /* walk through all the connections, looking for online ones that implement
- * the chat interface. We don't bother checking the account that this
- * signal was emitted for, because it's already offline and will be
- * filtered out by the online check.
- */
- connections = purple_connections_get_all();
- for(l = connections; l != NULL; l = l->next) {
- PurpleConnection *connection = PURPLE_CONNECTION(l->data);
- PurpleProtocol *protocol = NULL;
-
- /* if the connection isn't online, we don't care about it */
- if(!PURPLE_CONNECTION_IS_CONNECTED(connection)) {
- continue;
- }
-
- protocol = purple_connection_get_protocol(connection);
-
- /* check if the protocol implements the chat interface */
- if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, info)) {
- should_disable_chat = FALSE;
- }
-
- /* check if the protocol implement the room list interface */
- if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST, get_list)) {
- should_disable_room_list = FALSE;
- }
-
- /* if we can't disable both, we can bail out of the loop */
- if(!should_disable_chat && !should_disable_room_list) {
- break;
- }
- }
-
- if(should_disable_chat) {
- pidgin_action_group_chat_actions_set_enable(PIDGIN_ACTION_GROUP(data),
- FALSE);
- }
-
- if(should_disable_room_list) {
- pidgin_action_group_room_list_actions_set_enable(PIDGIN_ACTION_GROUP(data),
- FALSE);
- }
-}
-
/******************************************************************************
* Preference Callbacks
*****************************************************************************/
@@ -465,133 +245,6 @@
* Action Callbacks
*****************************************************************************/
static void
-pidgin_action_group_about(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- GtkWidget *about = pidgin_about_dialog_new();
-
- /* fix me? */
-#if 0
- gtk_window_set_transient_for(GTK_WINDOW(about), GTK_WINDOW(window));
-#endif
-
- gtk_widget_show_all(about);
-}
-
-static void
-pidgin_action_group_add_buddy(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- purple_blist_request_add_buddy(NULL, NULL, NULL, NULL);
-}
-
-static void
-pidgin_action_group_add_chat(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- purple_blist_request_add_chat(NULL, NULL, NULL, NULL);
-}
-
-static void
-pidgin_action_group_add_group(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- purple_blist_request_add_group();
-}
-
-static void
-pidgin_action_group_buddy_pounces(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- pidgin_pounces_manager_show();
-}
-
-static void
-pidgin_action_group_custom_smiley(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- pidgin_smiley_manager_show();
-}
-
-static void
-pidgin_action_group_debug(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- gboolean old = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled");
- purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/enabled", !old);
-}
-
-static void
-pidgin_action_group_file_transfers(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- pidgin_xfer_dialog_show(NULL);
-}
-
-static void
-pidgin_action_group_get_user_info(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- pidgin_dialogs_info();
-}
-
-static void
-pidgin_action_group_join_chat(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- pidgin_blist_joinchat_show();
-}
-
-static void
-pidgin_action_group_new_message(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- pidgin_dialogs_im();
-}
-
-static void
-pidgin_action_group_online_help(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- purple_notify_uri(NULL, PURPLE_WEBSITE "help");
-}
-
-static void
-pidgin_action_group_preferences(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- pidgin_prefs_show();
-}
-
-static void
-pidgin_action_group_privacy(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- pidgin_privacy_dialog_show();
-}
-
-static void
-pidgin_action_group_quit(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- purple_core_quit();
-}
-
-static void
-pidgin_action_group_room_list(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- pidgin_roomlist_dialog_show();
-}
-
-static void
-pidgin_action_group_set_mood(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- pidgin_mood_dialog_show(NULL);
-}
-
-static void
pidgin_action_group_show_buddy_icons(GSimpleAction *action, GVariant *value,
gpointer data)
{
@@ -642,20 +295,6 @@
g_variant_get_string(value, NULL));
}
-static void
-pidgin_action_group_system_log(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- pidgin_syslog_show();
-}
-
-static void
-pidgin_action_group_view_user_log(GSimpleAction *simple, GVariant *parameter,
- gpointer data)
-{
- pidgin_dialogs_log();
-}
-
/******************************************************************************
* GObject Implementation
*****************************************************************************/
@@ -664,60 +303,8 @@
static void
pidgin_action_group_init(PidginActionGroup *group) {
- gpointer handle = NULL;
GActionEntry entries[] = {
{
- .name = PIDGIN_ACTION_ABOUT,
- .activate = pidgin_action_group_about,
- }, {
- .name = PIDGIN_ACTION_ADD_BUDDY,
- .activate = pidgin_action_group_add_buddy,
- }, {
- .name = PIDGIN_ACTION_ADD_CHAT,
- .activate = pidgin_action_group_add_chat,
- }, {
- .name = PIDGIN_ACTION_ADD_GROUP,
- .activate = pidgin_action_group_add_group,
- }, {
- .name = PIDGIN_ACTION_BUDDY_POUNCES,
- .activate = pidgin_action_group_buddy_pounces,
- }, {
- .name = PIDGIN_ACTION_CUSTOM_SMILEY,
- .activate = pidgin_action_group_custom_smiley,
- }, {
- .name = PIDGIN_ACTION_DEBUG,
- .activate = pidgin_action_group_debug,
- }, {
- .name = PIDGIN_ACTION_FILE_TRANSFERS,
- .activate = pidgin_action_group_file_transfers,
- }, {
- .name = PIDGIN_ACTION_GET_USER_INFO,
- .activate = pidgin_action_group_get_user_info,
- }, {
- .name = PIDGIN_ACTION_JOIN_CHAT,
- .activate = pidgin_action_group_join_chat,
- }, {
- .name = PIDGIN_ACTION_NEW_MESSAGE,
- .activate = pidgin_action_group_new_message,
- }, {
- .name = PIDGIN_ACTION_ONLINE_HELP,
- .activate = pidgin_action_group_online_help,
- }, {
- .name = PIDGIN_ACTION_PREFERENCES,
- .activate = pidgin_action_group_preferences,
- }, {
- .name = PIDGIN_ACTION_PRIVACY,
- .activate = pidgin_action_group_privacy,
- }, {
- .name = PIDGIN_ACTION_QUIT,
- .activate = pidgin_action_group_quit,
- }, {
- .name = PIDGIN_ACTION_ROOM_LIST,
- .activate = pidgin_action_group_room_list,
- }, {
- .name = PIDGIN_ACTION_SET_MOOD,
- .activate = pidgin_action_group_set_mood,
- }, {
.name = PIDGIN_ACTION_SHOW_BUDDY_ICONS,
.state = "false",
.change_state = pidgin_action_group_show_buddy_icons,
@@ -742,12 +329,6 @@
.parameter_type = "s",
.state = "'none'",
.change_state = pidgin_action_group_sort_method,
- }, {
- .name = PIDGIN_ACTION_SYSTEM_LOG,
- .activate = pidgin_action_group_system_log,
- }, {
- .name = PIDGIN_ACTION_VIEW_USER_LOG,
- .activate = pidgin_action_group_view_user_log,
},
};
@@ -776,35 +357,6 @@
pidgin_action_group_setup_string(group, PIDGIN_ACTION_SORT_METHOD,
PIDGIN_PREFS_ROOT "/blist/sort_type",
pidgin_action_group_sort_method_callback);
-
- /* assume we are offline and disable all of the actions that require us to
- * be online.
- */
- pidgin_action_group_online_actions_set_enable(group, FALSE);
- pidgin_action_group_chat_actions_set_enable(group, FALSE);
- pidgin_action_group_room_list_actions_set_enable(group, FALSE);
-
- /* connect to the online and offline signals in purple connections. This
- * is used to toggle states of actions that require being online.
- */
- handle = purple_connections_get_handle();
- purple_signal_connect(handle, "online", group,
- PURPLE_CALLBACK(pidgin_action_group_online_cb),
- group);
- purple_signal_connect(handle, "offline", group,
- PURPLE_CALLBACK(pidgin_action_group_offline_cb),
- group);
-
- /* connect to account-signed-on and account-signed-off to toggle actions
- * that depend on specific interfaces in accounts.
- */
- handle = purple_accounts_get_handle();
- purple_signal_connect(handle, "account-signed-on", group,
- PURPLE_CALLBACK(pidgin_action_group_signed_on_cb),
- group);
- purple_signal_connect(handle, "account-signed-off", group,
- PURPLE_CALLBACK(pidgin_action_group_signed_off_cb),
- group);
};
static void
--- a/pidgin/pidginactiongroup.h Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/pidginactiongroup.h Sat Nov 14 03:15:43 2020 -0600
@@ -43,131 +43,6 @@
#include <gio/gio.h>
/**
- * PIDGIN_ACTION_ABOUT:
- *
- * A constant that represents the about action that shows the about window.
- */
-#define PIDGIN_ACTION_ABOUT ("about")
-
-/**
- * PIDGIN_ACTION_ADD_BUDDY:
- *
- * A constant that represents the add-buddy action to add a buddy to the
- * contact list.
- */
-#define PIDGIN_ACTION_ADD_BUDDY ("add-buddy")
-
-/**
- * PIDGIN_ACTION_ADD_CHAT:
- *
- * A constant that represents the add-chat action to add a chat to the
- * contact list.
- */
-#define PIDGIN_ACTION_ADD_CHAT ("add-chat")
-
-/**
- * PIDGIN_ACTION_ADD_GROUP:
- *
- * A constant that represents the add-group action to add a group to the
- * contact list.
- */
-#define PIDGIN_ACTION_ADD_GROUP ("add-group")
-
-/**
- * PIDGIN_ACTION_BUDDY_POUNCES:
- *
- * A constant that represents the pounces action.
- */
-#define PIDGIN_ACTION_BUDDY_POUNCES ("buddy-pounces")
-
-/**
- * PIDGIN_ACTION_CUSTOM_SMILEY:
- *
- * A constant that represents the custom-smiley action to toggle the visibility
- * of the smiley manager.
- */
-#define PIDGIN_ACTION_CUSTOM_SMILEY ("custom-smiley")
-
-/**
- * PIDGIN_ACTION_DEBUG:
- *
- * A constant that represents the debug action to toggle the visibility of the
- * debug window.
- */
-#define PIDGIN_ACTION_DEBUG ("debug")
-
-/**
- * PIDGIN_ACTION_FILE_TRANSFERS:
- *
- * A constant that represents the file-transfers action to toggle the
- * visibility of the file transfers window.
- */
-#define PIDGIN_ACTION_FILE_TRANSFERS ("file-transfers")
-
-/**
- * PIDGIN_ACTION_GET_USER_INFO:
- *
- * A constant that represents the get-user-info action.
- */
-#define PIDGIN_ACTION_GET_USER_INFO ("get-user-info")
-
-/**
- * PIDGIN_ACTION_JOIN_CHAT:
- *
- * A constant that represents the join-chat action.
- */
-#define PIDGIN_ACTION_JOIN_CHAT ("join-chat")
-
-/**
- * PIDGIN_ACTION_NEW_MESSAGE:
- *
- * A constant that represents the new-message action.
- */
-#define PIDGIN_ACTION_NEW_MESSAGE ("new-message")
-
-/**
- * PIDGIN_ACTION_ONLINE_HELP:
- *
- * A constant that represents the online-help action.
- */
-#define PIDGIN_ACTION_ONLINE_HELP ("online-help")
-
-/**
- * PIDGIN_ACTION_PREFERENCES:
- *
- * A constant that represents the preferences action.
- */
-#define PIDGIN_ACTION_PREFERENCES ("preferences")
-
-/**
- * PIDGIN_ACTION_PRIVACY:
- *
- * A constant that represents the privacy action.
- */
-#define PIDGIN_ACTION_PRIVACY ("privacy")
-
-/**
- * PIDGIN_ACTION_QUIT:
- *
- * A constant that represents the quit action.
- */
-#define PIDGIN_ACTION_QUIT ("quit")
-
-/**
- * PIDGIN_ACTION_ROOM_LIST:
- *
- * A constant that represents the room-list action.
- */
-#define PIDGIN_ACTION_ROOM_LIST ("room-list")
-
-/**
- * PIDGIN_ACTION_SET_MOOD:
- *
- * A constant that represents the set-mood action.
- */
-#define PIDGIN_ACTION_SET_MOOD ("set-mood")
-
-/**
* PIDGIN_ACTION_SHOW_BUDDY_ICONS:
*
* A constant that represents the show-buddy-icons action.
@@ -210,20 +85,6 @@
*/
#define PIDGIN_ACTION_SORT_METHOD ("sort-method")
-/**
- * PIDGIN_ACTION_SYSTEM_LOG:
- *
- * A constant that represents the system-log action.
- */
-#define PIDGIN_ACTION_SYSTEM_LOG ("system-log")
-
-/**
- * PIDGIN_ACTION_VIEW_USER_LOG:
- *
- * A constant that represents the view-user-log action.
- */
-#define PIDGIN_ACTION_VIEW_USER_LOG ("view-user-log")
-
G_BEGIN_DECLS
#define PIDGIN_TYPE_ACTION_GROUP (pidgin_action_group_get_type())
--- a/pidgin/pidginapplication.c Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/pidginapplication.c Sat Nov 14 03:15:43 2020 -0600
@@ -35,8 +35,19 @@
#include "gtkaccount.h"
#include "gtkblist.h"
+#include "gtkdialogs.h"
+#include "gtkpounce.h"
+#include "gtkprefs.h"
+#include "gtkprivacy.h"
+#include "gtkroomlist.h"
+#include "gtksmiley-manager.h"
+#include "gtkxfer.h"
+#include "pidginabout.h"
#include "pidgincore.h"
#include "pidgindebug.h"
+#include "pidginlog.h"
+#include "pidginmooddialog.h"
+#include "pidgin/pidginpluginsdialog.h"
struct _PidginApplication {
GtkApplication parent;
@@ -67,6 +78,422 @@
G_DEFINE_TYPE(PidginApplication, pidgin_application, GTK_TYPE_APPLICATION)
/******************************************************************************
+ * Actions
+ *****************************************************************************/
+/**< private >
+ * pidgin_application_online_actions:
+ *
+ * This list keeps track of which actions should only be enabled while online.
+ */
+static const gchar *pidgin_application_online_actions[] = {
+ "add-buddy",
+ "add-group",
+ "get-user-info",
+ "new-message",
+ "privacy",
+ "set-mood",
+};
+
+/**< private >
+ * pidgin_application_chat_actions:
+ *
+ * This list keeps track of which actions should only be enabled if a protocol
+ * supporting groups chats is connected.
+ */
+static const gchar *pidgin_application_chat_actions[] = {
+ "add-chat",
+ "join-chat",
+};
+
+/**< private >
+ * pidgin_application_room_list_actions:
+ *
+ * This list keeps track of which actions should only be enabled if an online
+ * account supports room lists.
+ */
+static const gchar *pidgin_application_room_list_actions[] = {
+ "room-list",
+};
+
+/*< private >
+ * pidgin_action_group_actions_set_enable:
+ * @group: The #PidginActionGroup instance.
+ * @actions: The action names.
+ * @n_actions: The number of @actions.
+ * @enabled: Whether or not to enable the actions.
+ *
+ * Sets the enabled property of the named actions to @enabled.
+ */
+static void
+pidgin_application_actions_set_enabled(PidginApplication *application,
+ const gchar *const *actions,
+ gint n_actions,
+ gboolean enabled)
+{
+ gint i = 0;
+
+ for(i = 0; i < n_actions; i++) {
+ GAction *action = NULL;
+ const gchar *name = actions[i];
+
+ action = g_action_map_lookup_action(G_ACTION_MAP(application), name);
+
+ if(action != NULL) {
+ g_simple_action_set_enabled(G_SIMPLE_ACTION(action), enabled);
+ } else {
+ g_warning("Failed to find action named %s", name);
+ }
+ }
+}
+
+static void
+pidgin_application_about(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ GtkWidget *about = pidgin_about_dialog_new();
+
+ /* fix me? */
+#if 0
+ gtk_window_set_transient_for(GTK_WINDOW(about), GTK_WINDOW(window));
+#endif
+
+ gtk_widget_show_all(about);
+}
+
+static void
+pidgin_application_accounts(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_accounts_window_show();
+}
+
+static void
+pidgin_application_add_buddy(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ purple_blist_request_add_buddy(NULL, NULL, NULL, NULL);
+}
+
+static void
+pidgin_application_add_chat(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ purple_blist_request_add_chat(NULL, NULL, NULL, NULL);
+}
+
+static void
+pidgin_application_add_group(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ purple_blist_request_add_group();
+}
+
+static void
+pidgin_application_buddy_pounces(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_pounces_manager_show();
+}
+
+static void
+pidgin_application_custom_smiley(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_smiley_manager_show();
+}
+
+static void
+pidgin_application_debug(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ gboolean old = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled");
+ purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/enabled", !old);
+}
+
+static void
+pidgin_application_file_transfers(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_xfer_dialog_show(NULL);
+}
+
+static void
+pidgin_application_get_user_info(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_dialogs_info();
+}
+
+static void
+pidgin_application_join_chat(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_blist_joinchat_show();
+}
+
+static void
+pidgin_application_new_message(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_dialogs_im();
+}
+
+static void
+pidgin_application_online_help(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ purple_notify_uri(NULL, PURPLE_WEBSITE "help");
+}
+
+static void
+pidgin_application_plugins(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ GtkWidget *dialog = pidgin_plugins_dialog_new();
+
+ /* fixme? */
+#if 0
+ gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(window));
+#endif
+
+ gtk_widget_show_all(dialog);
+}
+
+static void
+pidgin_application_preferences(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_prefs_show();
+}
+
+static void
+pidgin_application_privacy(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_privacy_dialog_show();
+}
+
+static void
+pidgin_application_quit(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ purple_core_quit();
+}
+
+static void
+pidgin_application_room_list(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_roomlist_dialog_show();
+}
+
+static void
+pidgin_application_set_mood(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_mood_dialog_show(NULL);
+}
+
+static void
+pidgin_application_system_log(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_syslog_show();
+}
+
+static void
+pidgin_application_view_user_log(GSimpleAction *simple, GVariant *parameter,
+ gpointer data)
+{
+ pidgin_dialogs_log();
+}
+
+static GActionEntry app_entries[] = {
+ {
+ .name = "about",
+ .activate = pidgin_application_about,
+ }, {
+ .name = "add-buddy",
+ .activate = pidgin_application_add_buddy,
+ }, {
+ .name = "add-chat",
+ .activate = pidgin_application_add_chat,
+ }, {
+ .name = "add-group",
+ .activate = pidgin_application_add_group,
+ }, {
+ .name = "buddy-pounces",
+ .activate = pidgin_application_buddy_pounces,
+ }, {
+ .name = "custom-smiley",
+ .activate = pidgin_application_custom_smiley,
+ }, {
+ .name = "debug",
+ .activate = pidgin_application_debug,
+ }, {
+ .name = "file-transfers",
+ .activate = pidgin_application_file_transfers,
+ }, {
+ .name = "get-user-info",
+ .activate = pidgin_application_get_user_info,
+ }, {
+ .name = "join-chat",
+ .activate = pidgin_application_join_chat,
+ }, {
+ .name = "manage-accounts",
+ .activate = pidgin_application_accounts,
+ }, {
+ .name = "manage-plugins",
+ .activate = pidgin_application_plugins,
+ }, {
+ .name = "new-message",
+ .activate = pidgin_application_new_message,
+ }, {
+ .name = "online-help",
+ .activate = pidgin_application_online_help,
+ }, {
+ .name = "preferences",
+ .activate = pidgin_application_preferences,
+ }, {
+ .name = "privacy",
+ .activate = pidgin_application_privacy,
+ }, {
+ .name = "quit",
+ .activate = pidgin_application_quit,
+ }, {
+ .name = "room-list",
+ .activate = pidgin_application_room_list,
+ }, {
+ .name = "set-mood",
+ .activate = pidgin_application_set_mood,
+ }, {
+ .name = "system-log",
+ .activate = pidgin_application_system_log,
+ }, {
+ .name = "view-user-log",
+ .activate = pidgin_application_view_user_log,
+ }
+};
+
+/******************************************************************************
+ * Purple Signal Callbacks
+ *****************************************************************************/
+static void
+pidgin_application_online_cb(gpointer data) {
+ gint n_actions = G_N_ELEMENTS(pidgin_application_online_actions);
+
+ pidgin_application_actions_set_enabled(PIDGIN_APPLICATION(data),
+ pidgin_application_online_actions,
+ n_actions,
+ TRUE);
+}
+
+static void
+pidgin_application_offline_cb(gpointer data) {
+ gint n_actions = G_N_ELEMENTS(pidgin_application_online_actions);
+
+ pidgin_application_actions_set_enabled(PIDGIN_APPLICATION(data),
+ pidgin_application_online_actions,
+ n_actions,
+ FALSE);
+}
+
+static void
+pidgin_application_signed_on_cb(PurpleAccount *account, gpointer data) {
+ PidginApplication *application = PIDGIN_APPLICATION(data);
+ PurpleProtocol *protocol = NULL;
+ const gchar *protocol_id = NULL;
+ gboolean should_enable_chat = FALSE, should_enable_room_list = FALSE;
+ gint n_actions = 0;
+
+ protocol_id = purple_account_get_protocol_id(account);
+ protocol = purple_protocols_find(protocol_id);
+
+ /* We assume that the current state is correct, so we don't bother changing
+ * state unless the newly connected account implements the chat interface,
+ * which would cause a state change.
+ */
+ should_enable_chat = PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, info);
+ if(should_enable_chat) {
+ n_actions = G_N_ELEMENTS(pidgin_application_chat_actions);
+ pidgin_application_actions_set_enabled(application,
+ pidgin_application_chat_actions,
+ n_actions,
+ TRUE);
+ }
+
+ /* likewise, for the room list, we only care about enabling in this
+ * handler.
+ */
+ should_enable_room_list = PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST,
+ get_list);
+ if(should_enable_room_list) {
+ n_actions = G_N_ELEMENTS(pidgin_application_room_list_actions);
+ pidgin_application_actions_set_enabled(application,
+ pidgin_application_room_list_actions,
+ n_actions,
+ TRUE);
+ }
+}
+
+static void
+pidgin_application_signed_off_cb(PurpleAccount *account, gpointer data) {
+ PidginApplication *application = PIDGIN_APPLICATION(data);
+ gboolean should_disable_chat = TRUE, should_disable_room_list = TRUE;
+ GList *connections = NULL, *l = NULL;
+ gint n_actions = 0;
+
+ /* walk through all the connections, looking for online ones that implement
+ * the chat interface. We don't bother checking the account that this
+ * signal was emitted for, because it's already offline and will be
+ * filtered out by the online check.
+ */
+ connections = purple_connections_get_all();
+ for(l = connections; l != NULL; l = l->next) {
+ PurpleConnection *connection = PURPLE_CONNECTION(l->data);
+ PurpleProtocol *protocol = NULL;
+
+ /* if the connection isn't online, we don't care about it */
+ if(!PURPLE_CONNECTION_IS_CONNECTED(connection)) {
+ continue;
+ }
+
+ protocol = purple_connection_get_protocol(connection);
+
+ /* check if the protocol implements the chat interface */
+ if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, info)) {
+ should_disable_chat = FALSE;
+ }
+
+ /* check if the protocol implements the room list interface */
+ if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST, get_list)) {
+ should_disable_room_list = FALSE;
+ }
+
+ /* if we can't disable both, we can bail out of the loop */
+ if(!should_disable_chat && !should_disable_room_list) {
+ break;
+ }
+ }
+
+ if(should_disable_chat) {
+ n_actions = G_N_ELEMENTS(pidgin_application_chat_actions);
+ pidgin_application_actions_set_enabled(application,
+ pidgin_application_chat_actions,
+ n_actions,
+ FALSE);
+ }
+
+ if(should_disable_room_list) {
+ n_actions = G_N_ELEMENTS(pidgin_application_room_list_actions);
+ pidgin_application_actions_set_enabled(application,
+ pidgin_application_room_list_actions,
+ n_actions,
+ FALSE);
+ }
+}
+
+/******************************************************************************
* GApplication Implementation
*****************************************************************************/
static void
@@ -75,6 +502,7 @@
GError *error = NULL;
GList *active_accounts = NULL;
gchar *search_path = NULL;
+ gpointer handle = NULL;
G_APPLICATION_CLASS(pidgin_application_parent_class)->startup(application);
@@ -201,6 +629,29 @@
/* TODO: Use GtkApplicationWindow or add a window instead */
g_application_hold(application);
+
+ /* connect to the online and offline signals in purple connections. This
+ * is used to toggle states of actions that require being online.
+ */
+ handle = purple_connections_get_handle();
+ purple_signal_connect(handle, "online", application,
+ PURPLE_CALLBACK(pidgin_application_online_cb),
+ application);
+ purple_signal_connect(handle, "offline", application,
+ PURPLE_CALLBACK(pidgin_application_offline_cb),
+ application);
+
+ /* connect to account-signed-on and account-signed-off to toggle actions
+ * that depend on specific interfaces in accounts.
+ */
+ handle = purple_accounts_get_handle();
+ purple_signal_connect(handle, "account-signed-on", application,
+ PURPLE_CALLBACK(pidgin_application_signed_on_cb),
+ application);
+ purple_signal_connect(handle, "account-signed-off", application,
+ PURPLE_CALLBACK(pidgin_application_signed_off_cb),
+ application);
+
}
static void
@@ -256,10 +707,36 @@
static void
pidgin_application_init(PidginApplication *application) {
GApplication *gapp = G_APPLICATION(application);
+ gboolean online = FALSE;
+ gint n_actions = 0;
g_application_add_main_option_entries(gapp, option_entries);
g_application_add_option_group(gapp, purple_get_option_group());
g_application_add_option_group(gapp, gplugin_get_option_group());
+
+ g_action_map_add_action_entries(G_ACTION_MAP(application), app_entries,
+ G_N_ELEMENTS(app_entries), application);
+
+ /* Set the default state for our actions to match our online state. */
+ online = purple_connections_is_online();
+
+ n_actions = G_N_ELEMENTS(pidgin_application_online_actions);
+ pidgin_application_actions_set_enabled(application,
+ pidgin_application_online_actions,
+ n_actions,
+ online);
+
+ n_actions = G_N_ELEMENTS(pidgin_application_chat_actions);
+ pidgin_application_actions_set_enabled(application,
+ pidgin_application_chat_actions,
+ n_actions,
+ online);
+
+ n_actions = G_N_ELEMENTS(pidgin_application_room_list_actions);
+ pidgin_application_actions_set_enabled(application,
+ pidgin_application_room_list_actions,
+ n_actions,
+ online);
}
static void
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/pidgincontactlist.c Sat Nov 14 03:15:43 2020 -0600
@@ -0,0 +1,78 @@
+/*
+ * 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/>.
+ */
+
+#include "pidgincontactlist.h"
+
+#include "pidginactiongroup.h"
+
+struct _PidginContactList {
+ GtkApplicationWindow parent;
+
+ GtkWidget *vbox;
+};
+
+G_DEFINE_TYPE(PidginContactList, pidgin_contact_list,
+ GTK_TYPE_APPLICATION_WINDOW)
+
+/******************************************************************************
+ * GObject Implementation
+ *****************************************************************************/
+static void
+pidgin_contact_list_init(PidginContactList *contact_list) {
+ GSimpleActionGroup *group = NULL;
+
+ gtk_widget_init_template(GTK_WIDGET(contact_list));
+
+ gtk_window_set_application(GTK_WINDOW(contact_list),
+ GTK_APPLICATION(g_application_get_default()));
+
+ group = pidgin_action_group_new();
+ gtk_widget_insert_action_group(GTK_WIDGET(contact_list), "blist",
+ G_ACTION_GROUP(group));
+}
+
+static void
+pidgin_contact_list_class_init(PidginContactListClass *klass) {
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+
+ gtk_widget_class_set_template_from_resource(
+ widget_class,
+ "/im/pidgin/Pidgin/BuddyList/window.ui"
+ );
+
+ gtk_widget_class_bind_template_child(widget_class, PidginContactList, vbox);
+}
+
+/******************************************************************************
+ * Public API
+ *****************************************************************************/
+GtkWidget *
+pidgin_contact_list_new(void) {
+ return GTK_WIDGET(g_object_new(PIDGIN_TYPE_CONTACT_LIST, NULL));
+}
+
+GtkWidget *
+pidgin_contact_list_get_vbox(PidginContactList *contact_list) {
+ g_return_val_if_fail(PIDGIN_IS_CONTACT_LIST(contact_list), NULL);
+
+ return contact_list->vbox;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/pidgincontactlist.h Sat Nov 14 03:15:43 2020 -0600
@@ -0,0 +1,72 @@
+/*
+ * 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_CONTACT_LIST_H
+#define PIDGIN_CONTACT_LIST_H
+
+/**
+ * SECTION:pidgincontactlist
+ * @section_id: pidgin-contactlist
+ * @short_description: The contact list widget.
+ * @title: Contact list widget
+ *
+ * #PidginContactList is a transitional widget as we slowly migrate it into the
+ * conversation window to make a single window application.
+ */
+
+#include <glib.h>
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PIDGIN_TYPE_CONTACT_LIST (pidgin_contact_list_get_type())
+G_DECLARE_FINAL_TYPE(PidginContactList, pidgin_contact_list, PIDGIN,
+ CONTACT_LIST, GtkApplicationWindow)
+
+/**
+ * pidgin_contact_list_new:
+ *
+ * Creates a new #PidginContactList instance.
+ *
+ * Returns: (transfer full): The new #PidginContactList instance.
+ */
+GtkWidget *pidgin_contact_list_new(void);
+
+/**
+ * pidgin_contact_list_get_vbox:
+ * @contact_list: The #PidginContactList instance.
+ *
+ * Gets the main vbox for @contact_list.
+ *
+ * Returns: (transfer none): The main vbox of @contact_list.
+ */
+GtkWidget *pidgin_contact_list_get_vbox(PidginContactList *contact_list);
+
+
+G_END_DECLS
+
+#endif /* PIDGIN_CONTACT_LIST_H */
--- a/pidgin/pidginpluginsmenu.c Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/pidginpluginsmenu.c Sat Nov 14 03:15:43 2020 -0600
@@ -26,8 +26,6 @@
#include <purple.h>
-#include "pidgin/pidginpluginsdialog.h"
-
struct _PidginPluginsMenu {
GtkMenu parent;
@@ -215,35 +213,12 @@
}
/******************************************************************************
- * Static Actions
- *****************************************************************************/
-static void
-pidgin_plugins_menu_show_manager(GSimpleAction *action, GVariant *parameter,
- gpointer data)
-{
- GtkWidget *dialog = pidgin_plugins_dialog_new();
-
- /* fixme? */
-#if 0
- gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(window));
-#endif
-
- gtk_widget_show_all(dialog);
-}
-
-/******************************************************************************
* GObject Implementation
*****************************************************************************/
G_DEFINE_TYPE(PidginPluginsMenu, pidgin_plugins_menu, GTK_TYPE_MENU)
static void
pidgin_plugins_menu_init(PidginPluginsMenu *menu) {
- GActionEntry actions[] = {
- {
- .name = "manager",
- .activate = pidgin_plugins_menu_show_manager,
- }
- };
gpointer handle;
/* initialize our template */
@@ -251,8 +226,6 @@
/* create our internal action group and assign it to ourself */
menu->action_group = g_simple_action_group_new();
- g_action_map_add_action_entries(G_ACTION_MAP(menu->action_group), actions,
- G_N_ELEMENTS(actions), NULL);
gtk_widget_insert_action_group(GTK_WIDGET(menu),
PIDGIN_PLUGINS_MENU_ACTION_PREFIX,
G_ACTION_GROUP(menu->action_group));
--- a/pidgin/resources/Accounts/menu.ui Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/resources/Accounts/menu.ui Sat Nov 14 03:15:43 2020 -0600
@@ -33,9 +33,9 @@
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="action_name">app.manage-accounts</property>
<property name="label" translatable="yes">Account _Manager</property>
<property name="use_underline">True</property>
- <signal name="activate" handler="pidgin_accounts_menu_open_manager_cb" object="PidginAccountsMenu" swapped="no"/>
<accelerator key="a" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
--- a/pidgin/resources/BuddyList/menu.ui Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/resources/BuddyList/menu.ui Sat Nov 14 03:15:43 2020 -0600
@@ -1,8 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.2 -->
+<!-- Generated with glade 3.22.2
+
+Pidgin - Internet Messenger
+Copyright (C) Pidgin Developers <devel@pidgin.im>
+
+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/>.
+
+-->
<interface>
<requires lib="gtk+" version="3.20"/>
<requires lib="pidgin" version="3.0"/>
+ <!-- interface-license-type gplv2 -->
+ <!-- interface-name Pidgin -->
+ <!-- interface-description Internet Messenger -->
+ <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
<template class="PidginBuddyListMenu" parent="GtkMenuBar">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -20,7 +42,7 @@
<object class="GtkMenuItem" id="new_message">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.new-message</property>
+ <property name="action_name">app.new-message</property>
<property name="label" translatable="yes">New Instant _Message...</property>
<property name="use_underline">True</property>
<accelerator key="m" signal="activate" modifiers="GDK_CONTROL_MASK"/>
@@ -30,7 +52,7 @@
<object class="GtkMenuItem" id="join_chat">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.join-chat</property>
+ <property name="action_name">app.join-chat</property>
<property name="label" translatable="yes">Join a _Chat...</property>
<property name="use_underline">True</property>
<accelerator key="c" signal="activate" modifiers="GDK_CONTROL_MASK"/>
@@ -40,7 +62,7 @@
<object class="GtkMenuItem" id="get_user_info">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.get-user-info</property>
+ <property name="action_name">app.get-user-info</property>
<property name="label" translatable="yes">Get User _Info...</property>
<property name="use_underline">True</property>
<accelerator key="i" signal="activate" modifiers="GDK_CONTROL_MASK"/>
@@ -50,7 +72,7 @@
<object class="GtkMenuItem" id="view_user_log">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.view-user-log</property>
+ <property name="action_name">app.view-user-log</property>
<property name="label" translatable="yes">View User _Log...</property>
<property name="use_underline">True</property>
<accelerator key="l" signal="activate" modifiers="GDK_CONTROL_MASK"/>
@@ -139,7 +161,7 @@
<object class="GtkMenuItem" id="add_buddy">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.add-buddy</property>
+ <property name="action_name">app.add-buddy</property>
<property name="label" translatable="yes">_Add Buddy...</property>
<property name="use_underline">True</property>
<accelerator key="b" signal="activate" modifiers="GDK_CONTROL_MASK"/>
@@ -149,7 +171,7 @@
<object class="GtkMenuItem" id="add_chat">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.add-chat</property>
+ <property name="action_name">app.add-chat</property>
<property name="label" translatable="yes">Add C_hat...</property>
<property name="use_underline">True</property>
</object>
@@ -158,7 +180,7 @@
<object class="GtkMenuItem" id="add_group">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.add-group</property>
+ <property name="action_name">app.add-group</property>
<property name="label" translatable="yes">Add _Group...</property>
<property name="use_underline">True</property>
</object>
@@ -173,7 +195,7 @@
<object class="GtkMenuItem" id="quit">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.quit</property>
+ <property name="action_name">app.quit</property>
<property name="label" translatable="yes">_Quit</property>
<property name="use_underline">True</property>
<accelerator key="q" signal="activate" modifiers="GDK_CONTROL_MASK"/>
@@ -205,7 +227,7 @@
<object class="GtkMenuItem" id="buddy_pounces">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.buddy-pounces</property>
+ <property name="action_name">app.buddy-pounces</property>
<property name="label" translatable="yes">Buddy _Pounces</property>
<property name="use_underline">True</property>
</object>
@@ -214,7 +236,7 @@
<object class="GtkMenuItem" id="custom_smileys">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.custom-smiley</property>
+ <property name="action_name">app.custom-smiley</property>
<property name="label" translatable="yes">Custom Smile_ys</property>
<property name="use_underline">True</property>
<accelerator key="y" signal="activate" modifiers="GDK_CONTROL_MASK"/>
@@ -224,7 +246,7 @@
<object class="GtkMenuItem" id="preferences">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.preferences</property>
+ <property name="action_name">app.preferences</property>
<property name="label" translatable="yes">Pr_eferences</property>
<property name="use_underline">True</property>
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
@@ -234,7 +256,7 @@
<object class="GtkMenuItem" id="privacy">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.privacy</property>
+ <property name="action_name">app.privacy</property>
<property name="label" translatable="yes">Pr_ivacy</property>
<property name="use_underline">True</property>
</object>
@@ -243,7 +265,7 @@
<object class="GtkMenuItem" id="set_mood">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.set-mood</property>
+ <property name="action_name">app.set-mood</property>
<property name="label" translatable="yes">Set _Mood</property>
<property name="use_underline">True</property>
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/>
@@ -259,7 +281,7 @@
<object class="GtkMenuItem" id="file_transfers">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.file-transfers</property>
+ <property name="action_name">app.file-transfers</property>
<property name="label" translatable="yes">_File Transfers</property>
<property name="use_underline">True</property>
<accelerator key="t" signal="activate" modifiers="GDK_CONTROL_MASK"/>
@@ -269,7 +291,7 @@
<object class="GtkMenuItem" id="room_list">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.room-list</property>
+ <property name="action_name">app.room-list</property>
<property name="label" translatable="yes">R_oom List</property>
<property name="use_underline">True</property>
</object>
@@ -278,7 +300,7 @@
<object class="GtkMenuItem" id="system_log">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.system-log</property>
+ <property name="action_name">app.system-log</property>
<property name="label" translatable="yes">System _Log</property>
<property name="use_underline">True</property>
</object>
@@ -309,7 +331,7 @@
<object class="GtkMenuItem" id="online_help">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.online-help</property>
+ <property name="action_name">app.online-help</property>
<property name="label" translatable="yes">Online _Help</property>
<property name="use_underline">True</property>
<accelerator key="F1" signal="activate"/>
@@ -319,7 +341,7 @@
<object class="GtkMenuItem" id="debug">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.debug</property>
+ <property name="action_name">app.debug</property>
<property name="label" translatable="yes">_Debug Window</property>
<property name="use_underline">True</property>
</object>
@@ -328,7 +350,7 @@
<object class="GtkMenuItem" id="about">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">blist.about</property>
+ <property name="action_name">app.about</property>
<property name="label" translatable="yes">_About</property>
<property name="use_underline">True</property>
</object>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/BuddyList/window.ui Sat Nov 14 03:15:43 2020 -0600
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.2
+
+Pidgin - Internet Messenger
+Copyright (C) Pidgin Developers <devel@pidgin.im>
+
+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/>.
+
+-->
+<interface>
+ <requires lib="gtk+" version="3.20"/>
+ <requires lib="pidgin" version="3.0"/>
+ <!-- interface-license-type gplv2 -->
+ <!-- interface-name Pidgin -->
+ <!-- interface-description Internet Messenger -->
+ <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
+ <template class="PidginContactList" parent="GtkApplicationWindow">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Contact List</property>
+ <property name="role">contact_list</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkBox" id="vbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
--- a/pidgin/resources/Plugins/menu.ui Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/resources/Plugins/menu.ui Sat Nov 14 03:15:43 2020 -0600
@@ -15,8 +15,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 02110-1301, USA.
+along with this program; if not, see <https://www.gnu.org/licenses/>.
-->
<interface>
@@ -32,7 +31,7 @@
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">plugins-menu.manager</property>
+ <property name="action_name">app.manage-plugins</property>
<property name="label" translatable="yes">Manage Plu_gins</property>
<property name="use_underline">True</property>
<accelerator key="u" signal="activate" modifiers="GDK_CONTROL_MASK"/>
--- a/pidgin/resources/pidgin.gresource.xml Sat Nov 14 03:05:16 2020 -0600
+++ b/pidgin/resources/pidgin.gresource.xml Sat Nov 14 03:15:43 2020 -0600
@@ -10,6 +10,7 @@
<file compressed="true">Accounts/entry.css</file>
<file compressed="true">Accounts/menu.ui</file>
<file compressed="true">BuddyList/menu.ui</file>
+ <file compressed="true">BuddyList/window.ui</file>
<file compressed="true">Conversations/invite_dialog.ui</file>
<file compressed="true">Conversations/tab-label.css</file>
<file compressed="true">Conversations/window.ui</file>
--- a/po/POTFILES.in Sat Nov 14 03:05:16 2020 -0600
+++ b/po/POTFILES.in Sat Nov 14 03:15:43 2020 -0600
@@ -344,6 +344,7 @@
pidgin/pidginclosebutton.c
pidgin/pidgincontactcompletion.c
pidgin/pidginconversationwindow.c
+pidgin/pidgincontactlist.c
pidgin/pidgindebug.c
pidgin/pidgindialog.c
pidgin/pidgingdkpixbuf.c