summaryrefslogtreecommitdiff
path: root/packages/gpe-conf/gpe-conf-0.1.20/misc1.patch
blob: d6c7658c85d2ba01ee11accd2f4de5b7bc0efe27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
Index: main.c
===================================================================
RCS file: /cvs/gpe/base/gpe-conf/main.c,v
retrieving revision 1.70
diff -u -r1.70 main.c
--- main.c	16 Oct 2004 16:03:42 -0000	1.70
+++ main.c	26 Oct 2004 14:52:24 -0000
@@ -125,7 +125,9 @@
     { &Unimplemented_Build_Objects, &Unimplemented_Free_Objects, &Unimplemented_Save, &Unimplemented_Restore ,
 		"Task nameserver" ,"task_nameserver","Task for changing nameserver", PREFIX "/share/pixmaps/gpe-config-admin.png"},
     { &Unimplemented_Build_Objects, &Unimplemented_Free_Objects, &Unimplemented_Save, &Unimplemented_Restore ,
-		"Task sound" ,"task_sound","Command line task saving/restoring sound settings.", PREFIX "/share/pixmaps/gpe-config-admin.png"}
+		"Task sound" ,"task_sound","Command line task saving/restoring sound settings.", PREFIX "/share/pixmaps/gpe-config-admin.png"},
+    { &Unimplemented_Build_Objects, &Unimplemented_Free_Objects, &Unimplemented_Save, &Unimplemented_Restore ,
+		"Task background image" ,"task_background","Only select background image.", PREFIX "/share/pixmaps/gpe-config-admin.png"}
   };
   
 struct gpe_icon my_icons[] = {
@@ -235,10 +237,24 @@
 
 void initwindow()
 {
-   // main window
+  gint size_x, size_y;
+
+   /* screen layout detection */
+   size_x = gdk_screen_width();
+   size_y = gdk_screen_height();  
+
+	
+   /* main window */	
    self.w = mainw = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-   wstyle = self.w->style;
    gtk_widget_set_usize(GTK_WIDGET(self.w),240, 310);
+	
+   if ((size_x > 640) && (size_y > 480))
+   {
+      gtk_window_set_type_hint(GTK_WINDOW(self.w), GDK_WINDOW_TYPE_HINT_DIALOG);
+	  gtk_window_set_default_size(GTK_WINDOW(self.w), 420, 460);
+   }
+   
+   wstyle = self.w->style;
 
    gtk_signal_connect (GTK_OBJECT(self.w), "delete-event",
 		       (GtkSignalFunc) gtk_main_quit, NULL);
@@ -337,18 +353,27 @@
 			  fprintf(stderr,_("'task_sound' needs (s)ave/(r)estore as argument.\n"));
 		  exit(0);
 	  }
+	  if (!strcmp(argv[1], "task_background"))
+	  {
+		  special_flag = TRUE;
+		  standalone = TRUE;
+		  task_change_background_image();
+		  exit(0);
+	  }
   }
   
   /* If no task? - start applet */
   if (!handled)
   { 
 	  self.cur_applet = -1;
-	  self.applet = NULL;	  if (!standalone)
+	  self.applet = NULL;
+	  
+	  if (!standalone)
 	  {
 		  initwindow();
 		
 		  self.vbox = gtk_vbox_new(FALSE,0);
-		  gtk_container_add(GTK_CONTAINER(self.w),self.vbox);
+		  gtk_container_add(GTK_CONTAINER(self.w), self.vbox);
 				
 		  make_container();
 		
Index: network.c
===================================================================
RCS file: /cvs/gpe/base/gpe-conf/network.c,v
retrieving revision 1.38
diff -u -r1.38 network.c
--- network.c	16 Oct 2004 16:03:42 -0000	1.38
+++ network.c	26 Oct 2004 14:52:24 -0000
@@ -475,7 +475,7 @@
 					GTK_RESPONSE_REJECT,
 					NULL);
 	
-	gtk_window_set_default_size(GTK_WINDOW(dialog), 200, 290);
+	gtk_window_set_default_size(GTK_WINDOW(dialog), 220, 320);
 
 	btnok = gtk_dialog_add_button(GTK_DIALOG(dialog), 
 	                              GTK_STOCK_OK, GTK_RESPONSE_OK);
Index: theme.c
===================================================================
RCS file: /cvs/gpe/base/gpe-conf/theme.c,v
retrieving revision 1.49
diff -u -r1.49 theme.c
--- theme.c	22 Sep 2004 16:50:01 -0000	1.49
+++ theme.c	26 Oct 2004 14:52:28 -0000
@@ -128,9 +128,57 @@
 	/* prefer xst */
 	if (!access(CMD_XST,X_OK))
 		use_xst = TRUE;
-	else
-		if (!access(CMD_GCONF,X_OK))
-			use_gconf = TRUE;	
+	/* to be extended in future */
+}
+
+void
+task_change_background_image(void)
+{
+	GtkWidget *filesel, *feedbackdlg;
+  
+	Theme_Build_Objects();
+	filesel = gtk_file_selection_new(_("Choose backgound image"));
+	gtk_file_selection_set_select_multiple(GTK_FILE_SELECTION(filesel), FALSE);
+  
+	if (gtk_dialog_run(GTK_DIALOG(filesel)) == GTK_RESPONSE_OK)
+	{
+		int ec = 0;
+		const gchar *file = 
+			gtk_file_selection_get_filename (GTK_FILE_SELECTION(filesel));
+		
+		gtk_widget_hide(filesel); 
+		ec = access(file, R_OK);
+		if (ec)
+			feedbackdlg = gtk_message_dialog_new(GTK_WINDOW(filesel),
+			  GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, 
+			  _("You are not allowed to read this file, choose another."));
+		else
+		{
+			gchar *confstr = NULL;
+				if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self.rbImgCent)))
+					confstr = g_strdup_printf("img-centered:%s", file);
+				else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self.rbImgStr)))
+					confstr = g_strdup_printf("img-stretched:%s", file);
+				else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(self.rbImgTiled)))
+					confstr = g_strdup_printf("img-tiled:%s", file);
+			if (confstr != NULL)
+			{
+				gchar *p = g_strdup_printf (CMD_XST " write %s%s str '%s'", 
+				                            KEY_MATCHBOX, "Background", confstr);
+				system(p);
+				g_free(p);
+				g_free(confstr);
+			}
+	  
+			feedbackdlg = gtk_message_dialog_new(GTK_WINDOW(filesel),
+			  GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
+			  "%s\n%s",_("Succesfully changed background image."), 
+			  _("Use \"Look and Feel\" setup tool to change details."));
+		}
+		gtk_dialog_run(GTK_DIALOG(feedbackdlg));
+		gtk_widget_destroy(feedbackdlg);
+	}
+	gtk_widget_destroy(filesel);	
 }
 
 gboolean
