aboutsummaryrefslogtreecommitdiff
path: root/src/ui/message.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/message.c')
-rw-r--r--src/ui/message.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/ui/message.c b/src/ui/message.c
index 8d5627f..3678414 100644
--- a/src/ui/message.c
+++ b/src/ui/message.c
@@ -101,7 +101,19 @@ handle_file_button_click(GtkButton *button,
101 GString* uri = g_string_new("file://"); 101 GString* uri = g_string_new("file://");
102 g_string_append(uri, preview); 102 g_string_append(uri, preview);
103 103
104 if (!g_app_info_launch_default_for_uri(uri->str, NULL, NULL)) 104 if (handle->media)
105 {
106 ui_play_media_window_init(app, &(app->ui.play_media));
107
108 ui_play_media_window_update(
109 &(app->ui.play_media),
110 uri->str,
111 file
112 );
113
114 gtk_widget_show(GTK_WIDGET(app->ui.play_media.window));
115 }
116 else if (!g_app_info_launch_default_for_uri(uri->str, NULL, NULL))
105 GNUNET_CHAT_file_close_preview(file); 117 GNUNET_CHAT_file_close_preview(file);
106 118
107 g_string_free(uri, TRUE); 119 g_string_free(uri, TRUE);
@@ -248,6 +260,7 @@ ui_message_new(MESSENGER_Application *app,
248 UI_MESSAGE_Handle* handle = g_malloc(sizeof(UI_MESSAGE_Handle)); 260 UI_MESSAGE_Handle* handle = g_malloc(sizeof(UI_MESSAGE_Handle));
249 261
250 handle->type = type; 262 handle->type = type;
263 handle->media = FALSE;
251 264
252 handle->timestamp = GNUNET_TIME_absolute_get_zero_(); 265 handle->timestamp = GNUNET_TIME_absolute_get_zero_();
253 handle->msg = NULL; 266 handle->msg = NULL;
@@ -472,7 +485,7 @@ _update_file_message(UI_MESSAGE_Handle *handle,
472 if (!(handle->preview_animation)) 485 if (!(handle->preview_animation))
473 handle->preview_image = gdk_pixbuf_new_from_file(preview, NULL); 486 handle->preview_image = gdk_pixbuf_new_from_file(preview, NULL);
474 487
475 if ((handle->preview_animation) || (handle->preview_animation)) 488 if ((handle->preview_animation) || (handle->preview_image))
476 { 489 {
477 gtk_widget_set_size_request( 490 gtk_widget_set_size_request(
478 GTK_WIDGET(handle->preview_drawing_area), 491 GTK_WIDGET(handle->preview_drawing_area),
@@ -489,6 +502,14 @@ _update_file_message(UI_MESSAGE_Handle *handle,
489 return; 502 return;
490 } 503 }
491 504
505 const char* extension = strrchr(filename, '.');
506
507 if (0 == g_strcmp0(extension, ".mp4"))
508 {
509 handle->media = TRUE;
510 goto file_progress;
511 }
512
492 GNUNET_CHAT_file_close_preview(file); 513 GNUNET_CHAT_file_close_preview(file);
493 514
494file_progress: 515file_progress:
@@ -496,7 +517,7 @@ file_progress:
496 517
497 gtk_image_set_from_icon_name( 518 gtk_image_set_from_icon_name(
498 handle->file_status_image, 519 handle->file_status_image,
499 "document-open-symbolic", 520 (handle->media? "video-x-generic-symbolic" : "document-open-symbolic"),
500 GTK_ICON_SIZE_BUTTON 521 GTK_ICON_SIZE_BUTTON
501 ); 522 );
502 523