Commit 443b4a7c00e14a08beda301342dddb9a1dab58ba

Authored by Perry Werneck
1 parent 587c6297

Fixing bugs on keypad.

src/objects/keypad/keypad.c
@@ -261,17 +261,23 @@ @@ -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 if(row) { 275 if(row) {
265 element->row = (unsigned short) atoi(row); 276 element->row = (unsigned short) atoi(row);
266 } else { 277 } else {
267 element->row = keypad->current.row; 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 if(width) { 282 if(width) {
277 element->width = (unsigned short) atoi(width); 283 element->width = (unsigned short) atoi(width);
src/objects/keypad/keypad.xml
@@ -28,147 +28,152 @@ @@ -28,147 +28,152 @@
28 28
29 <ui> 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 <attribute name='label' translatable='yes'>Lateral keypad</attribute> 33 <attribute name='label' translatable='yes'>Lateral keypad</attribute>
34 34
35 - <button> 35 + <button width='2'>
36 <attribute name="label" translatable="no">PF1</attribute> 36 <attribute name="label" translatable="no">PF1</attribute>
37 <attribute name="action"></attribute> 37 <attribute name="action"></attribute>
38 </button> 38 </button>
39 39
40 - <button> 40 + <button width='2'>
41 <attribute name="label" translatable="no">PF2</attribute> 41 <attribute name="label" translatable="no">PF2</attribute>
42 <attribute name="action"></attribute> 42 <attribute name="action"></attribute>
43 </button> 43 </button>
44 44
45 - <button> 45 + <button width='2'>
46 <attribute name="label" translatable="no">PF3</attribute> 46 <attribute name="label" translatable="no">PF3</attribute>
47 <attribute name="action"></attribute> 47 <attribute name="action"></attribute>
48 </button> 48 </button>
49 49
50 - <button> 50 + <button width='2'>
51 <attribute name="label" translatable="no">PF4</attribute> 51 <attribute name="label" translatable="no">PF4</attribute>
52 <attribute name="action"></attribute> 52 <attribute name="action"></attribute>
53 </button> 53 </button>
54 54
55 - <button> 55 + <button width='2'>
56 <attribute name="label" translatable="no">PF5</attribute> 56 <attribute name="label" translatable="no">PF5</attribute>
57 <attribute name="action"></attribute> 57 <attribute name="action"></attribute>
58 </button> 58 </button>
59 59
60 - <button> 60 + <button width='2'>
61 <attribute name="label" translatable="no">PF6</attribute> 61 <attribute name="label" translatable="no">PF6</attribute>
62 <attribute name="action"></attribute> 62 <attribute name="action"></attribute>
63 </button> 63 </button>
64 64
65 - <button> 65 + <button width='2'>
66 <attribute name="label" translatable="no">PF7</attribute> 66 <attribute name="label" translatable="no">PF7</attribute>
67 <attribute name="action"></attribute> 67 <attribute name="action"></attribute>
68 </button> 68 </button>
69 69
70 - <button> 70 + <button width='2'>
71 <attribute name="label" translatable="no">PF8</attribute> 71 <attribute name="label" translatable="no">PF8</attribute>
72 <attribute name="action"></attribute> 72 <attribute name="action"></attribute>
73 </button> 73 </button>
74 74
75 - <button> 75 + <button width='2'>
76 <attribute name="label" translatable="no">PF9</attribute> 76 <attribute name="label" translatable="no">PF9</attribute>
77 <attribute name="action"></attribute> 77 <attribute name="action"></attribute>
78 </button> 78 </button>
79 79
80 - <button> 80 + <button width='2'>
81 <attribute name="label" translatable="no">PF10</attribute> 81 <attribute name="label" translatable="no">PF10</attribute>
82 <attribute name="action"></attribute> 82 <attribute name="action"></attribute>
83 </button> 83 </button>
84 84
85 - <button> 85 + <button width='2'>
86 <attribute name="label" translatable="no">PF11</attribute> 86 <attribute name="label" translatable="no">PF11</attribute>
87 <attribute name="action"></attribute> 87 <attribute name="action"></attribute>
88 </button> 88 </button>
89 89
90 - <button> 90 + <button width='2'>
91 <attribute name="label" translatable="no">PF12</attribute> 91 <attribute name="label" translatable="no">PF12</attribute>
92 <attribute name="action"></attribute> 92 <attribute name="action"></attribute>
93 </button> 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 <attribute name="action"></attribute> 97 <attribute name="action"></attribute>
98 </button> 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 <attribute name="action"></attribute> 102 <attribute name="action"></attribute>
103 </button> 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 <attribute name="action"></attribute> 107 <attribute name="action"></attribute>
108 </button> 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 <attribute name="action"></attribute> 112 <attribute name="action"></attribute>
113 </button> 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 <attribute name="label" translatable="no">PA1</attribute> 121 <attribute name="label" translatable="no">PA1</attribute>
117 <attribute name="action"></attribute> 122 <attribute name="action"></attribute>
118 </button> 123 </button>
119 124
120 - <button> 125 + <button width='2'>
121 <attribute name="label" translatable="no">PA2</attribute> 126 <attribute name="label" translatable="no">PA2</attribute>
122 <attribute name="action"></attribute> 127 <attribute name="action"></attribute>
123 </button> 128 </button>
124 129
125 - <button> 130 + <button width='2'>
126 <attribute name="label" translatable="no">PA3</attribute> 131 <attribute name="label" translatable="no">PA3</attribute>
127 <attribute name="action"></attribute> 132 <attribute name="action"></attribute>
128 </button> 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 <attribute name="action"></attribute> 137 <attribute name="action"></attribute>
133 </button> 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 <attribute name="action"></attribute> 142 <attribute name="action"></attribute>
138 </button> 143 </button>
139 144
140 - <button> 145 + <button width='3'>
141 <attribute name="label" translatable="Yes">Clear</attribute> 146 <attribute name="label" translatable="Yes">Clear</attribute>
142 <attribute name="action"></attribute> 147 <attribute name="action"></attribute>
143 </button> 148 </button>
144 149
145 - <button> 150 + <button width='3'>
146 <attribute name="label" translatable="Yes">Reset</attribute> 151 <attribute name="label" translatable="Yes">Reset</attribute>
147 <attribute name="action"></attribute> 152 <attribute name="action"></attribute>
148 </button> 153 </button>
149 154
150 - <button> 155 + <button width='3'>
151 <attribute name="label" translatable="Yes">Erase\nEOF</attribute> 156 <attribute name="label" translatable="Yes">Erase\nEOF</attribute>
152 <attribute name="action"></attribute> 157 <attribute name="action"></attribute>
153 </button> 158 </button>
154 159
155 - <button> 160 + <button width='3'>
156 <attribute name="label" translatable="Yes">Erase\nInput</attribute> 161 <attribute name="label" translatable="Yes">Erase\nInput</attribute>
157 <attribute name="action"></attribute> 162 <attribute name="action"></attribute>
158 </button> 163 </button>
159 164
160 - <button> 165 + <button width='3'>
161 <attribute name="label" translatable="Yes">Attn</attribute> 166 <attribute name="label" translatable="Yes">Attn</attribute>
162 <attribute name="action"></attribute> 167 <attribute name="action"></attribute>
163 </button> 168 </button>
164 169
165 - <button> 170 + <button width='3'>
166 <attribute name="label" translatable="Yes">Break</attribute> 171 <attribute name="label" translatable="Yes">Break</attribute>
167 <attribute name="action"></attribute> 172 <attribute name="action"></attribute>
168 </button> 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 <attribute name="action"></attribute> 177 <attribute name="action"></attribute>
173 </button> 178 </button>
174 179
src/objects/keypad/widget.c
@@ -38,8 +38,8 @@ @@ -38,8 +38,8 @@
38 if(element->icon_name) { 38 if(element->icon_name) {
39 button = gtk_button_new_from_icon_name(element->icon_name,GTK_ICON_SIZE_SMALL_TOOLBAR); 39 button = gtk_button_new_from_icon_name(element->icon_name,GTK_ICON_SIZE_SMALL_TOOLBAR);
40 } else if(element->label) { 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 } else { 43 } else {
44 button = gtk_button_new(); 44 button = gtk_button_new();
45 } 45 }
@@ -59,6 +59,7 @@ @@ -59,6 +59,7 @@
59 59
60 GtkWidget * grid = gtk_grid_new(); 60 GtkWidget * grid = gtk_grid_new();
61 gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE); 61 gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
  62 + gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
62 63
63 g_list_foreach(PW_KEYPAD_MODEL(model)->elements,(GFunc) create_child, grid); 64 g_list_foreach(PW_KEYPAD_MODEL(model)->elements,(GFunc) create_child, grid);
64 65