diff options
author | Alessandro Ghedini <al3xbio@gmail.com> | 2012-11-03 16:15:11 +0100 |
---|---|---|
committer | Alessandro Ghedini <al3xbio@gmail.com> | 2012-11-03 16:15:11 +0100 |
commit | 1f6f24308e96040962794c5a9ffd81597b5e072a (patch) | |
tree | 7d719e21bf759d20ace53bcac13325048aa21a8c /src/gui | |
parent | 87a5b11d7598fc1e5239e11972c5e03a38bbb672 (diff) |
Imported Upstream version 0.5.4upstream/0.5.4
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/aboutWindow.vala | 4 | ||||
-rw-r--r-- | src/gui/newsWindow.vala | 24 | ||||
-rw-r--r-- | src/gui/pieList.vala | 24 | ||||
-rw-r--r-- | src/gui/piePreview.vala | 36 | ||||
-rw-r--r-- | src/gui/settingsWindow.vala | 6 | ||||
-rw-r--r-- | src/gui/triggerSelectButton.vala | 1 |
6 files changed, 61 insertions, 34 deletions
diff --git a/src/gui/aboutWindow.vala b/src/gui/aboutWindow.vala index 6c5820b..c6b7453 100644 --- a/src/gui/aboutWindow.vala +++ b/src/gui/aboutWindow.vala @@ -44,7 +44,9 @@ public class AboutWindow: Gtk.AboutDialog { "Eduardo Anabalon <lalo1412@gmail.com> (ES)", "Grégoire Bellon-Gervais <greggbg@gmail.com> (FR)", "Alex Maxime <cad.maxime@gmail.com> (FR)", - "Eugene Roskin <pams@imail.ru> (RU)" + "Eugene Roskin <pams@imail.ru> (RU)", + "Ting Zhou <tzhou@haverford.edu> (ZH-CN)", + "Martin Dinov <martindinov@yahoo.com> (BG)" }; // sort translators diff --git a/src/gui/newsWindow.vala b/src/gui/newsWindow.vala index 9212fa6..75de60e 100644 --- a/src/gui/newsWindow.vala +++ b/src/gui/newsWindow.vala @@ -23,7 +23,7 @@ namespace GnomePie { public class NewsWindow: Gtk.Dialog { - public static const int news_count = 1; + public static const int news_count = 2; ///////////////////////////////////////////////////////////////////// /// @@ -42,27 +42,7 @@ public class NewsWindow: Gtk.Dialog { var news = new Gtk.Label(""); news.wrap = true; news.set_width_chars(75); - news.set_markup("<b>Gnome-Pie needs your help!</b>\n\n" + - - "Hey, this is Simon, developer of Gnome-Pie. I’m going to " + - "write my Bachelor thesis on pie menus! In order to improve " + - "Gnome-Pie to the limits, I need some information on how " + - "you use Gnome-Pie.\n\n" + - - "<b>So please help improving this software by sending the " + - "file 'gnome-pie.stats' located in <a href='file:" + - Paths.config_directory + "'>" + Paths.config_directory + - "</a> by email to <a href='mailto:pie-stats@simonschneegans.de?subject=statistics'>" + - "pie-stats@simonschneegans.de</a>!</b>\n\n" + - - "There is no personal information in this file. Only " + - "information on your usage frequency, how fast you use " + - "Gnome-Pie and how many Pies with how many Slices you " + - "have configured. If you have any questions regarding " + - "this topic please send an email to " + - "<a href='mailto:code@simonschneegans.de'>code@simonschneegans.de</a>!\n\n" + - - "Thank you so much! It’s going to be exciting!"); + news.set_markup("<b>Thank you!</b>\n\n"); box.pack_start(news, false, false); diff --git a/src/gui/pieList.vala b/src/gui/pieList.vala index 474e5f5..f9fb54b 100644 --- a/src/gui/pieList.vala +++ b/src/gui/pieList.vala @@ -94,6 +94,7 @@ class PieList : Gtk.TreeView { this.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, entries, Gdk.DragAction.LINK); this.enable_model_drag_dest(entries, Gdk.DragAction.COPY | Gdk.DragAction.MOVE | Gdk.DragAction.LINK); this.drag_data_get.connect(this.on_dnd_source); + this.drag_data_received.connect(this.on_dnd_received); this.drag_begin.connect_after(this.on_start_drag); this.drag_motion.connect(this.on_drag_move); this.drag_leave.connect(() => { @@ -238,6 +239,29 @@ class PieList : Gtk.TreeView { return true; } + + ///////////////////////////////////////////////////////////////////// + /// Called when the user finishes a drag operation on this widget. + /// Only used for external drags. + ///////////////////////////////////////////////////////////////////// + + private void on_dnd_received(Gdk.DragContext context, int x, int y, + Gtk.SelectionData selection_data, uint info, uint time_) { + + Gtk.TreeIter active; + if (this.get_selection().get_selected(null, out active)) { + string id = ""; + this.data.get(active, DataPos.ID, out id); + + var pie = PieManager.all_pies[id]; + + foreach (var uri in selection_data.get_uris()) { + pie.add_action(ActionRegistry.new_for_uri(uri), 0); + } + + this.on_select(id); + } + } } } diff --git a/src/gui/piePreview.vala b/src/gui/piePreview.vala index 5745fcb..3ddf6c8 100644 --- a/src/gui/piePreview.vala +++ b/src/gui/piePreview.vala @@ -68,6 +68,7 @@ class PiePreview : Gtk.DrawingArea { ///////////////////////////////////////////////////////////////////// private int drag_start_index = -1; + private string drag_start_id = ""; ///////////////////////////////////////////////////////////////////// /// C'tor, creates the widget. @@ -174,8 +175,12 @@ class PiePreview : Gtk.DrawingArea { public void set_pie(string id) { this.current_id = id; - this.modify_bg(Gtk.StateType.NORMAL, Gtk.rc_get_style(this).light[0]); + this.modify_bg(Gtk.StateType.NORMAL, Gtk.rc_get_style(this).light[Gtk.StateType.NORMAL]); this.renderer.load_pie(PieManager.all_pies[id]); + + if (id == this.drag_start_id) { + this.renderer.hide_group(this.drag_start_index); + } } ///////////////////////////////////////////////////////////////////// @@ -209,6 +214,7 @@ class PiePreview : Gtk.DrawingArea { Gtk.Allocation allocation; this.get_allocation(out allocation); + ctx.translate((int)(allocation.width*0.5), (int)(allocation.height*0.5)); this.renderer.draw(frame_time, ctx); @@ -278,6 +284,7 @@ class PiePreview : Gtk.DrawingArea { Gtk.Allocation allocation; this.get_allocation(out allocation); this.renderer.on_mouse_move(x-allocation.width*0.5, y-allocation.height*0.5); + return true; } @@ -287,6 +294,7 @@ class PiePreview : Gtk.DrawingArea { private void on_start_drag(Gdk.DragContext ctx) { this.drag_start_index = this.renderer.get_active_slice(); + this.drag_start_id = this.current_id; var icon = this.renderer.get_active_icon(); var pixbuf = icon.to_pixbuf(); @@ -311,11 +319,29 @@ class PiePreview : Gtk.DrawingArea { context.list_targets().foreach((target) => { Gdk.Atom target_type = (Gdk.Atom)target; if (target_type.name() == "text/plain") { - var pie = PieManager.all_pies[this.current_id]; - pie.move_group(this.drag_start_index, target_index); - this.renderer.show_hidden_group_at(target_index); + if (this.current_id == this.drag_start_id) { + var pie = PieManager.all_pies[this.current_id]; + pie.move_group(this.drag_start_index, target_index); + this.renderer.show_hidden_group_at(target_index); + } else { + var src_pie = PieManager.all_pies[this.drag_start_id]; + var dst_pie = PieManager.all_pies[this.current_id]; + dst_pie.add_group(src_pie.action_groups[this.drag_start_index], target_index); + this.renderer.add_group(dst_pie.action_groups[target_index], target_index); + + if (this.renderer.slices.size == 1) + this.on_first_slice_added(); + + if ((context.get_actions() & Gdk.DragAction.COPY) == 0) + src_pie.remove_group(this.drag_start_index); + } + + } }); + + this.drag_start_index = -1; + this.drag_start_id = ""; } } @@ -349,7 +375,7 @@ class PiePreview : Gtk.DrawingArea { this.drag_enabled = true; Gtk.TargetEntry slice_source = {"text/plain", Gtk.TargetFlags.SAME_WIDGET | Gtk.TargetFlags.SAME_APP, 0}; Gtk.TargetEntry[] sources = { slice_source }; - Gtk.drag_source_set(this, Gdk.ModifierType.BUTTON1_MASK, sources, Gdk.DragAction.MOVE); + Gtk.drag_source_set(this, Gdk.ModifierType.BUTTON1_MASK, sources, Gdk.DragAction.MOVE | Gdk.DragAction.COPY); } } diff --git a/src/gui/settingsWindow.vala b/src/gui/settingsWindow.vala index 60bfcf3..81f8f7e 100644 --- a/src/gui/settingsWindow.vala +++ b/src/gui/settingsWindow.vala @@ -138,12 +138,6 @@ public class SettingsWindow : GLib.Object { private void on_close_button_clicked() { this.window.hide(); - - Logger.stats("SETTINGS " + Config.global.theme.name + - (this.indicator.active ? " INDICATOR" : "") + - (this.autostart.active ? " AUTOSTART" : "") + - (this.captions.active ? " CAPTIONS" : "") + - " %f".printf(Config.global.global_scale)); } ///////////////////////////////////////////////////////////////////// diff --git a/src/gui/triggerSelectButton.vala b/src/gui/triggerSelectButton.vala index fd8505a..7132220 100644 --- a/src/gui/triggerSelectButton.vala +++ b/src/gui/triggerSelectButton.vala @@ -48,6 +48,7 @@ public class TriggerSelectButton : Gtk.ToggleButton { ///////////////////////////////////////////////////////////////////// private Gdk.ModifierType lock_modifiers = Gdk.ModifierType.MOD2_MASK + |Gdk.ModifierType.SUPER_MASK |Gdk.ModifierType.LOCK_MASK |Gdk.ModifierType.MOD5_MASK; |