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

View file

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