qulogic/pidgin

Remove PidginActionGroup

4 months ago, Gary Kramlich
87654d7a8f79
Parents 32dc4a2380b4
Children d2088215e302
Remove PidginActionGroup

This was a temporary setup and apparently we never removed it after everything
got moved into PidginApplication.

Testing Done:
Called the turtles.

Reviewed at https://reviews.imfreedom.org/r/2900/
--- a/pidgin/meson.build Sat Dec 30 20:06:39 2023 -0600
+++ b/pidgin/meson.build Sat Dec 30 20:42:21 2023 -0600
@@ -23,7 +23,6 @@
'pidginaccountrow.c',
'pidginaccountsdisabledmenu.c',
'pidginaccountsenabledmenu.c',
- 'pidginactiongroup.c',
'pidginaddbuddydialog.c',
'pidginapplication.c',
'pidginautoadjustment.c',
@@ -81,7 +80,6 @@
'pidginaccountrow.h',
'pidginaccountsdisabledmenu.h',
'pidginaccountsenabledmenu.h',
- 'pidginactiongroup.h',
'pidginaddbuddydialog.h',
'pidginapplication.h',
'pidginautoadjustment.h',
--- a/pidgin/pidginactiongroup.c Sat Dec 30 20:06:39 2023 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
- * pidgin
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#include "pidginactiongroup.h"
-
-#include <purple.h>
-
-#include "pidgincore.h"
-
-struct _PidginActionGroup {
- GSimpleActionGroup parent;
-};
-
-/******************************************************************************
- * Helpers
- *****************************************************************************/
-
-/*< private >
- * pidgin_action_group_string_pref_handler:
- * @group: The #PidginActionGroup instance.
- * @action_name: The name of the action to update.
- * @value: The value of the preference.
- *
- * Changes the state of the action named @action_name to match @value.
- *
- * This function is meant to be called from a #PurplePrefCallback function as
- * there isn't a good way to have a #PurplePrefCallback with multiple items in
- * the data parameter without leaking them forever.
- */
-static void
-pidgin_action_group_string_pref_handler(PidginActionGroup *group,
- const gchar *action_name,
- const gchar *value)
-{
- GAction *action = NULL;
-
- action = g_action_map_lookup_action(G_ACTION_MAP(group), action_name);
- if(action != NULL) {
- g_simple_action_set_state(G_SIMPLE_ACTION(action),
- g_variant_new_string(value));
- }
-}
-
-/*< private >
- * pidgin_action_group_setup_string:
- * @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 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
- * state of the action.
- */
-static void
-pidgin_action_group_setup_string(PidginActionGroup *group,
- const gchar *action_name,
- const gchar *pref_name,
- PurplePrefCallback callback)
-{
- GAction *action = NULL;
- const gchar *value = NULL;
-
- /* find the action, if we can't find it, bail */
- action = g_action_map_lookup_action(G_ACTION_MAP(group), action_name);
- g_return_if_fail(action != NULL);
-
- /* change the state of the action to match the preference value. */
- value = purple_prefs_get_string(pref_name);
- g_simple_action_set_state(G_SIMPLE_ACTION(action),
- g_variant_new_string(value));
-
- /* finally add a preference callback to update the state based on the
- * preference.
- */
- purple_prefs_connect_callback(group, pref_name, callback, group);
-}
-
-/******************************************************************************
- * Preference Callbacks
- *****************************************************************************/
-static void
-pidgin_action_group_sort_method_callback(G_GNUC_UNUSED const gchar *name,
- G_GNUC_UNUSED PurplePrefType type,
- gconstpointer value,
- gpointer data)
-{
- PidginActionGroup *group = PIDGIN_ACTION_GROUP(data);
-
- pidgin_action_group_string_pref_handler(group,
- PIDGIN_ACTION_SORT_METHOD,
- value);
-}
-
-/******************************************************************************
- * Action Callbacks
- *****************************************************************************/
-static void
-pidgin_action_group_sort_method(G_GNUC_UNUSED GSimpleAction *action,
- GVariant *value, G_GNUC_UNUSED gpointer data)
-{
- purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/sort_type",
- g_variant_get_string(value, NULL));
-}
-
-/******************************************************************************
- * GObject Implementation
- *****************************************************************************/
-G_DEFINE_TYPE(PidginActionGroup, pidgin_action_group,
- G_TYPE_SIMPLE_ACTION_GROUP)
-
-static void
-pidgin_action_group_init(PidginActionGroup *group) {
- GActionEntry entries[] = {
- {
- .name = PIDGIN_ACTION_SORT_METHOD,
- .parameter_type = "s",
- .state = "'none'",
- .change_state = pidgin_action_group_sort_method,
- },
- };
-
- g_action_map_add_action_entries(G_ACTION_MAP(group), entries,
- G_N_ELEMENTS(entries), NULL);
-
- /* now add some handlers for preference changes and set actions to the
- * correct value.
- */
- pidgin_action_group_setup_string(group, PIDGIN_ACTION_SORT_METHOD,
- PIDGIN_PREFS_ROOT "/blist/sort_type",
- pidgin_action_group_sort_method_callback);
-};
-
-static void
-pidgin_action_group_finalize(GObject *obj) {
- purple_signals_disconnect_by_handle(obj);
-
- G_OBJECT_CLASS(pidgin_action_group_parent_class)->finalize(obj);
-}
-
-static void
-pidgin_action_group_class_init(PidginActionGroupClass *klass) {
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
-
- obj_class->finalize = pidgin_action_group_finalize;
-}
-
-/******************************************************************************
- * Public API
- *****************************************************************************/
-GSimpleActionGroup *
-pidgin_action_group_new(void) {
- return G_SIMPLE_ACTION_GROUP(g_object_new(PIDGIN_TYPE_ACTION_GROUP, NULL));
-}
-
--- a/pidgin/pidginactiongroup.h Sat Dec 30 20:06:39 2023 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * pidgin
- *
- * Pidgin is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
- */
-
-#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
-# error "only <pidgin.h> may be included directly"
-#endif
-
-#ifndef PIDGIN_ACTION_GROUP_H
-#define PIDGIN_ACTION_GROUP_H
-
-#include <glib.h>
-
-#include <gio/gio.h>
-
-#include "pidginversion.h"
-
-/**
- * PidginActionGroup:
- *
- * A #GSimpleActionGroup containing most of our actions. A lot of this will
- * need to be added to the #GtkApplication, but I didn't want to do that part
- * quite yet, so I created this instead.
- *
- * Since: 3.0.0
- */
-
-/**
- * PIDGIN_ACTION_SORT_METHOD:
- *
- * A constant that represents the sort-method action to change the sorting
- * method of the buddy list.
- *
- * Since: 3.0.0
- */
-#define PIDGIN_ACTION_SORT_METHOD ("sort-method" PIDGIN_AVAILABLE_MACRO_IN_3_0)
-
-G_BEGIN_DECLS
-
-#define PIDGIN_TYPE_ACTION_GROUP (pidgin_action_group_get_type())
-
-PIDGIN_AVAILABLE_IN_3_0
-G_DECLARE_FINAL_TYPE(PidginActionGroup, pidgin_action_group, PIDGIN,
- ACTION_GROUP, GSimpleActionGroup)
-
-/**
- * pidgin_action_group_new:
- *
- * Creates a new #PidginActionGroup instance that contains all of the
- * #GAction's in Pidgin.
- *
- * Returns: (transfer full): The new #PidginActionGroup instance.
- *
- * Since: 3.0.0
- */
-PIDGIN_AVAILABLE_IN_3_0
-GSimpleActionGroup *pidgin_action_group_new(void);
-
-G_END_DECLS
-
-#endif /* PIDGIN_ACTION_GROUP_H */
--- a/po/POTFILES.in Sat Dec 30 20:06:39 2023 -0600
+++ b/po/POTFILES.in Sat Dec 30 20:42:21 2023 -0600
@@ -251,7 +251,6 @@
pidgin/pidginaccountrow.c
pidgin/pidginaccountsdisabledmenu.c
pidgin/pidginaccountsenabledmenu.c
-pidgin/pidginactiongroup.c
pidgin/pidginaddbuddydialog.c
pidgin/pidginapplication.c
pidgin/pidginavatar.c