diff options
Diffstat (limited to 'src/ui/message.c')
-rw-r--r-- | src/ui/message.c | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/src/ui/message.c b/src/ui/message.c index 47ec2aa..da6bb97 100644 --- a/src/ui/message.c +++ b/src/ui/message.c | |||
@@ -27,8 +27,8 @@ | |||
27 | #include "../application.h" | 27 | #include "../application.h" |
28 | 28 | ||
29 | UI_MESSAGE_Handle* | 29 | UI_MESSAGE_Handle* |
30 | ui_message_new(UI_MESSAGE_Type type, | 30 | ui_message_new(MESSENGER_Application *app, |
31 | UI_MESSAGE_ContentType content_type) | 31 | UI_MESSAGE_Type type) |
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 | 34 | ||
@@ -39,17 +39,19 @@ ui_message_new(UI_MESSAGE_Type type, | |||
39 | switch (handle->type) | 39 | switch (handle->type) |
40 | { | 40 | { |
41 | case UI_MESSAGE_SENT: | 41 | case UI_MESSAGE_SENT: |
42 | ui_builder_file = "resources/ui/message-sent.ui"; | 42 | ui_builder_file = "ui/message-sent.ui"; |
43 | break; | 43 | break; |
44 | case UI_MESSAGE_STATUS: | 44 | case UI_MESSAGE_STATUS: |
45 | ui_builder_file = "resources/ui/message-status.ui"; | 45 | ui_builder_file = "ui/message-status.ui"; |
46 | break; | 46 | break; |
47 | default: | 47 | default: |
48 | ui_builder_file = "resources/ui/message.ui"; | 48 | ui_builder_file = "ui/message.ui"; |
49 | break; | 49 | break; |
50 | } | 50 | } |
51 | 51 | ||
52 | handle->builder = gtk_builder_new_from_file(ui_builder_file); | 52 | handle->builder = gtk_builder_new_from_resource( |
53 | application_get_resource_path(app, ui_builder_file) | ||
54 | ); | ||
53 | 55 | ||
54 | handle->message_box = GTK_WIDGET( | 56 | handle->message_box = GTK_WIDGET( |
55 | gtk_builder_get_object(handle->builder, "message_box") | 57 | gtk_builder_get_object(handle->builder, "message_box") |
@@ -94,8 +96,8 @@ ui_message_new(UI_MESSAGE_Type type, | |||
94 | gtk_builder_get_object(handle->builder, "content_box") | 96 | gtk_builder_get_object(handle->builder, "content_box") |
95 | ); | 97 | ); |
96 | 98 | ||
97 | GtkBuilder *builder = gtk_builder_new_from_file( | 99 | GtkBuilder *builder = gtk_builder_new_from_resource( |
98 | "resources/ui/message_content.ui" | 100 | application_get_resource_path(app, "ui/message_content.ui") |
99 | ); | 101 | ); |
100 | 102 | ||
101 | handle->timestamp_label = GTK_LABEL( | 103 | handle->timestamp_label = GTK_LABEL( |
@@ -131,32 +133,6 @@ ui_message_new(UI_MESSAGE_Type type, | |||
131 | break; | 133 | break; |
132 | } | 134 | } |
133 | 135 | ||
134 | switch (content_type) | ||
135 | { | ||
136 | case UI_MESSAGE_CONTENT_TEXT: | ||
137 | gtk_stack_set_visible_child( | ||
138 | handle->content_stack, | ||
139 | GTK_WIDGET(handle->text_label) | ||
140 | ); | ||
141 | break; | ||
142 | case UI_MESSAGE_CONTENT_FILE: | ||
143 | gtk_stack_set_visible_child( | ||
144 | handle->content_stack, | ||
145 | GTK_WIDGET(handle->file_revealer) | ||
146 | ); | ||
147 | |||
148 | gtk_revealer_set_reveal_child(handle->file_revealer, TRUE); | ||
149 | break; | ||
150 | case UI_MESSAGE_CONTENT_PREVIEW: | ||
151 | gtk_stack_set_visible_child( | ||
152 | handle->content_stack, | ||
153 | GTK_WIDGET(handle->preview_drawing_area) | ||
154 | ); | ||
155 | break; | ||
156 | default: | ||
157 | break; | ||
158 | } | ||
159 | |||
160 | gtk_container_add(content_box, GTK_WIDGET( | 136 | gtk_container_add(content_box, GTK_WIDGET( |
161 | gtk_builder_get_object(builder, "message_content_box") | 137 | gtk_builder_get_object(builder, "message_content_box") |
162 | )); | 138 | )); |