summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/aboutWindow.vala2
-rw-r--r--src/gui/iconSelectWindow.vala45
-rw-r--r--src/gui/newSliceWindow.vala9
-rw-r--r--src/gui/preferencesWindow.vala10
4 files changed, 38 insertions, 28 deletions
diff --git a/src/gui/aboutWindow.vala b/src/gui/aboutWindow.vala
index ccd956a..e7faca3 100644
--- a/src/gui/aboutWindow.vala
+++ b/src/gui/aboutWindow.vala
@@ -68,7 +68,7 @@ public class AboutWindow: Gtk.AboutDialog {
logo_icon_name: "gnome-pie",
website: "http://www.simonschneegans.de/?page_id=12",
website_label: "www.gnome-pie.simonschneegans.de",
- version: "0.4.0"
+ version: "0.4.1"
);
}
}
diff --git a/src/gui/iconSelectWindow.vala b/src/gui/iconSelectWindow.vala
index d66c654..174c23d 100644
--- a/src/gui/iconSelectWindow.vala
+++ b/src/gui/iconSelectWindow.vala
@@ -234,7 +234,7 @@ public class IconSelectWindow : GLib.Object {
// displays the filtered icons
this.icon_view = new Gtk.IconView.with_model(this.icon_list_filtered);
this.icon_view.item_width = 32;
- this.icon_view.item_padding = 3;
+ this.icon_view.item_padding = 2;
this.icon_view.pixbuf_column = 2;
this.icon_view.tooltip_column = 0;
@@ -309,13 +309,20 @@ public class IconSelectWindow : GLib.Object {
}
}
+ public static void clear_icons() {
+ if (icon_list != null) {
+ need_reload = true;
+ icon_list.clear();
+ }
+ }
+
/////////////////////////////////////////////////////////////////////
/// Makes the window select the icon of the given Pie.
/////////////////////////////////////////////////////////////////////
- public void set_pie(string id) {
- string icon = PieManager.all_pies[id].icon;
-
+ public void set_icon(string icon) {
+ this.active_icon = icon;
+
if (icon.contains("/")) {
this.file_chooser.set_filename(icon);
this.tabs.set_current_page(1);
@@ -369,28 +376,24 @@ public class IconSelectWindow : GLib.Object {
// disable sorting of the icon_view - else it's horribly slow
this.icon_list.set_sort_column_id(-1, Gtk.SortType.ASCENDING);
-
- try {
- // start loading in another thread
- unowned Thread loader = Thread.create<void*>(load_thread, false);
- loader.set_priority(ThreadPriority.LOW);
- } catch (GLib.ThreadError e) {
- error("Failed to create icon loader thread!");
- }
-
+
+ this.load_all.begin();
+
// insert loaded icons every 200 ms
Timeout.add(200, () => {
while (this.load_queue.length() > 0) {
var new_entry = this.load_queue.pop();
Gtk.TreeIter current;
- this.icon_list.append(out current);
- this.icon_list.set(current, 0, new_entry.name,
+ icon_list.append(out current);
+ icon_list.set(current, 0, new_entry.name,
1, new_entry.context,
2, new_entry.pixbuf);
}
// enable sorting of the icon_view if loading finished
- if (!this.loading) this.icon_list.set_sort_column_id(0, Gtk.SortType.ASCENDING);
+ if (!this.loading) {
+ icon_list.set_sort_column_id(0, Gtk.SortType.ASCENDING);
+ }
return loading;
});
@@ -402,12 +405,13 @@ public class IconSelectWindow : GLib.Object {
/// load_queue.
/////////////////////////////////////////////////////////////////////
- private void* load_thread() {
+ private async void load_all() {
var icon_theme = Gtk.IconTheme.get_default();
-
+
foreach (var context in icon_theme.list_contexts()) {
if (!disabled_contexts.contains(context)) {
foreach (var icon in icon_theme.list_icons(context)) {
+
IconContext icon_context = IconContext.OTHER;
switch(context) {
case "Apps": case "Applications":
@@ -423,6 +427,9 @@ public class IconSelectWindow : GLib.Object {
default: break;
}
+ Idle.add(load_all.callback);
+ yield;
+
try {
// create a new entry for the queue
var new_entry = new ListEntry();
@@ -447,8 +454,6 @@ public class IconSelectWindow : GLib.Object {
// hide the spinner
if (spinner != null)
spinner.visible = false;
-
- return null;
}
}
diff --git a/src/gui/newSliceWindow.vala b/src/gui/newSliceWindow.vala
index 4e38376..7bd6340 100644
--- a/src/gui/newSliceWindow.vala
+++ b/src/gui/newSliceWindow.vala
@@ -359,15 +359,16 @@ public class NewSliceWindow : GLib.Object {
/////////////////////////////////////////////////////////////////////
private void on_icon_button_clicked(Gtk.Button button) {
- if (icon_window == null) {
- icon_window = new IconSelectWindow(this.window);
- icon_window.on_ok.connect((icon) => {
+ if (this.icon_window == null) {
+ this.icon_window = new IconSelectWindow(this.window);
+ this.icon_window.on_ok.connect((icon) => {
this.current_custom_icon = icon;
this.set_icon(icon);
});
}
- icon_window.show();
+ this.icon_window.show();
+ this.icon_window.set_icon(this.current_icon);
}
/////////////////////////////////////////////////////////////////////
diff --git a/src/gui/preferencesWindow.vala b/src/gui/preferencesWindow.vala
index 022e44b..933919b 100644
--- a/src/gui/preferencesWindow.vala
+++ b/src/gui/preferencesWindow.vala
@@ -129,6 +129,11 @@ public class PreferencesWindow : GLib.Object {
// save settings on close
Config.global.save();
Pies.save();
+
+ Timeout.add(100, () => {
+ IconSelectWindow.clear_icons();
+ return false;
+ });
});
this.window.delete_event.connect(this.window.hide_on_delete);
@@ -181,9 +186,7 @@ public class PreferencesWindow : GLib.Object {
if (pie.icon.contains("/"))
try {
this.icon.pixbuf = new Gdk.Pixbuf.from_file_at_scale(pie.icon,
- this.icon.get_pixel_size(),
- this.icon.get_pixel_size(),
- true);
+ this.icon.get_pixel_size(), this.icon.get_pixel_size(), true);
} catch (GLib.Error error) {
warning(error.message);
}
@@ -305,6 +308,7 @@ public class PreferencesWindow : GLib.Object {
}
this.icon_window.show();
+ this.icon_window.set_icon(PieManager.all_pies[selected_id].icon);
}
}