video: reset button icon to inactive after video processing
In current state after video is processed and saved button has video-recording icon, that is confusing. The change handles exit code of movie.sh script and depending on that notifies UI to set video-inactive icon. video-recording icon is set, when the user press button to activate video recording.
This commit is contained in:

committed by
Martijn Braam

parent
4cbd8c2df7
commit
6a7d2ec85e
@@ -1008,13 +1008,11 @@ flash_button_clicked(GtkWidget *button, gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
notify_movie_progress(void)
|
notify_movie_record_ready(void)
|
||||||
{
|
{
|
||||||
if (!movie_start) {
|
movie_start = 0;
|
||||||
// Recording started
|
|
||||||
gtk_button_set_icon_name(GTK_BUTTON(movie),
|
gtk_button_set_icon_name(GTK_BUTTON(movie),
|
||||||
"video-recording-symbolic");
|
"video-inactive-symbolic");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -38,7 +38,7 @@ int remap(int value, int input_min, int input_max, int output_min, int output_ma
|
|||||||
|
|
||||||
bool check_window_active();
|
bool check_window_active();
|
||||||
|
|
||||||
void notify_movie_progress(void);
|
void notify_movie_record_ready(void);
|
||||||
|
|
||||||
void notify_movie_message(gchar *msg);
|
void notify_movie_message(gchar *msg);
|
||||||
void notify_auto_status(gchar *msg);
|
void notify_auto_status(gchar *msg);
|
||||||
|
@@ -837,7 +837,6 @@ static void on_read_complete(GObject *source_object, GAsyncResult *res, gpointer
|
|||||||
// End of file reached, close the stream
|
// End of file reached, close the stream
|
||||||
g_input_stream_close(stream, NULL, NULL);
|
g_input_stream_close(stream, NULL, NULL);
|
||||||
g_object_unref(stream);
|
g_object_unref(stream);
|
||||||
notify_movie_progress();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (bytes_read < 0) {
|
if (bytes_read < 0) {
|
||||||
@@ -868,6 +867,27 @@ static void on_read_complete(GObject *source_object, GAsyncResult *res, gpointer
|
|||||||
on_read_complete, NULL);
|
on_read_complete, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
spawn_movie_finished(GSubprocess *proc, GAsyncResult *res, gpointer data)
|
||||||
|
{
|
||||||
|
int exit_status;
|
||||||
|
|
||||||
|
g_subprocess_wait_finish(proc, res, NULL);
|
||||||
|
if (g_subprocess_get_if_exited (proc)) {
|
||||||
|
exit_status = g_subprocess_get_exit_status (proc);
|
||||||
|
if (movie_recording) {
|
||||||
|
// stop recording, when recording failed to start
|
||||||
|
if (exit_status) {
|
||||||
|
movie_recording = 0;
|
||||||
|
notify_movie_record_ready();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// finished video processing
|
||||||
|
notify_movie_record_ready();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spawn_movie(char *cmd)
|
spawn_movie(char *cmd)
|
||||||
{
|
{
|
||||||
@@ -910,6 +930,8 @@ spawn_movie(char *cmd)
|
|||||||
// Read the output of the subprocess asynchronously
|
// Read the output of the subprocess asynchronously
|
||||||
g_input_stream_read_async(stdout_stream, stdout_buf, sizeof(stdout_buf), G_PRIORITY_DEFAULT, NULL,
|
g_input_stream_read_async(stdout_stream, stdout_buf, sizeof(stdout_buf), G_PRIORITY_DEFAULT, NULL,
|
||||||
on_read_complete, NULL);
|
on_read_complete, NULL);
|
||||||
|
|
||||||
|
g_subprocess_wait_async(proc, NULL, (GAsyncReadyCallback)spawn_movie_finished, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user