Remove PidginAccountActionsMenu that was missed when PidginAccountsMenu was removed

Sun, 31 Jul 2022 15:18:37 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sun, 31 Jul 2022 15:18:37 -0500
changeset 41475
702bafe15ee3
parent 41474
ed1c0145c164
child 41476
1a53026013e4

Remove PidginAccountActionsMenu that was missed when PidginAccountsMenu was removed

Testing Done:
Compiled and `ninja pidgin-pot`

Reviewed at https://reviews.imfreedom.org/r/1561/

pidgin/meson.build file | annotate | diff | comparison | revisions
pidgin/pidginaccountactionsmenu.c file | annotate | diff | comparison | revisions
pidgin/pidginaccountactionsmenu.h file | annotate | diff | comparison | revisions
pidgin/resources/Accounts/actionsmenu.ui file | annotate | diff | comparison | revisions
pidgin/resources/pidgin.gresource.xml file | annotate | diff | comparison | revisions
po/POTFILES.in file | annotate | diff | comparison | revisions
--- a/pidgin/meson.build	Sun Jul 31 01:46:39 2022 -0500
+++ b/pidgin/meson.build	Sun Jul 31 15:18:37 2022 -0500
@@ -18,7 +18,6 @@
 	'libpidgin.c',
 	'minidialog.c',
 	'pidginabout.c',
-	'pidginaccountactionsmenu.c',
 	'pidginaccountchooser.c',
 	'pidginaccountfilterconnected.c',
 	'pidginaccountfilterprotocol.c',
@@ -92,7 +91,6 @@
 	'gtkxfer.h',
 	'minidialog.h',
 	'pidginabout.h',
-	'pidginaccountactionsmenu.h',
 	'pidginaccountchooser.h',
 	'pidginaccountfilterconnected.h',
 	'pidginaccountfilterprotocol.h',
