diff --git a/data/ui/settings-dialog.ui b/data/ui/settings-dialog.ui index b798950c..c449b3af 100644 --- a/data/ui/settings-dialog.ui +++ b/data/ui/settings-dialog.ui @@ -72,7 +72,8 @@ - True + False + True True start True @@ -84,7 +85,7 @@ - True + false False end Use dark design: diff --git a/po/gradio.pot b/po/gradio.pot index 41aae996..08ad216a 100644 --- a/po/gradio.pot +++ b/po/gradio.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-07-28 13:00+0200\n" +"POT-Creation-Date: 2016-07-28 13:59+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/src/Util.vala b/src/Util.vala index aff09b89..5b4df18d 100644 --- a/src/Util.vala +++ b/src/Util.vala @@ -18,49 +18,53 @@ public class Util{ } public static async Gdk.Pixbuf get_image_from_url (string url, int height, int width){ - SourceFunc callback = get_image_from_url.callback; - Gdk.Pixbuf output = null; - - ThreadFunc run = () => { - if(url != ""){ - var session = new Soup.Session (); - var message = new Soup.Message ("GET", url); - var loader = new Gdk.PixbufLoader(); + if(Gradio.App.settings.get_boolean ("load-pictures")){ + SourceFunc callback = get_image_from_url.callback; + Gdk.Pixbuf output = null; + + ThreadFunc run = () => { + if(url != ""){ + var session = new Soup.Session (); + var message = new Soup.Message ("GET", url); + var loader = new Gdk.PixbufLoader(); + + session.user_agent = "gradio/"+Constants.VERSION; + if(message == null){ + try{ + loader.close(); + }catch(GLib.Error e){ + warning(e.message); + } + + return null; + } + session.send_message (message); - session.user_agent = "gradio/"+Constants.VERSION; - if(message == null){ try{ + if(message.response_body.data != null) + loader.write(message.response_body.data); + loader.close(); - }catch(GLib.Error e){ - warning(e.message); + var pixbuf = loader.get_pixbuf(); + output = pixbuf.scale_simple(width, height, Gdk.InterpType.BILINEAR); + }catch (Error e){ + debug("Pixbufloader: " + e.message); } - return null; + session.abort(); } - session.send_message (message); - try{ - if(message.response_body.data != null) - loader.write(message.response_body.data); + Idle.add((owned) callback); + Thread.exit (1.to_pointer ()); + return null; + }; - loader.close(); - var pixbuf = loader.get_pixbuf(); - output = pixbuf.scale_simple(width, height, Gdk.InterpType.BILINEAR); - }catch (Error e){ - debug("Pixbufloader: " + e.message); - } - - session.abort(); - } - - Idle.add((owned) callback); - Thread.exit (1.to_pointer ()); + new Thread ("image_thread", run); + yield; + return output; + }else{ return null; - }; - - new Thread ("image_thread", run); - yield; - return output; + } } public static void remove_all_items_from_list_box (Gtk.ListBox container) { diff --git a/src/Widgets/SettingsDialog.vala b/src/Widgets/SettingsDialog.vala index 4ff7a29f..97363bbb 100644 --- a/src/Widgets/SettingsDialog.vala +++ b/src/Widgets/SettingsDialog.vala @@ -14,14 +14,17 @@ namespace Gradio{ private GLib.Settings settings; public SettingsDialog () { + var gtk_settings = Gtk.Settings.get_default (); settings = new GLib.Settings ("de.haecker-felix.gradio"); load_settings(settings); OnlyShowWorkingStationsSwitch.notify["active"].connect (() => { if (OnlyShowWorkingStationsSwitch.active) { settings.set_boolean ("only-show-working-stations", true); + gtk_settings.gtk_application_prefer_dark_theme = true; } else { settings.set_boolean ("only-show-working-stations", false); + gtk_settings.gtk_application_prefer_dark_theme = false; } });