From c15dba1b5a5eb806e95665728cf655dfd9f74d56 Mon Sep 17 00:00:00 2001 From: Mandrake Date: Fri, 1 Oct 1999 18:15:04 +0000 Subject: [PATCH] Fri Oct 1 13:35:50 PDT 1999 (Mandrake) wrote some code for "first time initialization" cruft. should generate the user menus in ~/.enlightenment, as well as run dox for the first time. SVN revision: 542 --- src/ChangeLog | 9 +++++++++ src/E.h | 2 ++ src/TODO | 1 - src/main.c | 22 ++++++++++++++++++++++ src/setup.c | 46 +++++++++++++++++++++++++++++++++++++++++----- 5 files changed, 74 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6cace865..428d2b9f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2651,3 +2651,12 @@ Fri Oct 1 12:52:19 PDT 1999 (Mandrake) fixed the bug in dox, removed from TODO list. + +------------------------------------------------------------------------------- + +Fri Oct 1 13:35:50 PDT 1999 +(Mandrake) + +wrote some code for "first time initialization" cruft. +should generate the user menus in ~/.enlightenment, as well as run dox for the +first time. diff --git a/src/E.h b/src/E.h index ec35fd40..a9038417 100644 --- a/src/E.h +++ b/src/E.h @@ -1194,6 +1194,7 @@ typedef struct _emode int kde_support; char clickalways; char keybinds_changed; + char firsttime; } EMode; @@ -1715,6 +1716,7 @@ void SetupX(void); void SetupDirs(void); void SetupEnv(void); Window MakeExtInitWin(void); +void SetupUserInitialization(void); void HandleSigHup(int num); void HandleSigInt(int num); diff --git a/src/TODO b/src/TODO index ef6c713b..ddec8c05 100644 --- a/src/TODO +++ b/src/TODO @@ -3,7 +3,6 @@ raster: need to investigate "The icons in the iconbox have garbage three cK: keeping the groups file in sync with the existing groups that need to be remembered. I'm sure there are bugs in that. cK hammering on this whole raise/lower/raiselower stuff in groups. mandrake: expose events in the dialog boxes aren't handled right. -mandrake: need a "first time you ran enlightenment" feature to pop up Help and generate the initial menus using e_gen_menu FEATURES FOR DR 0.17: kainx: reduce need for tooltip text to have auto gened tooltips work diff --git a/src/main.c b/src/main.c index d90ab7cd..3fa9182d 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,23 @@ #include "E.h" #include "timestamp.h" +static void +runDocBrowser(void) +{ + + char file[FILEPATH_LEN_MAX]; + + if (fork()) + EDBUG_RETURN_; + + Esnprintf(file, sizeof(file), "exec %s/dox %s/E-docs", + ENLIGHTENMENT_BIN, ENLIGHTENMENT_ROOT); + execl(usershell(getuid()), usershell(getuid()), "-c", + (char *)file, NULL); + exit(0); + +} + int main(int argc, char **argv) { @@ -177,6 +194,7 @@ main(int argc, char **argv) CommsSetup(); CommsFindCommsWindow(); GrabX(); + SetupUserInitialization(); LoadGroups(); LoadSnapInfo(); MapUnmap(0); @@ -339,6 +357,10 @@ main(int argc, char **argv) "modifying your themes now if they use Color Modifiers\n" ); } + if (mode.firsttime) + { + runDocBrowser(); + } /* The primary event loop */ for (;;) diff --git a/src/setup.c b/src/setup.c index 01a2a12f..63c4902d 100644 --- a/src/setup.c +++ b/src/setup.c @@ -2,7 +2,7 @@ #include "E.h" #include -void +void MapUnmap(int start) { /* this function will map and unmap all the windows based on the progress @@ -82,7 +82,7 @@ MapUnmap(int start) EDBUG_RETURN_; } -void +void SetupSignals() { @@ -165,7 +165,7 @@ SetupSignals() EDBUG_RETURN_; } -void +void SetupX() { @@ -583,7 +583,7 @@ SetupX() EDBUG_RETURN_; } -void +void SetupDirs() { char s[1024], ss[1024]; @@ -625,7 +625,7 @@ SetupDirs() EDBUG_RETURN_; } -void +void SetupEnv() { char s[1024]; @@ -830,3 +830,39 @@ MakeExtInitWin(void) * } */ exit(0); } + +void +SetupUserInitialization() +{ + + FILE *f; + char file[FILEPATH_LEN_MAX]; + + EDBUG(3, "SetupUserInitialization"); + + Esnprintf(file, sizeof(file), "%s/.initialized", UserEDir()); + if (isfile(file)) + { + mode.firsttime = 0; + } + else + { + mode.firsttime = 1; + f = fopen(file, "w"); + fprintf(f, "Congradulations, you have run enlightenment before.\n"); + fprintf(f, "Removing this file and *.menu in this directory\n"); + fprintf(f, "will cause enlightenment to regenerate them, as\n"); + fprintf(f, "run the documentation browser\n"); + fclose(f); + if (fork()) + EDBUG_RETURN_; + Esnprintf(file, sizeof(file), "exec %s/e_gen_menu", ENLIGHTENMENT_BIN); + execl(usershell(getuid()), usershell(getuid()), "-c", + (char *)file, NULL); + exit(0); + + } + + EDBUG_RETURN_; + +}