Commit 443b4a7c00e14a08beda301342dddb9a1dab58ba
1 parent
587c6297
Exists in
master
and in
4 other branches
Fixing bugs on keypad.
Showing
3 changed files
with
55 additions
and
43 deletions
Show diff stats
src/objects/keypad/keypad.c
... | ... | @@ -261,17 +261,23 @@ |
261 | 261 | |
262 | 262 | } |
263 | 263 | |
264 | + if(col) { | |
265 | + element->col = (unsigned short) atoi(col); | |
266 | + | |
267 | + if(element->col < keypad->current.col) { | |
268 | + keypad->current.row++; | |
269 | + } | |
270 | + | |
271 | + } else { | |
272 | + element->col = keypad->current.col; | |
273 | + } | |
274 | + | |
264 | 275 | if(row) { |
265 | 276 | element->row = (unsigned short) atoi(row); |
266 | 277 | } else { |
267 | 278 | element->row = keypad->current.row; |
268 | 279 | } |
269 | 280 | |
270 | - if(col) { | |
271 | - element->col = (unsigned short) atoi(col); | |
272 | - } else { | |
273 | - element->col = keypad->current.col; | |
274 | - } | |
275 | 281 | |
276 | 282 | if(width) { |
277 | 283 | element->width = (unsigned short) atoi(width); | ... | ... |
src/objects/keypad/keypad.xml
... | ... | @@ -28,147 +28,152 @@ |
28 | 28 | |
29 | 29 | <ui> |
30 | 30 | |
31 | - <keypad name="lateral_keypad" position="right" width='3'> | |
31 | + <keypad name="lateral_keypad" position="right" width='6'> | |
32 | 32 | |
33 | 33 | <attribute name='label' translatable='yes'>Lateral keypad</attribute> |
34 | 34 | |
35 | - <button> | |
35 | + <button width='2'> | |
36 | 36 | <attribute name="label" translatable="no">PF1</attribute> |
37 | 37 | <attribute name="action"></attribute> |
38 | 38 | </button> |
39 | 39 | |
40 | - <button> | |
40 | + <button width='2'> | |
41 | 41 | <attribute name="label" translatable="no">PF2</attribute> |
42 | 42 | <attribute name="action"></attribute> |
43 | 43 | </button> |
44 | 44 | |
45 | - <button> | |
45 | + <button width='2'> | |
46 | 46 | <attribute name="label" translatable="no">PF3</attribute> |
47 | 47 | <attribute name="action"></attribute> |
48 | 48 | </button> |
49 | 49 | |
50 | - <button> | |
50 | + <button width='2'> | |
51 | 51 | <attribute name="label" translatable="no">PF4</attribute> |
52 | 52 | <attribute name="action"></attribute> |
53 | 53 | </button> |
54 | 54 | |
55 | - <button> | |
55 | + <button width='2'> | |
56 | 56 | <attribute name="label" translatable="no">PF5</attribute> |
57 | 57 | <attribute name="action"></attribute> |
58 | 58 | </button> |
59 | 59 | |
60 | - <button> | |
60 | + <button width='2'> | |
61 | 61 | <attribute name="label" translatable="no">PF6</attribute> |
62 | 62 | <attribute name="action"></attribute> |
63 | 63 | </button> |
64 | 64 | |
65 | - <button> | |
65 | + <button width='2'> | |
66 | 66 | <attribute name="label" translatable="no">PF7</attribute> |
67 | 67 | <attribute name="action"></attribute> |
68 | 68 | </button> |
69 | 69 | |
70 | - <button> | |
70 | + <button width='2'> | |
71 | 71 | <attribute name="label" translatable="no">PF8</attribute> |
72 | 72 | <attribute name="action"></attribute> |
73 | 73 | </button> |
74 | 74 | |
75 | - <button> | |
75 | + <button width='2'> | |
76 | 76 | <attribute name="label" translatable="no">PF9</attribute> |
77 | 77 | <attribute name="action"></attribute> |
78 | 78 | </button> |
79 | 79 | |
80 | - <button> | |
80 | + <button width='2'> | |
81 | 81 | <attribute name="label" translatable="no">PF10</attribute> |
82 | 82 | <attribute name="action"></attribute> |
83 | 83 | </button> |
84 | 84 | |
85 | - <button> | |
85 | + <button width='2'> | |
86 | 86 | <attribute name="label" translatable="no">PF11</attribute> |
87 | 87 | <attribute name="action"></attribute> |
88 | 88 | </button> |
89 | 89 | |
90 | - <button> | |
90 | + <button width='2'> | |
91 | 91 | <attribute name="label" translatable="no">PF12</attribute> |
92 | 92 | <attribute name="action"></attribute> |
93 | 93 | </button> |
94 | 94 | |
95 | - <button column='1'> | |
96 | - <attribute name="icon-name" translatable="no">go-up</attribute> | |
95 | +\ <button column='2' width='2'> | |
96 | + <attribute name="icon-name" translatable="no">gtk-go-up</attribute> | |
97 | 97 | <attribute name="action"></attribute> |
98 | 98 | </button> |
99 | 99 | |
100 | - <button column='0'> | |
101 | - <attribute name="icon-name" translatable="no">go-back</attribute> | |
100 | + <button column='0' width='2'> | |
101 | + <attribute name="icon-name" translatable="no">gtk-go-back</attribute> | |
102 | 102 | <attribute name="action"></attribute> |
103 | 103 | </button> |
104 | 104 | |
105 | - <button> | |
106 | - <attribute name="icon-name" translatable="no">go-top</attribute> | |
105 | + <button width='2'> | |
106 | + <attribute name="icon-name" translatable="no">gtk-goto-top</attribute> | |
107 | 107 | <attribute name="action"></attribute> |
108 | 108 | </button> |
109 | 109 | |
110 | - <button> | |
111 | - <attribute name="icon-name" translatable="no">go-forward</attribute> | |
110 | + <button width='2'> | |
111 | + <attribute name="icon-name" translatable="no">gtk-go-forward</attribute> | |
112 | 112 | <attribute name="action"></attribute> |
113 | 113 | </button> |
114 | 114 | |
115 | - <button> | |
115 | + <button column='2' width='2'> | |
116 | + <attribute name="icon-name" translatable="no">gtk-go-down</attribute> | |
117 | + <attribute name="action"></attribute> | |
118 | + </button> | |
119 | + | |
120 | + <button width='2' column='0'> | |
116 | 121 | <attribute name="label" translatable="no">PA1</attribute> |
117 | 122 | <attribute name="action"></attribute> |
118 | 123 | </button> |
119 | 124 | |
120 | - <button> | |
125 | + <button width='2'> | |
121 | 126 | <attribute name="label" translatable="no">PA2</attribute> |
122 | 127 | <attribute name="action"></attribute> |
123 | 128 | </button> |
124 | 129 | |
125 | - <button> | |
130 | + <button width='2'> | |
126 | 131 | <attribute name="label" translatable="no">PA3</attribute> |
127 | 132 | <attribute name="action"></attribute> |
128 | 133 | </button> |
129 | 134 | |
130 | - <button> | |
131 | - <attribute name="icon-name" translatable="no">goto-first</attribute> | |
135 | + <button width='3'> | |
136 | + <attribute name="icon-name" translatable="no">go-first</attribute> | |
132 | 137 | <attribute name="action"></attribute> |
133 | 138 | </button> |
134 | 139 | |
135 | - <button> | |
136 | - <attribute name="icon-name" translatable="no">goto-last</attribute> | |
140 | + <button width='3'> | |
141 | + <attribute name="icon-name" translatable="no">go-last</attribute> | |
137 | 142 | <attribute name="action"></attribute> |
138 | 143 | </button> |
139 | 144 | |
140 | - <button> | |
145 | + <button width='3'> | |
141 | 146 | <attribute name="label" translatable="Yes">Clear</attribute> |
142 | 147 | <attribute name="action"></attribute> |
143 | 148 | </button> |
144 | 149 | |
145 | - <button> | |
150 | + <button width='3'> | |
146 | 151 | <attribute name="label" translatable="Yes">Reset</attribute> |
147 | 152 | <attribute name="action"></attribute> |
148 | 153 | </button> |
149 | 154 | |
150 | - <button> | |
155 | + <button width='3'> | |
151 | 156 | <attribute name="label" translatable="Yes">Erase\nEOF</attribute> |
152 | 157 | <attribute name="action"></attribute> |
153 | 158 | </button> |
154 | 159 | |
155 | - <button> | |
160 | + <button width='3'> | |
156 | 161 | <attribute name="label" translatable="Yes">Erase\nInput</attribute> |
157 | 162 | <attribute name="action"></attribute> |
158 | 163 | </button> |
159 | 164 | |
160 | - <button> | |
165 | + <button width='3'> | |
161 | 166 | <attribute name="label" translatable="Yes">Attn</attribute> |
162 | 167 | <attribute name="action"></attribute> |
163 | 168 | </button> |
164 | 169 | |
165 | - <button> | |
170 | + <button width='3'> | |
166 | 171 | <attribute name="label" translatable="Yes">Break</attribute> |
167 | 172 | <attribute name="action"></attribute> |
168 | 173 | </button> |
169 | 174 | |
170 | - <button> | |
171 | - <attribute name="icon-name" translatable="no">ok</attribute> | |
175 | + <button width='6'> | |
176 | + <attribute name="icon-name" translatable="no">gtk-ok</attribute> | |
172 | 177 | <attribute name="action"></attribute> |
173 | 178 | </button> |
174 | 179 | ... | ... |
src/objects/keypad/widget.c
... | ... | @@ -38,8 +38,8 @@ |
38 | 38 | if(element->icon_name) { |
39 | 39 | button = gtk_button_new_from_icon_name(element->icon_name,GTK_ICON_SIZE_SMALL_TOOLBAR); |
40 | 40 | } else if(element->label) { |
41 | - button = gtk_button_new(); | |
42 | - gtk_button_set_(element->label); | |
41 | + g_autofree gchar * label = g_strcompress(element->label); | |
42 | + button = gtk_button_new_with_label(label); | |
43 | 43 | } else { |
44 | 44 | button = gtk_button_new(); |
45 | 45 | } |
... | ... | @@ -59,6 +59,7 @@ |
59 | 59 | |
60 | 60 | GtkWidget * grid = gtk_grid_new(); |
61 | 61 | gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE); |
62 | + gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE); | |
62 | 63 | |
63 | 64 | g_list_foreach(PW_KEYPAD_MODEL(model)->elements,(GFunc) create_child, grid); |
64 | 65 | ... | ... |