--- epiphany-1.9.4/src/bookmarks/ephy-bookmarks.c~ 2006-01-10 14:15:53.000000000 +0100 +++ epiphany-1.9.4/src/bookmarks/ephy-bookmarks.c 2006-01-10 14:33:14.000000000 +0100 @@ -85,26 +85,81 @@ { const char *title; const char *location; + int keyword_id; + EphyNode *keyword_node; } EphyBookmarksBookmarkInfo; -static const EphyBookmarksBookmarkInfo default_bookmarks [] = +static EphyBookmarksBookmarkInfo default_bookmarks [] = { /* Translators you should change these links to respect your locale. * For instance in .nl these should be * "http://www.google.nl" and "http://www.google.nl/search?q=%s" */ - { N_("Search the web"), N_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8") } + { N_("Search the web"), N_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8"), -1, NULL}, + /* third parameter is the position in the keyword list of the used keyword (or -1 if no keyword is set */ + { "Mandriva", "http://www.mandriva.com/", 0, NULL}, + { "Mandriva Store", "http://www.mandrivastore.com/", 0, NULL}, + { "Mandriva Club", "http://club.mandriva.com/", 0, NULL}, + { "Mandriva Expert", "http://www.mandrivaexpert.com/", 0, NULL}, + { "Mandriva Online", "http://www.mandriva.com/mandrivaonline/", 0, NULL}, + { "Thawte", "http://www.advx.org/thawte.php/", 0, NULL}, + { "LPI", "http://www.lpi.org/", 0, NULL}, + { "Skype", "http://www.skype.com/", 0, NULL}, /* last discovery / download bookmark */ + { "Free Software Foundation", "http://www.gnu.org/software/software.html",1, NULL}, + { "The GNU Project","http://www.gnu.org/", 1, NULL}, + { "Freshmeat","http://freshmeat.net/", 1, NULL}, + { "GNOME","http://www.gnome.org/", 1, NULL}, + { "KDE","http://www.kde.org/",1, NULL}, + { "Linux.org","http://www.linux.org/",1, NULL}, + { "Linux Games","http://www.linuxgames.com/",1, NULL}, + { "Linux HeadQuarters","http://www.linuxhq.com/", 1, NULL}, + { "Linux Kernel Archives","http://www.kernel.org/",1, NULL}, + { "RpmFind.net","http://rpmfind.net/",1, NULL}, + { "XFree86","http://www.xfree86.org/",1, NULL}, + { "All Linux Devices","http://alllinuxdevices.com/",2, NULL}, + { "Linux.com","http://www.linux.com/",2, NULL}, + { "Linux Planet","http://www.linuxplanet.com/",2, NULL}, + { "Linux Today","http://linuxtoday.com/",2, NULL}, + { "Linux Weekly News","http://www.lwn.net/",2, NULL}, + { "OfB.biz","http://www.ofb.biz/", 2, NULL}, + { "OSNews.com","http://www.osnews.com/", 2, NULL}, + { "Slashdot","http://slashdot.org/", 2, NULL}, + { "Mandriva Linux Cooker","http://www.mandrivalinux.com/en/cookerdevel.php3", 3, NULL}, + { "Mandriva Linux Development Community","http://qa.mandriva.com/wiki", 3, NULL}, + { "GCC","http://gcc.gnu.org", 3, NULL}, + { "GTK+","http://www.gtk.org/",3, NULL}, + { "KDE - Developer's Corner","http://developer.kde.org/",3, NULL}, + { "OpenSource.org","http://www.opensource.org/",3, NULL}, + { "Perl.org","http://www.perl.org/",3, NULL}, + { "Python.org","http://www.python.org/",3, NULL}, + { "Qt Overview","http://www.trolltech.com/products/qt/",3, NULL}, + { "RPM.org","http://www.rpm.org/",3, NULL}, + { "SourceForge","http://sourceforge.net/",3, NULL}, /* last powerpack bookmark */ + { "Apache","http://www.apache.org/",4, NULL}, + { "Kolab","http://kolab.kde.org/",4, NULL}, + { "MySQL","http://www.mysql.com/",4, NULL}, + { "PHP","http://www.php.net/",4, NULL}, + { "Postfix","http://www.postfix.com/",4, NULL}, + { "PostgreSQL","http://www.postgresql.org/",4, NULL}, + { "ProFTPD","http://www.proftpd.org/",4, NULL}, + { "OpenLDAP","http://www.openldap.org/",4, NULL}, + { "Samba","http://samba.org/samba/samba.html",4, NULL}, /* last bookmark for Powerpackplus */ }; +static int n_default_bookmarks = G_N_ELEMENTS (default_bookmarks); +#define N_DEFAULT_BOOKMARKS_DISCOVERY_DOWNLOAD 9 +#define N_DEFAULT_BOOKMARKS_POWERPACK 38 static const char *default_topics [] = { - N_("Entertainment"), - N_("News"), - N_("Shopping"), - N_("Sports"), - N_("Travel"), - N_("Work") + "Mandriva", + "Community", + "News", + "Programming", + "Server", }; +#define N_DEFAULT_TOPICS_DISCOVERY_DOWNLOAD 1 +#define N_DEFAULT_TOPICS_POWERPACK 4 +static int n_default_topics = G_N_ELEMENTS (default_topics); /* Signals */ enum @@ -160,17 +215,60 @@ { int i; - for (i = 0; i < G_N_ELEMENTS (default_topics); i++) - { - ephy_bookmarks_add_keyword (eb, _(default_topics[i])); + int max_topics, max_bookmarks; + char *meta_class = NULL; + char *buffer; + + buffer = g_malloc (1024); + if (g_file_get_contents ("/etc/sysconfig/system", &buffer, NULL, NULL)) { + GKeyFile *key_file; + char *new_buffer; + + new_buffer = g_strconcat ("[General]\n", buffer, NULL); + + key_file = g_key_file_new (); + if (g_key_file_load_from_data (key_file, new_buffer, strlen(new_buffer), G_KEY_FILE_NONE,NULL)) { + meta_class = g_key_file_get_string (key_file, "General", "META_CLASS", NULL); + } + g_key_file_free (key_file); + g_free (new_buffer); + } + g_free (buffer); + + if (meta_class && g_ascii_strcasecmp (meta_class, "powerpackplus") == 0) { + max_topics = n_default_topics; + max_bookmarks = n_default_bookmarks; + } else if (meta_class && g_ascii_strcasecmp (meta_class, "powerpack") == 0) { + max_topics = N_DEFAULT_TOPICS_POWERPACK; + max_bookmarks = N_DEFAULT_BOOKMARKS_POWERPACK; + } else { + max_topics = N_DEFAULT_TOPICS_DISCOVERY_DOWNLOAD; + max_bookmarks = N_DEFAULT_BOOKMARKS_DISCOVERY_DOWNLOAD; + } + + for (i = 0; i < max_topics; i++) + { + EphyNode *kwd; + int j; + + kwd = ephy_bookmarks_add_keyword (eb, _(default_topics[i])); + for (j = 0; j < max_bookmarks; j++) { + if (default_bookmarks[j].keyword_id == i) { + default_bookmarks[j].keyword_node = kwd; + } + } } - for (i = 0; i < G_N_ELEMENTS (default_bookmarks); i++) + for (i = 0; i < max_bookmarks; i++) { EphyNode *bmk; bmk = ephy_bookmarks_add (eb, _(default_bookmarks[i].title), _(default_bookmarks[i].location)); + if (default_bookmarks[i].keyword_node) { + ephy_bookmarks_set_keyword (eb, default_bookmarks[i].keyword_node,bmk); + } + } }