Unique-ify the lists so that we can handle multiple excutable names for

2004-02-13  Jody Goldberg <jody@gnome.org>

	* gnome-default-applications-properties.c : Unique-ify the lists so
	  that we can handle multiple excutable names for the same browser
	  when the list jumps to gconf.  Remove the vile hack specifict to
	  evolution.

	* gnome-default-applications-properties-structs.c (};) : remove the
	  nremote flag and add a few new browsers.
This commit is contained in:
Jody Goldberg 2004-02-13 14:29:30 +00:00 committed by Jody Goldberg
parent ff003126bb
commit ed7b26ff46
3 changed files with 101 additions and 114 deletions

View file

@ -1,3 +1,13 @@
2004-02-13 Jody Goldberg <jody@gnome.org>
* gnome-default-applications-properties.c : Unique-ify the lists so
that we can handle multiple excutable names for the same browser
when the list jumps to gconf. Remove the vile hack specifict to
evolution.
* gnome-default-applications-properties-structs.c (};) : remove the
nremote flag and add a few new browsers.
2004-02-12 Mark McLoughlin <mark@skynet.ie>
* gnome-default-applications-properties.c: (dialog_response): Update

View file

@ -1,53 +1,32 @@
struct _BrowserDescription
{
gchar *name;
gchar *executable_name;
gchar *command;
gboolean needs_term;
gboolean nremote;
gboolean in_path;
};
struct _MailerDescription
{
gchar *name;
gchar *executable_name;
gchar *command;
struct _BrowserDescription {
gchar const *name;
gchar const *executable_name;
gchar const *command;
gboolean needs_term;
gboolean in_path;
};
BrowserDescription possible_browsers[] = {
{ N_("Epiphany"), "epiphany", "epiphany %s", FALSE, FALSE },
{ N_("Galeon"), "galeon", "galeon %s", FALSE, FALSE },
{ N_("Encompass"), "encompass", "encompass %s", FALSE, FALSE },
{ N_("Firebird/FireFox"), "mozilla-firebird", "mozilla-firebird %s", FALSE, FALSE },
{ N_("Mozilla/Netscape 6"), "mozilla-1.6", "mozilla-1.6 %s", FALSE, FALSE },
{ N_("Mozilla/Netscape 6"), "mozilla", "mozilla %s", FALSE, FALSE },
{ N_("Netscape Communicator"), "netscape", "netscape %s", FALSE, FALSE },
{ N_("Konqueror"), "konqueror", "konqueror %s", FALSE, FALSE },
{ N_("W3M Text Browser"), "w3n", "w3m %s", TRUE, FALSE },
{ N_("Lynx Text Browser"), "lynx", "lynx %s", TRUE, FALSE },
{ N_("Links Text Browser") , "links", "links %s", TRUE, FALSE }
};
struct _HelpViewDescription
{
gchar *name;
gchar *executable_name;
struct _MailerDescription {
gchar const *name;
gchar const *executable_name;
gchar const *command;
gboolean needs_term;
gboolean accepts_urls;
gboolean in_path;
};
struct _TerminalDesciption
{
gchar *name;
gchar *exec;
gchar *exec_arg;
gboolean in_path;
};
BrowserDescription possible_browsers[] =
{
{ N_("Epiphany"), "epiphany", "epiphany %s", FALSE, FALSE, FALSE },
{ N_("Galeon"), "galeon", "galeon %s", FALSE, FALSE, FALSE },
{ N_("Encompass"), "encompass", "encompass %s", FALSE, FALSE, FALSE },
{ N_("Mozilla/Netscape 6"), "mozilla", "mozilla %s", FALSE, TRUE, FALSE },
{ N_("Netscape Communicator"), "netscape", "netscape %s", FALSE, TRUE, FALSE },
{ N_("Konqueror"), "konqueror", "konqueror %s", FALSE, FALSE, FALSE },
{ N_("Lynx Text Browser"), "lynx", "lynx %s", TRUE, FALSE, FALSE },
{ N_("Links Text Browser") , "links", "links %s", TRUE, FALSE, FALSE }
};
MailerDescription possible_mailers[] =
{
MailerDescription possible_mailers[] = {
/* The code in gnome-default-applications-properties.c makes sure
* there is only one (the first entry in this list) Evolution entry
* in the list shown to the user
@ -61,8 +40,13 @@ MailerDescription possible_mailers[] =
};
TerminalDescription possible_terminals[] =
{
struct _TerminalDesciption {
gchar const *name;
gchar const *exec;
gchar const *exec_arg;
gboolean in_path;
};
TerminalDescription possible_terminals[] = {
{ N_("Gnome Terminal"), "gnome-terminal", "-x", FALSE },
{ N_("Standard XTerminal"), "xterm", "-e", FALSE },
{ N_("NXterm"), "nxterm", "-e", FALSE },

View file

@ -182,51 +182,45 @@ generic_guard (GtkWidget *toggle, GtkWidget *widget)
}
}
static gboolean
validate (GHashTable *unique, char const *name, char const *exec_name)
{
if (NULL == g_hash_table_lookup (unique, name)) {
char *path = g_find_program_in_path (exec_name);
if (path != NULL) {
g_hash_table_insert (unique, (gpointer)name, (gpointer)exec_name);
g_free (path);
return TRUE;
}
}
return FALSE;
}
static void
initialize_default_applications (void)
{
gint i;
/* This is used to only have one Evolution entry in the dropdown box
* in case the user has installed both evo for gnome1 and for gnome2
*/
gboolean evo_already_in_list = FALSE;
GHashTable *unique;
text_editors = gnome_vfs_mime_get_all_applications ("text/plain");
for (i = 0; i < G_N_ELEMENTS (possible_browsers); i++ ) {
gchar *browsers = g_find_program_in_path (possible_browsers[i].executable_name);
if (browsers) {
possible_browsers[i].in_path = TRUE;
g_free(browsers);
}
}
for (i = 0; i < G_N_ELEMENTS (possible_mailers); i++ ) {
gchar *mailers;
gchar *exec_name = possible_mailers[i].executable_name;
unique = g_hash_table_new (g_str_hash, g_str_equal);
for (i = 0; i < G_N_ELEMENTS (possible_browsers); i++ )
possible_browsers[i].in_path = validate (unique,
possible_browsers[i].name, possible_browsers[i].executable_name);
g_hash_table_destroy (unique);
mailers = g_find_program_in_path (exec_name);
if (mailers) {
if (g_str_has_prefix (exec_name, "evolution")) {
if (evo_already_in_list) {
g_free (mailers);
continue;
} else {
evo_already_in_list = TRUE;
}
}
unique = g_hash_table_new (g_str_hash, g_str_equal);
for (i = 0; i < G_N_ELEMENTS (possible_mailers); i++ )
possible_mailers[i].in_path = validate (unique,
possible_mailers[i].name, possible_mailers[i].executable_name);
g_hash_table_destroy (unique);
possible_mailers[i].in_path = TRUE;
g_free(mailers);
}
}
for (i = 0; i < G_N_ELEMENTS (possible_terminals); i++ ) {
gchar *terminals = g_find_program_in_path (possible_terminals[i].exec);
if (terminals) {
possible_terminals[i].in_path = TRUE;
g_free (terminals);
}
}
unique = g_hash_table_new (g_str_hash, g_str_equal);
for (i = 0; i < G_N_ELEMENTS (possible_terminals); i++ )
possible_terminals[i].in_path = validate (unique,
possible_terminals[i].name, possible_terminals[i].exec);
g_hash_table_destroy (unique);
}
static void
@ -716,7 +710,6 @@ create_dialog (GConfClient *client)
static void
get_legacy_settings (void)
{
}
int