Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

sysconfig: add simple performance mode parameters

  • Loading branch information...
commit 8ddcd845882844570e43ca7c5f741171eb764964 1 parent 23a7b43
Sébastien Bourdeauducq authored June 08, 2011
19  src/sysconfig.c
@@ -75,7 +75,7 @@ struct rtems_bsdnet_config rtems_bsdnet_config = {
75 75
 };
76 76
 
77 77
 #define SYSCONFIG_MAGIC 0xda81d4cb
78  
-#define SYSCONFIG_VERSION 2
  78
+#define SYSCONFIG_VERSION 3
79 79
 
80 80
 struct sysconfig {
81 81
 	unsigned int magic;
@@ -97,6 +97,8 @@ struct sysconfig {
97 97
 	char password[32];
98 98
 
99 99
 	int autostart_mode;
  100
+	int autostart_dt;
  101
+	int autostart_as;
100 102
 	char autostart[256];
101 103
 };
102 104
 
@@ -136,6 +138,7 @@ static struct sysconfig sysconfig = {
136 138
 	.dhcp_enable = 1,
137 139
 	.ip = 0xc0a8002a,
138 140
 	.netmask = 0xffffff00,
  141
+	.autostart_as = 1
139 142
 };
140 143
 
141 144
 #define FMT_IP_LEN (4*3+3*1+1)
@@ -379,6 +382,14 @@ int sysconfig_get_autostart_mode()
379 382
 	return sysconfig.autostart_mode;
380 383
 }
381 384
 
  385
+void sysconfig_get_autostart_mode_simple(int *dt, int *as)
  386
+{
  387
+	if(dt != NULL)
  388
+		*dt = sysconfig.autostart_dt;
  389
+	if(as != NULL)
  390
+		*as = sysconfig.autostart_as;
  391
+}
  392
+
382 393
 void sysconfig_get_autostart(char *autostart)
383 394
 {
384 395
 	strcpy(autostart, sysconfig.autostart);
@@ -513,6 +524,12 @@ void sysconfig_set_autostart_mode(int autostart_mode)
513 524
 	sysconfig.autostart_mode = autostart_mode;
514 525
 }
515 526
 
  527
+void sysconfig_set_autostart_mode_simple(int dt, int as)
  528
+{
  529
+	sysconfig.autostart_dt = dt;
  530
+	sysconfig.autostart_as = as;
  531
+}
  532
+
516 533
 void sysconfig_set_autostart(char *autostart)
517 534
 {
518 535
 	strcpy(sysconfig.autostart, autostart);
2  src/sysconfig.h
@@ -56,6 +56,7 @@ int sysconfig_get_keyboard_layout();
56 56
 void sysconfig_get_ipconfig(int *dhcp_enable, unsigned int *ip, unsigned int *netmask, unsigned int *gateway, unsigned int *dns1, unsigned int *dns2);
57 57
 void sysconfig_get_credentials(char *login, char *password);
58 58
 int sysconfig_get_autostart_mode();
  59
+void sysconfig_get_autostart_mode_simple(int *dt, int *as);
59 60
 void sysconfig_get_autostart(char *autostart);
60 61
 
61 62
 void sysconfig_set_resolution(int resolution);
@@ -66,6 +67,7 @@ void sysconfig_set_keyboard_layout(int layout);
66 67
 void sysconfig_set_ipconfig(int dhcp_enable, unsigned int ip, unsigned int netmask, unsigned int gateway, unsigned int dns1, unsigned int dns2);
67 68
 void sysconfig_set_credentials(char *login, char *password);
68 69
 void sysconfig_set_autostart_mode(int autostart_mode);
  70
+void sysconfig_set_autostart_mode_simple(int dt, int as);
69 71
 void sysconfig_set_autostart(char *autostart);
70 72
 
71 73
 bool sysconfig_login_check(const char *user, const char *passphrase);
60  src/sysettings.c
@@ -78,6 +78,22 @@ static void asmode_callback(mtk_event *e, void *arg)
78 78
 	update_asmode();
79 79
 }
80 80
 
  81
+static int current_asmode_dt;
  82
+
  83
+static void asmode_dt_callback(mtk_event *e, void *arg)
  84
