summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlessandro Ghedini <al3xbio@gmail.com>2012-03-19 16:35:30 +0100
committerAlessandro Ghedini <al3xbio@gmail.com>2012-03-19 16:35:30 +0100
commita248b1597394b4ee9a5817bc95c3c116e76cdd8f (patch)
tree338596cb8c179435c51b8954adb933462c54a5d6 /src
parent662bede321e96bef873eadb7882dbcad5f68ba95 (diff)
Imported Upstream version 0.5.2
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/actionGroups/windowListGroup.vala2
-rw-r--r--src/actions/actionRegistry.vala2
-rw-r--r--src/deamon.vala6
-rw-r--r--src/gui/indicator.vala17
-rw-r--r--src/gui/piePreview.vala3
-rw-r--r--src/gui/preferencesWindow.vala4
-rw-r--r--src/gui/sliceTypeList.vala2
-rw-r--r--src/images/icon.vala4
-rw-r--r--src/images/renderedText.vala18
-rw-r--r--src/pies/load.vala2
-rw-r--r--src/renderers/pieWindow.vala12
12 files changed, 46 insertions, 27 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 91ed3ab..7138fdd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -82,6 +82,7 @@ install(
install(
FILES
${CMAKE_SOURCE_DIR}/resources/gnome-pie.svg
+ ${CMAKE_SOURCE_DIR}/resources/gnome-pie-symbolic.svg
DESTINATION
${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps
)
diff --git a/src/actionGroups/windowListGroup.vala b/src/actionGroups/windowListGroup.vala
index 18bf55b..774666f 100644
--- a/src/actionGroups/windowListGroup.vala
+++ b/src/actionGroups/windowListGroup.vala
@@ -32,7 +32,7 @@ public class WindowListGroup : ActionGroup {
public static GroupRegistry.TypeDescription register() {
var description = new GroupRegistry.TypeDescription();
description.name = _("Group: Window List");
- description.icon = "window-manager";
+ description.icon = "gnome-window-manager";
description.description = _("Shows a Slice for each of your opened Windows. Almost like Alt-Tab.");
description.id = "window_list";
return description;
diff --git a/src/actions/actionRegistry.vala b/src/actions/actionRegistry.vala
index 705c06c..24cc1fe 100644
--- a/src/actions/actionRegistry.vala
+++ b/src/actions/actionRegistry.vala
@@ -148,7 +148,7 @@ public class ActionRegistry : GLib.Object {
}
if (!Gtk.IconTheme.get_default().has_icon(final_icon))
- final_icon = "application-default-icon";
+ final_icon = "stock_unknown";
if (name != null)
final_name = name;
diff --git a/src/deamon.vala b/src/deamon.vala
index b622028..2424f8f 100644
--- a/src/deamon.vala
+++ b/src/deamon.vala
@@ -36,7 +36,7 @@ public class Deamon : GLib.Object {
/////////////////////////////////////////////////////////////////////
public static int main(string[] args) {
- version = "0.5.1";
+ version = "0.5.2";
Logger.init();
Gdk.threads_init();
@@ -148,6 +148,8 @@ public class Deamon : GLib.Object {
return Unique.Response.PASSTHROUGH;
});
+ Gdk.threads_enter();
+
// init locale support
Intl.bindtextdomain ("gnomepie", Paths.locales);
Intl.textdomain ("gnomepie");
@@ -174,6 +176,8 @@ public class Deamon : GLib.Object {
if (open_pie != null) PieManager.open_pie(open_pie);
Gtk.main();
+
+ Gdk.threads_leave();
}
/////////////////////////////////////////////////////////////////////
diff --git a/src/gui/indicator.vala b/src/gui/indicator.vala
index dea4d3c..c8ef445 100644
--- a/src/gui/indicator.vala
+++ b/src/gui/indicator.vala
@@ -46,7 +46,6 @@ public class Indicator : GLib.Object {
public bool active {
get {
-
#if HAVE_APPINDICATOR
return indicator.get_status() == AppIndicator.IndicatorStatus.ACTIVE;
#else
@@ -68,12 +67,18 @@ public class Indicator : GLib.Object {
/////////////////////////////////////////////////////////////////////
public Indicator() {
+ string icon = "";
+
+ if (Gdk.X11Screen.get_window_manager_name(Gdk.Screen.get_default()) == "Mutter")
+ icon = "gnome-pie";
+ else
+ icon = "gnome-pie-symbolic";
+
#if HAVE_APPINDICATOR
string path = "";
- string icon = "indicator-applet";
+
try {
path = GLib.Path.get_dirname(GLib.FileUtils.read_link("/proc/self/exe"))+"/resources";
- icon = "gnome-pie";
} catch (GLib.FileError e) {
warning("Failed to get path of executable!");
}
@@ -86,16 +91,16 @@ public class Indicator : GLib.Object {
try {
var file = GLib.File.new_for_path(GLib.Path.build_filename(
GLib.Path.get_dirname(GLib.FileUtils.read_link("/proc/self/exe"))+"/resources",
- "gnome-pie.svg"
+ icon + ".svg"
));
if (!file.query_exists())
- this.indicator.set_from_icon_name("gnome-pie");
+ this.indicator.set_from_icon_name(icon);
else
this.indicator.set_from_file(file.get_path());
} catch (GLib.FileError e) {
warning("Failed to get path of executable!");
- this.indicator.set_from_icon_name("gnome-pie");
+ this.indicator.set_from_icon_name(icon);
}
this.menu = new Gtk.Menu();
diff --git a/src/gui/piePreview.vala b/src/gui/piePreview.vala
index 4963bb2..5745fcb 100644
--- a/src/gui/piePreview.vala
+++ b/src/gui/piePreview.vala
@@ -111,9 +111,6 @@ class PiePreview : Gtk.DrawingArea {
this.new_slice_window.on_select.connect((new_action, as_new_slice, at_position) => {
var pie = PieManager.all_pies[this.current_id];
- debug(new_action.actions[0].name);
- debug(new_action.actions[0].real_command);
-
if (new_action.has_quickaction())
renderer.disable_quickactions();
diff --git a/src/gui/preferencesWindow.vala b/src/gui/preferencesWindow.vala
index 933919b..3055bc5 100644
--- a/src/gui/preferencesWindow.vala
+++ b/src/gui/preferencesWindow.vala
@@ -174,7 +174,7 @@ public class PreferencesWindow : GLib.Object {
this.id_label.label = "";
this.name_label.label = _("No Pie selected.");
this.hotkey_label.set_markup("");
- this.icon.icon_name = "application-default-icon";
+ this.icon.icon_name = "stock_unknown";
this.no_pie_label.show();
} else {
@@ -212,7 +212,7 @@ public class PreferencesWindow : GLib.Object {
/////////////////////////////////////////////////////////////////////
private void on_add_pie_button_clicked(Gtk.ToolButton button) {
- var new_pie = PieManager.create_persistent_pie(_("New Pie"), "application-default-icon", null);
+ var new_pie = PieManager.create_persistent_pie(_("New Pie"), "stock_unknown", null);
this.pie_list.reload_all();
this.pie_list.select(new_pie.id);
}
diff --git a/src/gui/sliceTypeList.vala b/src/gui/sliceTypeList.vala
index b447dc3..a339e5e 100644
--- a/src/gui/sliceTypeList.vala
+++ b/src/gui/sliceTypeList.vala
@@ -140,7 +140,7 @@ class SliceTypeList : Gtk.TreeView {
this.data.get(active, DataPos.ICON_NAME, out icon);
this.on_select(id, icon);
} else {
- this.on_select("", "application-default-icon");
+ this.on_select("", "stock_unknown");
}
}
diff --git a/src/images/icon.vala b/src/images/icon.vala
index e942e7c..42be41f 100644
--- a/src/images/icon.vala
+++ b/src/images/icon.vala
@@ -105,7 +105,7 @@ public class Icon : Image {
return icon_name;
warning("Icon \"" + icon_name + "\" not found! Using default icon...");
- icon_name = "application-default-icon";
+ icon_name = "stock_unknown";
}
@@ -115,7 +115,7 @@ public class Icon : Image {
if (result == "") {
warning("Icon \"" + icon_name + "\" not found! Using default icon...");
- icon_name = "application-default-icon";
+ icon_name = "stock_unknown";
file = icon_theme.lookup_icon(icon_name, size, 0);
if (file != null) result = file.get_filename();
}
diff --git a/src/images/renderedText.vala b/src/images/renderedText.vala
index e99d26a..544af1f 100644
--- a/src/images/renderedText.vala
+++ b/src/images/renderedText.vala
@@ -71,21 +71,29 @@ public class RenderedText : Image {
// add newlines at the end of each line, in order to allow ellipsizing
string broken_string = "";
- var lines = layout.get_lines().copy();
- foreach (var line in lines) {
+ for (int i=0; i<layout.get_line_count(); ++i) {
- string next_line = text.substring(line.start_index, line.length);
+ string next_line = "";
+ if (i == layout.get_line_count() -1)
+ next_line = text.substring(layout.get_line(i).start_index, -1);
+ else
+ next_line = text.substring(layout.get_line(i).start_index, layout.get_line(i).length);
if (broken_string == "") {
broken_string = next_line;
} else if (next_line != "") {
// test whether the addition of a line would cause the height to become too large
string broken_string_tmp = broken_string + "\n" + next_line;
+
+ var layout_tmp = Pango.cairo_create_layout(ctx);
+ layout_tmp.set_width(Pango.units_from_double(width));
+
+ layout_tmp.set_font_description(font_description);
- layout.set_text(broken_string_tmp, -1);
+ layout_tmp.set_text(broken_string_tmp, -1);
Pango.Rectangle extents;
- layout.get_pixel_extents(null, out extents);
+ layout_tmp.get_pixel_extents(null, out extents);
if (extents.height > height) broken_string = broken_string + next_line;
else broken_string = broken_string_tmp;
diff --git a/src/pies/load.vala b/src/pies/load.vala
index 4a9274d..cb08a8a 100644
--- a/src/pies/load.vala
+++ b/src/pies/load.vala
@@ -60,8 +60,6 @@ namespace Pies {
}
}
}
- Xml.Parser.cleanup();
-
} else {
warning("Error loading pies: pies.conf is empty! The cake is a lie...");
}
diff --git a/src/renderers/pieWindow.vala b/src/renderers/pieWindow.vala
index 852a739..5238dfe 100644
--- a/src/renderers/pieWindow.vala
+++ b/src/renderers/pieWindow.vala
@@ -55,6 +55,7 @@ public class PieWindow : Gtk.Window {
/////////////////////////////////////////////////////////////////////
private bool closing = false;
+ private bool closed = false;
/////////////////////////////////////////////////////////////////////
/// A timer used for calculating the frame time.
@@ -186,7 +187,10 @@ public class PieWindow : Gtk.Window {
this.queue_draw();
// the main draw loop
- Timeout.add((uint)(1000.0/Config.global.refresh_rate), () => {
+ GLib.Timeout.add((uint)(1000.0/Config.global.refresh_rate), () => {
+ if (this.closed)
+ return false;
+
this.queue_draw();
return this.visible;
});
@@ -266,7 +270,8 @@ public class PieWindow : Gtk.Window {
FocusGrabber.ungrab();
this.renderer.activate();
- Timeout.add((uint)(Config.global.theme.fade_out_time*1000), () => {
+ GLib.Timeout.add((uint)(Config.global.theme.fade_out_time*1000), () => {
+ this.closed = true;
this.on_closed();
this.destroy();
return false;
@@ -286,7 +291,8 @@ public class PieWindow : Gtk.Window {
FocusGrabber.ungrab();
this.renderer.cancel();
- Timeout.add((uint)(Config.global.theme.fade_out_time*1000), () => {
+ GLib.Timeout.add((uint)(Config.global.theme.fade_out_time*1000), () => {
+ this.closed = true;
this.on_closed();
this.destroy();
return false;