pidgin/pidginaccounteditor.c

Mon, 22 Aug 2022 21:40:04 -0500

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Mon, 22 Aug 2022 21:40:04 -0500
branch
gtk4
changeset 41567
517ac516af27
parent 41560
2579a5138f0c
child 41688
6ccdb4116ca2
permissions
-rw-r--r--

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/

41483
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <glib/gi18n-lib.h>
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include "pidginaccounteditor.h"
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include "pidginproxyoptions.h"
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 struct _PidginAccountEditor {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 GtkDialog parent;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 PurpleAccount *account;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 GtkWidget *notebook;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 GtkWidget *proxy_options;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 };
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 enum {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 PROP_0,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 PROP_ACCOUNT,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 N_PROPERTIES,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 };
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 /******************************************************************************
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 * Helpers
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 *****************************************************************************/
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 static void
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 pidgin_account_editor_set_account(PidginAccountEditor *editor,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 PurpleAccount *account)
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 if(g_set_object(&editor->account, account)) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 PurpleProxyInfo *proxy_info = NULL;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 if(PURPLE_IS_ACCOUNT(account)) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 proxy_info = purple_account_get_proxy_info(account);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 pidgin_proxy_options_set_info(PIDGIN_PROXY_OPTIONS(editor->proxy_options),
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 proxy_info);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 g_object_notify_by_pspec(G_OBJECT(editor), properties[PROP_ACCOUNT]);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 static void
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 pidgin_account_editor_save_account(PidginAccountEditor *editor) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 PurpleAccountManager *manager = NULL;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 PurpleProxyInfo *info = NULL;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 gboolean new_account = FALSE;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 manager = purple_account_manager_get_default();
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 if(!PURPLE_IS_ACCOUNT(editor->account)) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 editor->account = purple_account_new("undefined", "undefined");
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 new_account = TRUE;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 info = pidgin_proxy_options_get_info(PIDGIN_PROXY_OPTIONS(editor->proxy_options));
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 purple_account_set_proxy_info(editor->account, info);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 /* If this is a new account, add it to the account manager and bring it
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 * online.
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 */
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 if(new_account) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 const PurpleSavedStatus *saved_status;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 purple_account_manager_add(manager, editor->account);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 saved_status = purple_savedstatus_get_current();
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 if (saved_status != NULL) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 purple_savedstatus_activate_for_account(saved_status,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 editor->account);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 purple_account_set_enabled(editor->account, TRUE);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 /******************************************************************************
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 * Callbacks
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 *****************************************************************************/
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 static void
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 pidgin_account_editor_response_cb(GtkDialog *dialog, gint response_id,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 G_GNUC_UNUSED gpointer data)
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 if(response_id == GTK_RESPONSE_APPLY) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 pidgin_account_editor_save_account(PIDGIN_ACCOUNT_EDITOR(dialog));
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109
41560
2579a5138f0c A bunch of random fixes for the the gtk4 branch
Gary Kramlich <grim@reaperworld.com>
parents: 41483
diff changeset
110 gtk_window_destroy(GTK_WINDOW(dialog));
41483
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 /******************************************************************************
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 * GObject Implementation
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 *****************************************************************************/
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 G_DEFINE_TYPE(PidginAccountEditor, pidgin_account_editor, GTK_TYPE_DIALOG)
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 static void
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 pidgin_account_editor_get_property(GObject *obj, guint param_id, GValue *value,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 GParamSpec *pspec)
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 PidginAccountEditor *editor = PIDGIN_ACCOUNT_EDITOR(obj);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 switch(param_id) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 case PROP_ACCOUNT:
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 g_value_set_object(value,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 pidgin_account_editor_get_account(editor));
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 break;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 default:
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 break;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 static void
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 pidgin_account_editor_set_property(GObject *obj, guint param_id,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 const GValue *value, GParamSpec *pspec)
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 PidginAccountEditor *editor = PIDGIN_ACCOUNT_EDITOR(obj);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 switch(param_id) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 case PROP_ACCOUNT:
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 pidgin_account_editor_set_account(editor,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 g_value_get_object(value));
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 break;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 default:
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 break;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 static void
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 pidgin_account_editor_dispose(GObject *obj) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 PidginAccountEditor *editor = PIDGIN_ACCOUNT_EDITOR(obj);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 g_clear_object(&editor->account);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 G_OBJECT_CLASS(pidgin_account_editor_parent_class)->dispose(obj);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 static void
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 pidgin_account_editor_init(PidginAccountEditor *account_editor) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 GtkWidget *widget = GTK_WIDGET(account_editor);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 gtk_widget_init_template(widget);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 static void
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 pidgin_account_editor_class_init(PidginAccountEditorClass *klass) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 obj_class->get_property = pidgin_account_editor_get_property;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 obj_class->set_property = pidgin_account_editor_set_property;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 obj_class->dispose = pidgin_account_editor_dispose;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 /**
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 * PidginAccountEditor::account:
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 *
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 * The account that this editor is modifying.
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 *
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 * Since: 3.0.0
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 */
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 properties[PROP_ACCOUNT] = g_param_spec_object(
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 "account", "account",
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 "The account to modify",
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 PURPLE_TYPE_ACCOUNT,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 gtk_widget_class_set_template_from_resource(widget_class,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 "/im/pidgin/Pidgin3/Accounts/editor.ui");
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 notebook);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 gtk_widget_class_bind_template_child(widget_class, PidginAccountEditor,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 proxy_options);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 gtk_widget_class_bind_template_callback(widget_class,
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 pidgin_account_editor_response_cb);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 /******************************************************************************
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 * API
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 *****************************************************************************/
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 GtkWidget *
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 pidgin_account_editor_new(PurpleAccount *account) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 return g_object_new(PIDGIN_TYPE_ACCOUNT_EDITOR, "account", account, NULL);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 }
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 PurpleAccount *
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 pidgin_account_editor_get_account(PidginAccountEditor *editor) {
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 g_return_val_if_fail(PIDGIN_IS_ACCOUNT_EDITOR(editor), NULL);
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 return editor->account;
e3bd18c1769d The start of the new account editor.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 }

mercurial