tint2conf: gradient config: do not add gradient 0 when missing

This commit is contained in:
o9000 2017-02-26 17:01:46 +01:00
parent e3e81505b9
commit 4c45538f6e
2 changed files with 19 additions and 9 deletions

View file

@ -427,7 +427,7 @@ void background_create_new()
bgColBorderOpacity,
borderOpacity,
bgColGradientId,
0,
-1,
bgColBorderWidth,
b,
bgColCornerRadius,
@ -443,7 +443,7 @@ void background_create_new()
bgColBorderOpacityOver,
borderOpacityOver,
bgColGradientIdOver,
0,
-1,
bgColFillColorPress,
&fillColorPress,
bgColFillOpacityPress,
@ -453,7 +453,7 @@ void background_create_new()
bgColBorderOpacityPress,
borderOpacityPress,
bgColGradientIdPress,
0,
-1,
bgColBorderSidesTop,
sideTop,
bgColBorderSidesBottom,
@ -502,6 +502,7 @@ void background_duplicate(GtkWidget *widget, gpointer data)
int fillOpacityPress;
GdkColor *borderColorPress;
int borderOpacityPress;
int gradient_id, gradient_id_over, gradient_id_press;
gtk_tree_model_get(GTK_TREE_MODEL(backgrounds),
&iter,
@ -541,6 +542,12 @@ void background_duplicate(GtkWidget *widget, gpointer data)
&sideLeft,
bgColBorderSidesRight,
&sideRight,
bgColGradientId,
&gradient_id,
bgColGradientIdOver,
&gradient_id_over,
bgColGradientIdPress,
&gradient_id_press,
-1);
gtk_list_store_append(backgrounds, &iter);
@ -555,7 +562,7 @@ void background_duplicate(GtkWidget *widget, gpointer data)
bgColBorderColor,
borderColor,
bgColGradientId,
0,
gradient_id,
bgColBorderOpacity,
borderOpacity,
bgColText,
@ -569,7 +576,7 @@ void background_duplicate(GtkWidget *widget, gpointer data)
bgColBorderOpacityOver,
borderOpacityOver,
bgColGradientIdOver,
0,
gradient_id_over,
bgColFillColorPress,
fillColorPress,
bgColFillOpacityPress,
@ -579,7 +586,7 @@ void background_duplicate(GtkWidget *widget, gpointer data)
bgColBorderOpacityPress,
borderOpacityPress,
bgColGradientIdPress,
0,
gradient_id_press,
bgColBorderWidth,
b,
bgColCornerRadius,

View file

@ -235,13 +235,16 @@ void config_write_backgrounds(FILE *fp)
config_write_color(fp, "background_color", *fillColor, fillOpacity);
config_write_color(fp, "border_color", *borderColor, borderOpacity);
fprintf(fp, "gradient_id = %d\n", gradient_id);
if (gradient_id >= 0)
fprintf(fp, "gradient_id = %d\n", gradient_id);
config_write_color(fp, "background_color_hover", *fillColorOver, fillOpacityOver);
config_write_color(fp, "border_color_hover", *borderColorOver, borderOpacityOver);
fprintf(fp, "gradient_id_hover = %d\n", gradient_id_over);
if (gradient_id_over >= 0)
fprintf(fp, "gradient_id_hover = %d\n", gradient_id_over);
config_write_color(fp, "background_color_pressed", *fillColorPress, fillOpacityPress);
config_write_color(fp, "border_color_pressed", *borderColorPress, borderOpacityPress);
fprintf(fp, "gradient_id_pressed = %d\n", gradient_id_press);
if (gradient_id_press >= 0)
fprintf(fp, "gradient_id_pressed = %d\n", gradient_id_press);
fprintf(fp, "\n");
}
}