From 5c71bed891f6cc1e427755bf9827f2c3865d3394 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 23 Jan 2024 13:32:27 +0600 Subject: [PATCH] Changed spawned infinite status box open/close logic --- source/libublsettings-gtk3.c | 30 ++++++++++++++++++++++++++++-- source/libublsettings-gtk3.h | 2 +- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/source/libublsettings-gtk3.c b/source/libublsettings-gtk3.c index 5fb6ace..96a00bf 100644 --- a/source/libublsettings-gtk3.c +++ b/source/libublsettings-gtk3.c @@ -682,6 +682,8 @@ struct temp_statusbox { GtkWidget *revealer; }; +static char *yon_status_thread_id=NULL; + void _yon_ubl_status_box_timed_remove(struct temp_statusbox *statusstruct){ sleep(statusstruct->times); if (status_thread_busy){ @@ -697,12 +699,33 @@ void __yon_ubl_status_box_destroyed(){ status_thread_busy=0; } -int yon_ubl_status_box_spawn_infinite(GtkContainer *container, char *display_text, BACKGROUND_IMAGE_TYPE type){ +void yon_status_box_destroyed(){ + if (yon_status_thread_id){ + free(yon_status_thread_id); + yon_status_thread_id=NULL; + } +} + +int yon_ubl_status_box_spawn_infinite(GtkContainer *container, char *status_id, char *display_text, BACKGROUND_IMAGE_TYPE type){ if (!status_thread_busy){ + if (yon_status_thread_id){ + if (!strcmp(yon_status_thread_id,status_id)){ + return 0; + } + free(yon_status_thread_id); + GList *list = gtk_container_get_children(container); + for (int i=0;irevealer = revealer; - status_thread_busy=2; } } int _yon_ubl_status_box_despawn_infinite(GtkContainer *container){ + if (yon_status_thread_id){ + free(yon_status_thread_id); + yon_status_thread_id=NULL; + } GList *list = gtk_container_get_children(container); for (int i=0; i