Author: benny
Date: 2007-01-19 19:49:04 +0000 (Fri, 19 Jan 2007)
New Revision: 24558

Modified:
   installit/branches/installer-single-file/ChangeLog
   
installit/branches/installer-single-file/i2t-generate/InstallIt/Generators/MainDependencies.rb
   installit/branches/installer-single-file/i2t-generate/InstallIt/Settings.rb
Log:
2007-01-19      Nick Schermer <[EMAIL PROTECTED]>

        * i2t-generate/InstallIt/Generators/MainDependencies.rb,
          i2t-generate/InstallIt/Settings.rb: Add support for optional
          dependencies.




Modified: installit/branches/installer-single-file/ChangeLog
===================================================================
--- installit/branches/installer-single-file/ChangeLog  2007-01-19 19:47:03 UTC 
(rev 24557)
+++ installit/branches/installer-single-file/ChangeLog  2007-01-19 19:49:04 UTC 
(rev 24558)
@@ -1,3 +1,9 @@
+2007-01-19     Nick Schermer <[EMAIL PROTECTED]>
+
+       * i2t-generate/InstallIt/Generators/MainDependencies.rb,
+         i2t-generate/InstallIt/Settings.rb: Add support for optional
+         dependencies.
+
 2007-01-17     Nick Schermer <[EMAIL PROTECTED]>
 
        * i2t-generate/InstallIt/Generators/Bootstrap.rb,

Modified: 
installit/branches/installer-single-file/i2t-generate/InstallIt/Generators/MainDependencies.rb
===================================================================
--- 
installit/branches/installer-single-file/i2t-generate/InstallIt/Generators/MainDependencies.rb
      2007-01-19 19:47:03 UTC (rev 24557)
+++ 
installit/branches/installer-single-file/i2t-generate/InstallIt/Generators/MainDependencies.rb
      2007-01-19 19:49:04 UTC (rev 24558)
@@ -1,6 +1,6 @@
 # $Id$
 #
-# Copyright (c) 2003-2005 os-cillation
+# Copyright (c) 2003-2007 os-cillation
 # All rights reserved.
 #
 # Written by Benedikt Meurer <[EMAIL PROTECTED]>
@@ -57,13 +57,13 @@
         result = <<EndOfCode
 typedef struct
 {
-  guint      type;
-  gchar     *name;
-  gchar     *version;
-  gchar     *description;
-  gchar     *path;
-  GtkWidget *box;
-  GtkWidget *image;
+  gboolean    optional;
+  guint       type;
+  gchar      *name;
+  gchar      *version;
+  gchar      *description;
+  gchar      *path;
+  GtkTreeIter iter;
 } #{basenameUpper()};
 
 static #{basenameUpper()} #{basename()}[] =
@@ -71,22 +71,22 @@
 EndOfCode
         @packages.each do |package|
           result += <<EndOfPackage
-  { #{TYPE_PACKAGE}, \"#{package.name}\", \"#{package.version}\", 
\"#{package.description}\", NULL, NULL, NULL, },
+  { #{package.optional}, #{TYPE_PACKAGE}, \"#{package.name}\", 
\"#{package.version}\", \"#{package.description}\", NULL, },
 EndOfPackage
         end
         @programs.each do |program|
           result += <<EndOfProgram
-  { #{TYPE_PROGRAM}, \"#{program.name}\", NULL, \"#{program.description}\", 
NULL, NULL, NULL, },
+  { #{program.optional}, #{TYPE_PROGRAM}, \"#{program.name}\", NULL, 
\"#{program.description}\", NULL, },
 EndOfProgram
         end
         @libraries.each do |library|
           result += <<EndOfProgram
-  { #{TYPE_LIBRARY}, \"#{library.name}\", NULL, \"#{library.description}\", 
NULL, NULL, NULL, },
+  { #{library.optional}, #{TYPE_LIBRARY}, \"#{library.name}\", NULL, 
\"#{library.description}\", NULL, },
 EndOfProgram
         end
         @perlModules.each do |perlModule|
           result += <<EndOfProgram
-  { #{TYPE_PERL_MODULE}, \"#{perlModule}\", NULL, \"#{perlModule}\", NULL, 
NULL, NULL, },
+  { #{perlModule.optional}, #{TYPE_PERL_MODULE}, \"#{perlModule.name}\", NULL, 
\"#{perlModule.description}\", NULL, },
 EndOfProgram
         end
         result += <<EndOfCode
@@ -95,6 +95,9 @@
 static const GdkPixdata #{basename()}_sdata = { #{SUCCEED_DATA} };
 static const GdkPixdata #{basename()}_fdata = { #{FAILED_DATA} };
 
+static GtkTreeStore *#{basename()}_store;
+static GtkTextTag   *#{basename()}_tag;
+
 EndOfCode
         if not @libraries.empty? then
           result += <<EndOfCode
@@ -188,16 +191,18 @@
 
       if (system ("./pkgtest.sh") != 0)
         {
-          gtk_widget_show (depend->box);
           pixbuf = fpixbuf;
-          ++nfailed;
+          if (!depend->optional)
+            ++nfailed;
         }
       else
         {
-          gtk_widget_hide (depend->box);
           pixbuf = spixbuf;
         }
-      gtk_image_set_from_pixbuf (GTK_IMAGE (depend->image), pixbuf);
+      gtk_tree_store_set (#{basename()}_store, &depend->iter,
+                          #{COL_ICON}, pixbuf,
+                          #{COL_FOUND}, (pixbuf == spixbuf),
+                          -1);
     }
 EndOfPackages
         end
@@ -215,7 +220,8 @@
           if (command == NULL)
             {
               pixbuf = fpixbuf;
-              ++nfailed;
+              if (!depend->optional)
+                ++nfailed;
             }
           else
             {
@@ -223,13 +229,10 @@
               g_free (command);
             }
         }
-
-      if (pixbuf == fpixbuf)
-        gtk_widget_show (depend->box);
-      else
-        gtk_widget_hide (depend->box);
-
-      gtk_image_set_from_pixbuf (GTK_IMAGE (depend->image), pixbuf);
+      gtk_tree_store_set (#{basename()}_store, &depend->iter,
+                          #{COL_ICON}, pixbuf,
+                          #{COL_FOUND}, (pixbuf == spixbuf),
+                          -1);
     }
 EndOfPrograms
         end
@@ -276,15 +279,13 @@
           g_free (lib_module);
         }
 
-      if (pixbuf == fpixbuf)
-        {
-          gtk_widget_show (depend->box);
-          ++nfailed;
-        }
-      else
-        gtk_widget_hide (depend->box);
+      if (pixbuf == fpixbuf && !depend->optional)
+        ++nfailed;
 
-      gtk_image_set_from_pixbuf (GTK_IMAGE (depend->image), pixbuf);
+      gtk_tree_store_set (#{basename()}_store, &depend->iter,
+                          #{COL_ICON}, pixbuf,
+                          #{COL_FOUND}, (pixbuf == spixbuf),
+                          -1);
     }
 EndOfLibraries
         end
