diff options
Diffstat (limited to 'src/ui/message.c')
-rw-r--r-- | src/ui/message.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/ui/message.c b/src/ui/message.c index f48bbaa..f89f5ef 100644 --- a/src/ui/message.c +++ b/src/ui/message.c | |||
@@ -31,23 +31,22 @@ ui_message_new(MESSENGER_Application *app, | |||
31 | bool sent) | 31 | bool sent) |
32 | { | 32 | { |
33 | UI_MESSAGE_Handle* handle = g_malloc(sizeof(UI_MESSAGE_Handle)); | 33 | UI_MESSAGE_Handle* handle = g_malloc(sizeof(UI_MESSAGE_Handle)); |
34 | GtkBuilder* builder; | ||
35 | 34 | ||
36 | if (sent) | 35 | if (sent) |
37 | builder = gtk_builder_new_from_file("resources/ui/message-sent.ui"); | 36 | handle->builder = gtk_builder_new_from_file("resources/ui/message-sent.ui"); |
38 | else | 37 | else |
39 | builder = gtk_builder_new_from_file("resources/ui/message.ui"); | 38 | handle->builder = gtk_builder_new_from_file("resources/ui/message.ui"); |
40 | 39 | ||
41 | handle->message_box = GTK_WIDGET( | 40 | handle->message_box = GTK_WIDGET( |
42 | gtk_builder_get_object(builder, "message_box") | 41 | gtk_builder_get_object(handle->builder, "message_box") |
43 | ); | 42 | ); |
44 | 43 | ||
45 | handle->sender_avatar = HDY_AVATAR( | 44 | handle->sender_avatar = HDY_AVATAR( |
46 | gtk_builder_get_object(builder, "sender_avatar") | 45 | gtk_builder_get_object(handle->builder, "sender_avatar") |
47 | ); | 46 | ); |
48 | 47 | ||
49 | handle->sender_label = GTK_LABEL( | 48 | handle->sender_label = GTK_LABEL( |
50 | gtk_builder_get_object(builder, "sender_label") | 49 | gtk_builder_get_object(handle->builder, "sender_label") |
51 | ); | 50 | ); |
52 | 51 | ||
53 | if (sent) | 52 | if (sent) |
@@ -59,16 +58,24 @@ ui_message_new(MESSENGER_Application *app, | |||
59 | } | 58 | } |
60 | 59 | ||
61 | handle->text_label = GTK_LABEL( | 60 | handle->text_label = GTK_LABEL( |
62 | gtk_builder_get_object(builder, "text_label") | 61 | gtk_builder_get_object(handle->builder, "text_label") |
63 | ); | 62 | ); |
64 | 63 | ||
65 | handle->timestamp_label = GTK_LABEL( | 64 | handle->timestamp_label = GTK_LABEL( |
66 | gtk_builder_get_object(builder, "timestamp_label") | 65 | gtk_builder_get_object(handle->builder, "timestamp_label") |
67 | ); | 66 | ); |
68 | 67 | ||
69 | handle->read_receipt_image = GTK_IMAGE( | 68 | handle->read_receipt_image = GTK_IMAGE( |
70 | gtk_builder_get_object(builder, "read_receipt_image") | 69 | gtk_builder_get_object(handle->builder, "read_receipt_image") |
71 | ); | 70 | ); |
72 | 71 | ||
73 | return handle; | 72 | return handle; |
74 | } | 73 | } |
74 | |||
75 | void | ||
76 | ui_message_delete(UI_MESSAGE_Handle *handle) | ||
77 | { | ||
78 | g_object_unref(handle->builder); | ||
79 | |||
80 | g_free(handle); | ||
81 | } | ||