Index: theme.h
===================================================================
RCS file: /cvs/gpe/base/gpe-conf/theme.h,v
retrieving revision 1.5
diff -u -r1.5 theme.h
--- theme.h	28 Feb 2003 20:58:45 -0000	1.5
+++ theme.h	26 Oct 2004 14:52:28 -0000
@@ -4,8 +4,9 @@
 GtkWidget *Theme_Build_Objects();
 void Theme_Save();
 void Theme_Restore();
+void task_change_background_image(void);
 
-// definitions taken from mbdesktop.h
+/* definitions taken from mbdesktop.h */
 enum {
   BG_SOLID = 1,
   BG_TILED_PXM,
Index: suid.c
===================================================================
RCS file: /cvs/gpe/base/gpe-conf/suid.c,v
retrieving revision 1.53
diff -u -r1.53 suid.c
--- suid.c	25 Oct 2004 16:19:42 -0000	1.53
+++ suid.c	26 Oct 2004 14:52:28 -0000
@@ -376,6 +376,7 @@
 				}
 				else if (strcmp (cmd, "XCAL") == 0)  // runs screen calibration tool
 				{
+					fscanf (in, "%100s", arg2);
 					system ("/usr/bin/xtscal");
 				}
 				else if (strcmp (cmd, "STZO") == 0)  // changes the timezone setting