@@ -295,15 +296,18 @@
       gchar *command = g_strdup_printf ("perl '-M%s' -e exit", depend->name);
       if (system (command) == 0)
         {
-          gtk_image_set_from_pixbuf (GTK_IMAGE (depend->image), spixbuf);
-          gtk_widget_hide (depend->box);
+          pixbuf = spixbuf;
         }
       else
         {
-          gtk_image_set_from_pixbuf (GTK_IMAGE (depend->image), fpixbuf);
-          gtk_widget_show (depend->box);
-          ++nfailed;
+          if (!depend->optional)
+            ++nfailed;
+          pixbuf = fpixbuf;
         }
+      gtk_tree_store_set (#{basename()}_store, &depend->iter,
+                          #{COL_ICON}, pixbuf,
+                          #{COL_FOUND}, (pixbuf == spixbuf),
+                          -1);
       g_free (command);
     }
 EndOfPerlModules
@@ -314,7 +318,7 @@
 
   i2t_page_set_can_next (page, nfailed == 0);
 }
-
+#if 0
 EndOfCode
         if not @packages.empty? or not @programs.empty? then
           result += <<EndOfCode
@@ -444,331 +448,209 @@
 EndOfCode
         end
         result += <<EndOfCode
+#endif
 static void
-#{basename()}_init (GtkWidget *page)
+#{basename()}_drop_iter_if_empty (GtkTreeIter *iter)
 {
-  #{basenameUpper()} *depend = #{basename()};
-  GtkTooltips *tips;
-  GtkWidget   *vbox;
-  GtkWidget   *label;
-  GtkWidget   *table;
-  GdkPixbuf   *pixbuf;
-  GtkWidget   *hbox;
-  GtkWidget   *button;
-  gchar       *text;
-  guint        m;
+  if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (#{basename()}_store), 
iter) == 0)
+    gtk_tree_store_remove (#{basename()}_store, iter);
+}
+static void
+#{basename()}_selection_changed (GtkTreeSelection *selection,
+                                 GtkTextView      *text)
+{
+  GtkTextBuffer *buffer;
+  GtkTreeModel  *model;
+  GtkTreeIter    iter;
+  GtkTextIter    start;
+  GtkTextIter    end;
+  gchar         *title;
+  gchar         *description;
+  gchar         *version;
 
-  tips = gtk_tooltips_new ();
+  buffer = gtk_text_view_get_buffer (text);
+  gtk_text_buffer_get_bounds (buffer, &start, &end);
+  gtk_text_buffer_delete (buffer, &start, &end);
 
-  pixbuf = gdk_pixbuf_from_pixdata (&#{basename()}_fdata, FALSE, NULL);
-EndOfCode
-        if not @packages.empty? then
-          result += <<EndOfPackages
-  vbox = gtk_vbox_new (FALSE, 6);
-  gtk_box_pack_start (GTK_BOX (page), vbox, FALSE, TRUE, 0);
-  gtk_widget_show (vbox);
+  if (gtk_tree_selection_get_selected (selection, &model, &iter))
+    {
+      gtk_tree_model_get (model, &iter, #{COL_NAME_PLAIN}, &title, 
#{COL_DESCRIPTION}, &description, #{COL_VERSION}, &version, -1);
 
-  label = g_object_new (GTK_TYPE_LABEL,
-                        "label", "The following packages are required:",
-                        "xalign", 0.0,
-                        NULL);
-  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
-  gtk_widget_show (label);
+      gtk_text_buffer_insert_with_tags (buffer, &end, title, -1, 
#{basename()}_tag, NULL);
+      if (version != NULL)
+        {
+          gtk_text_buffer_insert_with_tags (buffer, &end, " (", -1, 
#{basename()}_tag, NULL);
+          gtk_text_buffer_insert_with_tags (buffer, &end, version, -1, 
#{basename()}_tag, NULL);
+          gtk_text_buffer_insert_with_tags (buffer, &end, ")", -1, 
#{basename()}_tag, NULL);
+        }
+      gtk_text_buffer_insert (buffer, &end, "\\n\\n", -1);
+      gtk_text_buffer_insert (buffer, &end, description, -1);
 
-  table = gtk_table_new ([EMAIL PROTECTED] * 2}, 3, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 1);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
-  gtk_widget_show (table);
+      g_free (description);
+      g_free (version);
+      g_free (title);
+    }
+}
+static void
+#{basename()}_init (GtkWidget *page)
+{
+  static const gchar  MANDATORY_DESCRIPTION[] = "Mandatory dependencies are 
packages, programs, libraries or Perl modules that must be "
+                                                "installed on your system to 
build and run the software. You cannot proceed if atleast "
+                                                "one of these dependencies is 
missing on your system.";
+  static const gchar  OPTIONAL_DESCRIPTION[] = "Optional dependencies are 
packages, programs, libraries or Perl modules that can optionally "
+                                               "be used by the software to 
enable additional features. But the software will happily build "
+                                               "and run even if some of these 
dependencies are missing on your system.";
 
+  #{basenameUpper()} *depend = #{basename()};
+  GtkTreeViewColumn  *column;
+  GtkCellRenderer    *renderer;
+  GtkTextBuffer      *buffer;
+  GtkTreeIter         mandatory_root_iter;
+  GtkTreeIter         optional_root_iter;
+  GtkTreeIter         mandatory_iter;
+  GtkTreeIter         optional_iter;
+  GtkWidget          *paned;
+  GtkWidget          *swin;
+  GtkWidget          *tree;
+  GtkWidget          *text;
+  guint               m;
+  
+  #{basename()}_store = gtk_tree_store_new (#{N_COLS}, GDK_TYPE_PIXBUF, 
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING);
+  gtk_tree_store_append (#{basename()}_store, &mandatory_root_iter, NULL);
+  gtk_tree_store_set (#{basename()}_store, &mandatory_root_iter, #{COL_NAME}, 
"<b>Mandatory Dependencies</b>", #{COL_NAME_PLAIN}, "Mandatory Dependencies", 
#{COL_DESCRIPTION}, MANDATORY_DESCRIPTION, -1);
+  gtk_tree_store_append (#{basename()}_store, &optional_root_iter, NULL);
+  gtk_tree_store_set (#{basename()}_store, &optional_root_iter, #{COL_NAME}, 
"<b>Optional Dependencies</b>", #{COL_NAME_PLAIN}, "Mandatory Dependencies", 
#{COL_DESCRIPTION}, OPTIONAL_DESCRIPTION, -1);
+EndOfCode
+        if not @packages.empty? then
+          result += <<EndOfPackages
+  static const gchar  PACKAGES_DESCRIPTION[] = "A package is a special kind of 
software, usually a toolkit or a library, that is registered "
+                                               "on your system using the 
pkg-config utility. Each package installs one or more .pc files "
+                                               "into a special location in 
your file system. These .pc files usually ship as part of the "
+                                               "-dev or -devel packages, so 
make sure to install the appropriate -dev/-devel package if "
+                                               "a certain package is not found 
by the installer.";
+  gtk_tree_store_append (#{basename()}_store, &mandatory_iter, 
&mandatory_root_iter);
+  gtk_tree_store_set (#{basename()}_store, &mandatory_iter, #{COL_NAME}, 
"<b>Packages</b>", #{COL_NAME_PLAIN}, "Packages", #{COL_DESCRIPTION}, 
PACKAGES_DESCRIPTION, -1);
+  gtk_tree_store_append (#{basename()}_store, &optional_iter, 
&optional_root_iter);
+  gtk_tree_store_set (#{basename()}_store, &optional_iter, #{COL_NAME}, 
"<b>Packages</b>", #{COL_NAME_PLAIN}, "Packages", #{COL_DESCRIPTION}, 
PACKAGES_DESCRIPTION, -1);
   for (m = 0; m < [EMAIL PROTECTED]; ++m, ++depend)
     {
-      depend->image = gtk_image_new_from_pixbuf (pixbuf);
-      gtk_table_attach (GTK_TABLE (table), depend->image,
-                        0, 1, m * 2, m * 2 + 1, GTK_FILL, GTK_FILL, 0, 0);
-      gtk_widget_show (depend->image);
-
-      text = g_strdup_printf ("<b>%s</b> (%s)", depend->description, 
depend->name);
-      label = g_object_new (GTK_TYPE_LABEL,
-                            "label", text,
-                            "use-markup", TRUE,
-                            "xalign", 0.0,
-                            "yalign", 0.0,
-                            NULL);
-      gtk_table_attach (GTK_TABLE (table), label,
-                        1, 2, m * 2, m * 2 + 1, GTK_FILL, GTK_FILL, 0, 0);
-      gtk_widget_show (label);
-      g_free (text);
-
-      text = g_strdup_printf ("<i>%s or above</i>", depend->version);
-      label = g_object_new (GTK_TYPE_LABEL,
-                            "label", text,
-                            "use-markup", TRUE,
-                            "xalign", 0.0,
-                            "yalign", 0.0,
-                            NULL);
-      gtk_table_attach (GTK_TABLE (table), label,
-                        2, 3, m * 2, m * 2 + 1, GTK_FILL, GTK_FILL, 0, 0);
-      gtk_widget_show (label);
-      g_free (text);
-
-      depend->box = gtk_hbox_new (FALSE, 6);
-      gtk_table_attach (GTK_TABLE (table), depend->box,
-                        1, 3, m * 2 + 1, m * 2 + 2, GTK_EXPAND | GTK_FILL, 
GTK_FILL, 0, 0);
-
-      button = gtk_button_new ();
-      GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
-      gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-      g_object_set_data (G_OBJECT (button), "i2t-page", page);
-      g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK 
(#{basename()}_manually), depend);
-      gtk_box_pack_start (GTK_BOX (depend->box), button, FALSE, TRUE, 0);
-      gtk_widget_show (button);
-
-      text = g_strdup_printf ("Manually specify the location of the file %s.pc 
on your system", depend->name);
-      gtk_tooltips_set_tip (tips, button, text, NULL);
-      g_free (text);
-
-      hbox = gtk_hbox_new (FALSE, 6);
-      gtk_container_add (GTK_CONTAINER (button), hbox);
-      gtk_widget_show (hbox);
-
-      label = gtk_image_new_from_stock (GTK_STOCK_FIND, GTK_ICON_SIZE_BUTTON);
-      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-      gtk_widget_show (label);
-
-      label = g_object_new (GTK_TYPE_LABEL, "label", "<span size=\\"small\\" 
foreground=\\"red\\" underline=\\"low\\" weight=\\"bold\\">Specify location 
manually</span>", "use-markup", TRUE, NULL);
-      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
-      gtk_widget_show (label);
+      gtk_tree_store_append (#{basename()}_store, &depend->iter, 
depend->optional ? &optional_iter : &mandatory_iter);
+      gtk_tree_store_set (#{basename()}_store, &depend->iter, #{COL_NAME}, 
g_markup_escape_text (depend->name, -1), #{COL_NAME_PLAIN}, depend->name, 
#{COL_VERSION}, depend->version, #{COL_DESCRIPTION}, depend->description, -1);
     }
+  #{basename()}_drop_iter_if_empty (&mandatory_iter);
+  #{basename()}_drop_iter_if_empty (&optional_iter);
 EndOfPackages
         end
         if not @programs.empty? then
           result += <<EndOfPrograms
-  vbox = gtk_vbox_new (FALSE, 6);
-  gtk_box_pack_start (GTK_BOX (page), vbox, FALSE, TRUE, 0);
-  gtk_widget_show (vbox);
-
-  label = g_object_new (GTK_TYPE_LABEL,
-                        "label", "The following programs are required:",
-                        "xalign", 0.0,
-                        NULL);
-  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
-  gtk_widget_show (label);
-
-  table = gtk_table_new ([EMAIL PROTECTED] * 2}, 2, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 1);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
-  gtk_widget_show (table);
-
+  static const gchar  PROGRAMS_DESCRIPTION[] = "A program is an executable 
file on your system, usually located in one of the folders "
+                                               "listed in the $PATH 
environment variable.";
+  gtk_tree_store_append (#{basename()}_store, &mandatory_iter, 
&mandatory_root_iter);
+  gtk_tree_store_set (#{basename()}_store, &mandatory_iter, #{COL_NAME}, 
"<b>Programs</b>", #{COL_NAME_PLAIN}, "Programs", #{COL_DESCRIPTION}, 
PROGRAMS_DESCRIPTION, -1);
+  gtk_tree_store_append (#{basename()}_store, &optional_iter, 
&optional_root_iter);
+  gtk_tree_store_set (#{basename()}_store, &optional_iter, #{COL_NAME}, 
"<b>Programs</b>", #{COL_NAME_PLAIN}, "Programs", #{COL_DESCRIPTION}, 
PROGRAMS_DESCRIPTION, -1);
   for (m = 0; m < [EMAIL PROTECTED]; ++m, ++depend)
     {
-      depend->image = gtk_image_new_from_pixbuf (pixbuf);
-      gtk_table_attach (GTK_TABLE (table), depend->image,
-                        0, 1, m * 2, m * 2 + 1, GTK_FILL, GTK_FILL, 0, 0);
-      gtk_widget_show (depend->image);
-
-      text = g_strdup_printf ("<b>%s</b> (<tt>%s</tt>)",
-                              depend->description,
-                              depend->name);
-      label = g_object_new (GTK_TYPE_LABEL,
-                            "label", text,
-                            "use-markup", TRUE,
-                            "xalign", 0.0,
-                            "yalign", 0.0,
-                            NULL);
-      gtk_table_attach (GTK_TABLE (table), label,
-                        1, 2, m * 2, m * 2 + 1, GTK_FILL, GTK_FILL, 0, 0);
-      gtk_widget_show (label);
-      g_free (text);
-
-      depend->box = gtk_hbox_new (FALSE, 6);
-      gtk_table_attach (GTK_TABLE (table), depend->box,
-                        1, 2, m * 2 + 1, m * 2 + 2, GTK_EXPAND | GTK_FILL, 
GTK_FILL, 0, 0);
-
-      button = gtk_button_new ();
-      GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
-      gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-      g_object_set_data (G_OBJECT (button), "i2t-page", page);
-      g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK 
(#{basename()}_manually), depend);
-      gtk_box_pack_start (GTK_BOX (depend->box), button, FALSE, TRUE, 0);
-      gtk_widget_show (button);
-
-      text = g_strdup_printf ("Manually specify the location of the program %s 
on your system", depend->name);
-      gtk_tooltips_set_tip (tips, button, text, NULL);
-      g_free (text);
-
-      hbox = gtk_hbox_new (FALSE, 6);
-      gtk_container_add (GTK_CONTAINER (button), hbox);
-      gtk_widget_show (hbox);
-
-      label = gtk_image_new_from_stock (GTK_STOCK_FIND, GTK_ICON_SIZE_BUTTON);
-      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-      gtk_widget_show (label);
-
-      label = g_object_new (GTK_TYPE_LABEL, "label", "<span size=\\"small\\" 
foreground=\\"red\\" underline=\\"low\\" weight=\\"bold\\">Specify location 
manually</span>", "use-markup", TRUE, NULL);
-      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
-      gtk_widget_show (label);
+      gtk_tree_store_append (#{basename()}_store, &depend->iter, 
depend->optional ? &optional_iter : &mandatory_iter);
+      gtk_tree_store_set (#{basename()}_store, &depend->iter, #{COL_NAME}, 
g_markup_escape_text (depend->name, -1), #{COL_NAME_PLAIN}, depend->name, 
#{COL_VERSION}, depend->version, #{COL_DESCRIPTION}, depend->description, -1);
     }
+  #{basename()}_drop_iter_if_empty (&mandatory_iter);
+  #{basename()}_drop_iter_if_empty (&optional_iter);
 EndOfPrograms
         end
         if not @libraries.empty? then
           result += <<EndOfLibraries
-  vbox = gtk_vbox_new (FALSE, 6);
-  gtk_box_pack_start (GTK_BOX (page), vbox, FALSE, TRUE, 0);
-  gtk_widget_show (vbox);
-
-  label = g_object_new (GTK_TYPE_LABEL,
-                        "label", "The following additional libraries are 
required:",
-                        "xalign", 0.0,
-                        NULL);
-  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
-  gtk_widget_show (label);
-
-  table = gtk_table_new ([EMAIL PROTECTED] * 2}, 2, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 1);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
-  gtk_widget_show (table);
-
+  static const gchar  LIBRARIES_DESCRIPTION[] = "Libraries are special files 
that contain code and data used by multiple programs. These "
+                                                "shared libraries, sometimes 
called DLLs, are usually located in /usr/lib or /usr/local/lib "
+                                                "where the linker will pick 
them up. If the installer is unable to locate a library on your "
+                                                "system, make sure you 
installed the appropriate -dev/-devel software package.";
+  gtk_tree_store_append (#{basename()}_store, &mandatory_iter, 
&mandatory_root_iter);
+  gtk_tree_store_set (#{basename()}_store, &mandatory_iter, #{COL_NAME}, 
"<b>Libraries</b>", #{COL_NAME_PLAIN}, "Libraries", #{COL_DESCRIPTION}, 
LIBRARIES_DESCRIPTION, -1);
+  gtk_tree_store_append (#{basename()}_store, &optional_iter, 
&optional_root_iter);
+  gtk_tree_store_set (#{basename()}_store, &optional_iter, #{COL_NAME}, 
"<b>Libraries</b>", #{COL_NAME_PLAIN}, "Libraries", #{COL_DESCRIPTION}, 
LIBRARIES_DESCRIPTION, -1);
   for (m = 0; m < [EMAIL PROTECTED]; ++m, ++depend)
     {
-      gchar *lib_module;
-
-      depend->image = gtk_image_new_from_pixbuf (pixbuf);
-      gtk_table_attach (GTK_TABLE (table), depend->image,
-                        0, 1, m * 2, m * 2 + 1, GTK_FILL, GTK_FILL, 0, 0);
-      gtk_widget_show (depend->image);
-
-      text = g_strdup_printf ("<b>%s</b> (<tt>%s</tt>)",
-                              depend->description,
-                              depend->name);
-      label = g_object_new (GTK_TYPE_LABEL,
-                            "label", text,
-                            "use-markup", TRUE,
-                            "xalign", 0.0,
-                            "yalign", 0.0,
-                            NULL);
-      gtk_table_attach (GTK_TABLE (table), label,
-                        1, 2, m * 2, m * 2 + 1, GTK_FILL, GTK_FILL, 0, 0);
-      gtk_widget_show (label);
-      g_free (text);
-
-      depend->box = gtk_hbox_new (FALSE, 6);
-      gtk_table_attach (GTK_TABLE (table), depend->box,
-                        1, 2, m * 2 + 1, m * 2 + 2, GTK_EXPAND | GTK_FILL, 
GTK_FILL, 0, 0);
-
-      button = gtk_button_new ();
-      GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
-      gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-      g_object_set_data (G_OBJECT (button), "i2t-page", page);
-      g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK 
(#{basename()}_manually), depend);
-      gtk_box_pack_start (GTK_BOX (depend->box), button, FALSE, TRUE, 0);
-      gtk_widget_show (button);
-
-      lib_module = g_module_build_path (NULL, depend->name);
-      text = g_strdup_printf ("Manually specify the location of the library %s 
on your system", lib_module);
-      gtk_tooltips_set_tip (tips, button, text, NULL);
-      g_free (lib_module);
-      g_free (text);
-
-      hbox = gtk_hbox_new (FALSE, 6);
-      gtk_container_add (GTK_CONTAINER (button), hbox);
-      gtk_widget_show (hbox);
-
-      label = gtk_image_new_from_stock (GTK_STOCK_FIND, GTK_ICON_SIZE_BUTTON);
-      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-      gtk_widget_show (label);
-
-      label = g_object_new (GTK_TYPE_LABEL, "label", "<span size=\\"small\\" 
foreground=\\"red\\" underline=\\"low\\" weight=\\"bold\\">Specify location 
manually</span>", "use-markup", TRUE, NULL);
-      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
-      gtk_widget_show (label);
+      gtk_tree_store_append (#{basename()}_store, &depend->iter, 
depend->optional ? &optional_iter : &mandatory_iter);
+      gtk_tree_store_set (#{basename()}_store, &depend->iter, #{COL_NAME}, 
g_markup_escape_text (depend->name, -1), #{COL_NAME_PLAIN}, depend->name, 
#{COL_VERSION}, depend->version, #{COL_DESCRIPTION}, depend->description, -1);
     }
+  #{basename()}_drop_iter_if_empty (&mandatory_iter);
+  #{basename()}_drop_iter_if_empty (&optional_iter);
 EndOfLibraries
         end
         if not @perlModules.empty? then
           result += <<EndOfPerlModules
-  vbox = gtk_vbox_new (FALSE, 6);
-  gtk_box_pack_start (GTK_BOX (page), vbox, FALSE, TRUE, 0);
-  gtk_widget_show (vbox);
-
-  label = g_object_new (GTK_TYPE_LABEL,
-                        "label", "The following Perl modules are required:",
-                        "xalign", 0.0,
-                        NULL);
-  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
-  gtk_widget_show (label);
-
-  table = gtk_table_new ([EMAIL PROTECTED] * 2}, 2, FALSE);
-  gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-  gtk_table_set_row_spacings (GTK_TABLE (table), 1);
-  gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
-  gtk_widget_show (table);
-
+  static const gchar  PERLMODULES_DESCRIPTION[] = "Perl is a programming 
language used by various parts of the build system and also during "
+                                                  "runtime. Perl modules are 
extensions to the core language that provide additional functions "
+                                                  "for Perl programs. If a 
Perl module is missing from your system, you can either download it "
+                                                  "from CPAN.org or install 
the software package for your distribution.";
+  gtk_tree_store_append (#{basename()}_store, &mandatory_iter, 
&mandatory_root_iter);
+  gtk_tree_store_set (#{basename()}_store, &mandatory_iter, #{COL_NAME}, 
"<b>Perl Modules</b>", #{COL_NAME_PLAIN}, "Perl Modules", #{COL_DESCRIPTION}, 
PERLMODULES_DESCRIPTION, -1);
+  gtk_tree_store_append (#{basename()}_store, &optional_iter, 
&optional_root_iter);
+  gtk_tree_store_set (#{basename()}_store, &optional_iter, #{COL_NAME}, 
"<b>Perl Modules</b>", #{COL_NAME_PLAIN}, "Perl Modules", #{COL_DESCRIPTION}, 
PERLMODULES_DESCRIPTION, -1);
   for (m = 0; m < [EMAIL PROTECTED]; ++m, ++depend)
     {
-      gchar *xterm;
-      gchar *bash;
-      gchar *cpan;
+      gtk_tree_store_append (#{basename()}_store, &depend->iter, 
depend->optional ? &optional_iter : &mandatory_iter);
+      gtk_tree_store_set (#{basename()}_store, &depend->iter, #{COL_NAME}, 
g_markup_escape_text (depend->name, -1), #{COL_NAME_PLAIN}, depend->name, 
#{COL_VERSION}, depend->version, #{COL_DESCRIPTION}, depend->description, -1);
+    }
+  #{basename()}_drop_iter_if_empty (&mandatory_iter);
+  #{basename()}_drop_iter_if_empty (&optional_iter);
+EndOfPerlModules
+        end
+        result += <<EndOfCode
+  #{basename()}_drop_iter_if_empty (&mandatory_root_iter);
+  #{basename()}_drop_iter_if_empty (&optional_root_iter);
 
-      depend->image = gtk_image_new_from_pixbuf (pixbuf);
-      gtk_table_attach (GTK_TABLE (table), depend->image,
-                        0, 1, m * 2, m * 2 + 1, GTK_FILL, GTK_FILL, 0, 0);
-      gtk_widget_show (depend->image);
+  paned = gtk_vpaned_new ();
+  gtk_box_pack_start (GTK_BOX (page), paned, TRUE, TRUE, 0);
+  gtk_widget_show (paned);
 
-      text = g_strdup_printf ("<b>%s</b>", depend->name);
-      label = g_object_new (GTK_TYPE_LABEL,
-                            "label", text,
-                            "use-markup", TRUE,
-                            "xalign", 0.0,
-                            "yalign", 0.0,
-                            NULL);
-      gtk_table_attach (GTK_TABLE (table), label,
-                        1, 2, m * 2, m * 2 + 1, GTK_FILL, GTK_FILL, 0, 0);
-      gtk_widget_show (label);
-      g_free (text);
+  swin = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin), 
GTK_SHADOW_ETCHED_IN);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), 
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+  gtk_paned_pack1 (GTK_PANED (paned), swin, TRUE, TRUE);
+  gtk_widget_show (swin);
 
-      depend->box = gtk_hbox_new (FALSE, 6);
-      gtk_table_attach (GTK_TABLE (table), depend->box,
-                        1, 2, m * 2 + 1, m * 2 + 2, GTK_EXPAND | GTK_FILL, 
GTK_FILL, 0, 0);
+  tree = g_object_new (GTK_TYPE_TREE_VIEW, "headers-visible", FALSE, 
"headers-clickable", FALSE, "model", #{basename()}_store, "rules-hint", TRUE, 
NULL);
+  gtk_tree_view_expand_all (GTK_TREE_VIEW (tree));
+  gtk_container_add (GTK_CONTAINER (swin), tree);
+  gtk_widget_show (tree);
 
-      button = gtk_button_new ();
-      GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
-      gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-      g_object_set_data (G_OBJECT (button), "i2t-page", page);
-      g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK 
(#{basename()}_cpan), depend);
-      gtk_box_pack_start (GTK_BOX (depend->box), button, FALSE, TRUE, 0);
-      gtk_widget_show (button);
+  column = g_object_new (GTK_TYPE_TREE_VIEW_COLUMN, "expand", TRUE, "title", 
"Name", NULL);
+  renderer = gtk_cell_renderer_pixbuf_new ();
+  gtk_tree_view_column_pack_start (column, renderer, FALSE);
+  gtk_tree_view_column_add_attribute (column, renderer, "pixbuf", #{COL_ICON});
+  renderer = gtk_cell_renderer_text_new ();
+  gtk_tree_view_column_pack_start (column, renderer, TRUE);
+  gtk_tree_view_column_add_attribute (column, renderer, "markup", #{COL_NAME});
+  gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
 
-      /* the button is only sensitive if bash, cpan and xterm is available */
-      bash = g_find_program_in_path ("bash");
-      cpan = g_find_program_in_path ("cpan");
-      xterm = g_find_program_in_path ("xterm");
-      gtk_widget_set_sensitive (button, (bash != NULL && cpan != NULL && xterm 
!= NULL));
-      g_free (xterm);
-      g_free (cpan);
-      g_free (bash);
+  column = g_object_new (GTK_TYPE_TREE_VIEW_COLUMN, "expand", FALSE, "title", 
"Version", NULL);
+  renderer = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT, "xalign", 1.0f, NULL);
+  gtk_tree_view_column_pack_start (column, renderer, TRUE);
+  gtk_tree_view_column_add_attribute (column, renderer, "text", 
#{COL_VERSION});
+  gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
 
-      text = g_strdup_printf ("Download and install %s from CPAN", 
depend->name);
-      gtk_tooltips_set_tip (tips, button, text, NULL);
-      g_free (text);
+  swin = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
+                       "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
+                       "shadow-type", GTK_SHADOW_IN,
+                       "vscrollbar-policy", GTK_POLICY_AUTOMATIC,
+                       NULL);
+  gtk_paned_pack2 (GTK_PANED (paned), swin, TRUE, TRUE);
+  gtk_widget_show (swin);
 
-      hbox = gtk_hbox_new (FALSE, 6);
-      gtk_container_add (GTK_CONTAINER (button), hbox);
-      gtk_widget_show (hbox);
+  buffer = gtk_text_buffer_new (NULL);
+  #{basename()}_tag = gtk_text_buffer_create_tag (buffer, NULL,
+                                                  "weight", PANGO_WEIGHT_BOLD,
+                                                  NULL);
 
-      label = gtk_image_new_from_stock (GTK_STOCK_NETWORK, 
GTK_ICON_SIZE_BUTTON);
-      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-      gtk_widget_show (label);
+  text = gtk_text_view_new_with_buffer (buffer);
+  gtk_text_view_set_editable (GTK_TEXT_VIEW (text), FALSE);
+  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text), GTK_WRAP_WORD);
+  gtk_container_add (GTK_CONTAINER (swin), text);
+  gtk_widget_show (text);
 
-      label = g_object_new (GTK_TYPE_LABEL, "label", "<span size=\\"small\\" 
foreground=\\"red\\" underline=\\"low\\" weight=\\"bold\\">Install from 
CPAN</span>", "use-markup", TRUE, NULL);
-      gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
-      gtk_widget_show (label);
-    }
-EndOfPerlModules
-        end
-        result += <<EndOfCode
-  g_object_unref (G_OBJECT (pixbuf));
+  g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree)), 
"changed", G_CALLBACK (#{basename()}_selection_changed), text);
+  #{basename()}_selection_changed (gtk_tree_view_get_selection (GTK_TREE_VIEW 
(tree)), GTK_TEXT_VIEW (text));
 }
 EndOfCode
         return result
@@ -875,6 +757,14 @@
       TYPE_LIBRARY = 2
       TYPE_PERL_MODULE = 3
 
+      COL_ICON = 0
+      COL_NAME = 1
+      COL_NAME_PLAIN = 2
+      COL_VERSION = 3
+      COL_FOUND = 4
+      COL_DESCRIPTION = 5
+      N_COLS = 6
+
       SUCCEED_DATA = '0x47646b50, 24 + 687, 0x2010002, 64, 16, 16,' +
                      
'"\213\0\0\0\0\4\0\0\0\203\0\0\0\276\0\0\0|Gq\230\0\212\0\0\0\0\6\0\0\0"' +
                      
'"\13\0\1\1\2728ET\355Gq\230\377\0\0\0\323\13\22\27\0\212\0\0\0\0\5\0\0"' +

Modified: 
installit/branches/installer-single-file/i2t-generate/InstallIt/Settings.rb
===================================================================
--- installit/branches/installer-single-file/i2t-generate/InstallIt/Settings.rb 
2007-01-19 19:47:03 UTC (rev 24557)
+++ installit/branches/installer-single-file/i2t-generate/InstallIt/Settings.rb 
2007-01-19 19:49:04 UTC (rev 24558)
@@ -1,6 +1,6 @@
 # $Id: Config.rb 5 2004-10-26 10:27:32Z bmeurer $
 #
-# Copyright (c) 2003-2006 os-cillation
+# Copyright (c) 2003-2007 os-cillation
 # All rights reserved.
 #
 # Written by Benedikt Meurer <[EMAIL PROTECTED]>
@@ -181,24 +181,39 @@
           raise RuntimeError, "<dependency> requires attribute type"
         end
 
+        # check if it's optional
+        optional = depNode.attributes['optional']
+        if (not optional) or (optional != 'true') then
+          optional = 0
+        else
+          optional = 1
+        end
+
         if type == 'package' then
           package = DependenciesPackage.new
           package.name = lookupNode(depNode, 'name').text
           package.version = lookupNode(depNode, 'version').text
-          package.description = lookupNode(depNode, 'description').text
+          package.description = reformatCString(lookupNode(depNode, 
'description').text)
+          package.optional = optional
           @depPackages.push(package)
         elsif type == 'program' then
           program = DependenciesProgram.new
           program.name = lookupNode(depNode, 'name').text
-          program.description = lookupNode(depNode, 'description').text
+          program.description = reformatCString(lookupNode(depNode, 
'description').text)
+          program.optional = optional
           @depPrograms.push(program)
         elsif type == 'library' then
           library = DependenciesLibrary.new
           library.name = lookupNode(depNode, 'name').text
-          library.description = lookupNode(depNode, 'description').text
+          library.description = reformatCString(lookupNode(depNode, 
'description').text)
+          library.optional = optional
           @depLibraries.push(library)
         elsif type == 'perlmodule' then
-          @depPerlModules.push(lookupNode(depNode, 'name').text)
+          perlModule = DependenciesPerlModule.new
+          perlModule.name = lookupNode(depNode, 'name').text
+          perlModule.description = reformatCString(lookupNode(depNode, 
'description').text)
+          perlModule.optional = optional
+          @depPerlModules.push(perlModule)
         else
           raise RuntimeError, "Unsupported type \"#{type}\" for <dependency>"
         end
@@ -353,8 +368,8 @@
     # Dependencies package information
     #
     class DependenciesPackage
-      attr_reader :name, :version, :description
-      attr_writer :name, :version, :description
+      attr_reader :name, :version, :description, :optional
+      attr_writer :name, :version, :description, :optional
     end
 
 
@@ -362,8 +377,8 @@
     # Dependencies program information
     #
     class DependenciesProgram
-      attr_reader :name, :description
-      attr_writer :name, :description
+      attr_reader :name, :description, :optional
+      attr_writer :name, :description, :optional
     end
 
 
@@ -371,12 +386,21 @@
     # Dependencies library information
     #
     class DependenciesLibrary
-      attr_reader :name, :description
-      attr_writer :name, :description
+      attr_reader :name, :description, :optional
+      attr_writer :name, :description, :optional
     end
 
 
     ##
+    # Dependencies perl module information
+    #
+    class DependenciesPerlModule
+      attr_reader :name, :description, :optional
+      attr_writer :name, :description, :optional
+    end
+
+
+    ##
     # Information about a single option
     #
     class Option

_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
http://foo-projects.org/mailman/listinfo/xfce4-commits

Reply via email to