Mon, 22 Aug 2022 21:40:04 -0500
Inline pidgin_make_scrollable
We need to change it for GTK4, and there are few enough that it can be inlined. Eventually, that code might be a `.ui` anyway.
Testing Done:
Compile only.
Reviewed at https://reviews.imfreedom.org/r/1615/
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* Purple is the legal property of its developers, whose names are too numerous |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * source distribution. |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * along with this program; if not, write to the Free Software |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | */ |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | #include "action.h" |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | |
|
39481
4db28449567d
Rename PurpleMenuAction to PurpleActionMenu
Gary Kramlich <grim@reaperworld.com>
parents:
39480
diff
changeset
|
22 | struct _PurpleActionMenu { |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | gchar *label; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | GCallback callback; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | gpointer data; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | GList *children; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | }; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | /****************************************************************************** |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | * ActionMenu API |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | *****************************************************************************/ |
|
39481
4db28449567d
Rename PurpleMenuAction to PurpleActionMenu
Gary Kramlich <grim@reaperworld.com>
parents:
39480
diff
changeset
|
32 | PurpleActionMenu * |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
33 | purple_action_menu_new(const gchar *label, GCallback callback, gpointer data, |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | GList *children) |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | { |
|
39481
4db28449567d
Rename PurpleMenuAction to PurpleActionMenu
Gary Kramlich <grim@reaperworld.com>
parents:
39480
diff
changeset
|
36 | PurpleActionMenu *act = g_new(PurpleActionMenu, 1); |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | act->label = g_strdup(label); |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | act->callback = callback; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | act->data = data; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | act->children = children; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | return act; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
44 | } |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
45 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
46 | void |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
47 | purple_action_menu_free(PurpleActionMenu *act) { |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | g_return_if_fail(act != NULL); |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | |
|
39487
f0e629b4c500
Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents:
39484
diff
changeset
|
50 | purple_action_menu_set_children(act, NULL); |
|
f0e629b4c500
Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents:
39484
diff
changeset
|
51 | |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
52 | g_free(act->label); |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | g_free(act); |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | } |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | |
|
39487
f0e629b4c500
Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents:
39484
diff
changeset
|
56 | const gchar * |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
57 | purple_action_menu_get_label(const PurpleActionMenu *act) { |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
58 | g_return_val_if_fail(act != NULL, NULL); |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | return act->label; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | } |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | GCallback |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
64 | purple_action_menu_get_callback(const PurpleActionMenu *act) { |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | g_return_val_if_fail(act != NULL, NULL); |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | return act->callback; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | } |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | gpointer |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
71 | purple_action_menu_get_data(const PurpleActionMenu *act) { |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | g_return_val_if_fail(act != NULL, NULL); |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | return act->data; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | } |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
77 | GList * |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
78 | purple_action_menu_get_children(const PurpleActionMenu *act) { |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | g_return_val_if_fail(act != NULL, NULL); |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | return act->children; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | } |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | void |
|
39487
f0e629b4c500
Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents:
39484
diff
changeset
|
85 | purple_action_menu_set_label(PurpleActionMenu *act, const gchar *label) { |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | g_return_if_fail(act != NULL); |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | |
|
39487
f0e629b4c500
Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents:
39484
diff
changeset
|
88 | g_free(act->label); |
|
f0e629b4c500
Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents:
39484
diff
changeset
|
89 | |
|
f0e629b4c500
Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents:
39484
diff
changeset
|
90 | act->label = g_strdup(label); |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | } |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | void |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
94 | purple_action_menu_set_callback(PurpleActionMenu *act, GCallback callback) { |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | g_return_if_fail(act != NULL); |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | act->callback = callback; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | } |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | void |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
101 | purple_action_menu_set_data(PurpleActionMenu *act, gpointer data) { |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | g_return_if_fail(act != NULL); |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | act->data = data; |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | } |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | void |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
108 | purple_action_menu_set_children(PurpleActionMenu *act, GList *children) { |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | g_return_if_fail(act != NULL); |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | |
|
39514
9c7715998bbc
Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents:
39487
diff
changeset
|
111 | g_list_free_full(act->children, (GDestroyNotify)purple_action_menu_free); |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | |
|
39487
f0e629b4c500
Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents:
39484
diff
changeset
|
113 | act->children = children; |
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | } |
|
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | |
|
39480
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
116 | /****************************************************************************** |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
117 | * Protocol Action API |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
118 | *****************************************************************************/ |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
119 | PurpleProtocolAction * |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
120 | purple_protocol_action_new(const gchar* label, PurpleProtocolActionCallback callback) { |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
121 | PurpleProtocolAction *action; |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
122 | |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
123 | g_return_val_if_fail(label != NULL, NULL); |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
124 | g_return_val_if_fail(callback != NULL, NULL); |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
125 | |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
126 | action = g_new0(PurpleProtocolAction, 1); |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
127 | |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
128 | action->label = g_strdup(label); |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
129 | action->callback = callback; |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
130 | |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
131 | return action; |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
132 | } |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
133 | |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
134 | void |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
135 | purple_protocol_action_free(PurpleProtocolAction *action) { |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
136 | g_return_if_fail(action != NULL); |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
137 | |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
138 | g_free(action->label); |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
139 | g_free(action); |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
140 | } |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
141 | |
|
39484
0ece2412a0b0
Add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents:
39483
diff
changeset
|
142 | PurpleProtocolAction * |
|
39480
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
143 | purple_protocol_action_copy(PurpleProtocolAction *action) { |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
144 | g_return_val_if_fail(action != NULL, NULL); |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
145 | |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
146 | return purple_protocol_action_new(action->label, action->callback); |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
147 | } |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
148 | |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
149 | G_DEFINE_BOXED_TYPE( |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
150 | PurpleProtocolAction, |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
151 | purple_protocol_action, |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
152 | purple_protocol_action_copy, |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
153 | purple_protocol_action_free |
|
5e089a52b01b
Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
154 | ); |