Merge lp:~odd-rationale/diodon/odd-branch into lp:~diodon-team/diodon/trunk

Proposed by Dariel Dato-on
Status: Merged
Approved by: Dariel Dato-on
Approved revision: 59
Merge reported by: Dariel Dato-on
Merged at revision: not available
Proposed branch: lp:~odd-rationale/diodon/odd-branch
Merge into: lp:~diodon-team/diodon/trunk
Diff against target: 84 lines (+22/-3)
3 files modified
src/clipboard-manager.vala (+1/-1)
src/indicator-view.vala (+19/-0)
src/main.vala (+2/-2)
To merge this branch: bzr merge lp:~odd-rationale/diodon/odd-branch
Reviewer Review Type Date Requested Status
Dariel Dato-on Approve
Review via email: mp+43484@code.launchpad.net

Description of the change

Implements "<empty>" menu item when clipboard is empty.

To post a comment you must log in.
Revision history for this message
Dariel Dato-on (odd-rationale) wrote :

I'm merging these changes for now.

In the future, would it be better for you to review/approve any merge proposals I make? You are more familiar with the code and could let me know if I implemented it correctly.

review: Approve
Revision history for this message
Oliver Sauder (sao) wrote :

I'd say for you it's much easier to directly commit into the trunk. As currently the project is still small we can easily handle it this way.

I than can review them from there. For easier review it would be good if you add the bug number to the commit message.

About this particular change:
I moved the logic of showing or hiding the empty label to the Controller.

As the user interface is also written in Vala, it is sometimes difficult to figure out what the difference is between user interface and logic (in some cases I'm also not sure if some of the code of the view belongs actually to the Controller).

I hope I will soon be able to create a diagram to make it a little bit easier to understand where what code belongs too.

Revision history for this message
Oliver Sauder (sao) wrote :

I've just found the following to say bzr what bug has been fixed:
bzr ci --fixes lp:689447 -m "some message"

This is even better as there will be link directly to the bug in the bzr qlog and glog user interfaces.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/clipboard-manager.vala'
2--- src/clipboard-manager.vala 2010-12-02 21:07:32 +0000
3+++ src/clipboard-manager.vala 2010-12-12 23:29:32 +0000
4@@ -97,7 +97,7 @@
5 on_text_received(type, text);
6 }
7
8- return true;
9+ return true;
10 }
11 }
12 }
13
14=== modified file 'src/indicator-view.vala'
15--- src/indicator-view.vala 2010-12-11 18:11:07 +0000
16+++ src/indicator-view.vala 2010-12-12 23:29:32 +0000
17@@ -30,6 +30,7 @@
18 {
19 private AppIndicator.Indicator indicator;
20 private Gtk.Menu menu;
21+ private Gtk.MenuItem empty_item;
22
23 /**
24 * HashMap of all available clipboard items
25@@ -67,6 +68,10 @@
26 // Setup application menu
27 menu = new Gtk.Menu();
28
29+ empty_item = new Gtk.MenuItem.with_label(_("<Empty>"));
30+ empty_item.set_sensitive(false);
31+ menu.append(empty_item);
32+
33 Gtk.SeparatorMenuItem sep_item = new Gtk.SeparatorMenuItem();
34 menu.append(sep_item);
35
36@@ -107,6 +112,7 @@
37 menu_item.activate.connect(on_clicked_item);
38 menu_item.show();
39 clipboard_menu_items.set(item, menu_item);
40+ clipboard_is_empty(false);
41 menu.prepend(menu_item);
42 }
43
44@@ -134,6 +140,7 @@
45 }
46
47 clipboard_menu_items.clear();
48+ clipboard_is_empty(true);
49 }
50
51 /**
52@@ -146,6 +153,18 @@
53 }
54
55 /**
56+ * Show or hide the empty clipboard label
57+ */
58+ private void clipboard_is_empty(bool is_empty)
59+ {
60+ if (is_empty) {
61+ empty_item.set_visible(true);
62+ } else {
63+ empty_item.set_visible(false);
64+ }
65+ }
66+
67+ /**
68 * User event: clicked menu item clear
69 */
70 private void on_clicked_clear()
71
72=== modified file 'src/main.vala'
73--- src/main.vala 2010-12-01 21:14:30 +0000
74+++ src/main.vala 2010-12-12 23:29:32 +0000
75@@ -36,8 +36,8 @@
76 Gtk.init(ref args);
77
78 // setup storage
79- string diodon_dir = Environment.get_home_dir()
80- + "/.local/share/diodon";
81+ string diodon_dir = Environment.get_user_data_dir()
82+ + "/diodon";
83 IClipboardStorage storage = new XmlClipboardStorage(diodon_dir, "storage.xml");
84 ClipboardModel model = new ClipboardModel(storage);
85

Subscribers

People subscribed via source and target branches