|
|
|
|
@ -569,6 +569,18 @@ void yon_gtk_widget_set_sensitive_from_combo_box_inversed(GtkComboBox *toggle, G
|
|
|
|
|
gtk_widget_set_sensitive(target,!gtk_combo_box_get_active(toggle)>0 ? 0 : 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_gtk_toggle_button_set_inactive_from_toggle_button_inversed(GtkToggleButton *self, GtkToggleButton *target){
|
|
|
|
|
if (gtk_toggle_button_get_active(self)){
|
|
|
|
|
gtk_toggle_button_set_active(target,0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_gtk_toggle_button_set_inactive_from_toggle_button(GtkToggleButton *self, GtkToggleButton *target){
|
|
|
|
|
if (!gtk_toggle_button_get_active(self)){
|
|
|
|
|
gtk_toggle_button_set_active(target,0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _yon_ubl_header_setup(GtkWidget *Overlay, GtkWidget *Head, GtkWidget *Image, char *image_path)
|
|
|
|
|
{
|
|
|
|
|
gtk_overlay_add_overlay(GTK_OVERLAY(Overlay), Head);
|
|
|
|
|
@ -591,28 +603,38 @@ int yon_ubl_status_box_setup(GtkWidget *icon, GtkWidget *box, GtkWidget *label)
|
|
|
|
|
} else return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_ubl_status_box_set(BACKGROUND_IMAGE_TYPE type, GtkWidget *box, GtkImage *icon){
|
|
|
|
|
|
|
|
|
|
GtkIconTheme *ictheme = gtk_icon_theme_get_default();
|
|
|
|
|
switch (type){
|
|
|
|
|
case BACKGROUND_IMAGE_SUCCESS_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.libublsettingsui-gtk3.checked", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, NULL));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 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.libublsettingsui-gtk3.warning", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, NULL));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case BACKGROUND_IMAGE_INFO_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.libublsettingsui-gtk3.important", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, NULL));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _yon_ubl_status_box_render(char *text, BACKGROUND_IMAGE_TYPE type)
|
|
|
|
|
{
|
|
|
|
|
render_data data = render;
|
|
|
|
|
GtkIconTheme *ictheme = gtk_icon_theme_get_default();
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
if (err)
|
|
|
|
|
{
|
|
|
|
|
printf("%s\n", err->message);
|
|
|
|
|
g_error_free(err);
|
|
|
|
|
}
|
|
|
|
|
if (type == BACKGROUND_IMAGE_SUCCESS_TYPE||! type)
|
|
|
|
|
{
|
|
|
|
|
gtk_style_context_remove_class(gtk_widget_get_style_context(data.box), "boxInfoMessError");
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(data.box), "boxInfoMessOK");
|
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(data.icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-video.checked", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, &err));
|
|
|
|
|
}
|
|
|
|
|
else if (type == BACKGROUND_IMAGE_FAIL_TYPE)
|
|
|
|
|
{
|
|
|
|
|
gtk_style_context_remove_class(gtk_widget_get_style_context(data.box), "boxInfoMessOK");
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(data.box), "boxInfoMessError");
|
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(data.icon), gtk_icon_theme_load_icon_for_scale(ictheme, "com.ublinux.ubl-settings-video.warning", 25, 1, GTK_ICON_LOOKUP_FORCE_SIZE, &err));
|
|
|
|
|
}
|
|
|
|
|
yon_ubl_status_box_set(type,data.box,GTK_IMAGE(data.icon));
|
|
|
|
|
if (text)
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(data.label), text);
|
|
|
|
|
}
|
|
|
|
|
@ -660,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){
|
|
|
|
|
@ -675,15 +699,39 @@ 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);
|
|
|
|
|
yon_status_thread_id=NULL;
|
|
|
|
|
GList *list = gtk_container_get_children(container);
|
|
|
|
|
for (int i=0;i<g_list_length(list);i++){
|
|
|
|
|
gtk_widget_destroy((GtkWidget*)g_list_nth_data(list,i));
|
|
|
|
|
}
|
|
|
|
|
status_thread_busy=0;
|
|
|
|
|
}
|
|
|
|
|
yon_status_thread_id = yon_char_new(status_id);
|
|
|
|
|
|
|
|
|
|
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
|
|
|
|
|
GtkWidget *revealer = gtk_revealer_new();
|
|
|
|
|
GtkWidget *label = gtk_label_new("");
|
|
|
|
|
GtkWidget *icon = gtk_image_new();
|
|
|
|
|
g_signal_connect(G_OBJECT(box),"destroy",G_CALLBACK(yon_status_box_destroyed),NULL);
|
|
|
|
|
gtk_label_set_line_wrap(GTK_LABEL(label),1);
|
|
|
|
|
gtk_label_set_line_wrap_mode(GTK_LABEL(label),PANGO_WRAP_WORD);
|
|
|
|
|
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_box_pack_start(GTK_BOX(box),label,0,0,0);
|
|
|
|
|
gtk_container_add(container,revealer);
|
|
|
|
|
|
|
|
|
|
gtk_widget_show_all(revealer);
|
|
|
|
|
@ -706,29 +754,19 @@ int yon_ubl_status_box_spawn_infinite(GtkContainer *container, char *display_tex
|
|
|
|
|
(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));
|
|
|
|
|
}
|
|
|
|
|
yon_ubl_status_box_set(type,box,GTK_IMAGE(icon));
|
|
|
|
|
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){
|
|
|
|
|
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<g_list_length(list);i++){
|
|
|
|
|
GtkWidget *revealer = g_list_nth_data(list,i);
|
|
|
|
|
@ -752,6 +790,8 @@ void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int ti
|
|
|
|
|
GtkWidget *revealer = gtk_revealer_new();
|
|
|
|
|
GtkWidget *label = gtk_label_new("");
|
|
|
|
|
GtkWidget *icon = gtk_image_new();
|
|
|
|
|
gtk_label_set_line_wrap(GTK_LABEL(label),1);
|
|
|
|
|
gtk_label_set_line_wrap_mode(GTK_LABEL(label),PANGO_WRAP_WORD);
|
|
|
|
|
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);
|
|
|
|
|
@ -778,19 +818,7 @@ void yon_ubl_status_box_spawn(GtkContainer *container,char *display_text, int ti
|
|
|
|
|
);
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
yon_ubl_status_box_set(type,box,GTK_IMAGE(icon));
|
|
|
|
|
if (display_text)
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(label),display_text);
|
|
|
|
|
struct temp_statusbox *statusstruct = malloc(sizeof(struct temp_statusbox));
|
|
|
|
|
|