pidgin/pidgin

3f2e9e346f6f
Parents 4cdb2a681dc1
Children a10a60c6cea4
Fix a bunch of stuff that was found in review.
--- a/doc/reference/libpurple/signals_connection.xml Tue Apr 07 18:28:26 2020 -0500
+++ b/doc/reference/libpurple/signals_connection.xml Sun Apr 26 03:22:31 2020 -0500
@@ -29,7 +29,7 @@
</programlisting>
<para>
Emitted when the first connection has connected when all connections were
-previsously not connected.
+previously not connected.
</para>
<variablelist role="params">
<varlistentry>
--- a/pidgin/pidginaccountactionsmenu.c Tue Apr 07 18:28:26 2020 -0500
+++ b/pidgin/pidginaccountactionsmenu.c Sun Apr 26 03:22:31 2020 -0500
@@ -92,14 +92,12 @@
gboolean show_separator = FALSE;
gint position = 0;
- g_clear_object(&menu->account);
-
- if(!PURPLE_IS_ACCOUNT(account)) {
- return;
+ if(g_set_object(&menu->account, account)) {
+ if(!PURPLE_IS_ACCOUNT(menu->account)) {
+ return;
+ }
}
- menu->account = PURPLE_ACCOUNT(g_object_ref(G_OBJECT(account)));
-
connection = purple_account_get_connection(account);
if(connection == NULL) {
return;
--- a/pidgin/pidginaccountactionsmenu.h Tue Apr 07 18:28:26 2020 -0500
+++ b/pidgin/pidginaccountactionsmenu.h Sun Apr 26 03:22:31 2020 -0500
@@ -28,8 +28,8 @@
* @short_description: A menu for managing account actions
* @title: Accounts Actions Menu
*
- * #PidginAccountActionsMenu is a #GtkMenu that provides an interface to users
- * edit accounts and activate its actions.
+ * #PidginAccountActionsMenu is a #GtkMenu that provides an interface for users
+ * to edit accounts and activate the account's actions.
*/
#include <gtk/gtk.h>
--- a/pidgin/pidginaccountsmenu.c Tue Apr 07 18:28:26 2020 -0500
+++ b/pidgin/pidginaccountsmenu.c Sun Apr 26 03:22:31 2020 -0500
@@ -79,13 +79,9 @@
PurpleAccount *account)
{
GtkWidget *item = NULL, *submenu = NULL;
- gpointer data = NULL;
/* if the account is in the disabled list, delete its widget */
- data = g_hash_table_lookup(menu->disabled_items, account);
- if(data != NULL) {
- gtk_widget_destroy(GTK_WIDGET(data));
- }
+ g_hash_table_remove(menu->disabled_items, account);
item = pidgin_accounts_menu_create_account_menu_item(menu, account);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
@@ -105,13 +101,9 @@
PurpleAccount *account)
{
GtkWidget *item = NULL;
- gpointer data = NULL;
/* if the account is in the enabled list, delete its widget */
- data = g_hash_table_lookup(menu->account_items, account);
- if(data != NULL) {
- gtk_widget_destroy(GTK_WIDGET(data));
- }
+ g_hash_table_remove(menu->account_items, account);
item = pidgin_accounts_menu_create_account_menu_item(menu, account);
g_signal_connect(G_OBJECT(item), "activate",
@@ -212,8 +204,13 @@
static void
pidgin_accounts_menu_finalize(GObject *obj) {
+ PidginAccountsMenu *menu = PIDGIN_ACCOUNTS_MENU(obj);
+
purple_signals_disconnect_by_handle(obj);
+ g_hash_table_destroy(menu->account_items);
+ g_hash_table_destroy(menu->disabled_items);
+
G_OBJECT_CLASS(pidgin_accounts_menu_parent_class)->finalize(obj);
}
--- a/pidgin/pidginaccountsmenu.h Tue Apr 07 18:28:26 2020 -0500
+++ b/pidgin/pidginaccountsmenu.h Sun Apr 26 03:22:31 2020 -0500
@@ -28,7 +28,7 @@
* @short_description: A menu for managing accounts and their actions
* @title: Accounts Menu
*
- * #PidginAccountMenu is a #GtkMenu that provides an interface to users to open
+ * #PidginAccountsMenu is a #GtkMenu that provides an interface to users to open
* the account manager as well as activate account actions.
*
* It manages itself as accounts are created/deleted and enabled/disabled and
--- a/pidgin/pidginactiongroup.c Tue Apr 07 18:28:26 2020 -0500
+++ b/pidgin/pidginactiongroup.c Sun Apr 26 03:22:31 2020 -0500
@@ -104,8 +104,8 @@
* @group: The #PidginActionGroup instance.
* @action_name: The name of the action to setup.
* @pref_name: The name of the preference that @action_name is tied to.
- * @callback: (scope call): A #PurplePrefCallback to call when the preference
- * is changed.
+ * @callback: (scope notified): A #PurplePrefCallback to call when the
+ * preference is changed.
*
* Initializes the boolean action named @action_name to the value of @pref_name
* and setups up a preference change callback to @callback to maintain the
@@ -168,8 +168,8 @@
* @group: The #PidginActionGroup instance.
* @action_name: The name of the action to setup.
* @pref_name: The name of the preference that @action_name is tied to.
- * @callback: (scope call): A #PurplePrefCallback to call when the preference
- * is changed.
+ * @callback: (scope notified): A #PurplePrefCallback to call when the
+ * preference is changed.
*
* Initializes the string action named @action_name to the value of @pref_name
* and setups up a preference change callback to @callback to maintain the
@@ -206,7 +206,7 @@
* @n_actions: The number of @actions.
* @enabled: Whether or not to enable the actions.
*
- * Sets the enabled property of the the named actions to @enabled.
+ * Sets the enabled property of the named actions to @enabled.
*/
static void
pidgin_action_group_actions_set_enable(PidginActionGroup *group,
@@ -574,7 +574,7 @@
pidgin_action_group_online_help(GSimpleAction *simple, GVariant *parameter,
gpointer data)
{
- purple_notify_uri(NULL, PURPLE_WEBSITE "documentation");
+ purple_notify_uri(NULL, PURPLE_WEBSITE "help");
}
static void
--- a/pidgin/pidginactiongroup.h Tue Apr 07 18:28:26 2020 -0500
+++ b/pidgin/pidginactiongroup.h Sun Apr 26 03:22:31 2020 -0500
@@ -38,7 +38,7 @@
#include <gio/gio.h>
/**
- * PIDGIN_ACTION_ADD_ABOUT:
+ * PIDGIN_ACTION_ABOUT:
*
* A constant that represents the about action that shows the about window.
*/
@@ -78,7 +78,7 @@
/**
* PIDGIN_ACTION_CUSTOM_SMILEY:
*
- * A constant that represents the smiley-action action to toggle the visibility
+ * A constant that represents the custom-smiley action to toggle the visibility
* of the smiley manager.
*/
#define PIDGIN_ACTION_CUSTOM_SMILEY ("custom-smiley")
@@ -116,7 +116,7 @@
/**
* PIDGIN_ACTION_MUTE_SOUNDS:
*
- * A constatnt that represents the mute-sounds action.
+ * A constant that represents the mute-sounds action.
*/
#define PIDGIN_ACTION_MUTE_SOUNDS ("mute-sounds")
--- a/pidgin/pidginbuddylistmenu.h Tue Apr 07 18:28:26 2020 -0500
+++ b/pidgin/pidginbuddylistmenu.h Sun Apr 26 03:22:31 2020 -0500
@@ -66,6 +66,8 @@
* @menu: The #PidginBuddyList instance.
*
* Gets the #PidginMenuTray instance from @menu.
+ *
+ * Returns: (transfer none): The #PidginMenuTray from @menu.
*/
GtkWidget *pidgin_buddy_list_menu_get_menu_tray(PidginBuddyListMenu *menu);
--- a/pidgin/pidginmooddialog.c Tue Apr 07 18:28:26 2020 -0500
+++ b/pidgin/pidginmooddialog.c Sun Apr 26 03:22:31 2020 -0500
@@ -54,15 +54,17 @@
/*< private
* pidgin_mood_edit_cb:
- * @gc: The #PurpleConnection instance.
+ * @connection: The #PurpleConnection instance.
* @fields: The #PurpleRequestFields
*
* This a callback function for when the request dialog has been accepted.
*/
static void
-pidgin_mood_dialog_edit_cb(PurpleConnection *gc, PurpleRequestFields *fields) {
- PurpleRequestField *mood_field;
- GList *l;
+pidgin_mood_dialog_edit_cb(PurpleConnection *connection,
+ PurpleRequestFields *fields)
+{
+ PurpleRequestField *mood_field = NULL;
+ GList *l = NULL;
const gchar *mood = NULL;
mood_field = purple_request_fields_get_field(fields, "mood");
@@ -74,12 +76,15 @@
mood = purple_request_field_list_get_data(mood_field, l->data);
- if (gc) {
- const gchar *text;
- PurpleAccount *account = purple_connection_get_account(gc);
+ if(connection != NULL) {
+ PurpleAccount *account = purple_connection_get_account(connection);
+ PurpleConnectionFlags flags;
+ const gchar *text = NULL;
- if (purple_connection_get_flags(gc) & PURPLE_CONNECTION_FLAG_SUPPORT_MOOD_MESSAGES) {
- PurpleRequestField *text_field;
+ flags = purple_connection_get_flags(connection);
+ if (flags & PURPLE_CONNECTION_FLAG_SUPPORT_MOOD_MESSAGES) {
+ PurpleRequestField *text_field = NULL;
+
text_field = purple_request_fields_get_field(fields, "text");
text = purple_request_field_string_get_value(text_field);
} else {
@@ -92,10 +97,15 @@
for (; accounts ; accounts = g_list_delete_link(accounts, accounts)) {
PurpleAccount *account = (PurpleAccount *) accounts->data;
- PurpleConnection *gc = purple_account_get_connection(account);
+
+ connection = purple_account_get_connection(account);
+ if(PURPLE_IS_CONNECTION(connection)) {
+ PurpleConnectionFlags flags;
- if (gc && (purple_connection_get_flags(gc) & PURPLE_CONNECTION_FLAG_SUPPORT_MOODS)) {
- update_status_with_mood(account, mood, NULL);
+ flags = purple_connection_get_flags(connection);
+ if(flags & PURPLE_CONNECTION_FLAG_SUPPORT_MOODS) {
+ update_status_with_mood(account, mood, NULL);
+ }
}
}
}
@@ -110,11 +120,11 @@
* should probably also be returning a GList of moods as that's easier to deal
* with.
*
- * Also, there is non-deterministic behavior here that the return mood depends
- * purely on the order that the accounts where connected in. This is probably
- * okay, but we should look at fixing that somehow.
+ * Also, there is non-deterministic behavior here that the order of the
+ * returned moods depends purely on the order that the accounts where connected
+ * in. This is probably okay, but we should look at fixing that somehow.
*
- * Returns: (transfer container): A list of all global moods.
+ * Returns: (transfer full): A list of all global moods.
*/
static PurpleMood *
pidgin_mood_get_global_moods(void) {
@@ -144,7 +154,7 @@
int mood_count =
GPOINTER_TO_INT(g_hash_table_lookup(mood_counts, mood->mood));
- if (!g_hash_table_lookup(global_moods, mood->mood)) {
+ if (!g_hash_table_contains(global_moods, mood->mood)) {
g_hash_table_insert(global_moods, (gpointer)mood->mood, mood);
}
g_hash_table_insert(mood_counts, (gpointer)mood->mood,
--- a/pidgin/pidginmooddialog.h Tue Apr 07 18:28:26 2020 -0500
+++ b/pidgin/pidginmooddialog.h Sun Apr 26 03:22:31 2020 -0500
@@ -42,7 +42,7 @@
/**
* pidgin_mood_dialog_show:
- * @account: (nullable): The #PurpleAccount who's mood to set, or %NULL for the
+ * @account: (nullable): The #PurpleAccount whose mood to set, or %NULL for the
* global mood.
*
* Presents a dialog to select the mood for @account or the global mood if
@@ -53,7 +53,7 @@
/**
* pidgin_mood_get_icon_path:
* @mood: The id of the mood.
- *``
+ *
* Gets the path to the icon for @mood.
*
* Returns: (transfer full): The location of the icon for @mood.