|
|
|
|
@ -19,7 +19,9 @@ void yon_ubl_status_box_despawn(GtkContainer *status_container);
|
|
|
|
|
gboolean yon_ubl_status_destroy_status(struct status_struct *statusstruct);
|
|
|
|
|
gboolean _yon_ubl_status_box_timed_remove(struct status_struct *statusstruct);
|
|
|
|
|
gboolean yon_status_shrink_window(struct status_struct *statusstruct);
|
|
|
|
|
void yon_status_struct_destroy(struct status_struct *status);
|
|
|
|
|
|
|
|
|
|
GMutex status_remove_mutex;
|
|
|
|
|
|
|
|
|
|
struct status_struct *render = NULL;
|
|
|
|
|
|
|
|
|
|
@ -237,12 +239,7 @@ void yon_ubl_status_box_render_thread(char *text, BACKGROUND_IMAGE_TYPE type){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Status spawn functions
|
|
|
|
|
void __yon_ubl_status_box_destroyed(GtkWidget *self,struct status_struct *statusstruct){
|
|
|
|
|
g_mutex_lock(&statusstruct->mutex);
|
|
|
|
|
if (statusstruct->thread>-1){
|
|
|
|
|
g_source_remove(statusstruct->thread);
|
|
|
|
|
}
|
|
|
|
|
g_mutex_unlock(&statusstruct->mutex);
|
|
|
|
|
void __yon_ubl_status_box_destroyed(GtkWidget *,struct status_struct *statusstruct){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int timeout,BACKGROUND_IMAGE_TYPE type){
|
|
|
|
|
@ -250,7 +247,16 @@ void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int ti
|
|
|
|
|
int blocked = _render_blocked;
|
|
|
|
|
g_mutex_unlock(&_render_block_mutex);
|
|
|
|
|
if (blocked) return;
|
|
|
|
|
// if (gtk_container_get_children(container))return;
|
|
|
|
|
GList *list = gtk_container_get_children(container);
|
|
|
|
|
guint len = g_list_length(list);
|
|
|
|
|
if (len>=3){
|
|
|
|
|
struct status_struct *status = g_object_get_data(G_OBJECT(g_list_nth_data(list,len-3)),"status_struct");
|
|
|
|
|
g_mutex_lock(&status_remove_mutex);
|
|
|
|
|
if (status&>k_revealer_get_reveal_child(GTK_REVEALER(status->revealer))){
|
|
|
|
|
yon_status_struct_destroy(status);
|
|
|
|
|
}
|
|
|
|
|
g_mutex_unlock(&status_remove_mutex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct status_struct *status = yon_status_struct_new();
|
|
|
|
|
|
|
|
|
|
@ -266,9 +272,11 @@ void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int ti
|
|
|
|
|
|
|
|
|
|
gtk_window_get_size(GTK_WINDOW(gtk_widget_get_toplevel(status->revealer)),NULL,&status->window_height);
|
|
|
|
|
if (status->sleep_timer>0){
|
|
|
|
|
g_mutex_lock(&status_remove_mutex);
|
|
|
|
|
g_mutex_lock(&status->mutex);
|
|
|
|
|
status->thread = g_timeout_add(status->sleep_timer*1000,(GSourceFunc)_yon_ubl_status_box_timed_remove,status);
|
|
|
|
|
g_mutex_unlock(&status->mutex);
|
|
|
|
|
g_mutex_unlock(&status_remove_mutex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -293,9 +301,10 @@ void yon_ubl_status_box_despawn(GtkContainer *status_container){
|
|
|
|
|
GList *iter;
|
|
|
|
|
for (iter=list;iter;iter=iter->next){
|
|
|
|
|
struct status_struct *status = g_object_get_data(G_OBJECT(status_container),"status_struct");
|
|
|
|
|
if (status->thread>(guint)-1){
|
|
|
|
|
if (status->thread>(guint)0){
|
|
|
|
|
g_mutex_lock(&status->mutex);
|
|
|
|
|
g_source_remove(status->thread);
|
|
|
|
|
status->thread=0;
|
|
|
|
|
g_mutex_unlock(&status->mutex);
|
|
|
|
|
}
|
|
|
|
|
g_idle_add_once((GSourceOnceFunc)yon_ubl_status_hide_revealer,status);
|
|
|
|
|
@ -305,12 +314,11 @@ void yon_ubl_status_box_despawn(GtkContainer *status_container){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gboolean _yon_ubl_status_box_timed_remove(struct status_struct *statusstruct){
|
|
|
|
|
if (statusstruct->revealer){
|
|
|
|
|
yon_ubl_status_hide_revealer(statusstruct);
|
|
|
|
|
g_idle_add((GSourceFunc)yon_status_shrink_window,statusstruct);
|
|
|
|
|
g_timeout_add(10000,(GSourceFunc)yon_ubl_status_destroy_status,statusstruct);
|
|
|
|
|
g_timeout_add(200,(GSourceFunc)yon_ubl_status_destroy_status,statusstruct);
|
|
|
|
|
}
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
|
}
|
|
|
|
|
@ -334,7 +342,15 @@ gboolean yon_status_shrink_window(struct status_struct *statusstruct){
|
|
|
|
|
gtk_window_get_size(GTK_WINDOW(window),&width,NULL);
|
|
|
|
|
gtk_window_resize(GTK_WINDOW(window),width,statusstruct->window_height);
|
|
|
|
|
return G_SOURCE_CONTINUE;
|
|
|
|
|
} else return G_SOURCE_REMOVE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_status_struct_destroy(struct status_struct *status){
|
|
|
|
|
_yon_ubl_status_box_timed_remove(status);
|
|
|
|
|
g_mutex_lock(&status->mutex);
|
|
|
|
|
g_source_remove(status->thread);
|
|
|
|
|
status->thread=0;
|
|
|
|
|
g_mutex_unlock(&status->mutex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -347,6 +363,11 @@ gboolean _yon_ubl_status_highlight_incorrect_start(GtkWidget *widget){
|
|
|
|
|
|
|
|
|
|
gboolean _yon_ubl_status_highlight_incorrect_stop(GtkWidget *widget){
|
|
|
|
|
gtk_style_context_remove_class(gtk_widget_get_style_context(widget),"errorBox");
|
|
|
|
|
guint *thread = g_object_get_data(G_OBJECT(widget),"highlight_thread");
|
|
|
|
|
if (thread&&(*thread)>(guint)0){
|
|
|
|
|
g_object_set_data(G_OBJECT(widget),"highlight_thread",NULL);
|
|
|
|
|
free(thread);
|
|
|
|
|
}
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -358,8 +379,9 @@ gboolean _yon_ubl_status_highlight_incorrect(GtkWidget *widget){
|
|
|
|
|
void yon_ubl_status_highlight_incorrect(GtkWidget *widget){
|
|
|
|
|
guint *thread = NULL;
|
|
|
|
|
thread = g_object_get_data(G_OBJECT(widget),"highlight_thread");
|
|
|
|
|
if ((*thread)>(guint)-1){
|
|
|
|
|
if (thread&&(*thread)>(guint)0){
|
|
|
|
|
g_source_remove((*thread));
|
|
|
|
|
g_object_set_data(G_OBJECT(widget),"highlight_thread",NULL);
|
|
|
|
|
free(thread);
|
|
|
|
|
}
|
|
|
|
|
thread = malloc(sizeof(guint));
|
|
|
|
|
|