Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a9d2e4d13 | ||
|
|
63ffa15123 |
No files matched your search
@@ -22,6 +22,13 @@
|
||||
<category>Development</category>
|
||||
</categories>
|
||||
<releases>
|
||||
<release version="1.0.2" date="2017-08-20" urgency="medium">
|
||||
<description>
|
||||
<ul>
|
||||
<li>Implement "Don't add the same color to color history twice" (issue #24)</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release version="1.0.1" date="2017-07-13" urgency="medium">
|
||||
<description>
|
||||
<ul>
|
||||
|
||||
Vendored
+6
@@ -1,3 +1,9 @@
|
||||
com.github.ronnydo.colorpicker (1.0.1) xenial; urgency=medium
|
||||
|
||||
* Implement "Don't add the same color to color history twice" (issue #24)
|
||||
|
||||
-- Ronny Dobra <ronnydobra at arcor dot de> Thu, 20 Aug 2017 13:30:00 +0100
|
||||
|
||||
com.github.ronnydo.colorpicker (1.0.1) xenial; urgency=medium
|
||||
|
||||
* Improvements to avoid issue #19
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
sudo rm -r build
|
||||
meson build
|
||||
cd build
|
||||
mesonconf -Dprefix=/usr
|
||||
ninja
|
||||
./com.github.ronnydo.colorpicker
|
||||
cd ..
|
||||
@@ -87,19 +87,29 @@ namespace ColorPicker.Widgets {
|
||||
}
|
||||
|
||||
public void add_color (Gdk.RGBA color) {
|
||||
if (color_list.size >= max_colors) {
|
||||
remove_oldest_color ();
|
||||
}
|
||||
int c_index = get_index_of (color);
|
||||
|
||||
if (c_index < 0) {
|
||||
if (color_list.size >= max_colors) {
|
||||
color_list.remove_at (0);
|
||||
}
|
||||
} else {
|
||||
color_list.remove_at (c_index);
|
||||
}
|
||||
|
||||
color_list.add (color);
|
||||
store_colors ();
|
||||
|
||||
selected_color = get_color_list ().size - 1;
|
||||
}
|
||||
|
||||
public void remove_oldest_color () {
|
||||
color_list.remove_at (0);
|
||||
store_colors ();
|
||||
}
|
||||
public int get_index_of (Gdk.RGBA color) {
|
||||
for (int i = 0; i < color_list.size; i++) {
|
||||
if (color_list[i] == color) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public Gee.ArrayList<Gdk.RGBA?> get_color_list () {
|
||||
return color_list;
|
||||
|
||||
Reference in new issue
Block a user