|
|
|
@ -635,6 +635,77 @@ void __yon_ubl_status_box_destroyed(){
|
|
|
|
status_thread_busy=0;
|
|
|
|
status_thread_busy=0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int yon_ubl_status_box_spawn_infinite(GtkContainer *container, char *display_text, BACKGROUND_IMAGE_TYPE type){
|
|
|
|
|
|
|
|
if (!status_thread_busy){
|
|
|
|
|
|
|
|
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
|
|
|
|
GtkWidget *revealer = gtk_revealer_new();
|
|
|
|
|
|
|
|
GtkWidget *label = gtk_label_new("");
|
|
|
|
|
|
|
|
GtkWidget *icon = gtk_image_new();
|
|
|
|
|
|
|
|
gtk_container_add(GTK_CONTAINER(revealer),box);
|
|
|
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(box),icon,0,0,5);
|
|
|
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(box),label,0,0,5);
|
|
|
|
|
|
|
|
gtk_container_add(container,revealer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_show_all(revealer);
|
|
|
|
|
|
|
|
gtk_revealer_set_reveal_child(GTK_REVEALER(revealer),1);
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(revealer),"destroy", G_CALLBACK(__yon_ubl_status_box_destroyed),NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gtk_widget_set_margin_bottom(label,9);
|
|
|
|
|
|
|
|
gtk_widget_set_margin_top(label,9);
|
|
|
|
|
|
|
|
gtk_label_set_xalign(GTK_LABEL(label),0.0);
|
|
|
|
|
|
|
|
PangoAttrList *attributes = pango_attr_list_new();
|
|
|
|
|
|
|
|
PangoAttribute *boldAttr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
|
|
|
|
|
|
|
|
pango_attr_list_insert(attributes, boldAttr);
|
|
|
|
|
|
|
|
gtk_label_set_attributes(GTK_LABEL(label),attributes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GdkRGBA textColor;
|
|
|
|
|
|
|
|
gdk_rgba_parse(&textColor, "#4d4d4d4d4d4d");
|
|
|
|
|
|
|
|
PangoAttribute *colorAttr = pango_attr_foreground_new(
|
|
|
|
|
|
|
|
(int)(textColor.red * 65535),
|
|
|
|
|
|
|
|
(int)(textColor.green * 65535),
|
|
|
|
|
|
|
|
(int)(textColor.blue * 65535)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
pango_attr_list_insert(attributes, colorAttr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GtkIconTheme *ictheme = gtk_icon_theme_get_default();
|
|
|
|
|
|
|
|
if (type == BACKGROUND_IMAGE_SUCCESS_TYPE||! type)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
gtk_style_context_remove_class(gtk_widget_get_style_context(box), "boxInfoMessError");
|
|
|
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(box), "boxInfoMessOK");
|
|
|
|
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-logging.checked", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, NULL));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (type == BACKGROUND_IMAGE_FAIL_TYPE)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
gtk_style_context_remove_class(gtk_widget_get_style_context(box), "boxInfoMessOK");
|
|
|
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(box), "boxInfoMessError");
|
|
|
|
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-logging.warning", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, NULL));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (display_text)
|
|
|
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(label),display_text);
|
|
|
|
|
|
|
|
struct temp_statusbox *statusstruct = malloc(sizeof(struct temp_statusbox));
|
|
|
|
|
|
|
|
statusstruct->revealer = revealer;
|
|
|
|
|
|
|
|
status_thread_busy=2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int _yon_ubl_status_box_despawn_infinite(GtkContainer *container){
|
|
|
|
|
|
|
|
GList *list = gtk_container_get_children(container);
|
|
|
|
|
|
|
|
for (int i=0; i<g_list_length(list);i++){
|
|
|
|
|
|
|
|
GtkWidget *revealer = g_list_nth_data(list,i);
|
|
|
|
|
|
|
|
if (GTK_IS_REVEALER(revealer)){
|
|
|
|
|
|
|
|
gtk_revealer_set_reveal_child(GTK_REVEALER(revealer),0);
|
|
|
|
|
|
|
|
usleep(200000);
|
|
|
|
|
|
|
|
if (GTK_IS_REVEALER(revealer)){
|
|
|
|
|
|
|
|
gtk_widget_destroy(revealer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int yon_ubl_status_box_despawn_infinite(GtkContainer *container){
|
|
|
|
|
|
|
|
GThread *thread = g_thread_new("StatusThread",(GThreadFunc)_yon_ubl_status_box_despawn_infinite,container);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int timeout,BACKGROUND_IMAGE_TYPE type){
|
|
|
|
void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int timeout,BACKGROUND_IMAGE_TYPE type){
|
|
|
|
if (!status_thread_busy){
|
|
|
|
if (!status_thread_busy){
|
|
|
|
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
|