pidgin/pidginstatuseditor.c

Thu, 16 Nov 2023 23:44:39 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 16 Nov 2023 23:44:39 -0600
changeset 42504
02c38caf387b
parent 42445
f7838d462608
permissions
-rw-r--r--

Depend on GPlugin 0.42.1

Testing Done:
Ran `ninja turtles` without issues and noted that the ircv3 introspection was successful.

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

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 "pidginstatuseditor.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 "pidginstatusprimitivechooser.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 enum {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 PROP_0,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 PROP_STATUS,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 N_PROPERTIES
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 };
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 static GParamSpec *properties[N_PROPERTIES] = {NULL, };
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 enum {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 RESPONSE_USE,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 RESPONSE_SAVE
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 };
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 struct _PidginStatusEditor {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 GtkDialog parent;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 PurpleSavedStatus *status;
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 GtkTextBuffer *buffer;
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 GtkWidget *title;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 GtkWidget *primitive;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 };
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 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
51
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 /******************************************************************************
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 * Helpers
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 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 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
57 PurpleSavedStatus *status)
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 PurpleStatusPrimitive primitive;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 PidginStatusPrimitiveChooser *chooser = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 const gchar *title = NULL, *message = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 editor->status = 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 if(editor->status != NULL) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 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
67 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
68 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
69 } else {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 primitive = PURPLE_STATUS_AWAY;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 if(title == NULL) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 title = "";
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 if(message == NULL) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 message = "";
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80
41544
53ba39406c86 Port PidginStatusEditor to GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
81 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
82 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
83 pidgin_status_primitive_chooser_set_selected(chooser, primitive);
42445
f7838d462608 Remove Talkatu from the status editor
Gary Kramlich <grim@reaperworld.com>
parents: 42189
diff changeset
84 gtk_text_buffer_set_text(editor->buffer, message, -1);
41356
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 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
87 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 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
91 PidginStatusPrimitiveChooser *chooser = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 PurpleStatusPrimitive primitive;
42445
f7838d462608 Remove Talkatu from the status editor
Gary Kramlich <grim@reaperworld.com>
parents: 42189
diff changeset
93 GtkTextIter start;
f7838d462608 Remove Talkatu from the status editor
Gary Kramlich <grim@reaperworld.com>
parents: 42189
diff changeset
94 GtkTextIter end;
41356
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 gchar *message = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 const gchar *title = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97
41544
53ba39406c86 Port PidginStatusEditor to GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
98 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
99
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 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
101 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
102
42445
f7838d462608 Remove Talkatu from the status editor
Gary Kramlich <grim@reaperworld.com>
parents: 42189
diff changeset
103 gtk_text_buffer_get_start_iter(editor->buffer, &start);
f7838d462608 Remove Talkatu from the status editor
Gary Kramlich <grim@reaperworld.com>
parents: 42189
diff changeset
104 gtk_text_buffer_get_end_iter(editor->buffer, &end);
f7838d462608 Remove Talkatu from the status editor
Gary Kramlich <grim@reaperworld.com>
parents: 42189
diff changeset
105 message = gtk_text_buffer_get_text(editor->buffer, &start, &end, FALSE);
41356
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 if(editor->status == NULL) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 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
109 } else {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 const gchar *current_title = NULL;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 /* 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
113 * 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
114 * title if it hasn't changed.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 */
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 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
117 if(!purple_strequal(title, current_title)) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 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
119 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 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
122 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 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
125
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 g_free(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
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 * Callbacks
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 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 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
134 gpointer data)
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 PidginStatusEditor *editor = 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 switch(response_id) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 case RESPONSE_USE:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 pidgin_status_editor_save_status(editor);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 purple_savedstatus_activate(editor->status);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 break;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 case RESPONSE_SAVE:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 pidgin_status_editor_save_status(editor);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 break;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147
41544
53ba39406c86 Port PidginStatusEditor to GTK4
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
148 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
149 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 static void
41947
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41544
diff changeset
152 pidgin_status_editor_title_changed_cb(G_GNUC_UNUSED GtkEditable *editable,
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41544
diff changeset
153 gpointer data)
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41544
diff changeset
154 {
41356
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) {
42189
4784cd60a1f8 Use Adwaita widgets in status editor
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41947
diff changeset
174 gtk_dialog_set_response_sensitive(GTK_DIALOG(editor),
4784cd60a1f8 Use Adwaita widgets in status editor
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41947
diff changeset
175 RESPONSE_USE, FALSE);
4784cd60a1f8 Use Adwaita widgets in status editor
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41947
diff changeset
176 gtk_dialog_set_response_sensitive(GTK_DIALOG(editor),
4784cd60a1f8 Use Adwaita widgets in status editor
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41947
diff changeset
177 RESPONSE_SAVE, FALSE);
41356
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 return;
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 }
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 sensitive = !purple_strequal(title, "");
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184
42189
4784cd60a1f8 Use Adwaita widgets in status editor
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41947
diff changeset
185 gtk_dialog_set_response_sensitive(GTK_DIALOG(editor), RESPONSE_USE,
4784cd60a1f8 Use Adwaita widgets in status editor
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41947
diff changeset
186 sensitive);
4784cd60a1f8 Use Adwaita widgets in status editor
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41947
diff changeset
187 gtk_dialog_set_response_sensitive(GTK_DIALOG(editor), RESPONSE_SAVE,
4784cd60a1f8 Use Adwaita widgets in status editor
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41947
diff changeset
188 sensitive);
41356
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
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 /******************************************************************************
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 * GObject Implementation
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 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 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
196 GParamSpec *pspec)
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 PidginStatusEditor *editor = PIDGIN_STATUS_EDITOR(obj);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 switch(param_id) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 case PROP_STATUS:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 g_value_set_pointer(value,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 pidgin_status_editor_get_status(editor));
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 break;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 default:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 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
207 break;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 }
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 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 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
213 const GValue *value, GParamSpec *pspec)
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215 PidginStatusEditor *editor = PIDGIN_STATUS_EDITOR(obj);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 switch(param_id) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 case PROP_STATUS:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 pidgin_status_editor_set_status(editor,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 g_value_get_pointer(value));
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221 break;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 default:
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 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
224 break;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 }
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 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 pidgin_status_editor_init(PidginStatusEditor *manager) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
230 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
231 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233 static void
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 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
235 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
236 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
237
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238 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
239 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
240
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 /**
41479
3d2e114380f6 Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41356
diff changeset
242 * PidginStatusEditor:status:
41356
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
244 * 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
245 * 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
246 *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 * Since: 3.0.0.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 */
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 /* 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
250 * managed.
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 */
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252 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
253 "status", "status",
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 "The saved status we're editing",
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 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
256
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 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
258
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259 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
260 widget_class,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 "/im/pidgin/Pidgin3/Status/editor.ui"
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
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264 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
265 buffer);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266
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 title);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 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
270 primitive);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
271
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 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
273 pidgin_status_editor_response_cb);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274 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
275 pidgin_status_editor_title_changed_cb);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 /******************************************************************************
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 * Public API
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 GtkWidget *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282 pidgin_status_editor_new(PurpleSavedStatus *status) {
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 return g_object_new(
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 PIDGIN_TYPE_STATUS_EDITOR,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 "status", status,
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 NULL);
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 }
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
288
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
289 PurpleSavedStatus *
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 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
291 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
292
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 return editor->status;
9753153c49fc Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 }

mercurial