diff options
author | Koen Kooi <koen@openembedded.org> | 2005-06-30 08:19:37 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2005-06-30 08:19:37 +0000 |
commit | c8e5702127e507e82e6f68a4b8c546803accea9d (patch) | |
tree | 00583491f40ecc640f2b28452af995e3a63a09d7 /packages/gpe-conf/gpe-conf-0.1.20 | |
parent | 87ec8ca4d2e2eb4d1c1e1e1a6b46a395d56805b9 (diff) |
import clean BK tree at cset 1.3670
Diffstat (limited to 'packages/gpe-conf/gpe-conf-0.1.20')
-rw-r--r-- | packages/gpe-conf/gpe-conf-0.1.20/.mtn2git_empty | 0 | ||||
-rw-r--r-- | packages/gpe-conf/gpe-conf-0.1.20/hwclock.patch | 30 | ||||
-rw-r--r-- | packages/gpe-conf/gpe-conf-0.1.20/meminfo26.patch | 149 | ||||
-rw-r--r-- | packages/gpe-conf/gpe-conf-0.1.20/misc1.patch | 192 | ||||
-rw-r--r-- | packages/gpe-conf/gpe-conf-0.1.20/ntpdate.patch | 148 | ||||
-rw-r--r-- | packages/gpe-conf/gpe-conf-0.1.20/password-if.patch | 442 |
6 files changed, 961 insertions, 0 deletions
diff --git a/packages/gpe-conf/gpe-conf-0.1.20/.mtn2git_empty b/packages/gpe-conf/gpe-conf-0.1.20/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/gpe-conf/gpe-conf-0.1.20/.mtn2git_empty diff --git a/packages/gpe-conf/gpe-conf-0.1.20/hwclock.patch b/packages/gpe-conf/gpe-conf-0.1.20/hwclock.patch index e69de29bb2..2dfc40f205 100644 --- a/packages/gpe-conf/gpe-conf-0.1.20/hwclock.patch +++ b/packages/gpe-conf/gpe-conf-0.1.20/hwclock.patch @@ -0,0 +1,30 @@ +Index: suid.c +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/suid.c,v +retrieving revision 1.52 +diff -u -r1.52 suid.c +--- suid.c 16 Oct 2004 16:03:43 -0000 1.52 ++++ suid.c 25 Oct 2004 15:00:56 -0000 +@@ -95,6 +95,7 @@ + } + else // if ok, update rtc time + { ++ system("/sbin/hwclock --systohc"); + system ("echo > /var/spool/at/trigger"); + } + g_free(tstr); +@@ -337,11 +338,11 @@ + time_t t; + fscanf (in, "%ld", &t); + if (stime (&t) == -1) +- fprintf (stderr, +- "Error while setting the time: %d\n", +- errno); ++ fprintf (stderr, "Error while setting the time: %d\n", ++ errno); + else // if ok, update rtc time + { ++ system("/sbin/hwclock --systohc"); + system ("echo > /var/spool/at/trigger"); + } + } diff --git a/packages/gpe-conf/gpe-conf-0.1.20/meminfo26.patch b/packages/gpe-conf/gpe-conf-0.1.20/meminfo26.patch index e69de29bb2..b78a48d38a 100644 --- a/packages/gpe-conf/gpe-conf-0.1.20/meminfo26.patch +++ b/packages/gpe-conf/gpe-conf-0.1.20/meminfo26.patch @@ -0,0 +1,149 @@ +Index: sysinfo.c +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/sysinfo.c,v +retrieving revision 1.19 +diff -u -r1.19 sysinfo.c +--- sysinfo.c 8 Sep 2004 22:14:12 -0000 1.19 ++++ sysinfo.c 25 Oct 2004 12:01:01 -0000 +@@ -160,6 +160,7 @@ + get_device_info() + { + t_deviceinfo result; ++ struct utsname uinfo; + #ifdef __arm__ + char **strv; + int len = 0; +@@ -173,6 +174,8 @@ + result.ram = 0; + result.flash = 0; + ++ uname(&uinfo); ++ + #ifdef __arm__ + /* check mach type and model */ + if (!access(P_IPAQ,F_OK)) +@@ -235,6 +238,7 @@ + #endif + #ifdef __i386__ + result.cpu = g_strdup(_("Intel x86 or compatible")); ++ result.model = g_strdup_printf("%s, %s", _("IBM type PC"), uinfo.machine); + #endif + #ifdef __mips__ + result.cpu = g_strdup(_("Mips")); +@@ -246,12 +250,13 @@ + result.cpu = g_strdup(_("IBM Power or PowerPC")); + #endif + if (!result.model) +- result.model = g_strdup(MACHINE); ++ result.model = g_strdup_printf("%s (%s)", uinfo.machine, MACHINE); + #endif + + /* memory and flash size */ ++ + system_memory(); +- result.ram = meminfo.total / 1024 + 1; ++ result.ram = meminfo.total; + result.flash = get_flash_size(); + return result; + } +Index: storage.c +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/storage.c,v +retrieving revision 1.17 +diff -u -r1.17 storage.c +--- storage.c 13 Sep 2004 12:00:01 -0000 1.17 ++++ storage.c 25 Oct 2004 12:01:01 -0000 +@@ -54,41 +54,32 @@ + return FS_T_UNKNOWN; + } + +-/* from minisys */ + int + system_memory (void) + { +- u_int64_t my_mem_used, my_mem_max; +- u_int64_t my_swap_max; ++ unsigned long mem_free, mem_total; + +- static int mem_delay = 0; + FILE *mem; +- static u_int64_t aa, ab, ac, ad, ae, af, ag, ah; +- /* put this in permanent storage instead of stack */ +- static char not_needed[2048]; +- if (mem_delay-- <= 0) ++ static char line[255]; ++ mem = fopen ("/proc/meminfo", "r"); ++ if (mem) + { +- mem = fopen ("/proc/meminfo", "r"); +- fgets (not_needed, 2048, mem); +- +- fscanf (mem, "%*s %Ld %Ld %Ld %Ld %Ld %Ld", &aa, &ab, &ac, +- &ad, &ae, &af); +- fscanf (mem, "%*s %Ld %Ld", &ag, &ah); ++ while (fgets (line, 255, mem)) ++ { ++ if (g_str_has_prefix(line, "MemTotal")) ++ sscanf(line, "%*s %lu %*s", &mem_total); ++ else if (g_str_has_prefix(line, "MemFree")) ++ { ++ sscanf(line, "%*s %lu %*s", &mem_free); ++ break; ++ } ++ } + fclose (mem); +- mem_delay = 25; +- +- /* calculate it */ +- my_mem_max = aa; /* memory.total; */ +- my_swap_max = ag; /* swap.total; */ +- +- my_mem_used = ah + ab - af - ae; +- +- meminfo.total = my_mem_max / 1024; +- meminfo.used = my_mem_used / 1024; +- meminfo.avail = (my_mem_max - my_mem_used) / 1024; +- return 0; ++ meminfo.total = mem_total / 1024; ++ meminfo.used = (mem_total - mem_free) / 1024; ++ meminfo.avail = mem_free / 1024; + } +- return 1; ++ return 0; + } + + +@@ -183,13 +174,13 @@ + /* TRANSLATORS: MB == Mega Bytes*/ + sprintf (cnew2, "%s: <i>%4.1f</i> %s", _("Free memory"), + ((float) meminfo.total - +- (float) meminfo.used) / 1024.0, _("MB")); ++ (float) meminfo.used), _("MB")); + gtk_label_set_markup (GTK_LABEL (meminfo.label3), cnew2); + + fstr = g_strdup_printf ("%s%s %4.1f %s %s", + "<span foreground=\"black\">", + _("Total:"), +- (float) meminfo.total / 1024.0, ++ (float) meminfo.total, + _("MB"), "</span>"); + gtk_label_set_markup (GTK_LABEL (meminfo.label2), fstr); + g_free (fstr); +@@ -452,7 +443,7 @@ + (float) meminfo.total); + sprintf (cnew2, "%s: <i>%4.1f</i> %s", _("Free memory"), + ((float) meminfo.total - +- (float) meminfo.used) / 1024.0, _("MB")); ++ (float) meminfo.used), _("MB")); + label1 = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (label1), 0.0, 0.5); + meminfo.label3 = label1; +@@ -464,7 +455,7 @@ + fstr = g_strdup_printf ("%s%s %4.1f %s %s", + "<span foreground=\"black\">", + _("Total:"), +- (float) meminfo.total / 1024.0, ++ (float) meminfo.total, + _("MB"), "</span>"); + gtk_label_set_markup (GTK_LABEL (label1), fstr); + g_free (fstr); diff --git a/packages/gpe-conf/gpe-conf-0.1.20/misc1.patch b/packages/gpe-conf/gpe-conf-0.1.20/misc1.patch index e69de29bb2..d6c7658c85 100644 --- a/packages/gpe-conf/gpe-conf-0.1.20/misc1.patch +++ b/packages/gpe-conf/gpe-conf-0.1.20/misc1.patch @@ -0,0 +1,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 diff --git a/packages/gpe-conf/gpe-conf-0.1.20/ntpdate.patch b/packages/gpe-conf/gpe-conf-0.1.20/ntpdate.patch index e69de29bb2..2a9b3098ff 100644 --- a/packages/gpe-conf/gpe-conf-0.1.20/ntpdate.patch +++ b/packages/gpe-conf/gpe-conf-0.1.20/ntpdate.patch @@ -0,0 +1,148 @@ +Index: suid.c +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/suid.c,v +retrieving revision 1.54 +diff -u -r1.54 suid.c +--- suid.c 26 Oct 2004 15:04:22 -0000 1.54 ++++ suid.c 28 Oct 2004 20:20:23 -0000 +@@ -88,17 +88,25 @@ + void + update_time_from_net (const gchar * server) + { ++ ++ if (setvbuf(nsreturn,NULL,_IONBF,0) != 0) ++ fprintf(stderr,"gpe-conf: error setting buffer size!"); ++ + char *tstr = g_strdup_printf ("ntpdate -b %s", server); + if (system(tstr)) + { + fprintf (stderr, "failed to execute ntpdate\n"); ++ fprintf(nsreturn,"<failed>\n"); + } +- else // if ok, update rtc time ++ else /* if ok, update rtc time */ + { ++ fprintf(nsreturn,"<success>\n"); + system("/sbin/hwclock --systohc"); + system ("echo > /var/spool/at/trigger"); + } + g_free(tstr); ++ fflush(nsreturn); ++ fsync(nsreturnfd); + } + + +Index: network.c +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/network.c,v +retrieving revision 1.39 +diff -u -r1.39 network.c +--- network.c 26 Oct 2004 15:04:22 -0000 1.39 ++++ network.c 28 Oct 2004 20:20:23 -0000 +@@ -1416,7 +1416,9 @@ + if (entry) + { + newval = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1); +- suid_exec ("SDNS", newval); ++ if (strlen(newval)) ++ suid_exec ("SDNS", newval); ++ g_free(newval); + } + } + +Index: timeanddate.c +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/timeanddate.c,v +retrieving revision 1.37 +diff -u -r1.37 timeanddate.c +--- timeanddate.c 23 Aug 2004 22:33:01 -0000 1.37 ++++ timeanddate.c 28 Oct 2004 20:20:23 -0000 +@@ -17,18 +17,20 @@ + #include <stdio.h> + #include <stdlib.h> + #include <string.h> +-#include <dirent.h> +-#include <pwd.h> + #include <fcntl.h> + #include <unistd.h> +-#include <signal.h> + #include <time.h> + #include <libintl.h> ++#include <time.h> ++#include <ctype.h> ++ + #include <sys/types.h> + #include <sys/stat.h> ++#include <sys/poll.h> ++ ++#include <X11/Xlib.h> + #include <gtk/gtk.h> +-#include <time.h> +-#include <ctype.h> ++#include <gdk/gdkx.h> + + #include "applets.h" + #include "timeanddate.h" +@@ -39,6 +41,7 @@ + #include <gpe/errorbox.h> + #include <gpe/gtkdatecombo.h> + #include <gpe/gpetimesel.h> ++#include <gpe/infoprint.h> + + + /* --- local types and constants --- */ +@@ -402,23 +405,48 @@ + + gboolean refresh_time() + { ++ static char str[256]; ++ struct pollfd pfd[1]; ++ gboolean ret = FALSE; ++ Display *dpy = GDK_DISPLAY(); ++ + Time_Restore(); ++ memset(str, 0, 256); ++ ++ pfd[0].fd = suidinfd; ++ pfd[0].events = (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI); ++ while (poll(pfd, 1, 0)) ++ { ++ if (fgets (str, 255, suidin)) ++ { ++ if (strstr(str, "<success>")) ++ gpe_popup_infoprint (dpy, ++ _("Time adjusted from network.")); ++ else ++ gpe_error_box(_("Adjusting time from network failed.")); ++ ++ } ++ ret = TRUE; ++ } ++ + trc--; +- if (!trc) ++ if (!trc) ++ ret = TRUE; ++ if (ret) + { +- gtk_widget_set_sensitive(self.internet,TRUE); +- gtk_timeout_remove(tid); ++ gtk_widget_set_sensitive(self.internet, TRUE); ++ return FALSE; + } + system (SCREENSAVER_RESET_CMD); +- return (trc ? TRUE : FALSE); ++ return (TRUE); + } + + void GetInternetTime() + { + gtk_widget_set_sensitive(self.internet,FALSE); + suid_exec("NTPD",gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (self.ntpserver)->entry))); +- trc = 10; +- tid = gtk_timeout_add(500,refresh_time,NULL); ++ trc = 60; ++ tid = gtk_timeout_add(500, refresh_time, NULL); + } + + diff --git a/packages/gpe-conf/gpe-conf-0.1.20/password-if.patch b/packages/gpe-conf/gpe-conf-0.1.20/password-if.patch index e69de29bb2..1e1b578cd3 100644 --- a/packages/gpe-conf/gpe-conf-0.1.20/password-if.patch +++ b/packages/gpe-conf/gpe-conf-0.1.20/password-if.patch @@ -0,0 +1,442 @@ +Index: cfgfile.c +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/cfgfile.c,v +retrieving revision 1.13 +diff -u -r1.13 cfgfile.c +--- cfgfile.c 29 Aug 2004 13:20:25 -0000 1.13 ++++ cfgfile.c 16 Oct 2004 15:50:30 -0000 +@@ -436,26 +436,28 @@ + iflen = l; + + fd = fopen(_PATH_PROCNET_WIRELESS, "r"); +- fgets(buffer, 256, fd); // chuck first two lines; +- fgets(buffer, 256, fd); +- while (!feof(fd)) { +- if (fgets(buffer, 256, fd) == NULL) +- break; +- name = buffer; +- sep = strrchr(buffer, ':'); +- if (sep) *sep = 0; +- while(*name == ' ') name++; +- +- for (i = 0; i < iflen; i++) +- { +- if (!strcmp (name, iflist[i].name)) ++ if (fd) ++ { ++ fgets(buffer, 256, fd); // chuck first two lines; ++ fgets(buffer, 256, fd); ++ while (!feof(fd)) { ++ if (fgets(buffer, 256, fd) == NULL) ++ break; ++ name = buffer; ++ sep = strrchr(buffer, ':'); ++ if (sep) *sep = 0; ++ while(*name == ' ') name++; ++ ++ for (i = 0; i < iflen; i++) + { +- iflist[i].iswireless = TRUE; ++ if (!strcmp (name, iflist[i].name)) ++ { ++ iflist[i].iswireless = TRUE; ++ } + } + } ++ fclose(fd); + } +- fclose(fd); +- + return l; + } + +Index: main.c +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/main.c,v +retrieving revision 1.69 +diff -u -r1.69 main.c +--- main.c 10 Oct 2004 21:48:39 -0000 1.69 ++++ main.c 16 Oct 2004 15:50:30 -0000 +@@ -188,6 +188,9 @@ + self.cur_applet = i; + + self.applet = applets[i].Build_Objects(useronly); ++ ++ if (self.applet) ++ { + gtk_container_add(GTK_CONTAINER(self.viewport),self.applet); + + gtk_window_set_title(GTK_WINDOW(self.w), applets[i].frame_label); +@@ -220,6 +223,7 @@ + } + else + gtk_widget_hide(self.cancel); ++ } + } + + +@@ -289,9 +293,11 @@ + void main_one(int argc, char **argv,int applet) + { + int handled = FALSE; +- gboolean user_only_setup = FALSE; /* Don't change to suid mode. */ ++ gboolean special_flag = FALSE; /* Don't change to suid mode or similar. */ ++ gboolean standalone = FALSE; /* applet creates its own window */ + + self.alone_applet = 1; ++ self.applet = NULL; + + my_icons[count_icons - 1].filename = applets[applet].icon_file; + +@@ -315,7 +321,12 @@ + } + if (!strcmp(argv[2],"user_only")) + { +- user_only_setup = TRUE; ++ special_flag = TRUE; ++ } ++ if (!strcmp(argv[2],"password")) ++ { ++ special_flag = TRUE; ++ standalone = TRUE; + } + if (!strcmp(argv[1],"task_sound")) + { +@@ -331,23 +342,23 @@ + /* If no task? - start applet */ + if (!handled) + { +- initwindow(); +- +- self.vbox = gtk_vbox_new(FALSE,0); +- gtk_container_add(GTK_CONTAINER(self.w),self.vbox); +- + self.cur_applet = -1; +- self.applet = NULL; +- +- make_container(); +- +- gpe_set_window_icon(self.w, "icon"); +- gtk_widget_show_all(self.w); +- +- gtk_widget_show(self.w); +- ++ self.applet = NULL; if (!standalone) ++ { ++ initwindow(); ++ ++ self.vbox = gtk_vbox_new(FALSE,0); ++ gtk_container_add(GTK_CONTAINER(self.w),self.vbox); ++ ++ make_container(); ++ ++ gpe_set_window_icon(self.w, "icon"); ++ gtk_widget_show_all(self.w); ++ ++ gtk_widget_show(self.w); ++ } + +- item_select(user_only_setup, (gpointer)applet); ++ item_select(special_flag, (gpointer)applet); + gtk_main(); + gtk_exit(0); + } +Index: network.c +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/network.c,v +retrieving revision 1.37 +diff -u -r1.37 network.c +--- network.c 8 Sep 2004 22:14:12 -0000 1.37 ++++ network.c 16 Oct 2004 15:50:30 -0000 +@@ -123,9 +123,34 @@ + free (buffer); + } + ++void ++copy_new_interfaces(void) ++{ ++ struct interface *ife; ++ struct interface *int_list; ++ ++ int_list = if_getlist (); ++ ++ system_printf ("/bin/cp %s %s", NET_NEWFILE, NET_CONFIGFILE); ++ system_printf ("chmod 0644 %s", NET_CONFIGFILE); ++ system_printf ("/bin/rm -f %s", NET_NEWFILE); ++ ++ for (ife = int_list; ife; ife = ife->next) ++ { ++ if ((ife->flags & IFF_UP) && !(ife->flags & IFF_LOOPBACK)) ++ { ++ gchar *cmd = g_strdup_printf("/sbin/ifdown %s", ife->name); ++ system(cmd); ++ g_free(cmd); ++ cmd = g_strdup_printf("/sbin/ifup %s", ife->name); ++ system(cmd); ++ g_free(cmd); ++ } ++ } ++} + + static GList * +-get_unconfigured_interfaces () ++get_unconfigured_interfaces (void) + { + #define num_suggestions 3 + +@@ -139,34 +164,34 @@ + gchar suggestions[num_suggestions][6] = {"eth0", "wlan0", "bnep0"}; + + fd = fopen(_PATH_PROCNET_DEV, "r"); +- fgets(buffer, 256, fd); // chuck first two lines; +- fgets(buffer, 256, fd); +- while (!feof(fd)) { +- if (fgets(buffer, 256, fd) == NULL) +- break; +- name = buffer; +- sep = strrchr(buffer, ':'); +- if (sep) *sep = 0; +- while(*name == ' ') name++; +- +- found = FALSE; +- for (i = 0; i < iflen; i++) +- { +- if (!strcmp (name, iflist[i].name)) +- { +- found = TRUE; ++ if (fd) ++ { ++ fgets(buffer, 256, fd); // chuck first two lines; ++ fgets(buffer, 256, fd); ++ while (!feof(fd)) { ++ if (fgets(buffer, 256, fd) == NULL) + break; ++ name = buffer; ++ sep = strrchr(buffer, ':'); ++ if (sep) *sep = 0; ++ while(*name == ' ') name++; ++ ++ found = FALSE; ++ for (i = 0; i < iflen; i++) ++ { ++ if (!strcmp (name, iflist[i].name)) ++ { ++ found = TRUE; ++ break; ++ } ++ } ++ if (!found) ++ { ++ result = g_list_append (result, g_strdup (name)); + } + } +- if (!found) +- { +- result = g_list_append (result, g_strdup (name)); +- } +- +- ++ fclose(fd); + } +- fclose(fd); +- + for (j = 0; j < num_suggestions; j++) + { + found = FALSE; +Index: suid.c +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/suid.c,v +retrieving revision 1.51 +diff -u -r1.51 suid.c +--- suid.c 12 Oct 2004 21:07:02 -0000 1.51 ++++ suid.c 16 Oct 2004 15:50:30 -0000 +@@ -45,6 +45,7 @@ + #include "cardinfo.h" + #include "timeanddate.h" + #include "users/passwd.h" ++#include "network.h" + + static GtkWidget *passwd_entry; + static int retv; +@@ -359,13 +360,7 @@ + else if (strcmp (cmd, "CPIF") == 0) // installs a new interfaces file + { + fscanf (in, "%100s", arg2); // to forget soon... +- strcpy (arg1, "/tmp/interfaces"); +- strcpy (arg2, "/etc/network/interfaces"); +- system ("/etc/init.d/networking stop"); +- system_printf ("/bin/cp %s %s", arg1, arg2); +- system_printf ("chmod 0644 %s", arg2); +- system_printf ("/bin/rm -f %s", arg1); +- system ("/etc/init.d/networking start"); ++ copy_new_interfaces(); + } + else if (strcmp (cmd, "CPOI") == 0) // rewrites owner information data + { +Index: network.h +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/network.h,v +retrieving revision 1.4 +diff -u -r1.4 network.h +--- network.h 25 Aug 2004 10:16:31 -0000 1.4 ++++ network.h 16 Oct 2004 15:50:30 -0000 +@@ -1,3 +1,6 @@ ++#ifndef _GPE_CONF_NETWORK_H ++#define _GPE_CONF_NETWORK_H ++ + #define _PATH_PROCNET_DEV "/proc/net/dev" + #define _PATH_PROCNET_WIRELESS "/proc/net/wireless" + +@@ -5,3 +8,6 @@ + void Network_Save(); + void Network_Free_Objects(); + void Network_Restore(); ++void copy_new_interfaces(void); ++ ++#endif +Index: users.h +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/users.h,v +retrieving revision 1.2 +diff -u -r1.2 users.h +--- users.h 7 Sep 2002 22:34:06 -0000 1.2 ++++ users.h 16 Oct 2004 15:50:30 -0000 +@@ -1,4 +1,4 @@ +-GtkWidget *Users_Build_Objects(); ++GtkWidget *Users_Build_Objects(gboolean password_only); + void Users_Save(); + void Users_Free_Objects(); + void Users_Restore(); +Index: users/interface.c +=================================================================== +RCS file: /cvs/gpe/base/gpe-conf/users/interface.c,v +retrieving revision 1.22 +diff -u -r1.22 interface.c +--- users/interface.c 8 Sep 2004 22:14:12 -0000 1.22 ++++ users/interface.c 16 Oct 2004 15:50:30 -0000 +@@ -202,15 +202,15 @@ + } + + GtkWidget* +-Users_Build_Objects (void) ++Users_Build_Objects (gboolean password_only) + { +- GtkWidget *vbox1; +- GtkWidget *pw; +- GtkWidget *toolbar; +- GtkWidget *button1; +- GtkWidget *button2; +- GtkWidget *button3; +- GtkWidget *button4; ++ GtkWidget *vbox1 = NULL; ++ GtkWidget *pw = NULL; ++ GtkWidget *toolbar = NULL; ++ GtkWidget *button1 = NULL; ++ GtkWidget *button2 = NULL; ++ GtkWidget *button3 = NULL; ++ GtkWidget *button4 = NULL; + + listTitles[0] = _("User Name"); + listTitles[1] = _("User Info"); +@@ -218,6 +218,8 @@ + + InitSpacings (); + ++ if (!password_only) ++ { + vbox1 = gtk_vbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (vbox1), border_width); + +@@ -254,28 +256,40 @@ + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(pw), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_container_add (GTK_CONTAINER (pw), user_list); ++ } + + InitPwList(); +- ReloadList(); ++ if (!password_only) ++ { ++ ReloadList(); + +- gtk_widget_show (user_list); +- +- gtk_box_pack_start (GTK_BOX (vbox1), pw, TRUE, TRUE, 0); ++ gtk_widget_show (user_list); ++ gtk_box_pack_start (GTK_BOX (vbox1), pw, TRUE, TRUE, 0); + +- /* check if we have the permissions to change users */ +- if (suid_exec("CHEK","")) +- { +- gtk_widget_set_sensitive(user_list, FALSE); +- gtk_widget_set_sensitive(button1, FALSE); +- gtk_widget_set_sensitive(button2, FALSE); +- gtk_widget_set_sensitive(button3, FALSE); +- have_access = FALSE; +- } ++ /* check if we have the permissions to change users */ ++ if (suid_exec("CHEK","")) ++ { ++ gtk_widget_set_sensitive(user_list, FALSE); ++ gtk_widget_set_sensitive(button1, FALSE); ++ gtk_widget_set_sensitive(button2, FALSE); ++ gtk_widget_set_sensitive(button3, FALSE); ++ have_access = FALSE; ++ } ++ else ++ { ++ have_access = TRUE; ++ } ++ } + else +- { +- have_access = TRUE; +- } +- return vbox1; ++ have_access = FALSE; ++ ++ if (password_only) ++ { ++ gtk_widget_show(create_passwindow(pwroot, NULL)); ++ return NULL; ++ } ++ else ++ return vbox1; + } + + GtkWidget* +@@ -440,7 +454,7 @@ + } + + GtkWidget* +-create_passwindow (pwlist *init,GtkWidget *parent) ++create_passwindow (pwlist *init, GtkWidget *parent) + { + GtkWidget *passwindow; + GtkWidget *vbox3; +@@ -463,9 +477,8 @@ + gtk_window_set_transient_for (GTK_WINDOW(passwindow), GTK_WINDOW(parent)); + gtk_window_set_title (GTK_WINDOW (passwindow), _("Change Password")); + gtk_window_set_modal (GTK_WINDOW (passwindow), TRUE); +- + vbox3 = GTK_DIALOG (passwindow)->vbox; +- ++ + table3 = gtk_table_new (3, 3, FALSE); + + gtk_widget_show (table3); +@@ -561,9 +574,12 @@ + GTK_SIGNAL_FUNC (users_on_changepasswd_clicked), + (gpointer)self); + +- /* in case of destruction by close (X) button */ +- gtk_signal_connect (GTK_OBJECT(passwindow) , "destroy", ++ if (parent) ++ gtk_signal_connect (GTK_OBJECT(passwindow) , "destroy", + (GtkSignalFunc) freedata, (gpointer)self); ++ else ++ gtk_signal_connect (GTK_OBJECT(passwindow) , "destroy", ++ gtk_main_quit, NULL); + + return passwindow; + } |