aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2022-11-21 22:29:06 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2022-11-21 22:29:06 +0100
commit056af2fb44379238609a2a28ede614ee3c5defed (patch)
tree6bb90cf374a8e4648fcae7bb206d1ba974276857
parent898ff5665c89266889cd1e9a85fad73a5415a1ba (diff)
downloadmessenger-gtk-056af2fb44379238609a2a28ede614ee3c5defed.tar.gz
messenger-gtk-056af2fb44379238609a2a28ede614ee3c5defed.zip
Add window to play media with fullscreen toggle
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r--resources/ui.gresource.xml1
-rw-r--r--resources/ui/play_media.ui288
-rw-r--r--src/application.h2
-rw-r--r--src/ui/Makefile.am1
-rw-r--r--src/ui/picker.c18
-rw-r--r--src/ui/play_media.c287
-rw-r--r--src/ui/play_media.h79
7 files changed, 675 insertions, 1 deletions
diff --git a/resources/ui.gresource.xml b/resources/ui.gresource.xml
index eb0072e..61116c1 100644
--- a/resources/ui.gresource.xml
+++ b/resources/ui.gresource.xml
@@ -22,6 +22,7 @@
22 <file compressed="true">ui/new_platform.ui</file> 22 <file compressed="true">ui/new_platform.ui</file>
23 <file compressed="true">ui/new_account.ui</file> 23 <file compressed="true">ui/new_account.ui</file>
24 <file compressed="true">ui/picker.ui</file> 24 <file compressed="true">ui/picker.ui</file>
25 <file compressed="true">ui/play_media.ui</file>
25 <file compressed="true">ui/account_entry.ui</file> 26 <file compressed="true">ui/account_entry.ui</file>
26 <file compressed="true">ui/send_file.ui</file> 27 <file compressed="true">ui/send_file.ui</file>
27 <file compressed="true">ui/settings.ui</file> 28 <file compressed="true">ui/settings.ui</file>
diff --git a/resources/ui/play_media.ui b/resources/ui/play_media.ui
new file mode 100644
index 0000000..9e485df
--- /dev/null
+++ b/resources/ui/play_media.ui
@@ -0,0 +1,288 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<!-- Generated with glade 3.40.0
3
4Copyright (C) 2022 GNUnet e.V.
5
6GNUnet is free software: you can redistribute it and/or modify it
7under the terms of the GNU Affero General Public License as published
8by the Free Software Foundation, either version 3 of the License,
9or (at your option) any later version.
10
11GNUnet is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14Affero General Public License for more details.
15
16You should have received a copy of the GNU Affero General Public License
17along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19SPDX-License-Identifier: AGPL3.0-or-later
20Author: Tobias Frisch
21
22-->
23<interface>
24 <requires lib="gtk+" version="3.24"/>
25 <requires lib="libhandy" version="1.2"/>
26 <object class="HdyWindow" id="play_media_window">
27 <property name="width-request">250</property>
28 <property name="height-request">180</property>
29 <property name="can-focus">False</property>
30 <property name="modal">True</property>
31 <property name="window-position">center-on-parent</property>
32 <property name="type-hint">dialog</property>
33 <child>
34 <object class="GtkBox">
35 <property name="visible">True</property>
36 <property name="can-focus">False</property>
37 <property name="orientation">vertical</property>
38 <child>
39 <object class="GtkRevealer" id="header_revealer">
40 <property name="visible">True</property>
41 <property name="can-focus">False</property>
42 <property name="reveal-child">True</property>
43 <child>
44 <object class="HdyWindowHandle">
45 <property name="visible">True</property>
46 <property name="can-focus">False</property>
47 <child>
48 <object class="HdyHeaderBar" id="title_bar">
49 <property name="visible">True</property>
50 <property name="can-focus">False</property>
51 <property name="show-close-button">True</property>
52 <child>
53 <object class="GtkButton" id="back_button">
54 <property name="visible">True</property>
55 <property name="can-focus">True</property>
56 <property name="receives-default">True</property>
57 <child>
58 <object class="GtkImage">
59 <property name="visible">True</property>
60 <property name="can-focus">False</property>
61 <property name="icon-name">go-previous-symbolic</property>
62 </object>
63 </child>
64 </object>
65 </child>
66 </object>
67 </child>
68 </object>
69 </child>
70 </object>
71 <packing>
72 <property name="expand">False</property>
73 <property name="fill">True</property>
74 <property name="position">0</property>
75 </packing>
76 </child>
77 <child>
78 <object class="HdyFlap" id="controls_flap">
79 <property name="visible">True</property>
80 <property name="can-focus">False</property>
81 <property name="orientation">vertical</property>
82 <property name="flap-position">end</property>
83 <property name="modal">False</property>
84 <child type="content">
85 <object class="GtkImage">
86 <property name="visible">True</property>
87 <property name="can-focus">False</property>
88 <property name="icon-name">folder-videos-symbolic</property>
89 <property name="icon_size">6</property>
90 </object>
91 </child>
92 <child type="separator">
93 <object class="GtkSeparator">
94 <property name="visible">True</property>
95 <property name="can-focus">False</property>
96 </object>
97 </child>
98 <child type="flap">
99 <object class="GtkBox">
100 <property name="visible">True</property>
101 <property name="can-focus">False</property>
102 <property name="orientation">vertical</property>
103 <child>
104 <object class="GtkBox">
105 <property name="visible">True</property>
106 <property name="can-focus">False</property>
107 <property name="border-width">4</property>
108 <property name="spacing">8</property>
109 <child>
110 <object class="GtkButton" id="play_pause_button">
111 <property name="visible">True</property>
112 <property name="can-focus">True</property>
113 <property name="receives-default">True</property>
114 <property name="relief">none</property>
115 <child>
116 <object class="GtkStack" id="play_symbol_stack">
117 <property name="visible">True</property>
118 <property name="can-focus">False</property>
119 <child>
120 <object class="GtkImage">
121 <property name="visible">True</property>
122 <property name="can-focus">False</property>
123 <property name="icon-name">media-playback-start-symbolic</property>
124 </object>
125 <packing>
126 <property name="name">play_page</property>
127 </packing>
128 </child>
129 <child>
130 <object class="GtkImage">
131 <property name="visible">True</property>
132 <property name="can-focus">False</property>
133 <property name="icon-name">media-playback-pause-symbolic</property>
134 </object>
135 <packing>
136 <property name="name">pause_page</property>
137 <property name="position">1</property>
138 </packing>
139 </child>
140 </object>
141 </child>
142 </object>
143 <packing>
144 <property name="expand">False</property>
145 <property name="fill">True</property>
146 <property name="position">0</property>
147 </packing>
148 </child>
149 <child>
150 <object class="GtkVolumeButton" id="volume_button">
151 <property name="visible">True</property>
152 <property name="can-focus">True</property>
153 <property name="focus-on-click">False</property>
154 <property name="receives-default">True</property>
155 <property name="relief">none</property>
156 <property name="orientation">vertical</property>
157 <property name="icons">audio-volume-muted-symbolic
158audio-volume-high-symbolic
159audio-volume-low-symbolic
160audio-volume-medium-symbolic</property>
161 <child internal-child="plus_button">
162 <object class="GtkButton">
163 <property name="can-focus">False</property>
164 <property name="receives-default">False</property>
165 </object>
166 </child>
167 <child internal-child="minus_button">
168 <object class="GtkButton">
169 <property name="can-focus">False</property>
170 <property name="receives-default">False</property>
171 </object>
172 </child>
173 </object>
174 <packing>
175 <property name="expand">False</property>
176 <property name="fill">True</property>
177 <property name="position">1</property>
178 </packing>
179 </child>
180 <child>
181 <object class="GtkLabel" id="timeline_label">
182 <property name="visible">True</property>
183 <property name="can-focus">False</property>
184 <property name="label" translatable="yes">0:00 / 0:00</property>
185 </object>
186 <packing>
187 <property name="expand">False</property>
188 <property name="fill">True</property>
189 <property name="position">2</property>
190 </packing>
191 </child>
192 <child>
193 <object class="GtkButton" id="fullscreen_button">
194 <property name="visible">True</property>
195 <property name="can-focus">True</property>
196 <property name="receives-default">True</property>
197 <property name="relief">none</property>
198 <child>
199 <object class="GtkStack" id="fullscreen_symbol_stack">
200 <property name="visible">True</property>
201 <property name="can-focus">False</property>
202 <child>
203 <object class="GtkImage">
204 <property name="visible">True</property>
205 <property name="can-focus">False</property>
206 <property name="icon-name">view-fullscreen-symbolic</property>
207 </object>
208 <packing>
209 <property name="name">scale_up_page</property>
210 </packing>
211 </child>
212 <child>
213 <object class="GtkImage">
214 <property name="visible">True</property>
215 <property name="can-focus">False</property>
216 <property name="icon-name">view-restore-symbolic</property>
217 </object>
218 <packing>
219 <property name="name">scale_down_page</property>
220 <property name="position">1</property>
221 </packing>
222 </child>
223 </object>
224 </child>
225 </object>
226 <packing>
227 <property name="expand">False</property>
228 <property name="fill">True</property>
229 <property name="pack-type">end</property>
230 <property name="position">3</property>
231 </packing>
232 </child>
233 <child>
234 <object class="GtkButton" id="settings_button">
235 <property name="visible">True</property>
236 <property name="can-focus">True</property>
237 <property name="receives-default">True</property>
238 <property name="relief">none</property>
239 <child>
240 <object class="GtkImage">
241 <property name="visible">True</property>
242 <property name="can-focus">False</property>
243 <property name="icon-name">emblem-system-symbolic</property>
244 </object>
245 </child>
246 </object>
247 <packing>
248 <property name="expand">False</property>
249 <property name="fill">True</property>
250 <property name="pack-type">end</property>
251 <property name="position">4</property>
252 </packing>
253 </child>
254 </object>
255 <packing>
256 <property name="expand">False</property>
257 <property name="fill">True</property>
258 <property name="pack-type">end</property>
259 <property name="position">1</property>
260 </packing>
261 </child>
262 <child>
263 <object class="GtkProgressBar" id="timeline_progress_bar">
264 <property name="visible">True</property>
265 <property name="can-focus">False</property>
266 <property name="margin-start">4</property>
267 <property name="margin-end">4</property>
268 </object>
269 <packing>
270 <property name="expand">False</property>
271 <property name="fill">True</property>
272 <property name="position">2</property>
273 </packing>
274 </child>
275 </object>
276 </child>
277 </object>
278 <packing>
279 <property name="expand">True</property>
280 <property name="fill">True</property>
281 <property name="pack-type">end</property>
282 <property name="position">2</property>
283 </packing>
284 </child>
285 </object>
286 </child>
287 </object>
288</interface>
diff --git a/src/application.h b/src/application.h
index f3b4407..2dc4696 100644
--- a/src/application.h
+++ b/src/application.h
@@ -42,6 +42,7 @@
42#include "ui/new_group.h" 42#include "ui/new_group.h"
43#include "ui/new_lobby.h" 43#include "ui/new_lobby.h"
44#include "ui/new_platform.h" 44#include "ui/new_platform.h"
45#include "ui/play_media.h"
45#include "ui/send_file.h" 46#include "ui/send_file.h"
46#include "ui/settings.h" 47#include "ui/settings.h"
47 48
@@ -100,6 +101,7 @@ typedef struct MESSENGER_Application
100 UI_DELETE_MESSAGES_Handle delete_messages; 101 UI_DELETE_MESSAGES_Handle delete_messages;
101 UI_INVITE_CONTACT_Handle invite_contact; 102 UI_INVITE_CONTACT_Handle invite_contact;
102 UI_SEND_FILE_Handle send_file; 103 UI_SEND_FILE_Handle send_file;
104 UI_PLAY_MEDIA_Handle play_media;
103 105
104 UI_NEW_CONTACT_Handle new_contact; 106 UI_NEW_CONTACT_Handle new_contact;
105 UI_NEW_GROUP_Handle new_group; 107 UI_NEW_GROUP_Handle new_group;
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index b30f8ee..3e6cbf7 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -32,6 +32,7 @@ libui_a_SOURCES = \
32 new_lobby.c new_lobby.h \ 32 new_lobby.c new_lobby.h \
33 new_platform.c new_platform.h \ 33 new_platform.c new_platform.h \
34 picker.c picker.h \ 34 picker.c picker.h \
35 play_media.c play_media.h \
35 send_file.c send_file.h \ 36 send_file.c send_file.h \
36 settings.c settings.h 37 settings.c settings.h
37 38
diff --git a/src/ui/picker.c b/src/ui/picker.c
index 09ccf09..ca8423e 100644
--- a/src/ui/picker.c
+++ b/src/ui/picker.c
@@ -95,8 +95,17 @@ handle_search_button_click(UNUSED GtkButton *button,
95 ); 95 );
96} 96}
97 97
98static void
99handle_settings_button_click(UNUSED GtkButton *button,
100 gpointer user_data)
101{
102 MESSENGER_Application *app = (MESSENGER_Application*) user_data;
103 ui_play_media_window_init(app, &(app->ui.play_media));
104 gtk_widget_show(GTK_WIDGET(app->ui.play_media.window));
105}
106
98UI_PICKER_Handle* 107UI_PICKER_Handle*
99ui_picker_new(UNUSED MESSENGER_Application *app, 108ui_picker_new(MESSENGER_Application *app,
100 UI_CHAT_Handle *chat) 109 UI_CHAT_Handle *chat)
101{ 110{
102 UI_PICKER_Handle *handle = g_malloc(sizeof(UI_PICKER_Handle)); 111 UI_PICKER_Handle *handle = g_malloc(sizeof(UI_PICKER_Handle));
@@ -244,6 +253,13 @@ ui_picker_new(UNUSED MESSENGER_Application *app,
244 gtk_builder_get_object(handle->builder, "settings_button") 253 gtk_builder_get_object(handle->builder, "settings_button")
245 ); 254 );
246 255
256 g_signal_connect(
257 handle->settings_button,
258 "clicked",
259 G_CALLBACK(handle_settings_button_click),
260 app
261 );
262
247 return handle; 263 return handle;
248} 264}
249 265
diff --git a/src/ui/play_media.c b/src/ui/play_media.c
new file mode 100644
index 0000000..dc41a3e
--- /dev/null
+++ b/src/ui/play_media.c
@@ -0,0 +1,287 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2022 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20/*
21 * @author Tobias Frisch
22 * @file ui/play_media.c
23 */
24
25#include "play_media.h"
26
27#include "../application.h"
28#include "../ui.h"
29
30static void
31handle_back_button_click(GtkButton *button,
32 gpointer user_data)
33{
34 GtkWindow *window = GTK_WINDOW(user_data);
35 gtk_window_close(window);
36}
37
38static void
39_pause_playing_media(UI_PLAY_MEDIA_Handle *handle)
40{
41 //
42
43 handle->playing = FALSE;
44}
45
46static void
47_continue_playing_media(UI_PLAY_MEDIA_Handle *handle)
48{
49 //
50
51 handle->playing = TRUE;
52}
53
54static void
55handle_play_pause_button_click(GtkButton *button,
56 gpointer user_data)
57{
58 UI_PLAY_MEDIA_Handle *handle = (UI_PLAY_MEDIA_Handle*) user_data;
59
60 if (handle->playing)
61 _pause_playing_media(handle);
62 else
63 _continue_playing_media(handle);
64
65 gtk_stack_set_visible_child_name(
66 handle->play_symbol_stack,
67 handle->playing? "pause_page" : "play_page"
68 );
69}
70
71static void
72handle_fullscreen_button_click(GtkButton *button,
73 gpointer user_data)
74{
75 UI_PLAY_MEDIA_Handle *handle = (UI_PLAY_MEDIA_Handle*) user_data;
76
77 gtk_revealer_set_reveal_child(handle->header_revealer, handle->fullscreen);
78 hdy_flap_set_reveal_flap(handle->controls_flap, handle->fullscreen);
79
80 handle->fullscreen = !(handle->fullscreen);
81
82 if (!(handle->fullscreen))
83 gtk_window_unfullscreen(GTK_WINDOW(handle->window));
84
85 gtk_widget_hide(GTK_WIDGET(handle->window));
86
87 gtk_window_set_type_hint(
88 GTK_WINDOW(handle->window),
89 handle->fullscreen?
90 GDK_WINDOW_TYPE_HINT_NORMAL :
91 GDK_WINDOW_TYPE_HINT_DIALOG
92 );
93
94 gtk_window_set_modal(GTK_WINDOW(handle->window), !(handle->fullscreen));
95
96 gtk_window_set_position(
97 GTK_WINDOW(handle->window),
98 handle->fullscreen? GTK_WIN_POS_NONE : GTK_WIN_POS_CENTER_ON_PARENT
99 );
100
101 gtk_window_set_transient_for(
102 GTK_WINDOW(handle->window),
103 handle->fullscreen? NULL : handle->parent
104 );
105
106 gtk_widget_show_all(GTK_WIDGET(handle->window));
107
108 if (handle->fullscreen)
109 gtk_window_fullscreen(GTK_WINDOW(handle->window));
110
111 gtk_stack_set_visible_child_name(
112 handle->fullscreen_symbol_stack,
113 handle->fullscreen? "scale_down_page" : "scale_up_page"
114 );
115}
116
117static gboolean
118handle_media_motion_lost(gpointer user_data)
119{
120 UI_PLAY_MEDIA_Handle *handle = (UI_PLAY_MEDIA_Handle*) user_data;
121
122 if (!(hdy_flap_get_reveal_flap(handle->controls_flap)))
123 return FALSE;
124
125 hdy_flap_set_reveal_flap(handle->controls_flap, FALSE);
126 handle->motion_lost = 0;
127 return FALSE;
128}
129
130static gboolean
131handle_media_motion_notify(GtkWidget *widget,
132 GdkEvent *event,
133 gpointer user_data)
134{
135 UI_PLAY_MEDIA_Handle *handle = (UI_PLAY_MEDIA_Handle*) user_data;
136
137 if (hdy_flap_get_reveal_flap(handle->controls_flap))
138 return FALSE;
139
140 if (handle->motion_lost)
141 g_source_remove(handle->motion_lost);
142
143 hdy_flap_set_reveal_flap(handle->controls_flap, TRUE);
144 handle->motion_lost = g_timeout_add_seconds(
145 3,
146 G_SOURCE_FUNC(handle_media_motion_lost),
147 handle
148 );
149
150 return FALSE;
151}
152
153static void
154handle_window_destroy(UNUSED GtkWidget *window,
155 gpointer user_data)
156{
157 ui_play_media_window_cleanup((UI_PLAY_MEDIA_Handle*) user_data);
158}
159
160void
161ui_play_media_window_init(MESSENGER_Application *app,
162 UI_PLAY_MEDIA_Handle *handle)
163{
164 GNUNET_assert((app) && (handle));
165
166 handle->parent = GTK_WINDOW(app->ui.messenger.main_window);
167
168 handle->builder = gtk_builder_new_from_resource(
169 application_get_resource_path(app, "ui/play_media.ui")
170 );
171
172 handle->window = HDY_WINDOW(
173 gtk_builder_get_object(handle->builder, "play_media_window")
174 );
175
176 gtk_window_set_position(
177 GTK_WINDOW(handle->window),
178 GTK_WIN_POS_CENTER_ON_PARENT
179 );
180
181 gtk_window_set_transient_for(
182 GTK_WINDOW(handle->window),
183 handle->parent
184 );
185
186 handle->header_revealer = GTK_REVEALER(
187 gtk_builder_get_object(handle->builder, "header_revealer")
188 );
189
190 handle->title_bar = HDY_HEADER_BAR(
191 gtk_builder_get_object(handle->builder, "title_bar")
192 );
193
194 hdy_header_bar_set_title(handle->title_bar, _("Play Media"));
195
196 handle->back_button = GTK_BUTTON(
197 gtk_builder_get_object(handle->builder, "back_button")
198 );
199
200 g_signal_connect(
201 handle->back_button,
202 "clicked",
203 G_CALLBACK(handle_back_button_click),
204 handle->window
205 );
206
207 handle->controls_flap = HDY_FLAP(
208 gtk_builder_get_object(handle->builder, "controls_flap")
209 );
210
211 handle->play_pause_button = GTK_BUTTON(
212 gtk_builder_get_object(handle->builder, "play_pause_button")
213 );
214
215 handle->play_symbol_stack = GTK_STACK(
216 gtk_builder_get_object(handle->builder, "play_symbol_stack")
217 );
218
219 g_signal_connect(
220 handle->play_pause_button,
221 "clicked",
222 G_CALLBACK(handle_play_pause_button_click),
223 handle
224 );
225
226 handle->volume_button = GTK_VOLUME_BUTTON(
227 gtk_builder_get_object(handle->builder, "volume_button")
228 );
229
230 handle->timeline_label = GTK_LABEL(
231 gtk_builder_get_object(handle->builder, "timeline_label")
232 );
233
234 handle->settings_button = GTK_BUTTON(
235 gtk_builder_get_object(handle->builder, "settings_button")
236 );
237
238 handle->fullscreen_button = GTK_BUTTON(
239 gtk_builder_get_object(handle->builder, "fullscreen_button")
240 );
241
242 handle->fullscreen_symbol_stack = GTK_STACK(
243 gtk_builder_get_object(handle->builder, "fullscreen_symbol_stack")
244 );
245
246 g_signal_connect(
247 handle->fullscreen_button,
248 "clicked",
249 G_CALLBACK(handle_fullscreen_button_click),
250 handle
251 );
252
253 g_signal_connect(
254 handle->window,
255 "motion-notify-event",
256 G_CALLBACK(handle_media_motion_notify),
257 handle
258 );
259
260 gtk_widget_add_events(
261 GTK_WIDGET(handle->window),
262 GDK_POINTER_MOTION_HINT_MASK |
263 GDK_POINTER_MOTION_MASK
264 );
265
266 g_signal_connect(
267 handle->window,
268 "destroy",
269 G_CALLBACK(handle_window_destroy),
270 handle
271 );
272
273 gtk_widget_show_all(GTK_WIDGET(handle->window));
274}
275
276void
277ui_play_media_window_cleanup(UI_PLAY_MEDIA_Handle *handle)
278{
279 GNUNET_assert(handle);
280
281 g_object_unref(handle->builder);
282
283 if (handle->motion_lost)
284 g_source_remove(handle->motion_lost);
285
286 memset(handle, 0, sizeof(*handle));
287}
diff --git a/src/ui/play_media.h b/src/ui/play_media.h
new file mode 100644
index 0000000..29f8d1a
--- /dev/null
+++ b/src/ui/play_media.h
@@ -0,0 +1,79 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2022 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20/*
21 * @author Tobias Frisch
22 * @file ui/play_media.h
23 */
24
25#ifndef UI_PLAY_MEDIA_H_
26#define UI_PLAY_MEDIA_H_
27
28#include "messenger.h"
29
30typedef struct UI_PLAY_MEDIA_Handle
31{
32 gboolean playing;
33 gboolean fullscreen;
34
35 GtkWindow *parent;
36
37 GtkBuilder *builder;
38 HdyWindow *window;
39
40 GtkRevealer *header_revealer;
41 HdyHeaderBar *title_bar;
42 GtkButton *back_button;
43
44 HdyFlap *controls_flap;
45 GtkButton *play_pause_button;
46 GtkStack *play_symbol_stack;
47
48 GtkVolumeButton *volume_button;
49 GtkLabel *timeline_label;
50
51 GtkButton *settings_button;
52
53 GtkButton *fullscreen_button;
54 GtkStack *fullscreen_symbol_stack;
55
56 guint motion_lost;
57} UI_PLAY_MEDIA_Handle;
58
59/**
60 * Initializes a handle for the play media window
61 * of a given messenger application.
62 *
63 * @param app Messenger application
64 * @param handle Play media window handle
65 */
66void
67ui_play_media_window_init(MESSENGER_Application *app,
68 UI_PLAY_MEDIA_Handle *handle);
69
70/**
71 * Cleans up the allocated resources and resets the
72 * state of a given play media window handle.
73 *
74 * @param handle Play media window handle
75 */
76void
77ui_play_media_window_cleanup(UI_PLAY_MEDIA_Handle *handle);
78
79#endif /* UI_PLAY_MEDIA_H_ */