Merge lp:~sheosi/lingo-dictionary/fix-952508 into lp:lingo-dictionary

Proposed by Sergio Tortosa
Status: Needs review
Proposed branch: lp:~sheosi/lingo-dictionary/fix-952508
Merge into: lp:lingo-dictionary
Diff against target: 109 lines (+69/-2)
2 files modified
CMakeLists.txt (+2/-0)
src/lingo-window.vala (+67/-2)
To merge this branch: bzr merge lp:~sheosi/lingo-dictionary/fix-952508
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+109121@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

128. By Sergio Tortosa

Fix bug 952508 and add searchbar autofocus.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2012-01-07 18:58:13 +0000
3+++ CMakeLists.txt 2012-06-07 12:18:17 +0000
4@@ -72,6 +72,7 @@
5 pkg_check_modules(GTK+ REQUIRED "gtk+-3.0")
6 pkg_check_modules(GEE REQUIRED "gee-1.0")
7 #pkg_check_modules(UNIQUE REQUIRED "unique-1.0")
8+pkg_check_modules(GDK REQUIRED "gdk-3.0")
9 pkg_check_modules(DEPS REQUIRED ${LINGO_DEPS} gthread-2.0)
10
11 add_definitions(${DEPS_CFLAGS})
12@@ -95,6 +96,7 @@
13 src/lingo-wordnik.vala
14 PACKAGES
15 gtk+-3.0
16+ gdk-3.0
17 granite
18 json-glib-1.0
19 gee-1.0
20
21=== modified file 'src/lingo-window.vala'
22--- src/lingo-window.vala 2012-03-19 20:58:37 +0000
23+++ src/lingo-window.vala 2012-06-07 12:18:17 +0000
24@@ -14,11 +14,13 @@
25 with this program. If not, see <http://www.gnu.org/licenses/>.
26 END LICENSE
27 ***/
28+using Gdk;
29
30 namespace Lingo {
31
32 const int MIN_WIDTH = 350;
33 const int MIN_HEIGHT = 300;
34+ short ctrlpressed;
35
36 public class LingoWindow : Gtk.Window {
37 public static Granite.Application app { get; private set; }
38@@ -481,6 +483,69 @@
39 save_state ();
40 Gtk.main_quit ();
41 }
42- }
43-
44+
45+ public override bool key_press_event (Gdk.EventKey event) {
46+
47+ switch (Gdk.keyval_name (event.keyval)) {
48+
49+ case "Control_L":
50+ ctrlpressed=1;
51+ break;
52+ case "Control_R":
53+ ctrlpressed=1;
54+ break;
55+ case "KP_Add":
56+ if (ctrlpressed==1 && dict_view.font_size < 3)
57+ increase_text_size_cb ();
58+ break;
59+ case "KP_Subtract":
60+ if (ctrlpressed==1 && dict_view.font_size > 1)
61+ decrease_text_size_cb ();
62+ break;
63+ default:
64+ if (!search_bar.has_focus)
65+ search_bar.grab_focus ();
66+ return base.key_press_event (event);
67+ break;
68+ }
69+
70+ return true;
71+
72+ }
73+
74+ public override bool key_release_event (Gdk.EventKey event) {
75+
76+ switch (Gdk.keyval_name (event.keyval)) {
77+ case "Control_L":
78+ ctrlpressed=0;
79+ break;
80+ case "Control_R":
81+ ctrlpressed=0;
82+ break;
83+
84+ }
85+
86+ return true;
87+
88+ }
89+
90+ public override bool scroll_event (EventScroll event) {
91+
92+ switch (event.direction.to_string ()) {
93+ case "GDK_SCROLL_UP":
94+ if (ctrlpressed==1 && dict_view.font_size < 3)
95+ increase_text_size_cb ();
96+ break;
97+ //case "GDK_SCROLL_LEFT":
98+ case "GDK_SCROLL_DOWN":
99+ if (ctrlpressed==1 && dict_view.font_size > 1)
100+ decrease_text_size_cb ();
101+ break;
102+ //case "GDK_SCROLL_RIGHT":
103+ }
104+
105+ return false;
106+
107+ }
108+ }
109 }

Subscribers

People subscribed via source and target branches

to all changes: