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> 2004-02-12 Mark McLoughlin <mark@skynet.ie>
* gnome-default-applications-properties.c: (dialog_response): Update * gnome-default-applications-properties.c: (dialog_response): Update

View file

@ -1,71 +1,55 @@
struct _BrowserDescription struct _BrowserDescription {
{ gchar const *name;
gchar *name; gchar const *executable_name;
gchar *executable_name; gchar const *command;
gchar *command;
gboolean needs_term;
gboolean nremote;
gboolean in_path;
};
struct _MailerDescription
{
gchar *name;
gchar *executable_name;
gchar *command;
gboolean needs_term; gboolean needs_term;
gboolean in_path; 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 struct _MailerDescription {
{ gchar const *name;
gchar *name; gchar const *executable_name;
gchar *executable_name; gchar const *command;
gboolean needs_term; gboolean needs_term;
gboolean accepts_urls;
gboolean in_path; gboolean in_path;
}; };
MailerDescription possible_mailers[] = {
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[] =
{
/* The code in gnome-default-applications-properties.c makes sure /* The code in gnome-default-applications-properties.c makes sure
* there is only one (the first entry in this list) Evolution entry * there is only one (the first entry in this list) Evolution entry
* in the list shown to the user * in the list shown to the user
*/ */
{ N_("Evolution Mail Reader"), "evolution-1.4", "evolution-1.4 %s", FALSE, FALSE, }, { N_("Evolution Mail Reader"), "evolution-1.4", "evolution-1.4 %s", FALSE, FALSE, },
{ N_("Evolution Mail Reader"), "evolution", "evolution %s", FALSE, FALSE, }, { N_("Evolution Mail Reader"), "evolution", "evolution %s", FALSE, FALSE, },
{ N_("Balsa"), "balsa", "balsa --compose=%s", FALSE, FALSE }, { N_("Balsa"), "balsa", "balsa --compose=%s", FALSE, FALSE },
{ N_("KMail"), "kmail", "kmail %s", FALSE, FALSE }, { N_("KMail"), "kmail", "kmail %s", FALSE, FALSE },
{ N_("Mozilla Mail"), "mozilla", "mozilla -mail %s", FALSE, FALSE}, { N_("Mozilla Mail"), "mozilla", "mozilla -mail %s", FALSE, FALSE},
{ N_("Mutt") , "mutt", "mutt %s", TRUE, FALSE }, { N_("Mutt") , "mutt", "mutt %s", TRUE, FALSE },
}; };
TerminalDescription possible_terminals[] = struct _TerminalDesciption {
{ gchar const *name;
{ N_("Gnome Terminal"), "gnome-terminal", "-x", FALSE }, gchar const *exec;
{ N_("Standard XTerminal"), "xterm", "-e", FALSE }, gchar const *exec_arg;
{ N_("NXterm"), "nxterm", "-e", FALSE }, gboolean in_path;
{ N_("RXVT"), "rxvt", "-e", FALSE }, };
{ N_("ETerm"), "Eterm", "-e", FALSE } TerminalDescription possible_terminals[] = {
{ N_("Gnome Terminal"), "gnome-terminal", "-x", FALSE },
{ N_("Standard XTerminal"), "xterm", "-e", FALSE },
{ N_("NXterm"), "nxterm", "-e", FALSE },
{ N_("RXVT"), "rxvt", "-e", FALSE },
{ N_("ETerm"), "Eterm", "-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 static void
initialize_default_applications (void) initialize_default_applications (void)
{ {
gint i; gint i;
/* This is used to only have one Evolution entry in the dropdown box GHashTable *unique;
* in case the user has installed both evo for gnome1 and for gnome2
*/
gboolean evo_already_in_list = FALSE;
text_editors = gnome_vfs_mime_get_all_applications ("text/plain"); text_editors = gnome_vfs_mime_get_all_applications ("text/plain");
for (i = 0; i < G_N_ELEMENTS (possible_browsers); i++ ) { unique = g_hash_table_new (g_str_hash, g_str_equal);
gchar *browsers = g_find_program_in_path (possible_browsers[i].executable_name); for (i = 0; i < G_N_ELEMENTS (possible_browsers); i++ )
if (browsers) { possible_browsers[i].in_path = validate (unique,
possible_browsers[i].in_path = TRUE; possible_browsers[i].name, possible_browsers[i].executable_name);
g_free(browsers); g_hash_table_destroy (unique);
}
}
for (i = 0; i < G_N_ELEMENTS (possible_mailers); i++ ) {
gchar *mailers;
gchar *exec_name = possible_mailers[i].executable_name;
mailers = g_find_program_in_path (exec_name); unique = g_hash_table_new (g_str_hash, g_str_equal);
if (mailers) { for (i = 0; i < G_N_ELEMENTS (possible_mailers); i++ )
if (g_str_has_prefix (exec_name, "evolution")) { possible_mailers[i].in_path = validate (unique,
if (evo_already_in_list) { possible_mailers[i].name, possible_mailers[i].executable_name);
g_free (mailers); g_hash_table_destroy (unique);
continue;
} else {
evo_already_in_list = TRUE;
}
}
possible_mailers[i].in_path = TRUE; unique = g_hash_table_new (g_str_hash, g_str_equal);
g_free(mailers); 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);
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);
}
}
} }
static void static void
@ -716,7 +710,6 @@ create_dialog (GConfClient *client)
static void static void
get_legacy_settings (void) get_legacy_settings (void)
{ {
} }
int int