move fetching icon into a separate thread

This commit is contained in:
Artem Anufrij 2018-02-11 20:15:11 +01:00
parent 4cd8bfb869
commit 3595041e99

View file

@ -212,6 +212,9 @@ namespace Webpin.Widgets.Views {
reset_grab_color_and_icon (); reset_grab_color_and_icon ();
grab_timer = Timeout.add ( grab_timer = Timeout.add (
500, 500,
() => {
new Thread<void*> (
"grab_color_and_icon",
() => { () => {
if (tmp_icon_file != "" ) { if (tmp_icon_file != "" ) {
FileUtils.remove (tmp_icon_file); FileUtils.remove (tmp_icon_file);
@ -239,7 +242,11 @@ namespace Webpin.Widgets.Views {
var result = match_info.fetch (0); var result = match_info.fetch (0);
Gdk.RGBA return_value = {0, 0, 0, 1}; Gdk.RGBA return_value = {0, 0, 0, 1};
if (return_value.parse (result)) { if (return_value.parse (result)) {
Idle.add (
() => {
primary_color_button.set_rgba (return_value); primary_color_button.set_rgba (return_value);
return false;
});
} }
} }
@ -304,12 +311,20 @@ namespace Webpin.Widgets.Views {
} }
if (tmp_icon_file != "") { if (tmp_icon_file != "") {
Idle.add (
() => {
icon_name_entry.set_text (tmp_icon_file); icon_name_entry.set_text (tmp_icon_file);
return false;
});
} }
} }
msg.dispose (); msg.dispose ();
session.dispose (); session.dispose ();
return null;
});
reset_grab_color_and_icon (); reset_grab_color_and_icon ();
return false; return false;
}); });