Mon, 16 Jan 2023 22:08:46 -0600
Add copy button to Build Information sections
These buttons on each group allow exporting the sections to the clipboard in a markdown format.
The Copy All button allows exporting everything.
Note that this information is purposely _not_ translated as I expect it to primarily be used for debugging by us in bug reports.
Testing Done:
Opened About dialog, clicked all the Copy buttons and confirmed their contents; clicked the Copy All button and confirmed everything was there.
Reviewed at https://reviews.imfreedom.org/r/2196/
|
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 |
|
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
|
154 | 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
|
155 | 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
|
156 | { |
|
41356
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
157 | PidginStatusEditor *editor = data; |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
158 | gboolean title_changed = FALSE, sensitive = FALSE; |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
159 | const gchar *title = NULL; |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
160 | |
|
41544
53ba39406c86
Port PidginStatusEditor to GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
161 | 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
|
162 | |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
163 | if(editor->status != NULL) { |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
164 | /* 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
|
165 | title_changed = !purple_strequal(title, |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
166 | purple_savedstatus_get_title(editor->status)); |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
167 | } else { |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
168 | /* 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
|
169 | title_changed = !purple_strequal(title, ""); |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
170 | } |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
171 | |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
172 | if(title_changed) { |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
173 | 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
|
174 | |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
175 | if(duplicated) { |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
176 | 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
|
177 | 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
|
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 | |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
185 | 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
|
186 | 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
|
187 | } |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
188 | |
|
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 | * GObject Implementation |
|
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 | static void |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
193 | 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
|
194 | GParamSpec *pspec) |
|
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 | PidginStatusEditor *editor = PIDGIN_STATUS_EDITOR(obj); |
|
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 | switch(param_id) { |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
199 | case PROP_STATUS: |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
200 | g_value_set_pointer(value, |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
201 | pidgin_status_editor_get_status(editor)); |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
202 | break; |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
203 | default: |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
204 | 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
|
205 | break; |
|
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 | } |
|
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 | static void |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
210 | 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
|
211 | const GValue *value, GParamSpec *pspec) |
|
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 | PidginStatusEditor *editor = PIDGIN_STATUS_EDITOR(obj); |
|
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 | switch(param_id) { |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
216 | case PROP_STATUS: |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
217 | pidgin_status_editor_set_status(editor, |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
218 | g_value_get_pointer(value)); |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
219 | break; |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
220 | default: |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
221 | 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
|
222 | break; |
|
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 | } |
|
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 | static void |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
227 | pidgin_status_editor_init(PidginStatusEditor *manager) { |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
228 | 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
|
229 | } |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
230 | |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
231 | static void |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
232 | 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
|
233 | 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
|
234 | 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
|
235 | |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
236 | 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
|
237 | 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
|
238 | |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
239 | /** |
|
41479
3d2e114380f6
Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41356
diff
changeset
|
240 | * PidginStatusEditor:status: |
|
41356
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
241 | * |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
242 | * 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
|
243 | * 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
|
244 | * |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
245 | * Since: 3.0.0. |
|
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 | /* 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
|
248 | * managed. |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
249 | */ |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
250 | 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
|
251 | "status", "status", |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
252 | "The saved status we're editing", |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
253 | 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
|
254 | |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
255 | 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
|
256 | |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
257 | 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
|
258 | widget_class, |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
259 | "/im/pidgin/Pidgin3/Status/editor.ui" |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
260 | ); |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
261 | |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
262 | 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
|
263 | buffer); |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
264 | |
|
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 | title); |
|
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 | primitive); |
|
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 | message); |
|
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_child(widget_class, PidginStatusEditor, |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
273 | use); |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
274 | 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
|
275 | save); |
|
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 | 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_response_cb); |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
279 | 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
|
280 | pidgin_status_editor_title_changed_cb); |
|
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 | |
|
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 | * Public API |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
285 | *****************************************************************************/ |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
286 | GtkWidget * |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
287 | pidgin_status_editor_new(PurpleSavedStatus *status) { |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
288 | return g_object_new( |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
289 | PIDGIN_TYPE_STATUS_EDITOR, |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
290 | "status", status, |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
291 | 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 | |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
294 | PurpleSavedStatus * |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
295 | 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
|
296 | 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
|
297 | |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
298 | return editor->status; |
|
9753153c49fc
Add a new templated PidginStatusEditor and wire it up.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
299 | } |