--- a/pidgin/pidginaccountactionsmenu.c	Sun Jul 31 01:46:39 2022 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,297 +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, see <https://www.gnu.org/licenses/>.
- */
-
-#include "pidginaccountactionsmenu.h"
-
-#include <purple.h>
-
-#include "gtkaccount.h"
-#include "pidgincore.h"
-#include "pidginmooddialog.h"
-
-struct _PidginAccountActionsMenu {
-	GtkMenu parent;
-
-	GtkWidget *separator;
-	GtkWidget *set_mood;
-
-	PurpleAccount *account;
-};
-
-enum {
-	PROP_ZERO,
-	PROP_ACCOUNT,
-	N_PROPERTIES
-};
-static GParamSpec *properties[N_PROPERTIES] = { NULL, };
-
-/******************************************************************************
- * GSignal Handlers
- *****************************************************************************/
-static void
-pidgin_account_actions_menu_edit_cb(GtkMenuItem *item, gpointer data) {
-	PidginAccountActionsMenu *menu = PIDGIN_ACCOUNT_ACTIONS_MENU(data);
-
-	pidgin_account_dialog_show(PIDGIN_MODIFY_ACCOUNT_DIALOG, menu->account);
-}
-
-static void
-pidgin_account_actions_menu_disable_cb(GtkMenuItem *item, gpointer data) {
-	PidginAccountActionsMenu *menu = PIDGIN_ACCOUNT_ACTIONS_MENU(data);
-
-	purple_account_set_enabled(menu->account, FALSE);
-}
-
-static void
-pidgin_account_actions_menu_set_mood_cb(GtkMenuItem *item, gpointer data) {
-	PidginAccountActionsMenu *menu = PIDGIN_ACCOUNT_ACTIONS_MENU(data);
-
-	pidgin_mood_dialog_show(menu->account);
-}
-
-static void
-pidgin_account_actions_menu_action(GtkMenuItem *item, gpointer data) {
-	PurpleProtocolAction *action = (PurpleProtocolAction *)data;
-
-	if(action && action->callback) {
-		action->callback(action);
-	}
-}
-
-/******************************************************************************
- * Helpers
- *****************************************************************************/
-static void
-pidgin_account_actions_menu_set_account(PidginAccountActionsMenu *menu,
-                                        PurpleAccount *account)
-{
-	PurpleConnection *connection = NULL;
-	PurpleProtocol *protocol = NULL;
-	GList *children = NULL;
-	gboolean show_separator = FALSE;
-	gint position = 0;
-
-	if(g_set_object(&menu->account, account)) {
-		if(!PURPLE_IS_ACCOUNT(menu->account)) {
-			return;
-		}
-	}
-
-	connection = purple_account_get_connection(account);
-	if(connection == NULL) {
-		return;
-	}
-
-	if(!PURPLE_CONNECTION_IS_CONNECTED(connection)) {
-		return;
-	}
-
-	/* we're pretty sure we're going to insert some items into the menu, so we
-	 * need to figure out where to put them.  GtkMenu stores its children in
-	 * order, so we just need to get the index of the set_mood item to find the
-	 * proper position.
-	 */
-	children = gtk_container_get_children(GTK_CONTAINER(menu));
-	position = g_list_index(children, menu->set_mood) + 1;
-	g_list_free(children);
-
-	protocol = purple_connection_get_protocol(connection);
-
-	if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, CLIENT, get_moods)) {
-		gtk_widget_show(menu->set_mood);
-
-		show_separator = TRUE;
-	}
-
-	if(PURPLE_IS_PROTOCOL_CLIENT(protocol)) {
-		PurpleProtocolClient *client = PURPLE_PROTOCOL_CLIENT(protocol);
-		GtkWidget *item = NULL;
-		GList *actions = NULL;
-
-		actions = purple_protocol_client_get_actions(client, connection);
-
-		while(actions != NULL) {
-			PurpleProtocolAction *action = (PurpleProtocolAction *)actions->data;
-
-			if(action == NULL) {
-				item = gtk_separator_menu_item_new();
-				gtk_menu_shell_insert(GTK_MENU_SHELL(menu), item, position++);
-				gtk_widget_show(item);
-
-				continue;
-			}
-
-			if(action->label == NULL) {
-				purple_protocol_action_free(action);
-
-				continue;
-			}
-
-			/* Make sure the action has its connection set. */
-			action->connection = connection;
-
-			/* now add the action */
-			item = gtk_menu_item_new_with_label(action->label);
-			g_signal_connect_data(G_OBJECT(item), "activate",
-			                      G_CALLBACK(pidgin_account_actions_menu_action),
-			                      action,
-			                      (GClosureNotify)purple_protocol_action_free,
-			                      0);
-			gtk_menu_shell_insert(GTK_MENU_SHELL(menu), item, position++);
-			gtk_widget_show(item);
-
-			/* since we added an item, make sure items_added is true */
-			show_separator = TRUE;
-
-			/* Iterate to the next item while deleting the one we just
-			 * processed.
-			 */
-			actions = g_list_delete_link(actions, actions);
-		}
-	}
-
-	/* if we added any items, make our separator visible. */
-	if(show_separator) {
-		gtk_widget_show(menu->separator);
-	}
-}
-
-/******************************************************************************
- * GObject Implementation
- *****************************************************************************/
-G_DEFINE_TYPE(PidginAccountActionsMenu, pidgin_account_actions_menu,
-              GTK_TYPE_MENU)
-
-static void
-pidgin_account_actions_menu_get_property(GObject *obj, guint param_id,
-                                         GValue *value, GParamSpec *pspec)
-{
-	PidginAccountActionsMenu *menu = PIDGIN_ACCOUNT_ACTIONS_MENU(obj);
-
-	switch(param_id) {
-		case PROP_ACCOUNT:
-			g_value_set_object(value,
-			                   pidgin_account_actions_menu_get_account(menu));
-			break;
-		default:
-			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-			break;
-	}
-}
-
-static void
-pidgin_account_actions_menu_set_property(GObject *obj, guint param_id,
-                                         const GValue *value,
-                                         GParamSpec *pspec)
-{
-	PidginAccountActionsMenu *menu = PIDGIN_ACCOUNT_ACTIONS_MENU(obj);
-
-	switch(param_id) {
-		case PROP_ACCOUNT:
-			pidgin_account_actions_menu_set_account(menu,
-			                                        g_value_get_object(value));
-			break;
-
-		default:
-			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-			break;
-	}
-}
-
-static void
-pidgin_account_actions_menu_finalize(GObject *obj) {
-	PidginAccountActionsMenu *menu = PIDGIN_ACCOUNT_ACTIONS_MENU(obj);
-
-	g_clear_object(&menu->account);
-
-	G_OBJECT_CLASS(pidgin_account_actions_menu_parent_class)->finalize(obj);
-}
-
-static void
-pidgin_account_actions_menu_init(PidginAccountActionsMenu *menu) {
-	/* initialize our template */
-	gtk_widget_init_template(GTK_WIDGET(menu));
-};
-
-static void
-pidgin_account_actions_menu_class_init(PidginAccountActionsMenuClass *klass) {
-	GObjectClass *obj_class = G_OBJECT_CLASS(klass);
-	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
-
-	gtk_widget_class_set_template_from_resource(
-	    widget_class,
-	    "/im/pidgin/Pidgin3/Accounts/actionsmenu.ui"
-	);
-
-	obj_class->get_property = pidgin_account_actions_menu_get_property;
-	obj_class->set_property = pidgin_account_actions_menu_set_property;
-	obj_class->finalize = pidgin_account_actions_menu_finalize;
-
-	/**
-	 * PidginAccountActionsMenu::account:
-	 *
-	 * The #PurpleAccount that this menu was created for.
-	 */
-	properties[PROP_ACCOUNT] =
-		g_param_spec_object("account", "account",
-		                    "The account this menu is for",
-		                    PURPLE_TYPE_ACCOUNT,
-		                    G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
-		                    G_PARAM_STATIC_STRINGS);
-
-	g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
-
-	gtk_widget_class_bind_template_child(widget_class, PidginAccountActionsMenu,
-	                                     separator);
-	gtk_widget_class_bind_template_child(widget_class, PidginAccountActionsMenu,
-	                                     set_mood);
-
-	gtk_widget_class_bind_template_callback(widget_class,
-	                                        pidgin_account_actions_menu_edit_cb);
-	gtk_widget_class_bind_template_callback(widget_class,
-	                                        pidgin_account_actions_menu_disable_cb);
-	gtk_widget_class_bind_template_callback(widget_class,
-	                                        pidgin_account_actions_menu_set_mood_cb);
-}
-
-/******************************************************************************
- * Public API
- *****************************************************************************/
-GtkWidget *
-pidgin_account_actions_menu_new(PurpleAccount *account) {
-	GObject *obj = NULL;
-
-	g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
-
-	obj = g_object_new(PIDGIN_TYPE_ACCOUNT_ACTIONS_MENU,
-	                   "account", account,
-	                   NULL);
-
-	return GTK_WIDGET(obj);
-}
-
-PurpleAccount *
-pidgin_account_actions_menu_get_account(PidginAccountActionsMenu *menu) {
-	g_return_val_if_fail(PIDGIN_IS_ACCOUNT_ACTIONS_MENU(menu), NULL);
-
-	return menu->account;
-}
--- a/pidgin/pidginaccountactionsmenu.h	Sun Jul 31 01:46:39 2022 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +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, 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_ACCOUNT_ACTIONS_MENU_H
-#define PIDGIN_ACCOUNT_ACTIONS_MENU_H
-
-#include <gtk/gtk.h>
-
-#include <purple.h>
-
-G_BEGIN_DECLS
-
-/**
- * PidginAccountActionsMenu:
- *
- * A #GtkMenu that provides an interface for users to edit accounts and
- * activate the account's actions.
- */
-
-#define PIDGIN_TYPE_ACCOUNT_ACTIONS_MENU (pidgin_account_actions_menu_get_type())
-G_DECLARE_FINAL_TYPE(PidginAccountActionsMenu, pidgin_account_actions_menu,
-                     PIDGIN, ACCOUNT_ACTIONS_MENU, GtkMenu)
-
-/**
- * pidgin_account_actions_menu_new:
- * @account: The #PurpleAccount that this menu is for.
- *
- * Creates a new #PidginAccountActionsMenu for @account.
- *
- * Returns: (transfer full): The new #PidginAccountActionsMenu instance.
- */
-GtkWidget *pidgin_account_actions_menu_new(PurpleAccount *account);
-
-/**
- * pidgin_account_actions_menu_get_account:
- * @menu: The #PidginAccountActionsMenu instance.
- *
- * Gets the #PurpleAccount associated with @menu.
- *
- * Returns: (transfer none): The #PurpleAccount associated with @menu.
- */
-PurpleAccount *pidgin_account_actions_menu_get_account(PidginAccountActionsMenu *menu);
-
-G_END_DECLS
-
-#endif /* PIDGIN_ACCOUNT_ACTIONS_MENU_H */
--- a/pidgin/resources/Accounts/actionsmenu.ui	Sun Jul 31 01:46:39 2022 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.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, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
--->
-<interface>
-  <requires lib="gtk+" version="3.20"/>
-  <!-- interface-license-type gplv2 -->
-  <!-- interface-name Pidgin -->
-  <!-- interface-description Internet Messenger -->
-  <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
-  <template class="PidginAccountActionsMenu" parent="GtkMenu">
-    <property name="visible">True</property>
-    <property name="can-focus">False</property>
-    <child>
-      <object class="GtkMenuItem">
-        <property name="visible">True</property>
-        <property name="can-focus">False</property>
-        <property name="label" translatable="yes">_Edit Account</property>
-        <property name="use-underline">True</property>
-        <signal name="activate" handler="pidgin_account_actions_menu_edit_cb" object="PidginAccountActionsMenu" swapped="no"/>
-      </object>
-    </child>
-    <child>
-      <object class="GtkSeparatorMenuItem" id="separator">
-        <property name="can-focus">False</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="set_mood">
-        <property name="can-focus">False</property>
-        <property name="label" translatable="yes">Set _Mood...</property>
-        <property name="use-underline">True</property>
-        <signal name="activate" handler="pidgin_account_actions_menu_set_mood_cb" object="PidginAccountActionsMenu" swapped="no"/>
-      </object>
-    </child>
-    <child>
-      <object class="GtkSeparatorMenuItem">
-        <property name="visible">True</property>
-        <property name="can-focus">False</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem">
-        <property name="visible">True</property>
-        <property name="can-focus">False</property>
-        <property name="label" translatable="yes">_Disable</property>
-        <property name="use-underline">True</property>
-        <signal name="activate" handler="pidgin_account_actions_menu_disable_cb" object="PidginAccountActionsMenu" swapped="no"/>
-      </object>
-    </child>
-  </template>
-</interface>
--- a/pidgin/resources/pidgin.gresource.xml	Sun Jul 31 01:46:39 2022 -0500
+++ b/pidgin/resources/pidgin.gresource.xml	Sun Jul 31 15:18:37 2022 -0500
@@ -5,7 +5,6 @@
     <file compressed="true">About/about.ui</file>
     <file compressed="true">About/about.md</file>
     <file compressed="true">About/credits.json</file>
-    <file compressed="true">Accounts/actionsmenu.ui</file>
     <file compressed="true">Accounts/chooser.ui</file>
     <file compressed="true">Accounts/entry.css</file>
     <file compressed="true">Accounts/manager.ui</file>
--- a/po/POTFILES.in	Sun Jul 31 01:46:39 2022 -0500
+++ b/po/POTFILES.in	Sun Jul 31 15:18:37 2022 -0500
@@ -334,7 +334,6 @@
 pidgin/libpidgin.c
 pidgin/minidialog.c
 pidgin/pidginabout.c
-pidgin/pidginaccountactionsmenu.c
 pidgin/pidginaccountchooser.c
 pidgin/pidginaccountfilterconnected.c
 pidgin/pidginaccountfilterprotocol.c
@@ -396,7 +395,6 @@
 pidgin/prefs/pidginproxyprefs.c
 pidgin/prefs/pidginvvprefs.c
 pidgin/resources/About/about.ui
-pidgin/resources/Accounts/actionsmenu.ui
 pidgin/resources/Accounts/chooser.ui
 pidgin/resources/Accounts/manager.ui
 pidgin/resources/Avatar/avatar.ui

mercurial