+{
  85
+	current_asmode_dt = !current_asmode_dt;
  86
+	update_asmode();
  87
+}
  88
+
  89
+static int current_asmode_as;
  90
+
  91
+static void asmode_as_callback(mtk_event *e, void *arg)
  92
+{
  93
+	current_asmode_as = !current_asmode_as;
  94
+	update_asmode();
  95
+}
  96
+
81 97
 static void ok_callback(mtk_event *e, void *arg)
82 98
 {
83 99
 	close_sysettings_window(1);
@@ -189,6 +205,9 @@ void init_sysettings()
189 205
 		"g_network1 = new Grid()",
190 206
 		"l_dhcp = new Label(-text \"DHCP client:\")",
191 207
 		"b_dhcp = new Button(-text \"Enable\")",
  208
+		"g_network1.place(l_dhcp, -column 1 -row 1)",
  209
+		"g_network1.place(b_dhcp, -column 2 -row 1)",
  210
+		"g_network2 = new Grid()",
192 211
 		"l_ip = new Label(-text \"IP address:\")",
193 212
 		"e_ip = new Entry()",
194 213
 		"l_netmask = new Label(-text \"Netmask:\")",
@@ -197,16 +216,14 @@ void init_sysettings()
197 216
 		"e_gateway = new Entry()",
198 217
 		"l_dns = new Label(-text \"DNS:\")",
199 218
 		"e_dns = new Entry()",
200  
-		"g_network1.place(l_dhcp, -column 1 -row 1)",
201  
-		"g_network1.place(b_dhcp, -column 2 -row 1)",
202  
-		"g_network1.place(l_ip, -column 1 -row 2)",
203  
-		"g_network1.place(e_ip, -column 2 -row 2)",
204  
-		"g_network1.place(l_netmask, -column 1 -row 3)",
205  
-		"g_network1.place(e_netmask, -column 2 -row 3)",
206  
-		"g_network1.place(l_gateway, -column 1 -row 4)",
207  
-		"g_network1.place(e_gateway, -column 2 -row 4)",
208  
-		"g_network1.place(l_dns, -column 1 -row 5)",
209  
-		"g_network1.place(e_dns, -column 2 -row 5)",
  219
+		"g_network2.place(l_ip, -column 1 -row 1)",
  220
+		"g_network2.place(e_ip, -column 2 -row 1)",
  221
+		"g_network2.place(l_netmask, -column 3 -row 1)",
  222
+		"g_network2.place(e_netmask, -column 4 -row 1)",
  223
+		"g_network2.place(l_gateway, -column 1 -row 2)",
  224
+		"g_network2.place(e_gateway, -column 2 -row 2)",
  225
+		"g_network2.place(l_dns, -column 3 -row 2)",
  226
+		"g_network2.place(e_dns, -column 4 -row 2)",
210 227
 
211 228
 		"g_remote0 = new Grid()",
212 229
 		"l_remote = new Label(-text \"Remote access\" -font \"title\")",
@@ -237,10 +254,16 @@ void init_sysettings()
237 254
 		"b_asmode_none = new Button(-text \"None\")",
238 255
 		"b_asmode_simple = new Button(-text \"Simple\")",
239 256
 		"b_asmode_file = new Button(-text \"File\")",
  257
+		"b_asmode_separator = new Separator(-vertical yes)",
  258
+		"b_asmode_dt = new Button(-text \"Display titles\")",
  259
+		"b_asmode_as = new Button(-text \"Auto switch\")",
240 260
 		"g_autostart1.place(l_asmode, -column 1 -row 1)",
241 261
 		"g_autostart1.place(b_asmode_none, -column 2 -row 1)",
242 262
 		"g_autostart1.place(b_asmode_simple, -column 3 -row 1)",
243 263
 		"g_autostart1.place(b_asmode_file, -column 4 -row 1)",
  264
+		"g_autostart1.place(b_asmode_separator, -column 5 -row 1)",
  265
+		"g_autostart1.place(b_asmode_dt, -column 6 -row 1)",
  266
+		"g_autostart1.place(b_asmode_as, -column 7 -row 1)",
244 267
 		"g_autostart2 = new Grid()",
245 268
 		"l_autostart = new Label(-text \"File:\")",
246 269
 		"e_autostart = new Entry()",
@@ -264,11 +287,12 @@ void init_sysettings()
264 287
 		"g.place(g_localization, -column 1 -row 5)",
265 288
 		"g.place(g_network0, -column 1 -row 6)",
266 289
 		"g.place(g_network1, -column 1 -row 7)",
267  
-		"g.place(g_remote0, -column 1 -row 8)",
268  
-		"g.place(g_remote1, -column 1 -row 9)",
269  
-		"g.place(g_autostart0, -column 1 -row 10)",
270  
-		"g.place(g_autostart1, -column 1 -row 11)",
271  
-		"g.place(g_autostart2, -column 1 -row 12)",
  290
+		"g.place(g_network2, -column 1 -row 8)",
  291
+		"g.place(g_remote0, -column 1 -row 9)",
  292
+		"g.place(g_remote1, -column 1 -row 10)",
  293
+		"g.place(g_autostart0, -column 1 -row 11)",
  294
+		"g.place(g_autostart1, -column 1 -row 12)",
  295
+		"g.place(g_autostart2, -column 1 -row 13)",
272 296
 		"g.place(g_btn, -column 1 -row 14)",
273 297
 
274 298
 		"w = new Window(-content g -title \"System settings\" -y 0)",
@@ -294,6 +318,8 @@ void init_sysettings()
294 318
 	mtk_bind(appid, "b_asmode_none", "press", asmode_callback, (void *)SC_AUTOSTART_NONE);
295 319
 	mtk_bind(appid, "b_asmode_simple", "press", asmode_callback, (void *)SC_AUTOSTART_SIMPLE);
296 320
 	mtk_bind(appid, "b_asmode_file", "press", asmode_callback, (void *)SC_AUTOSTART_FILE);
  321
+	mtk_bind(appid, "b_asmode_dt", "press", asmode_dt_callback, NULL);
  322
+	mtk_bind(appid, "b_asmode_as", "press", asmode_as_callback, NULL);
297 323
 	mtk_bind(appid, "b_autostart", "commit", browse_autostart_callback, NULL);
298 324
 	
299 325
 	mtk_bind(appid, "b_ok", "commit", ok_callback, NULL);
@@ -409,6 +435,8 @@ static void update_asmode()
409 435
 	mtk_cmdf(appid, "b_asmode_none.set(-state %s)", current_asmode == SC_AUTOSTART_NONE ? "on" : "off");
410 436
 	mtk_cmdf(appid, "b_asmode_simple.set(-state %s)", current_asmode == SC_AUTOSTART_SIMPLE ? "on" : "off");
411 437
 	mtk_cmdf(appid, "b_asmode_file.set(-state %s)", current_asmode == SC_AUTOSTART_FILE ? "on" : "off");
  438
+	mtk_cmdf(appid, "b_asmode_dt.set(-state %s)", current_asmode_dt ? "on" : "off");
  439
+	mtk_cmdf(appid, "b_asmode_as.set(-state %s)", current_asmode_as ? "on" : "off");
412 440
 }
413 441
 
414 442
 static void update_autostart()
@@ -451,6 +479,7 @@ void open_sysettings_window()
451 479
 	previous_resolution = sysconfig_get_resolution();
452 480
 	current_language = sysconfig_get_language();
453 481
 	current_asmode = sysconfig_get_autostart_mode();
  482
+	sysconfig_get_autostart_mode_simple(&current_asmode_dt, &current_asmode_as);
454 483
 	
455 484
 	sysettings_update_resolution();
456 485
 	update_wallpaper();
@@ -519,6 +548,7 @@ static void close_sysettings_window(int save)
519 548
 			inet_addr(gateway_txt), dns1, dns2);
520 549
 		sysconfig_set_credentials(login, password);
521 550
 		sysconfig_set_autostart_mode(current_asmode);
  551
+		sysconfig_set_autostart_mode_simple(current_asmode_dt, current_asmode_as);
522 552
 		sysconfig_set_autostart(autostart);
523 553
 		
524 554
 		sysconfig_save();

0 notes on commit 8ddcd84

Please sign in to comment.
Something went wrong with that request. Please try again.