Merge commit 'diablo-package-3.3b1-1' into fremantle-package
authorSteven Luo <steven+maemo@steven676.net>
Sun, 30 May 2010 10:19:24 +0000 (03:19 -0700)
committerSteven Luo <steven+maemo@steven676.net>
Sun, 30 May 2010 10:19:24 +0000 (03:19 -0700)
1  2 
config-ui/browser-switchboard-cp.c
debian/changelog
debian/rules

@@@ -51,7 -51,7 +51,7 @@@
  #endif /* HILDON_CP_APPLET */
  #endif /* HILDON */
  
- #include "configfile.h"
+ #include "config.h"
  
  #define CONTINUOUS_MODE_DEFAULT 0
  
@@@ -64,15 -64,16 +64,15 @@@ struct browser_entry 
        char *displayname;
  };
  struct browser_entry browsers[] = {
-       { "microb", "MicroB" }, /* First entry is the default! */
+       { "microb", "MicroB (stock browser)" }, /* First entry is the default! */
        { "tear", "Tear" },
        { "fennec", "Mobile Firefox (Fennec)" },
 -      { "opera", "Opera Mobile" },
        { "midori", "Midori" },
        { "other", "Other" },
        { NULL, NULL },
  };
  
- char *logger_name = NULL;
+ struct swb_config orig_cfg;
  
  struct config_widgets {
  #if defined(HILDON) && defined(FREMANTLE)
@@@ -151,170 -152,40 +151,40 @@@ static inline void set_other_browser_cm
  }
  
  static void load_config(void) {
-       FILE *fp;
-       int continuous_mode_seen = 0;
-       int default_browser_seen = 0;
-       int other_browser_cmd_seen = 0;
-       struct swb_config_line line;
-       if (!(fp = open_config_file()))
-               return;
-       /* Parse the config file
-          TODO: should we handle errors differently than EOF? */
-       if (!parse_config_file_begin())
-               goto out;
-       while (!parse_config_file_line(fp, &line)) {
-               if (line.parsed) {
-                       if (!strcmp(line.key, "continuous_mode")) {
-                               if (!continuous_mode_seen) {
-                                       set_continuous_mode(atoi(line.value));
-                                       continuous_mode_seen = 1;
-                               }
-                               free(line.value);
-                       } else if (!strcmp(line.key, "default_browser")) {
-                               if (!default_browser_seen) {
-                                       set_default_browser(line.value);
-                                       default_browser_seen = 1;
-                               }
-                               free(line.value);
-                       } else if (!strcmp(line.key, "other_browser_cmd")) {
-                               if (!other_browser_cmd_seen) {
-                                       set_other_browser_cmd(line.value);
-                                       other_browser_cmd_seen = 1;
-                               }
-                               free(line.value);
-                       } else if (!strcmp(line.key, "logging")) {
-                               if (!logger_name)
-                                       logger_name = line.value;
-                       }
-               }
-               free(line.key);
-       }
-       parse_config_file_end();
- out:
-       fclose(fp);
-       return;
+       swb_config_init(&orig_cfg);
+       
+       swb_config_load(&orig_cfg);
+       set_continuous_mode(orig_cfg.continuous_mode);
+       set_default_browser(orig_cfg.default_browser);
+       if (orig_cfg.other_browser_cmd)
+               set_other_browser_cmd(orig_cfg.other_browser_cmd);
  }
  
  static void save_config(void) {
-       FILE *fp = NULL, *tmpfp = NULL;
-       char *homedir, *tempfile, *newfile;
-       size_t len;
-       int continuous_mode_seen = 0;
-       int default_browser_seen = 0;
-       int other_browser_cmd_seen = 0;
-       struct swb_config_line line;
-       /* If CONFIGFILE_DIR doesn't exist already, try to create it */
-       if (!(homedir = getenv("HOME")))
-               homedir = DEFAULT_HOMEDIR;
-       len = strlen(homedir) + strlen(CONFIGFILE_DIR) + 1;
-       if (!(newfile = calloc(len, sizeof(char))))
-               return;
-       snprintf(newfile, len, "%s%s", homedir, CONFIGFILE_DIR);
-       if (access(newfile, F_OK) == -1 && errno == ENOENT) {
-               mkdir(newfile, 0750);
+       struct swb_config new_cfg;
+       swb_config_copy(&new_cfg, &orig_cfg);
+       if (get_continuous_mode() != orig_cfg.continuous_mode) {
+               new_cfg.continuous_mode = get_continuous_mode();
+               new_cfg.flags |= SWB_CONFIG_CONTINUOUS_MODE_SET;
        }
-       free(newfile);
-       /* Put together the path to the new config file and the tempfile */
-       len = strlen(homedir) + strlen(CONFIGFILE_LOC) + 1;
-       if (!(newfile = calloc(len, sizeof(char))))
-               return;
-       /* 4 = strlen(".tmp") */
-       if (!(tempfile = calloc(len+4, sizeof(char)))) {
-               free(newfile);
-               return;
+       if (strcmp(get_default_browser(), orig_cfg.default_browser)) {
+               new_cfg.default_browser = get_default_browser();
+               new_cfg.flags |= SWB_CONFIG_DEFAULT_BROWSER_SET;
        }
-       snprintf(newfile, len, "%s%s", homedir, CONFIGFILE_LOC);
-       snprintf(tempfile, len+4, "%s%s", newfile, ".tmp");
-       /* Open the temporary file for writing */
-       if (!(tmpfp = fopen(tempfile, "w")))
-               /* TODO: report the error somehow? */
-               goto out;
-       /* Open the old config file, if it exists */
-       if ((fp = open_config_file()) && parse_config_file_begin()) {
-               /* Copy the old config file over to the new one line by line,
-                  replacing old config values with new ones
-                  TODO: should we handle errors differently than EOF? */
-               while (!parse_config_file_line(fp, &line)) {
-                       if (line.parsed) {
-                               /* Is a config line, print the new value here */
-                               if (!strcmp(line.key, "continuous_mode")) {
-                                       if (!continuous_mode_seen) {
-                                               fprintf(tmpfp, "%s = %d\n",
-                                                       line.key,
-                                                       get_continuous_mode());
-                                               continuous_mode_seen = 1;
-                                       }
-                               } else if (!strcmp(line.key,
-                                                       "default_browser")) {
-                                       if (!default_browser_seen) {
-                                               fprintf(tmpfp, "%s = \"%s\"\n",
-                                                       line.key,
-                                                       get_default_browser());
-                                               default_browser_seen = 1;
-                                       }
-                               } else if (!strcmp(line.key,
-                                                       "other_browser_cmd")) {
-                                       if (!other_browser_cmd_seen &&
-                                           strlen(get_other_browser_cmd())>0) {
-                                               fprintf(tmpfp, "%s = \"%s\"\n",
-                                                       line.key,
-                                                       get_other_browser_cmd());
-                                               other_browser_cmd_seen = 1;
-                                       }
-                               } else if (!strcmp(line.key,
-                                                       "logging")) {
-                                       if (logger_name) {
-                                               fprintf(tmpfp, "%s = \"%s\"\n",
-                                                       line.key,
-                                                       logger_name);
-                                               free(logger_name);
-                                               logger_name = NULL;
-                                       }
-                               }
-                       } else {
-                               /* Just copy the old line over */
-                               fprintf(tmpfp, "%s\n", line.key);
-                       }
-                       free(line.key);
-                       free(line.value);
-               }
-               parse_config_file_end();
+       if (strlen(get_other_browser_cmd()) == 0) {
+               new_cfg.other_browser_cmd = NULL;
+               new_cfg.flags &= ~SWB_CONFIG_OTHER_BROWSER_CMD_SET;
+       } else if (!(orig_cfg.other_browser_cmd &&
+                    !strcmp(get_other_browser_cmd(),
+                            orig_cfg.other_browser_cmd))) {
+               new_cfg.other_browser_cmd = get_other_browser_cmd();
+               new_cfg.flags |= SWB_CONFIG_OTHER_BROWSER_CMD_SET;
        }
  
-       /* If we haven't written them yet, write out the new config values */
-       if (!continuous_mode_seen)
-               fprintf(tmpfp, "%s = %d\n",
-                       "continuous_mode", get_continuous_mode());
-       if (!default_browser_seen)
-               fprintf(tmpfp, "%s = \"%s\"\n",
-                       "default_browser", get_default_browser());
-       if (!other_browser_cmd_seen && strlen(get_other_browser_cmd()) > 0)
-               fprintf(tmpfp, "%s = \"%s\"\n",
-                       "other_browser_cmd", get_other_browser_cmd());
-       if (logger_name)
-               fprintf(tmpfp, "%s = \"%s\"\n",
-                       "logging", logger_name);
-       /* Replace the old config file with the new one */
-       fclose(tmpfp);
-       tmpfp = NULL;
-       rename(tempfile, newfile);
- out:
-       free(newfile);
-       free(tempfile);
-       if (tmpfp)
-               fclose(tmpfp);
-       if (fp)
-               fclose(fp);
-       return;
+       swb_config_save(&new_cfg);
  }
  
  static void do_reconfig(void) {
diff --combined debian/changelog
@@@ -1,30 -1,29 +1,50 @@@
+ browser-switchboard (3.3~b1-1) extras-devel; urgency=low
+   * New "upstream" development release.
+   * Upstream changes:
+     - add support for Opera Mobile
+     - fall back to the built-in default if the user's configured default
+       browser isn't installed
+     - introduce a command-line config utility; this is mainly intended to give
+       browser vendors a way to set their browser as the default
+     - provide a description for users who don't know what MicroB is; thanks
+       Emanuele Cassioli for pointing out the need
+     - major rewrite of configuration loading/saving code
+   * Cherry-pick addb0ed9... ("Add command-line utility to Makefile install
+     target").
+   * Packaging changes:
+     - Build and install the new command-line config utility.
+  -- Steven Luo <steven+maemo@steven676.net>  Sun, 30 May 2010 02:52:31 -0700 
 +browser-switchboard (3.2-2fremantle1) extras-devel; urgency=low
 +
 +  * Beta release for Fremantle.
 +  * Packaging changes:
 +    - Clear hildon-control-panel's cached screenshot on package remove.
 +    - Don't build with -mthumb, to avoid a SIGILL on PR1.2.
 +
 + -- Steven Luo <steven+maemo@steven676.net>  Fri, 28 May 2010 01:40:27 -0700 
 +
  browser-switchboard (3.2-2) extras-devel; urgency=low
  
    * Cherry-pick ebfd6218... ("Add preliminary support for Opera Mobile").
+   * Update package description to mention Opera Mobile.
  
   -- Steven Luo <steven+maemo@steven676.net>  Fri, 28 May 2010 01:35:22 -0700 
  
 +browser-switchboard (3.2-1fremantle1) extras-devel; urgency=low
 +
 +  * Beta release for Fremantle.
 +  * Packaging changes:
 +    - Ship a different microb.desktop file with the Fremantle location of the
 +      stock web browser icon.
 +    - Add a postinst that attempts to kill open MicroB browser processes, to
 +      avoid having to restart for browser-switchboard to start handling
 +      com.nokia.osso_browser.
 +
 + -- Steven Luo <steven+maemo@steven676.net>  Mon, 22 Feb 2010 03:02:50 -0800 
 +
  browser-switchboard (3.2-1) extras-devel; urgency=low
  
    * New "upstream" stable release.
  
   -- Steven Luo <steven+maemo@steven676.net>  Mon, 22 Feb 2010 02:14:19 -0800 
  
 +browser-switchboard (3.1-2fremantle4) extras-devel; urgency=low
 +
 +  * Alpha release for Fremantle.
 +  * Cherry-pick 870b63f0... ("Install the inotify watch for lockfile creation
 +    before forking").
 +  * Cherry-pick a712d8d7... ("Avoid a race between MicroB startup and
 +    establishing D-Bus watch for it").
 +  * Cherry-pick 32801150... ("Ensure that only one browser-switchboard is
 +    active at any time").
 +
 + -- Steven Luo <steven+maemo@steven676.net>  Mon, 15 Feb 2010 18:57:46 -0800 
 +
 +browser-switchboard (3.1-2fremantle3) extras-devel; urgency=low
 +
 +  * Alpha release for Fremantle.
 +  * Cherry-pick e7bb0f3e... ("Take a different approach to detecting MicroB
 +    browser window close").
 +
 + -- Steven Luo <steven+maemo@steven676.net>  Sat, 13 Feb 2010 21:07:56 -0800 
 +
 +browser-switchboard (3.1-2fremantle2) extras-devel; urgency=low
 +
 +  * Alpha release for Fremantle.
 +  * Cherry-pick 5b7e4808... ("Make sure a running browserd is detected
 +    correctly on all devices").
 +  * Cherry-pick 88db9429... ("Kill MicroB browser UI processes instead
 +    of using exit_browser").
 +
 + -- Steven Luo <steven+maemo@steven676.net>  Sat, 06 Feb 2010 03:10:16 -0800 
 +
 +browser-switchboard (3.1-2fremantle1) extras-devel; urgency=low
 +
 +  * Alpha release for Fremantle.
 +  * No need to lose the tablet-browser-ui dependency on Fremantle.
 +  * Cherry-pick d8d8d1ed... ("Close stdin/stdout/stderr in child
 +    processes before exec()") and 53ba5ca0... ("Throw away stdout/stderr
 +    for browserds we launch too") to make ongoing debugging efforts
 +    easier.
 +
 + -- Steven Luo <steven+maemo@steven676.net>  Fri, 05 Feb 2010 00:13:54 -0800 
 +
  browser-switchboard (3.1-2) extras-devel; urgency=low
  
    * Drop the dependency on tablet-browser-ui for Diablo until maemo.org
  
   -- Steven Luo <steven+maemo@steven676.net>  Fri, 05 Feb 2010 00:05:27 -0800 
  
 +browser-switchboard (3.1-1fremantle2) extras-devel; urgency=low
 +
 +  * Alpha release for Fremantle.
 +  * Cherry-pick 6b78dde6... ("Initial support for launching MicroB on
 +    Fremantle") and associated cleanups.
 +  * Revise build system to reflect updated dependencies.
 +
 + -- Steven Luo <steven+maemo@steven676.net>  Tue, 02 Feb 2010 02:45:42 -0800
 +
 +browser-switchboard (3.1-1fremantle1) extras-devel; urgency=low
 +
 +  * Alpha release for Fremantle.
 +  * Pass EXTRA_CPPFLAGS=-DFREMANTLE to make to compile Fremantle-specific code.
 +
 + -- Steven Luo <steven+maemo@steven676.net>  Fri, 15 Jan 2010 02:52:40 -0800
 +
  browser-switchboard (3.1-1) extras-devel; urgency=low
  
    * New "upstream" stable release.
  
   -- Steven Luo <steven+maemo@steven676.net>  Fri, 15 Jan 2010 01:54:56 -0800
  
 +browser-switchboard (3.0-1fremantle1) extras-devel; urgency=low
 +
 +  * Experimental build for Fremantle.
 +  * Add XSBC-Bugtracker to debian/control to indicate where bugs should be
 +    filed; needed for maemo extras QA.
 +  * No need to add CPU optimization flags, the Fremantle toolchain
 +    automatically optimizes for N900/OMAP3.
 +
 + -- Steven Luo <steven+maemo@steven676.net>  Wed, 23 Dec 2009 04:01:53 -0800
 +
  browser-switchboard (3.0-1) extras-devel; urgency=low
  
    * New "upstream" stable release.
  
   -- Steven Luo <steven+maemo@steven676.net>  Wed, 23 Dec 2009 03:48:02 -0800
  
 +browser-switchboard (3.0~rc1-2fremantle1) extras-devel; urgency=low
 +
 +  * Experimental build for Fremantle.
 +  * Upload to extras-devel.
 +
 + -- Steven Luo <steven+maemo@steven676.net>  Fri, 18 Dec 2009 20:44:08 -0800
 +
  browser-switchboard (3.0~rc1-2) extras-devel; urgency=low
  
    * Actually upload to extras-devel.
  
   -- Steven Luo <steven+maemo@steven676.net>  Fri, 18 Dec 2009 19:07:25 -0800
  
 +browser-switchboard (3.0~rc1-1fremantle1) extras-devel; urgency=low
 +
 +  * Experimental build for Fremantle.
 +  * Packaging changes:
 +    - Add a different .desktop file with the Fremantle location of the stock
 +      web browser icon.
 +
 + -- Steven Luo <steven+maemo@steven676.net>  Fri, 18 Dec 2009 05:24:16 -0800
 +
  browser-switchboard (3.0~rc1-1) extras-devel; urgency=low
  
    * New "upstream" prerelease.
diff --combined debian/rules
@@@ -9,13 -9,14 +9,13 @@@
  # Uncomment this to turn on verbose mode.
  #export DH_VERBOSE=1
  
 -# Optimize for N8x0 CPUs if building for armel
 -ifeq ($(DEB_HOST_ARCH),armel)
 -      EXTRA_CFLAGS += -mcpu=arm1136jf-s
 +#ifeq ($(DEB_HOST_ARCH),armel)
 +      #EXTRA_CFLAGS += -mcpu=arm1136jf-s
        # Use Thumb for smaller binaries unless otherwise requested
 -      ifeq (,$(filter nothumb,$(DEB_BUILD_OPTIONS)))
 -              EXTRA_CFLAGS += -mthumb
 -      endif
 -endif
 +      #ifeq (,$(filter nothumb,$(DEB_BUILD_OPTIONS)))
 +      #       EXTRA_CFLAGS += -mthumb
 +      #endif
 +#endif
  
  configure: configure-stamp
  configure-stamp:
@@@ -27,8 -28,8 +27,8 @@@ build: build-stam
  build-stamp: configure-stamp 
        dh_testdir
  
 -      make EXTRA_CFLAGS="$(EXTRA_CFLAGS)" diablo
 -      make -C config-ui EXTRA_CFLAGS="$(EXTRA_CFLAGS)" diablo-plugin util
 +      make EXTRA_CFLAGS="$(EXTRA_CFLAGS)" fremantle
-       make -C config-ui EXTRA_CFLAGS="$(EXTRA_CFLAGS)" fremantle-plugin
++      make -C config-ui EXTRA_CFLAGS="$(EXTRA_CFLAGS)" fremantle-plugin util
  
        touch $@
  
@@@ -52,8 -53,6 +52,8 @@@ install: buil
        # debian/browser-switchboard.
        make DESTDIR=debian/browser-switchboard install
        make -C config-ui DESTDIR=../debian/browser-switchboard install
 +      install -c -m 0644 debian/browser-switchboard-cp.desktop debian/browser-switchboard/usr/share/applications/hildon-control-panel
 +      install -c -m 0644 debian/microb.desktop debian/browser-switchboard/usr/share/applications/hildon
  
  
  binary-indep: build install