| 17 * GNU General Public License for more details. |
17 * GNU General Public License for more details. |
| 18 * |
18 * |
| 19 * You should have received a copy of the GNU General Public License |
19 * You should have received a copy of the GNU General Public License |
| 20 * along with this program; if not, see <https://www.gnu.org/licenses/>. |
20 * along with this program; if not, see <https://www.gnu.org/licenses/>. |
| 21 */ |
21 */ |
| 22 |
|
| 23 #include <talkatu/talkatu.h> |
|
| 24 |
22 |
| 25 #include "pidginstatuseditor.h" |
23 #include "pidginstatuseditor.h" |
| 26 |
24 |
| 27 #include "pidginstatusprimitivechooser.h" |
25 #include "pidginstatusprimitivechooser.h" |
| 28 |
26 |
| 81 } |
79 } |
| 82 |
80 |
| 83 gtk_editable_set_text(GTK_EDITABLE(editor->title), title); |
81 gtk_editable_set_text(GTK_EDITABLE(editor->title), title); |
| 84 chooser = PIDGIN_STATUS_PRIMITIVE_CHOOSER(editor->primitive); |
82 chooser = PIDGIN_STATUS_PRIMITIVE_CHOOSER(editor->primitive); |
| 85 pidgin_status_primitive_chooser_set_selected(chooser, primitive); |
83 pidgin_status_primitive_chooser_set_selected(chooser, primitive); |
| 86 talkatu_markup_set_html(TALKATU_BUFFER(editor->buffer), message, -1); |
84 gtk_text_buffer_set_text(editor->buffer, message, -1); |
| 87 |
85 |
| 88 g_object_notify_by_pspec(G_OBJECT(editor), properties[PROP_STATUS]); |
86 g_object_notify_by_pspec(G_OBJECT(editor), properties[PROP_STATUS]); |
| 89 } |
87 } |
| 90 |
88 |
| 91 static void |
89 static void |
| 92 pidgin_status_editor_save_status(PidginStatusEditor *editor) { |
90 pidgin_status_editor_save_status(PidginStatusEditor *editor) { |
| 93 PidginStatusPrimitiveChooser *chooser = NULL; |
91 PidginStatusPrimitiveChooser *chooser = NULL; |
| 94 PurpleStatusPrimitive primitive; |
92 PurpleStatusPrimitive primitive; |
| |
93 GtkTextIter start; |
| |
94 GtkTextIter end; |
| 95 gchar *message = NULL; |
95 gchar *message = NULL; |
| 96 const gchar *title = NULL; |
96 const gchar *title = NULL; |
| 97 |
97 |
| 98 title = gtk_editable_get_text(GTK_EDITABLE(editor->title)); |
98 title = gtk_editable_get_text(GTK_EDITABLE(editor->title)); |
| 99 |
99 |
| 100 chooser = PIDGIN_STATUS_PRIMITIVE_CHOOSER(editor->primitive); |
100 chooser = PIDGIN_STATUS_PRIMITIVE_CHOOSER(editor->primitive); |
| 101 primitive = pidgin_status_primitive_chooser_get_selected(chooser); |
101 primitive = pidgin_status_primitive_chooser_get_selected(chooser); |
| 102 |
102 |
| 103 message = talkatu_markup_get_html(editor->buffer, NULL); |
103 gtk_text_buffer_get_start_iter(editor->buffer, &start); |
| |
104 gtk_text_buffer_get_end_iter(editor->buffer, &end); |
| |
105 message = gtk_text_buffer_get_text(editor->buffer, &start, &end, FALSE); |
| 104 |
106 |
| 105 if(editor->status == NULL) { |
107 if(editor->status == NULL) { |
| 106 editor->status = purple_savedstatus_new(title, primitive); |
108 editor->status = purple_savedstatus_new(title, primitive); |
| 107 } else { |
109 } else { |
| 108 const gchar *current_title = NULL; |
110 const gchar *current_title = NULL; |