pidgin/pidginstatuseditor.c

Sat, 29 Oct 2022 01:14:13 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 29 Oct 2022 01:14:13 -0500
changeset 41859
ed82ab63d15a
parent 41544
53ba39406c86
child 41947
7b3312d0760c
permissions
-rw-r--r--

Convert PidginProxyPrefs to Adwaita 1.2

Testing Done:
Set all the values via the ui and the config file and tested bad values in the port in both as well. Bad values in the ui will store whatever atoi returned, but bad values in the config file will fallback to the default.

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

41356
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * Pidgin - Internet Messenger
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Copyright (C) Pidgin Developers <devel@pidgin.im>
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * Pidgin is the legal property of its developers, whose names are too numerous
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * to list here. Please refer to the COPYRIGHT file distributed with this
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * source distribution.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * (at your option) any later version.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * GNU General Public License for more details.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * along with this program; if not, see <https://www.gnu.org/licenses/>.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 */
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #include <talkatu/talkatu.h>
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include "pidginstatuseditor.h"
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include "pidginstatusprimitivechooser.h"
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 enum {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 PROP_0,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 PROP_STATUS,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 N_PROPERTIES
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 };
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 enum {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 RESPONSE_USE,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 RESPONSE_SAVE
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 };
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 struct _PidginStatusEditor {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 GtkDialog parent;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 PurpleSavedStatus *status;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 GtkTextBuffer *buffer;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 GtkWidget *title;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 GtkWidget *primitive;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 GtkWidget *message;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 GtkWidget *use;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 GtkWidget *save;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 };
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 G_DEFINE_TYPE(PidginStatusEditor, pidgin_status_editor, GTK_TYPE_DIALOG)
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 /******************************************************************************
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 * Helpers
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 *****************************************************************************/
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 pidgin_status_editor_set_status(PidginStatusEditor *editor,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 PurpleSavedStatus *status)
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 PurpleStatusPrimitive primitive;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 PidginStatusPrimitiveChooser *chooser = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 const gchar *title = NULL, *message = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 editor->status = status;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 if(editor->status != NULL) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 title = purple_savedstatus_get_title(editor->status);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 primitive = purple_savedstatus_get_primitive_type(editor->status);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 message = purple_savedstatus_get_message(editor->status);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 } else {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 primitive = PURPLE_STATUS_AWAY;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 if(title == NULL) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 title = "";
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 if(message == NULL) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 message = "";
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86
41544
53ba39406c86 Port PidginStatusEditor to GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
87 gtk_editable_set_text(GTK_EDITABLE(editor->title), title);
41356
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 chooser = PIDGIN_STATUS_PRIMITIVE_CHOOSER(editor->primitive);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 pidgin_status_primitive_chooser_set_selected(chooser, primitive);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 talkatu_markup_set_html(TALKATU_BUFFER(editor->buffer), message, -1);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 g_object_notify_by_pspec(G_OBJECT(editor), properties[PROP_STATUS]);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 pidgin_status_editor_save_status(PidginStatusEditor *editor) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 PidginStatusPrimitiveChooser *chooser = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 PurpleStatusPrimitive primitive;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 gchar *message = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 const gchar *title = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101
41544
53ba39406c86 Port PidginStatusEditor to GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
102 title = gtk_editable_get_text(GTK_EDITABLE(editor->title));
41356
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 chooser = PIDGIN_STATUS_PRIMITIVE_CHOOSER(editor->primitive);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 primitive = pidgin_status_primitive_chooser_get_selected(chooser);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 message = talkatu_markup_get_html(editor->buffer, NULL);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 if(editor->status == NULL) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 editor->status = purple_savedstatus_new(title, primitive);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 } else {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 const gchar *current_title = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 /* purple_savedstatus_set_title throws a warning if you try to save a
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 * status with an existing title, which means we can't just save the
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 * title if it hasn't changed.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 */
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 current_title = purple_savedstatus_get_title(editor->status);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 if(!purple_strequal(title, current_title)) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 purple_savedstatus_set_title(editor->status, title);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 purple_savedstatus_set_primitive_type(editor->status, primitive);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 purple_savedstatus_set_message(editor->status, message);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 g_free(message);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 /******************************************************************************
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 * Callbacks
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 *****************************************************************************/
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 pidgin_status_editor_response_cb(GtkDialog *dialog, gint response_id,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 gpointer data)
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 PidginStatusEditor *editor = data;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 switch(response_id) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 case RESPONSE_USE:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 pidgin_status_editor_save_status(editor);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 purple_savedstatus_activate(editor->status);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 break;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 case RESPONSE_SAVE:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 pidgin_status_editor_save_status(editor);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 break;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149
41544
53ba39406c86 Port PidginStatusEditor to GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
150 gtk_window_destroy(GTK_WINDOW(dialog));
41356
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 pidgin_status_editor_title_changed_cb(GtkEditable *editable, gpointer data) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 PidginStatusEditor *editor = data;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 gboolean title_changed = FALSE, sensitive = FALSE;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 const gchar *title = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158
41544
53ba39406c86 Port PidginStatusEditor to GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
159 title = gtk_editable_get_text(GTK_EDITABLE(editor->title));
41356
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 if(editor->status != NULL) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162 /* If we're editing a status, check if the title is the same. */
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 title_changed = !purple_strequal(title,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 purple_savedstatus_get_title(editor->status));
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 } else {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 /* If this is a new status, check if the title is empty or not. */
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 title_changed = !purple_strequal(title, "");
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170 if(title_changed) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 gboolean duplicated = purple_savedstatus_find(title) != NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 if(duplicated) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 gtk_widget_set_sensitive(editor->use, FALSE);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 gtk_widget_set_sensitive(editor->save, FALSE);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 return;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 sensitive = !purple_strequal(title, "");
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 gtk_widget_set_sensitive(editor->use, sensitive);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 gtk_widget_set_sensitive(editor->save, sensitive);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187 /******************************************************************************
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 * GObject Implementation
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 *****************************************************************************/
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 pidgin_status_editor_get_property(GObject *obj, guint param_id, GValue *value,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 GParamSpec *pspec)
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 PidginStatusEditor *editor = PIDGIN_STATUS_EDITOR(obj);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 switch(param_id) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 case PROP_STATUS:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 g_value_set_pointer(value,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 pidgin_status_editor_get_status(editor));
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 break;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 default:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 break;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 pidgin_status_editor_set_property(GObject *obj, guint param_id,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 const GValue *value, GParamSpec *pspec)
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211 PidginStatusEditor *editor = PIDGIN_STATUS_EDITOR(obj);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 switch(param_id) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 case PROP_STATUS:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215 pidgin_status_editor_set_status(editor,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 g_value_get_pointer(value));
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 break;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 default:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 break;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 pidgin_status_editor_init(PidginStatusEditor *manager) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 gtk_widget_init_template(GTK_WIDGET(manager));
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 pidgin_status_editor_class_init(PidginStatusEditorClass *klass) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231 GObjectClass *obj_class = G_OBJECT_CLASS(klass);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 obj_class->get_property = pidgin_status_editor_get_property;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 obj_class->set_property = pidgin_status_editor_set_property;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 /**
41479
3d2e114380f6 Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41356
diff changeset
238 * PidginStatusEditor:status:
41356
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240 * The [type@Purple.SavedStatus] that this editor is responsible for.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 * This may be %NULL if it is creating a new status.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 * Since: 3.0.0.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244 */
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245 /* we don't used boxed here because of the way status are currently
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246 * managed.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 */
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 properties[PROP_STATUS] = g_param_spec_pointer(
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 "status", "status",
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 "The saved status we're editing",
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253 g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 gtk_widget_class_set_template_from_resource(
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256 widget_class,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 "/im/pidgin/Pidgin3/Status/editor.ui"
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 );
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 gtk_widget_class_bind_template_child(widget_class, PidginStatusEditor,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 buffer);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 gtk_widget_class_bind_template_child(widget_class, PidginStatusEditor,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264 title);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 gtk_widget_class_bind_template_child(widget_class, PidginStatusEditor,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266 primitive);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 gtk_widget_class_bind_template_child(widget_class, PidginStatusEditor,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268 message);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270 gtk_widget_class_bind_template_child(widget_class, PidginStatusEditor,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271 use);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 gtk_widget_class_bind_template_child(widget_class, PidginStatusEditor,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 save);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275 gtk_widget_class_bind_template_callback(widget_class,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 pidgin_status_editor_response_cb);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 gtk_widget_class_bind_template_callback(widget_class,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 pidgin_status_editor_title_changed_cb);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 /******************************************************************************
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282 * Public API
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 *****************************************************************************/
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 GtkWidget *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 pidgin_status_editor_new(PurpleSavedStatus *status) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 return g_object_new(
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 PIDGIN_TYPE_STATUS_EDITOR,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288 "status", status,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289 NULL);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
292 PurpleSavedStatus *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 pidgin_status_editor_get_status(PidginStatusEditor *editor) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 g_return_val_if_fail(PIDGIN_IS_STATUS_EDITOR(editor), NULL);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296 return editor->status;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 }

mercurial