new gnome-default-applications capplet, patch by Luca Cavalli
2006-01-16 Sebastien Bacher <seb128@debian.org> * Makefile.am: * default-applications-properties.glade: * gnome-da-capplet.c, gnome-da-capplet.h: * gnome-da-item.c, gnome-da-item.h: * gnome-da-xml.c, gnome-da-xml.h: * gnome-default-applications-properties-structs.c: * gnome-default-applications-properties.c: * gnome-default-applications-properties.glade: * gnome-default-applications.xml.in: new gnome-default-applications capplet, patch by Luca Cavalli <loopback@slackit.org> updated for the gnome-control-center build system
This commit is contained in:
parent
ccf99ec6be
commit
2f8d99ddce
13 changed files with 3215 additions and 2297 deletions
|
@ -1,3 +1,18 @@
|
|||
2006-01-16 Sebastien Bacher <seb128@debian.org>
|
||||
|
||||
* Makefile.am:
|
||||
* default-applications-properties.glade:
|
||||
* gnome-da-capplet.c, gnome-da-capplet.h:
|
||||
* gnome-da-item.c, gnome-da-item.h:
|
||||
* gnome-da-xml.c, gnome-da-xml.h:
|
||||
* gnome-default-applications-properties-structs.c:
|
||||
* gnome-default-applications-properties.c:
|
||||
* gnome-default-applications-properties.glade:
|
||||
* gnome-default-applications.xml.in:
|
||||
new gnome-default-applications capplet,
|
||||
patch by Luca Cavalli <loopback@slackit.org> updated for the
|
||||
gnome-control-center build system
|
||||
|
||||
2006-01-03 pholie <golierr@gmail.com>
|
||||
|
||||
Fixes bug #324629
|
||||
|
|
|
@ -2,7 +2,9 @@ bin_PROGRAMS = gnome-default-applications-properties
|
|||
|
||||
gnome_default_applications_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS)
|
||||
gnome_default_applications_properties_SOURCES = \
|
||||
gnome-default-applications-properties.c
|
||||
gnome-da-capplet.c gnome-da-capplet.h \
|
||||
gnome-da-xml.c gnome-da-xml.h \
|
||||
gnome-da-item.c gnome-da-item.h
|
||||
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
||||
|
@ -13,6 +15,12 @@ desktopdir = $(datadir)/applications
|
|||
Desktop_in_files = default-applications.desktop.in
|
||||
desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop)
|
||||
|
||||
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS)
|
||||
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA)
|
||||
EXTRA_DIST = $(Glade_DATA) gnome-default-applications-properties-structs.c
|
||||
xmldata_in_files = gnome-default-applications.xml.in
|
||||
xmldatadir = $(datadir)/gnome-default-applications
|
||||
xmldata_DATA = $(xmldata_in_files:.xml.in=.xml)
|
||||
@INTLTOOL_XML_RULE@
|
||||
|
||||
INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) $(DEFAULT_APPLICATIONS_CAPPLET_CFLAGS) -DGLADEDIR=\""$(gladedir)"\"
|
||||
noinst_DATA = default-applications.xml.in
|
||||
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA) $(xmldata_DATA)
|
||||
EXTRA_DIST = $(Glade_DATA) gnome-default-applications.xml.in
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
1
|
839
capplets/default-applications/gnome-da-capplet.c
Normal file
839
capplets/default-applications/gnome-da-capplet.c
Normal file
|
@ -0,0 +1,839 @@
|
|||
/*
|
||||
* Authors: Luca Cavalli <loopback@slackit.org>
|
||||
*
|
||||
* Copyright 2005-2006 Luca Cavalli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <gnome.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "gnome-da-capplet.h"
|
||||
#include "gnome-da-xml.h"
|
||||
#include "gnome-da-item.h"
|
||||
|
||||
/* TODO: add support for themeable icons also for combo boxes */
|
||||
/* TODO: it doesn't use GConfPropertyEditor, use it when/if moved to control-center */
|
||||
|
||||
enum
|
||||
{
|
||||
PIXBUF_COL,
|
||||
TEXT_COL,
|
||||
N_COLUMNS
|
||||
};
|
||||
|
||||
static void
|
||||
close_cb (GtkWidget *window, gint response, gpointer user_data)
|
||||
{
|
||||
if (response == GTK_RESPONSE_HELP) {
|
||||
GError *error = NULL;
|
||||
|
||||
/* capplet_help (GTK_WINDOW (dialog), "user-guide.xml", "goscustdoc-2"); */
|
||||
gnome_help_display_desktop (NULL, "user-guide", "user-guide.xml",
|
||||
"goscustdoc-2", &error);
|
||||
if (error != NULL) {
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
|
||||
_("Could not display help"));
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||
_("Please make sure that the applet "
|
||||
"is properly installed"));
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
}
|
||||
else {
|
||||
gtk_widget_destroy (window);
|
||||
gtk_main_quit ();
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
entry_focus_out_event_cb (GtkWidget *widget, GdkEventFocus *event, GnomeDACapplet *capplet)
|
||||
{
|
||||
const gchar *text;
|
||||
GError *error = NULL;
|
||||
|
||||
text = gtk_entry_get_text (GTK_ENTRY (widget));
|
||||
|
||||
if (widget == capplet->web_browser_command_entry) {
|
||||
gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_HTTP_EXEC, text, &error);
|
||||
}
|
||||
else if (widget == capplet->mail_reader_command_entry) {
|
||||
gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_MAILER_EXEC, text, &error);
|
||||
}
|
||||
else if (widget == capplet->terminal_command_entry) {
|
||||
gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC, text, &error);
|
||||
}
|
||||
else if (widget == capplet->terminal_exec_flag_entry) {
|
||||
gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, text, &error);
|
||||
}
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning (_("Error saving configuration: %s"), error->message);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
terminal_checkbutton_toggled_cb (GtkToggleButton *togglebutton, GnomeDACapplet *capplet)
|
||||
{
|
||||
gboolean is_active;
|
||||
GConfChangeSet *cs;
|
||||
GError *error = NULL;
|
||||
|
||||
is_active = gtk_toggle_button_get_active (togglebutton);
|
||||
|
||||
if (GTK_WIDGET (togglebutton) == capplet->web_browser_terminal_checkbutton) {
|
||||
cs = gconf_change_set_new ();
|
||||
|
||||
gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, is_active);
|
||||
gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_HTTPS_NEEDS_TERM, is_active);
|
||||
gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_UNKNOWN_NEEDS_TERM, is_active);
|
||||
gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_ABOUT_NEEDS_TERM, is_active);
|
||||
|
||||
gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
|
||||
gconf_change_set_unref (cs);
|
||||
}
|
||||
else if (GTK_WIDGET (togglebutton) == capplet->mail_reader_terminal_checkbutton) {
|
||||
gconf_client_set_bool (capplet->gconf, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, is_active, &error);
|
||||
}
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning (_("Error saving configuration: %s"), error->message);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_icon (GtkImage *image, GtkIconTheme *theme, const char *name)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
if ((pixbuf = gtk_icon_theme_load_icon (theme, name, 48, 0, NULL))) {
|
||||
gtk_image_set_from_pixbuf (image, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static struct {
|
||||
const gchar *name;
|
||||
const gchar *icon;
|
||||
} icons[] = {
|
||||
{ "web_browser_image", "web-browser" },
|
||||
{ "mail_reader_image", "stock_mail-open" },
|
||||
/* { "messenger_image", "im" },
|
||||
* { "image_image", "image-viewer" },
|
||||
* { "sound_image", "gnome-audio" },
|
||||
* { "video_image", "gnome-multimedia" },
|
||||
* { "text_image", "text-editor" }, */
|
||||
{ "terminal_image", "gnome-terminal" }
|
||||
};
|
||||
|
||||
static void
|
||||
web_radiobutton_toggled_cb (GtkToggleButton *togglebutton, GnomeDACapplet *capplet)
|
||||
{
|
||||
gint index;
|
||||
GnomeDAWebItem *item;
|
||||
gchar *command;
|
||||
GError *error = NULL;
|
||||
|
||||
index = gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->web_combo_box));
|
||||
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
item = (GnomeDAWebItem*) g_list_nth_data (capplet->web_browsers, index);
|
||||
|
||||
if (GTK_WIDGET (togglebutton) == capplet->default_radiobutton) {
|
||||
command = item->generic.command;
|
||||
}
|
||||
else if (GTK_WIDGET (togglebutton) == capplet->new_win_radiobutton) {
|
||||
command = item->win_command;
|
||||
}
|
||||
else if (GTK_WIDGET (togglebutton) == capplet->new_tab_radiobutton) {
|
||||
command = item->tab_command;
|
||||
}
|
||||
|
||||
gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_HTTP_EXEC, command, &error);
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning (_("Error saving configuration: %s"), error->message);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
web_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath *path;
|
||||
guint current_index;
|
||||
gboolean is_custom_active;
|
||||
gboolean has_net_remote;
|
||||
GnomeDAWebItem *item;
|
||||
GConfChangeSet *cs;
|
||||
GError *error = NULL;
|
||||
|
||||
gtk_combo_box_get_active_iter (combo, &iter);
|
||||
path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo), &iter);
|
||||
current_index = gtk_tree_path_get_indices (path)[0];
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
if (current_index < g_list_length (capplet->web_browsers)) {
|
||||
gchar *command;
|
||||
|
||||
item = (GnomeDAWebItem*) g_list_nth_data (capplet->web_browsers, current_index);
|
||||
has_net_remote = item->netscape_remote;
|
||||
is_custom_active = FALSE;
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton)) && has_net_remote == TRUE)
|
||||
command = item->win_command;
|
||||
else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton)) && has_net_remote == TRUE)
|
||||
command = item->tab_command;
|
||||
else
|
||||
command = item->generic.command;
|
||||
|
||||
cs = gconf_change_set_new ();
|
||||
|
||||
gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_HTTP_EXEC, command);
|
||||
gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, item->run_in_terminal);
|
||||
|
||||
gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning (_("Error saving configuration: %s"), error->message);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
gconf_change_set_unref (cs);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->web_browser_command_entry), "");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->web_browser_terminal_checkbutton), FALSE);
|
||||
}
|
||||
else {
|
||||
has_net_remote = FALSE;
|
||||
is_custom_active = TRUE;
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->web_browser_command_entry),
|
||||
gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_HTTP_EXEC, NULL));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->web_browser_terminal_checkbutton),
|
||||
gconf_client_get_bool (capplet->gconf, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, NULL));
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (capplet->default_radiobutton, has_net_remote);
|
||||
gtk_widget_set_sensitive (capplet->new_win_radiobutton, has_net_remote);
|
||||
gtk_widget_set_sensitive (capplet->new_tab_radiobutton, has_net_remote);
|
||||
|
||||
gtk_widget_set_sensitive (capplet->web_browser_command_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->web_browser_command_label, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->web_browser_terminal_checkbutton, is_custom_active);
|
||||
}
|
||||
|
||||
static void
|
||||
mail_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath *path;
|
||||
guint current_index;
|
||||
gboolean is_custom_active;
|
||||
GnomeDAMailItem *item;
|
||||
GConfChangeSet *cs;
|
||||
GError *error = NULL;
|
||||
|
||||
gtk_combo_box_get_active_iter (combo, &iter);
|
||||
path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo), &iter);
|
||||
current_index = gtk_tree_path_get_indices (path)[0];
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
if (current_index < g_list_length (capplet->mail_readers)) {
|
||||
item = (GnomeDAMailItem*) g_list_nth_data (capplet->mail_readers, current_index);
|
||||
is_custom_active = FALSE;
|
||||
|
||||
cs = gconf_change_set_new ();
|
||||
|
||||
gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_MAILER_EXEC, item->generic.command);
|
||||
gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, item->run_in_terminal);
|
||||
|
||||
gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning (_("Error saving configuration: %s"), error->message);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
gconf_change_set_unref (cs);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->mail_reader_command_entry), "");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mail_reader_terminal_checkbutton), FALSE);
|
||||
}
|
||||
else {
|
||||
is_custom_active = TRUE;
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->mail_reader_command_entry),
|
||||
gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_MAILER_EXEC, NULL));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mail_reader_terminal_checkbutton),
|
||||
gconf_client_get_bool (capplet->gconf, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, NULL));
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (capplet->mail_reader_command_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->mail_reader_command_label, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->mail_reader_terminal_checkbutton, is_custom_active);
|
||||
}
|
||||
|
||||
static void
|
||||
terminal_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath *path;
|
||||
guint current_index;
|
||||
gboolean is_custom_active;
|
||||
GnomeDATermItem *item;
|
||||
GConfChangeSet *cs;
|
||||
GError *error = NULL;
|
||||
|
||||
gtk_combo_box_get_active_iter (combo, &iter);
|
||||
path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo), &iter);
|
||||
current_index = gtk_tree_path_get_indices (path)[0];
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
if (current_index < g_list_length (capplet->terminals)) {
|
||||
item = (GnomeDATermItem*) g_list_nth_data (capplet->terminals, current_index);
|
||||
is_custom_active = FALSE;
|
||||
|
||||
cs = gconf_change_set_new ();
|
||||
|
||||
gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_TERMINAL_EXEC, item->generic.command);
|
||||
gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, item->exec_flag);
|
||||
|
||||
gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning (_("Error saving configuration: %s"), error->message);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
gconf_change_set_unref (cs);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->terminal_command_entry), "");
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->terminal_exec_flag_entry), "");
|
||||
}
|
||||
else {
|
||||
is_custom_active = TRUE;
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->terminal_command_entry),
|
||||
gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC, NULL));
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->terminal_exec_flag_entry),
|
||||
gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, NULL));
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (capplet->terminal_command_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->terminal_command_label, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->terminal_exec_flag_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->terminal_exec_flag_label, is_custom_active);
|
||||
}
|
||||
|
||||
static void
|
||||
theme_changed_cb (GtkIconTheme *theme, GladeXML *xml)
|
||||
{
|
||||
GtkWidget *icon;
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (icons); i++) {
|
||||
icon = glade_xml_get_widget (xml, icons[i].name);
|
||||
set_icon (GTK_IMAGE (icon), theme, icons[i].icon);
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
generic_item_comp (gconstpointer list_item, gconstpointer command)
|
||||
{
|
||||
return (strcmp (((GnomeDAItem *) list_item)->command, (gchar *) command));
|
||||
}
|
||||
|
||||
static gint
|
||||
web_item_comp (gconstpointer item, gconstpointer command)
|
||||
{
|
||||
gint res;
|
||||
GnomeDAWebItem *web_list_item;
|
||||
|
||||
web_list_item = (GnomeDAWebItem *) item;
|
||||
|
||||
if (strcmp (web_list_item->generic.command, (gchar *) command) == 0)
|
||||
return 0;
|
||||
|
||||
if (web_list_item->netscape_remote) {
|
||||
if (strcmp (web_list_item->tab_command, (gchar *) command) == 0)
|
||||
return 0;
|
||||
|
||||
if (strcmp (web_list_item->win_command, (gchar *) command) == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (strcmp (web_list_item->generic.command, (gchar *) command));
|
||||
}
|
||||
|
||||
static void
|
||||
web_browser_update_combo_box (GnomeDACapplet *capplet, const gchar *command)
|
||||
{
|
||||
GList *entry;
|
||||
gint index;
|
||||
gboolean is_custom_active;
|
||||
gboolean has_net_remote;
|
||||
|
||||
entry = g_list_find_custom (capplet->web_browsers, command, (GCompareFunc) web_item_comp);
|
||||
|
||||
if (entry) {
|
||||
GnomeDAWebItem *item = (GnomeDAWebItem *) entry->data;
|
||||
|
||||
index = g_list_position (capplet->web_browsers, entry);
|
||||
has_net_remote = item->netscape_remote;
|
||||
is_custom_active = FALSE;
|
||||
|
||||
if (has_net_remote) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->default_radiobutton),
|
||||
strcmp (item->generic.command, command) == 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton),
|
||||
strcmp (item->tab_command, command) == 0);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton),
|
||||
strcmp (item->win_command, command) == 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* index of 'Custom' combo box entry */
|
||||
index = g_list_length (capplet->web_browsers) + 1;
|
||||
has_net_remote = FALSE;
|
||||
is_custom_active = TRUE;
|
||||
|
||||
/* TODO: Remove when GConfPropertyEditor will be used */
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->web_browser_command_entry), command);
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (capplet->default_radiobutton, has_net_remote);
|
||||
gtk_widget_set_sensitive (capplet->new_win_radiobutton, has_net_remote);
|
||||
gtk_widget_set_sensitive (capplet->new_tab_radiobutton, has_net_remote);
|
||||
gtk_widget_set_sensitive (capplet->web_browser_command_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->web_browser_command_label, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->web_browser_terminal_checkbutton, is_custom_active);
|
||||
|
||||
if (gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->web_combo_box)) != index)
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (capplet->web_combo_box), index);
|
||||
}
|
||||
|
||||
static void
|
||||
mail_reader_update_combo_box (GnomeDACapplet *capplet, const gchar *command)
|
||||
{
|
||||
GList *entry;
|
||||
gint index;
|
||||
gboolean is_custom_active;
|
||||
|
||||
entry = g_list_find_custom (capplet->mail_readers, command, (GCompareFunc) generic_item_comp);
|
||||
|
||||
if (entry) {
|
||||
index = g_list_position (capplet->mail_readers, entry);
|
||||
is_custom_active = FALSE;
|
||||
}
|
||||
else {
|
||||
/* index of 'Custom' combo box entry */
|
||||
index = g_list_length (capplet->mail_readers) + 1;
|
||||
is_custom_active = TRUE;
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->mail_reader_command_entry), command);
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (capplet->mail_reader_command_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->mail_reader_command_label, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->mail_reader_terminal_checkbutton, is_custom_active);
|
||||
|
||||
if (gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->mail_combo_box)) != index)
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (capplet->mail_combo_box), index);
|
||||
}
|
||||
|
||||
static void
|
||||
terminal_update_combo_box (GnomeDACapplet *capplet, const gchar *command)
|
||||
{
|
||||
GList *entry;
|
||||
gint index;
|
||||
gboolean is_custom_active;
|
||||
|
||||
entry = g_list_find_custom (capplet->terminals, command, (GCompareFunc) generic_item_comp);
|
||||
|
||||
if (entry) {
|
||||
index = g_list_position (capplet->terminals, entry);
|
||||
is_custom_active = FALSE;
|
||||
}
|
||||
else {
|
||||
/* index of 'Custom' combo box entry */
|
||||
index = g_list_length (capplet->terminals) + 1;
|
||||
is_custom_active = TRUE;
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->terminal_command_entry), command);
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (capplet->terminal_command_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->terminal_command_label, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->terminal_exec_flag_entry, is_custom_active);
|
||||
gtk_widget_set_sensitive (capplet->terminal_exec_flag_label, is_custom_active);
|
||||
|
||||
if (gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->term_combo_box)) != index)
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (capplet->term_combo_box), index);
|
||||
}
|
||||
|
||||
static void
|
||||
web_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet)
|
||||
{
|
||||
GConfValue *value;
|
||||
GConfChangeSet *cs;
|
||||
GError *error = NULL;
|
||||
|
||||
g_return_if_fail (gconf_entry_get_key (entry) != NULL);
|
||||
|
||||
if (!(value = gconf_entry_get_value (entry)))
|
||||
return;
|
||||
|
||||
if (strcmp (entry->key, DEFAULT_APPS_KEY_HTTP_EXEC) == 0) {
|
||||
web_browser_update_combo_box (capplet, gconf_value_get_string (value));
|
||||
|
||||
cs = gconf_change_set_new ();
|
||||
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_HTTPS_EXEC, value);
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_UNKNOWN_EXEC, value);
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_ABOUT_EXEC, value);
|
||||
|
||||
gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning (_("Error saving configuration: %s"), error->message);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
gconf_change_set_unref (cs);
|
||||
}
|
||||
/* TODO: Remove when GConfPropertyEditor will be used */
|
||||
else if (strcmp (entry->key, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM) == 0) {
|
||||
if (GTK_WIDGET_SENSITIVE (capplet->web_browser_terminal_checkbutton)) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->web_browser_terminal_checkbutton),
|
||||
gconf_value_get_bool (value));
|
||||
}
|
||||
|
||||
cs = gconf_change_set_new ();
|
||||
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_HTTPS_NEEDS_TERM, value);
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_UNKNOWN_NEEDS_TERM, value);
|
||||
gconf_change_set_set (cs, DEFAULT_APPS_KEY_ABOUT_NEEDS_TERM, value);
|
||||
|
||||
gconf_client_commit_change_set (capplet->gconf, cs, TRUE, &error);
|
||||
|
||||
if (error != NULL) {
|
||||
g_warning (_("Error saving configuration: %s"), error->message);
|
||||
g_error_free (error);
|
||||
error = NULL;
|
||||
}
|
||||
|
||||
gconf_change_set_unref (cs);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mail_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet)
|
||||
{
|
||||
GConfValue *value;
|
||||
GList *mail_entry;
|
||||
gint index;
|
||||
|
||||
g_return_if_fail (gconf_entry_get_key (entry) != NULL);
|
||||
|
||||
if (!(value = gconf_entry_get_value (entry)))
|
||||
return;
|
||||
|
||||
if (strcmp (entry->key, DEFAULT_APPS_KEY_MAILER_EXEC) == 0) {
|
||||
mail_reader_update_combo_box (capplet, gconf_value_get_string (value));
|
||||
}
|
||||
/* TODO: Remove when GConfPropertyEditor will be used */
|
||||
else if (strcmp (entry->key, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM) == 0) {
|
||||
if (GTK_WIDGET_SENSITIVE (capplet->mail_reader_terminal_checkbutton)) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mail_reader_terminal_checkbutton),
|
||||
gconf_value_get_bool (value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
term_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet)
|
||||
{
|
||||
GConfValue *value;
|
||||
GList *terminal_entry;
|
||||
gint index;
|
||||
|
||||
g_return_if_fail (gconf_entry_get_key (entry) != NULL);
|
||||
|
||||
if (!(value = gconf_entry_get_value (entry)))
|
||||
return;
|
||||
|
||||
if (strcmp (entry->key, DEFAULT_APPS_KEY_TERMINAL_EXEC) == 0) {
|
||||
terminal_update_combo_box (capplet, gconf_value_get_string (value));
|
||||
}
|
||||
/* TODO: Remove when GConfPropertyEditor will be used */
|
||||
else if (strcmp (entry->key, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG) == 0) {
|
||||
if (GTK_WIDGET_SENSITIVE (capplet->terminal_exec_flag_entry)) {
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->terminal_exec_flag_entry), gconf_value_get_string (value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_separator (GtkTreeModel *model, GtkTreeIter *iter, gpointer sep_index)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
gboolean result;
|
||||
|
||||
path = gtk_tree_model_get_path (model, iter);
|
||||
result = gtk_tree_path_get_indices (path)[0] == GPOINTER_TO_INT (sep_index);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
fill_combo_box (GtkIconTheme *theme, GtkComboBox *combo_box, GList *app_list)
|
||||
{
|
||||
GList *entry;
|
||||
GtkTreeModel *model;
|
||||
GtkCellRenderer *renderer;
|
||||
GtkTreeIter iter;
|
||||
GdkPixbuf *pixbuf;
|
||||
gchar *label;
|
||||
|
||||
gtk_combo_box_set_row_separator_func (combo_box, is_separator,
|
||||
GINT_TO_POINTER (g_list_length (app_list)), NULL);
|
||||
|
||||
model = GTK_TREE_MODEL (gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING));
|
||||
gtk_combo_box_set_model (combo_box, model);
|
||||
|
||||
renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
|
||||
/* not all cells have a pixbuf, this prevents the combo box to shrink */
|
||||
gtk_cell_renderer_set_fixed_size (renderer, -1, 22);
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, FALSE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
|
||||
"pixbuf", PIXBUF_COL,
|
||||
NULL);
|
||||
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
|
||||
"text", TEXT_COL,
|
||||
NULL);
|
||||
|
||||
for (entry = app_list; entry != NULL; entry = g_list_next (entry)) {
|
||||
GnomeDAItem *item;
|
||||
item = (GnomeDAItem *) entry->data;
|
||||
|
||||
pixbuf = gtk_icon_theme_load_icon (theme, item->icon_name, 22, 0, NULL);
|
||||
label = g_strdup (item->name);
|
||||
|
||||
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
||||
PIXBUF_COL, pixbuf,
|
||||
TEXT_COL, label,
|
||||
-1);
|
||||
|
||||
if (pixbuf)
|
||||
g_object_unref (pixbuf);
|
||||
g_free (label);
|
||||
}
|
||||
|
||||
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter, -1);
|
||||
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
||||
PIXBUF_COL, NULL,
|
||||
TEXT_COL, _("Custom"),
|
||||
-1);
|
||||
}
|
||||
|
||||
static void
|
||||
show_dialog (GnomeDACapplet *capplet)
|
||||
{
|
||||
GConfValue *value;
|
||||
GtkIconTheme *theme;
|
||||
gint i;
|
||||
|
||||
if (g_file_test (GLADEDIR "gnome-default-applications.glade", G_FILE_TEST_EXISTS) != FALSE) {
|
||||
capplet->xml = glade_xml_new (GLADEDIR "gnome-default-applications-properties.glade", NULL, PACKAGE);
|
||||
}
|
||||
else {
|
||||
capplet->xml = glade_xml_new ("./gnome-default-applications-properties.glade", NULL, PACKAGE);
|
||||
}
|
||||
|
||||
if (capplet->xml == NULL) {
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
|
||||
_("Could not load the main interface"));
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||
_("Please make sure that the applet "
|
||||
"is properly installed"));
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
capplet->window = glade_xml_get_widget (capplet->xml, "preferred_apps_dialog");
|
||||
g_signal_connect (capplet->window, "response", G_CALLBACK (close_cb), NULL);
|
||||
|
||||
theme = gtk_icon_theme_get_default ();
|
||||
g_signal_connect (theme, "changed", G_CALLBACK (theme_changed_cb), capplet->xml);
|
||||
theme_changed_cb (theme, capplet->xml);
|
||||
|
||||
capplet->web_browser_command_entry = glade_xml_get_widget (capplet->xml, "web_browser_command_entry");
|
||||
capplet->web_browser_command_label = glade_xml_get_widget (capplet->xml, "web_browser_command_label");
|
||||
capplet->web_browser_terminal_checkbutton = glade_xml_get_widget (capplet->xml, "web_browser_terminal_checkbutton");
|
||||
capplet->default_radiobutton = glade_xml_get_widget (capplet->xml, "web_browser_default_radiobutton");
|
||||
capplet->new_win_radiobutton = glade_xml_get_widget (capplet->xml, "web_browser_new_win_radiobutton");
|
||||
capplet->new_tab_radiobutton = glade_xml_get_widget (capplet->xml, "web_browser_new_tab_radiobutton");
|
||||
|
||||
capplet->mail_reader_command_entry = glade_xml_get_widget (capplet->xml, "mail_reader_command_entry");
|
||||
capplet->mail_reader_command_label = glade_xml_get_widget (capplet->xml, "mail_reader_command_label");
|
||||
capplet->mail_reader_terminal_checkbutton = glade_xml_get_widget (capplet->xml, "mail_reader_terminal_checkbutton");
|
||||
|
||||
capplet->terminal_command_entry = glade_xml_get_widget (capplet->xml, "terminal_command_entry");
|
||||
capplet->terminal_command_label = glade_xml_get_widget (capplet->xml, "terminal_command_label");
|
||||
capplet->terminal_exec_flag_entry = glade_xml_get_widget (capplet->xml, "terminal_exec_flag_entry");
|
||||
capplet->terminal_exec_flag_label = glade_xml_get_widget (capplet->xml, "terminal_exec_flag_label");
|
||||
|
||||
capplet->web_combo_box = glade_xml_get_widget (capplet->xml, "web_browser_combobox");
|
||||
capplet->mail_combo_box = glade_xml_get_widget (capplet->xml, "mail_reader_combobox");
|
||||
capplet->term_combo_box = glade_xml_get_widget (capplet->xml, "terminal_combobox");
|
||||
|
||||
fill_combo_box (theme, GTK_COMBO_BOX (capplet->web_combo_box), capplet->web_browsers);
|
||||
fill_combo_box (theme, GTK_COMBO_BOX (capplet->mail_combo_box), capplet->mail_readers);
|
||||
fill_combo_box (theme, GTK_COMBO_BOX (capplet->term_combo_box), capplet->terminals);
|
||||
|
||||
/* update ui to gconf content */
|
||||
value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_HTTP_EXEC, NULL);
|
||||
web_browser_update_combo_box (capplet, gconf_value_get_string (value));
|
||||
|
||||
value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, NULL);
|
||||
if (GTK_WIDGET_SENSITIVE (capplet->web_browser_terminal_checkbutton)) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->web_browser_terminal_checkbutton),
|
||||
gconf_value_get_bool (value));
|
||||
}
|
||||
|
||||
value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MAILER_EXEC, NULL);
|
||||
mail_reader_update_combo_box (capplet, gconf_value_get_string (value));
|
||||
|
||||
value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, NULL);
|
||||
if (GTK_WIDGET_SENSITIVE (capplet->mail_reader_terminal_checkbutton)) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mail_reader_terminal_checkbutton),
|
||||
gconf_value_get_bool (value));
|
||||
}
|
||||
|
||||
value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC, NULL);
|
||||
terminal_update_combo_box (capplet, gconf_value_get_string (value));
|
||||
|
||||
value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, NULL);
|
||||
if (GTK_WIDGET_SENSITIVE (capplet->terminal_exec_flag_entry)) {
|
||||
gtk_entry_set_text (GTK_ENTRY (capplet->terminal_exec_flag_entry), gconf_value_get_string (value));
|
||||
}
|
||||
|
||||
g_signal_connect (capplet->web_combo_box, "changed", G_CALLBACK (web_combo_changed_cb), capplet);
|
||||
g_signal_connect (capplet->mail_combo_box, "changed", G_CALLBACK (mail_combo_changed_cb), capplet);
|
||||
g_signal_connect (capplet->term_combo_box, "changed", G_CALLBACK (terminal_combo_changed_cb), capplet);
|
||||
|
||||
/* TODO: Remove when GConfPropertyEditor will be used */
|
||||
g_signal_connect (capplet->web_browser_terminal_checkbutton, "toggled",
|
||||
G_CALLBACK (terminal_checkbutton_toggled_cb), capplet);
|
||||
g_signal_connect (capplet->mail_reader_terminal_checkbutton, "toggled",
|
||||
G_CALLBACK (terminal_checkbutton_toggled_cb), capplet);
|
||||
|
||||
/* TODO: Remove when GConfPropertyEditor will be used */
|
||||
g_signal_connect (capplet->web_browser_command_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet);
|
||||
g_signal_connect (capplet->mail_reader_command_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet);
|
||||
g_signal_connect (capplet->terminal_command_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet);
|
||||
g_signal_connect (capplet->terminal_exec_flag_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet);
|
||||
|
||||
g_signal_connect (capplet->default_radiobutton, "toggled", G_CALLBACK (web_radiobutton_toggled_cb), capplet);
|
||||
g_signal_connect (capplet->new_win_radiobutton, "toggled", G_CALLBACK (web_radiobutton_toggled_cb), capplet);
|
||||
g_signal_connect (capplet->new_tab_radiobutton, "toggled", G_CALLBACK (web_radiobutton_toggled_cb), capplet);
|
||||
|
||||
/* capplet_set_icon (GTK_WINDOW (main_dlg), "gnome-settings-default-applications"); */
|
||||
gtk_window_set_icon_name (GTK_WINDOW (capplet->window),
|
||||
"gnome-settings-default-applications");
|
||||
|
||||
gtk_widget_show (capplet->window);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GnomeDACapplet *capplet;
|
||||
|
||||
capplet = g_new0 (GnomeDACapplet, 1);
|
||||
|
||||
gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, argc, argv,
|
||||
GNOME_PARAM_NONE);
|
||||
|
||||
glade_init ();
|
||||
|
||||
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
|
||||
bind_textdomain_codeset (PACKAGE, "UTF-8");
|
||||
textdomain (PACKAGE);
|
||||
|
||||
capplet->gconf = gconf_client_get_default ();
|
||||
|
||||
gconf_client_add_dir (capplet->gconf, "/desktop/gnome/applications/browser", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
gconf_client_add_dir (capplet->gconf, "/desktop/gnome/applications/terminal", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
gconf_client_add_dir (capplet->gconf, "/desktop/gnome/url-handlers", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
|
||||
gconf_client_notify_add (capplet->gconf, DEFAULT_APPS_KEY_HTTP_PATH,
|
||||
(GConfClientNotifyFunc) web_gconf_changed_cb,
|
||||
capplet, NULL, NULL);
|
||||
gconf_client_notify_add (capplet->gconf, DEFAULT_APPS_KEY_MAILER_PATH,
|
||||
(GConfClientNotifyFunc) mail_gconf_changed_cb,
|
||||
capplet, NULL, NULL);
|
||||
gconf_client_notify_add (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_PATH,
|
||||
(GConfClientNotifyFunc) term_gconf_changed_cb,
|
||||
capplet, NULL, NULL);
|
||||
|
||||
gnome_da_xml_load_list (capplet);
|
||||
|
||||
show_dialog (capplet);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
g_object_unref (capplet->gconf);
|
||||
g_object_unref (capplet->xml);
|
||||
|
||||
return 0;
|
||||
}
|
90
capplets/default-applications/gnome-da-capplet.h
Normal file
90
capplets/default-applications/gnome-da-capplet.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* Authors: Luca Cavalli <loopback@slackit.org>
|
||||
*
|
||||
* Copyright 2005-2006 Luca Cavalli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GNOME_DA_CAPPLET_H_
|
||||
#define _GNOME_DA_CAPPLET_H_
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glade/glade.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
|
||||
// Set http, https, about, and unknown keys to the chosen web browser.
|
||||
#define DEFAULT_APPS_KEY_HTTP_PATH "/desktop/gnome/url-handlers/http"
|
||||
#define DEFAULT_APPS_KEY_HTTP_NEEDS_TERM DEFAULT_APPS_KEY_HTTP_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_HTTP_EXEC DEFAULT_APPS_KEY_HTTP_PATH"/command"
|
||||
|
||||
#define DEFAULT_APPS_KEY_HTTPS_PATH "/desktop/gnome/url-handlers/https"
|
||||
#define DEFAULT_APPS_KEY_HTTPS_NEEDS_TERM DEFAULT_APPS_KEY_HTTPS_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_HTTPS_EXEC DEFAULT_APPS_KEY_HTTPS_PATH"/command"
|
||||
|
||||
// While gnome-vfs2 does not use the "unknown" key, several widespread apps like htmlview
|
||||
// have read it for the past few years. Setting it should not hurt.
|
||||
#define DEFAULT_APPS_KEY_UNKNOWN_PATH "/desktop/gnome/url-handlers/unknown"
|
||||
#define DEFAULT_APPS_KEY_UNKNOWN_NEEDS_TERM DEFAULT_APPS_KEY_UNKNOWN_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_UNKNOWN_EXEC DEFAULT_APPS_KEY_UNKNOWN_PATH"/command"
|
||||
|
||||
// about:blank and other about: URI's are commonly used by browsers too
|
||||
#define DEFAULT_APPS_KEY_ABOUT_PATH "/desktop/gnome/url-handlers/about"
|
||||
#define DEFAULT_APPS_KEY_ABOUT_NEEDS_TERM DEFAULT_APPS_KEY_ABOUT_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_ABOUT_EXEC DEFAULT_APPS_KEY_ABOUT_PATH"/command"
|
||||
|
||||
#define DEFAULT_APPS_KEY_MAILER_PATH "/desktop/gnome/url-handlers/mailto"
|
||||
#define DEFAULT_APPS_KEY_MAILER_NEEDS_TERM DEFAULT_APPS_KEY_MAILER_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_MAILER_EXEC DEFAULT_APPS_KEY_MAILER_PATH"/command"
|
||||
|
||||
#define DEFAULT_APPS_KEY_TERMINAL_PATH "/desktop/gnome/applications/terminal"
|
||||
#define DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG DEFAULT_APPS_KEY_TERMINAL_PATH"/exec_arg"
|
||||
#define DEFAULT_APPS_KEY_TERMINAL_EXEC DEFAULT_APPS_KEY_TERMINAL_PATH"/exec"
|
||||
|
||||
typedef struct _GnomeDACapplet GnomeDACapplet;
|
||||
|
||||
struct _GnomeDACapplet {
|
||||
GladeXML *xml;
|
||||
|
||||
GtkWidget *window;
|
||||
|
||||
GtkWidget *web_combo_box;
|
||||
GtkWidget *mail_combo_box;
|
||||
GtkWidget *term_combo_box;
|
||||
|
||||
GtkWidget *web_browser_command_entry;
|
||||
GtkWidget *web_browser_command_label;
|
||||
GtkWidget *web_browser_terminal_checkbutton;
|
||||
GtkWidget *default_radiobutton;
|
||||
GtkWidget *new_win_radiobutton;
|
||||
GtkWidget *new_tab_radiobutton;
|
||||
|
||||
GtkWidget *mail_reader_command_entry;
|
||||
GtkWidget *mail_reader_command_label;
|
||||
GtkWidget *mail_reader_terminal_checkbutton;
|
||||
|
||||
GtkWidget *terminal_command_entry;
|
||||
GtkWidget *terminal_command_label;
|
||||
GtkWidget *terminal_exec_flag_entry;
|
||||
GtkWidget *terminal_exec_flag_label;
|
||||
|
||||
GConfClient *gconf;
|
||||
|
||||
GList *web_browsers;
|
||||
GList *mail_readers;
|
||||
GList *terminals;
|
||||
};
|
||||
|
||||
#endif
|
96
capplets/default-applications/gnome-da-item.c
Normal file
96
capplets/default-applications/gnome-da-item.c
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Authors: Luca Cavalli <loopback@slackit.org>
|
||||
*
|
||||
* Copyright 2005-2006 Luca Cavalli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "gnome-da-capplet.h"
|
||||
#include "gnome-da-item.h"
|
||||
|
||||
GnomeDAWebItem*
|
||||
gnome_da_web_item_new (void)
|
||||
{
|
||||
GnomeDAWebItem *item = NULL;
|
||||
|
||||
item = g_new0 (GnomeDAWebItem, 1);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
GnomeDAMailItem*
|
||||
gnome_da_mail_item_new (void)
|
||||
{
|
||||
GnomeDAMailItem *item = NULL;
|
||||
|
||||
item = g_new0 (GnomeDAMailItem, 1);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
GnomeDATermItem*
|
||||
gnome_da_term_item_new (void)
|
||||
{
|
||||
GnomeDATermItem *item = NULL;
|
||||
|
||||
item = g_new0 (GnomeDATermItem, 1);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
void
|
||||
gnome_da_web_item_free (GnomeDAWebItem *item)
|
||||
{
|
||||
g_return_if_fail (item != NULL);
|
||||
|
||||
g_free (item->generic.name);
|
||||
g_free (item->generic.executable);
|
||||
g_free (item->generic.command);
|
||||
g_free (item->generic.icon_name);
|
||||
|
||||
g_free (item->tab_command);
|
||||
g_free (item->win_command);
|
||||
|
||||
g_free (item);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_da_mail_item_free (GnomeDAMailItem *item)
|
||||
{
|
||||
g_return_if_fail (item != NULL);
|
||||
|
||||
g_free (item->generic.name);
|
||||
g_free (item->generic.executable);
|
||||
g_free (item->generic.command);
|
||||
g_free (item->generic.icon_name);
|
||||
|
||||
g_free (item);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_da_term_item_free (GnomeDATermItem *item)
|
||||
{
|
||||
g_return_if_fail (item != NULL);
|
||||
|
||||
g_free (item->generic.name);
|
||||
g_free (item->generic.executable);
|
||||
g_free (item->generic.command);
|
||||
g_free (item->generic.icon_name);
|
||||
|
||||
g_free (item->exec_flag);
|
||||
|
||||
g_free (item);
|
||||
}
|
64
capplets/default-applications/gnome-da-item.h
Normal file
64
capplets/default-applications/gnome-da-item.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Authors: Luca Cavalli <loopback@slackit.org>
|
||||
*
|
||||
* Copyright 2005-2006 Luca Cavalli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GNOME_DA_ITEM_H_
|
||||
#define _GNOME_DA_ITEM_H_
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct _GnomeDAItem GnomeDAItem;
|
||||
|
||||
typedef struct _GnomeDAWebItem GnomeDAWebItem;
|
||||
typedef struct _GnomeDAMailItem GnomeDAMailItem;
|
||||
typedef struct _GnomeDATermItem GnomeDATermItem;
|
||||
|
||||
struct _GnomeDAItem {
|
||||
gchar *name;
|
||||
gchar *executable;
|
||||
gchar *command;
|
||||
gchar *icon_name;
|
||||
};
|
||||
|
||||
struct _GnomeDAWebItem {
|
||||
GnomeDAItem generic;
|
||||
gboolean run_in_terminal;
|
||||
gboolean netscape_remote;
|
||||
gchar *tab_command;
|
||||
gchar *win_command;
|
||||
};
|
||||
|
||||
struct _GnomeDAMailItem {
|
||||
GnomeDAItem generic;
|
||||
gboolean run_in_terminal;
|
||||
};
|
||||
|
||||
struct _GnomeDATermItem {
|
||||
GnomeDAItem generic;
|
||||
gchar *exec_flag;
|
||||
};
|
||||
|
||||
GnomeDAWebItem* gnome_da_web_item_new (void);
|
||||
GnomeDAMailItem* gnome_da_mail_item_new (void);
|
||||
GnomeDATermItem* gnome_da_term_item_new (void);
|
||||
void gnome_da_web_item_free (GnomeDAWebItem *item);
|
||||
void gnome_da_mail_item_free (GnomeDAMailItem *item);
|
||||
void gnome_da_term_item_free (GnomeDATermItem *item);
|
||||
|
||||
#endif
|
208
capplets/default-applications/gnome-da-xml.c
Normal file
208
capplets/default-applications/gnome-da-xml.c
Normal file
|
@ -0,0 +1,208 @@
|
|||
/*
|
||||
* Authors: Luca Cavalli <loopback@slackit.org>
|
||||
*
|
||||
* Copyright 2005-2006 Luca Cavalli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#include "gnome-da-capplet.h"
|
||||
#include "gnome-da-xml.h"
|
||||
#include "gnome-da-item.h"
|
||||
|
||||
|
||||
static gboolean
|
||||
gnome_da_xml_get_bool (const xmlNode *parent, const gchar *val_name)
|
||||
{
|
||||
xmlNode *element;
|
||||
gboolean ret_val = FALSE;
|
||||
xmlChar *xml_val_name;
|
||||
gint len;
|
||||
|
||||
g_return_val_if_fail (parent != NULL, FALSE);
|
||||
g_return_val_if_fail (parent->children != NULL, ret_val);
|
||||
g_return_val_if_fail (val_name != NULL, FALSE);
|
||||
|
||||
xml_val_name = xmlCharStrdup (val_name);
|
||||
len = xmlStrlen (xml_val_name);
|
||||
|
||||
for (element = parent->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, xml_val_name, len)) {
|
||||
xmlChar *cont = xmlNodeGetContent (element);
|
||||
|
||||
if (!xmlStrcasecmp (cont, "true") || !xmlStrcasecmp (cont, "1"))
|
||||
ret_val = TRUE;
|
||||
else
|
||||
ret_val = FALSE;
|
||||
|
||||
xmlFree (cont);
|
||||
}
|
||||
}
|
||||
|
||||
xmlFree (xml_val_name);
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
static gchar*
|
||||
gnome_da_xml_get_string (const xmlNode *parent, const gchar *val_name)
|
||||
{
|
||||
xmlNode *element;
|
||||
gchar *ret_val = NULL;
|
||||
xmlChar *xml_val_name;
|
||||
gint len;
|
||||
|
||||
g_return_val_if_fail (parent != NULL, ret_val);
|
||||
g_return_val_if_fail (parent->children != NULL, ret_val);
|
||||
g_return_val_if_fail (val_name != NULL, ret_val);
|
||||
|
||||
xml_val_name = xmlCharStrdup (val_name);
|
||||
len = xmlStrlen (xml_val_name);
|
||||
|
||||
for (element = parent->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, xml_val_name, len))
|
||||
ret_val = (gchar *) xmlNodeGetContent (element);
|
||||
}
|
||||
|
||||
xmlFree (xml_val_name);
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_executable_valid (gchar *executable)
|
||||
{
|
||||
gchar *path;
|
||||
|
||||
path = g_find_program_in_path (executable);
|
||||
|
||||
if (path) {
|
||||
g_free (path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_da_xml_load_xml (GnomeDACapplet *capplet, const gchar * filename)
|
||||
{
|
||||
xmlDoc *xml_doc;
|
||||
xmlNode *root, *section, *element, *value;
|
||||
GnomeDAWebItem *web_item;
|
||||
GnomeDAMailItem *mail_item;
|
||||
GnomeDATermItem *term_item;
|
||||
|
||||
gint i;
|
||||
|
||||
xml_doc = xmlParseFile (filename);
|
||||
|
||||
if (!xml_doc)
|
||||
return;
|
||||
|
||||
root = xmlDocGetRootElement (xml_doc);
|
||||
|
||||
for (section = root->children; section != NULL; section = section->next) {
|
||||
if (!xmlStrncmp (section->name, "web-browsers", 12)) {
|
||||
for (element = section->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, "web-browser", 11)) {
|
||||
if (is_executable_valid (gnome_da_xml_get_string (element, "executable"))) {
|
||||
web_item = gnome_da_web_item_new ();
|
||||
|
||||
web_item->generic.name = gnome_da_xml_get_string (element, "name");
|
||||
web_item->generic.executable = gnome_da_xml_get_string (element, "executable");
|
||||
web_item->generic.command = gnome_da_xml_get_string (element, "command");
|
||||
web_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
|
||||
|
||||
web_item->run_in_terminal = gnome_da_xml_get_bool (element, "run-in-terminal");
|
||||
web_item->netscape_remote = gnome_da_xml_get_bool (element, "netscape-remote");
|
||||
if (web_item->netscape_remote) {
|
||||
web_item->tab_command = gnome_da_xml_get_string (element, "tab-command");
|
||||
web_item->win_command = gnome_da_xml_get_string (element, "win-command");
|
||||
}
|
||||
|
||||
capplet->web_browsers = g_list_append (capplet->web_browsers, web_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!xmlStrncmp (section->name, "mail-readers", 12)) {
|
||||
for (element = section->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, "mail-reader", 11)) {
|
||||
if (is_executable_valid (gnome_da_xml_get_string (element, "executable"))) {
|
||||
mail_item = gnome_da_mail_item_new ();
|
||||
|
||||
mail_item->generic.name = gnome_da_xml_get_string (element, "name");
|
||||
mail_item->generic.executable = gnome_da_xml_get_string (element, "executable");
|
||||
mail_item->generic.command = gnome_da_xml_get_string (element, "command");
|
||||
mail_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
|
||||
|
||||
mail_item->run_in_terminal = gnome_da_xml_get_bool (element, "run-in-terminal");
|
||||
|
||||
capplet->mail_readers = g_list_append (capplet->mail_readers, mail_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!xmlStrncmp (section->name, "terminals", 9)) {
|
||||
for (element = section->children; element != NULL; element = element->next) {
|
||||
if (!xmlStrncmp (element->name, "terminal", 8)) {
|
||||
if (is_executable_valid (gnome_da_xml_get_string (element, "executable"))) {
|
||||
term_item = gnome_da_term_item_new ();
|
||||
|
||||
term_item->generic.name = gnome_da_xml_get_string (element, "name");
|
||||
term_item->generic.executable = gnome_da_xml_get_string (element, "executable");
|
||||
term_item->generic.command = gnome_da_xml_get_string (element, "command");
|
||||
term_item->generic.icon_name = gnome_da_xml_get_string (element, "icon-name");
|
||||
|
||||
term_item->exec_flag = gnome_da_xml_get_string (element, "exec-flag");
|
||||
|
||||
capplet->terminals = g_list_append (capplet->terminals, term_item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xmlFreeDoc (xml_doc);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_da_xml_load_list (GnomeDACapplet *capplet)
|
||||
{
|
||||
const char * const *xdg_dirs;
|
||||
gint i;
|
||||
|
||||
xdg_dirs = g_get_system_data_dirs ();
|
||||
if (xdg_dirs == NULL)
|
||||
return;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (xdg_dirs); i++) {
|
||||
gchar *filename;
|
||||
|
||||
filename = g_build_filename (xdg_dirs[i],
|
||||
"gnome-default-applications",
|
||||
"gnome-default-applications.xml",
|
||||
NULL);
|
||||
|
||||
if (g_file_test (filename, G_FILE_TEST_EXISTS))
|
||||
gnome_da_xml_load_xml (capplet, filename);
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
if (capplet->web_browsers == NULL)
|
||||
gnome_da_xml_load_xml (capplet, "./gnome-default-applications.xml");
|
||||
}
|
26
capplets/default-applications/gnome-da-xml.h
Normal file
26
capplets/default-applications/gnome-da-xml.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Authors: Luca Cavalli <loopback@slackit.org>
|
||||
*
|
||||
* Copyright 2005-2006 Luca Cavalli
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of version 2 of the GNU General Public License
|
||||
* as published by the Free Software Foundation
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GNOME_DA_XML_H_
|
||||
#define _GNOME_DA_XML_H_
|
||||
|
||||
void gnome_da_xml_load_list (GnomeDACapplet *capplet);
|
||||
|
||||
#endif
|
|
@ -1,68 +0,0 @@
|
|||
struct _BrowserDescription {
|
||||
gchar const *name;
|
||||
gchar const *executable_name;
|
||||
gchar const *command;
|
||||
gboolean needs_term;
|
||||
gboolean in_path;
|
||||
};
|
||||
static BrowserDescription possible_browsers[] = {
|
||||
{ N_("Debian Sensible Browser"), "sensible-browser", "sensible-browser %s", FALSE, FALSE },
|
||||
{ N_("Epiphany"), "epiphany", "epiphany %s", FALSE, FALSE },
|
||||
{ N_("Galeon"), "galeon", "galeon %s", FALSE, FALSE },
|
||||
{ N_("Encompass"), "encompass", "encompass %s", FALSE, FALSE },
|
||||
{ N_("Firebird"), "mozilla-firebird", "mozilla-firebird %s", FALSE, FALSE },
|
||||
{ N_("Firefox"), "firefox", "firefox %s", FALSE, FALSE },
|
||||
{ N_("Mozilla"), "mozilla-1.6", "mozilla-1.6 %s", FALSE, FALSE },
|
||||
{ N_("Mozilla"), "mozilla", "mozilla %s", FALSE, FALSE },
|
||||
{ N_("Netscape Communicator"), "netscape", "netscape %s", FALSE, FALSE },
|
||||
{ N_("Konqueror"), "konqueror", "konqueror %s", FALSE, FALSE },
|
||||
{ N_("Opera"), "opera", "opera %s", FALSE, FALSE },
|
||||
{ N_("Opera (open in new tab)"), "opera", "opera -newpage %s", FALSE, FALSE },
|
||||
{ N_("W3M Text Browser"), "w3m", "w3m %s", TRUE, FALSE },
|
||||
{ N_("Lynx Text Browser"), "lynx", "lynx %s", TRUE, FALSE },
|
||||
{ N_("Links Text Browser") , "links", "links %s", TRUE, FALSE }
|
||||
};
|
||||
|
||||
struct _MailerDescription {
|
||||
gchar const *name;
|
||||
gchar const *executable_name;
|
||||
gchar const *command;
|
||||
gboolean needs_term;
|
||||
gboolean in_path;
|
||||
};
|
||||
static 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
|
||||
*/
|
||||
{ N_("Evolution Mail Reader"), "evolution-2.4", "evolution-2.4 %s", FALSE, FALSE, },
|
||||
{ N_("Evolution Mail Reader"), "evolution-2.2", "evolution-2.2 %s", FALSE, FALSE, },
|
||||
{ N_("Evolution Mail Reader"), "evolution-2.0", "evolution-2.0 %s", FALSE, FALSE, },
|
||||
{ N_("Evolution Mail Reader"), "evolution-1.6", "evolution-1.6 %s", FALSE, FALSE, },
|
||||
{ N_("Evolution Mail Reader"), "evolution-1.5", "evolution-1.5 %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_("Balsa"), "balsa", "balsa -m %s", FALSE, FALSE },
|
||||
{ N_("KMail"), "kmail", "kmail %s", FALSE, FALSE },
|
||||
{ N_("Thunderbird"), "thunderbird", "thunderbird -mail %s", FALSE, FALSE},
|
||||
{ N_("Thunderbird"), "mozilla-thunderbird", "mozilla-thunderbird -mail %s", FALSE, FALSE},
|
||||
{ N_("Mozilla Mail"), "mozilla", "mozilla -mail %s", FALSE, FALSE},
|
||||
{ N_("Mutt") , "mutt", "mutt %s", TRUE, FALSE },
|
||||
{ N_("Sylpheed-Claws") , "sylpheed-claws", "sylpheed-claws --compose %s", FALSE, FALSE }
|
||||
};
|
||||
|
||||
struct _TerminalDesciption {
|
||||
gchar const *name;
|
||||
gchar const *exec;
|
||||
gchar const *exec_arg;
|
||||
gboolean in_path;
|
||||
};
|
||||
static TerminalDescription possible_terminals[] = {
|
||||
{ N_("Debian Terminal Emulator"), "x-terminal-emulator", "-e", FALSE },
|
||||
{ N_("GNOME Terminal"), "gnome-terminal", "-x", FALSE },
|
||||
{ N_("Standard XTerminal"), "xterm", "-e", FALSE },
|
||||
{ N_("NXterm"), "nxterm", "-e", FALSE },
|
||||
{ N_("RXVT"), "rxvt", "-e", FALSE },
|
||||
{ N_("aterm"), "aterm", "-e", FALSE },
|
||||
{ N_("ETerm"), "Eterm", "-e", FALSE }
|
||||
};
|
|
@ -1,794 +0,0 @@
|
|||
/* -*- mode: c; style: linux -*- */
|
||||
|
||||
/* mouse-properties-capplet.c
|
||||
* Copyright (C) 2001 Red Hat, Inc.
|
||||
* Copyright (C) 2001 Ximian, Inc.
|
||||
*
|
||||
* Written by: Jonathon Blandford <jrb@redhat.com>,
|
||||
* Bradford Hovinen <hovinen@ximian.com>,
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <gnome.h>
|
||||
#include <gconf/gconf-client.h>
|
||||
#include <glade/glade.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
|
||||
#include <libgnomevfs/gnome-vfs-application-registry.h>
|
||||
|
||||
#include "capplet-util.h"
|
||||
#include "gconf-property-editor.h"
|
||||
|
||||
// Set http, https, about, and unknown keys to the chosen web browser.
|
||||
#define DEFAULT_APPS_KEY_HTTP_PATH "/desktop/gnome/url-handlers/http"
|
||||
#define DEFAULT_APPS_KEY_HTTP_NEEDS_TERM DEFAULT_APPS_KEY_HTTP_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_HTTP_EXEC DEFAULT_APPS_KEY_HTTP_PATH"/command"
|
||||
|
||||
#define DEFAULT_APPS_KEY_HTTPS_PATH "/desktop/gnome/url-handlers/https"
|
||||
#define DEFAULT_APPS_KEY_HTTPS_NEEDS_TERM DEFAULT_APPS_KEY_HTTPS_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_HTTPS_EXEC DEFAULT_APPS_KEY_HTTPS_PATH"/command"
|
||||
|
||||
// While gnome-vfs2 does not use the "unknown" key, several widespread apps like htmlview
|
||||
// have read it for the past few years. Setting it should not hurt.
|
||||
#define DEFAULT_APPS_KEY_UNKNOWN_PATH "/desktop/gnome/url-handlers/unknown"
|
||||
#define DEFAULT_APPS_KEY_UNKNOWN_NEEDS_TERM DEFAULT_APPS_KEY_UNKNOWN_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_UNKNOWN_EXEC DEFAULT_APPS_KEY_UNKNOWN_PATH"/command"
|
||||
|
||||
// about:blank and other about: URI's are commonly used by browsers too
|
||||
#define DEFAULT_APPS_KEY_ABOUT_PATH "/desktop/gnome/url-handlers/about"
|
||||
#define DEFAULT_APPS_KEY_ABOUT_NEEDS_TERM DEFAULT_APPS_KEY_ABOUT_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_ABOUT_EXEC DEFAULT_APPS_KEY_ABOUT_PATH"/command"
|
||||
|
||||
#define DEFAULT_APPS_KEY_MAILER_PATH "/desktop/gnome/url-handlers/mailto"
|
||||
#define DEFAULT_APPS_KEY_MAILER_NEEDS_TERM DEFAULT_APPS_KEY_MAILER_PATH"/needs_terminal"
|
||||
#define DEFAULT_APPS_KEY_MAILER_EXEC DEFAULT_APPS_KEY_MAILER_PATH"/command"
|
||||
|
||||
#define DEFAULT_APPS_KEY_TERMINAL_PATH "/desktop/gnome/applications/terminal"
|
||||
#define DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG DEFAULT_APPS_KEY_TERMINAL_PATH"/exec_arg"
|
||||
#define DEFAULT_APPS_KEY_TERMINAL_EXEC DEFAULT_APPS_KEY_TERMINAL_PATH"/exec"
|
||||
|
||||
#define MIME_APPLICATION_ID "gnome-default-applications-editor"
|
||||
|
||||
typedef struct _BrowserDescription BrowserDescription;
|
||||
typedef struct _MailerDescription MailerDescription;
|
||||
typedef struct _TerminalDesciption TerminalDescription;
|
||||
|
||||
/* All defined below */
|
||||
#include "gnome-default-applications-properties-structs.c"
|
||||
|
||||
static GList *text_editors = NULL;
|
||||
|
||||
static GConfClient *client = NULL;
|
||||
|
||||
static void
|
||||
on_text_custom_properties_clicked (GtkWidget *w, GladeXML *dialog)
|
||||
{
|
||||
GtkWidget *d;
|
||||
int res;
|
||||
GnomeVFSMimeApplication *mime_app;
|
||||
const char *command, *name;
|
||||
|
||||
d = WID ("custom_editor_dialog");
|
||||
gtk_window_set_transient_for (GTK_WINDOW (d), GTK_WINDOW (WID ("default_applications_dialog")));
|
||||
|
||||
mime_app = gnome_vfs_application_registry_get_mime_application (MIME_APPLICATION_ID);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (WID ("text_custom_name_entry")),
|
||||
mime_app ? _(mime_app->name) : "");
|
||||
gtk_entry_set_text (GTK_ENTRY (WID ("text_custom_command_entry")),
|
||||
mime_app ? mime_app->command : "");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("text_custom_multi_toggle")),
|
||||
mime_app ? mime_app->can_open_multiple_files : FALSE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("text_custom_terminal_toggle")),
|
||||
mime_app ? mime_app->requires_terminal : FALSE);
|
||||
|
||||
run_properties_dialog:
|
||||
res = gtk_dialog_run (GTK_DIALOG (d));
|
||||
|
||||
if (res != GTK_RESPONSE_OK) {
|
||||
gtk_widget_hide (d);
|
||||
gnome_vfs_mime_application_free (mime_app);
|
||||
return;
|
||||
}
|
||||
|
||||
name = gtk_entry_get_text (GTK_ENTRY (WID ("text_custom_name_entry")));
|
||||
command = gtk_entry_get_text (GTK_ENTRY (WID ("text_custom_command_entry")));
|
||||
|
||||
if (!*name || !*command) {
|
||||
GtkWidget *d2;
|
||||
d2 = gtk_message_dialog_new (GTK_WINDOW (d),
|
||||
0,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_OK,
|
||||
_("Please specify a name and a command for this editor."));
|
||||
gtk_dialog_run (GTK_DIALOG (d2));
|
||||
gtk_widget_destroy (d2);
|
||||
goto run_properties_dialog;
|
||||
}
|
||||
|
||||
gtk_widget_hide (d);
|
||||
|
||||
if (mime_app) {
|
||||
g_free (mime_app->name);
|
||||
g_free (mime_app->command);
|
||||
} else {
|
||||
mime_app = g_new0 (GnomeVFSMimeApplication, 1);
|
||||
mime_app->id = g_strdup (MIME_APPLICATION_ID);
|
||||
}
|
||||
|
||||
mime_app->name = g_strdup (name);
|
||||
mime_app->command = g_strdup (command);
|
||||
|
||||
mime_app->can_open_multiple_files = GTK_TOGGLE_BUTTON (WID ("text_custom_multi_toggle"))->active;
|
||||
mime_app->requires_terminal = GTK_TOGGLE_BUTTON (WID ("text_custom_terminal_toggle"))->active;
|
||||
mime_app->expects_uris = GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_PATHS;
|
||||
|
||||
#if 0
|
||||
GTK_TOGGLE_BUTTON (WID ("text_custom_uri_toggle"))->active
|
||||
? GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS_FOR_NON_FILES
|
||||
: GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_PATHS;
|
||||
#endif
|
||||
|
||||
gnome_vfs_application_registry_save_mime_application (mime_app);
|
||||
|
||||
gnome_vfs_mime_set_default_application ("text/plain", mime_app->id);
|
||||
gnome_vfs_mime_application_free (mime_app);
|
||||
|
||||
gnome_vfs_application_registry_sync ();
|
||||
}
|
||||
|
||||
static void
|
||||
on_text_default_viewer_toggle (GtkWidget *toggle, GladeXML *dialog)
|
||||
{
|
||||
GnomeVFSMimeActionType old_action_type, new_action_type;
|
||||
|
||||
old_action_type = gnome_vfs_mime_get_default_action_type ("text/plain");
|
||||
new_action_type = GTK_TOGGLE_BUTTON (toggle)->active
|
||||
? GNOME_VFS_MIME_ACTION_TYPE_APPLICATION
|
||||
: GNOME_VFS_MIME_ACTION_TYPE_COMPONENT;
|
||||
|
||||
if (new_action_type == old_action_type)
|
||||
return;
|
||||
|
||||
gnome_vfs_mime_set_default_action_type ("text/plain", new_action_type);
|
||||
gnome_vfs_application_registry_sync ();
|
||||
}
|
||||
|
||||
static void
|
||||
generic_guard (GtkWidget *toggle, GtkWidget *widget)
|
||||
{
|
||||
|
||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (toggle), FALSE);
|
||||
gtk_widget_set_sensitive (widget, GTK_TOGGLE_BUTTON (toggle)->active);
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (toggle)->active) {
|
||||
GtkWidget *e;
|
||||
/* Get entry associated with us */
|
||||
e = g_object_get_data (G_OBJECT (toggle), "entry");
|
||||
if (e && GTK_WIDGET_REALIZED (e)) gtk_widget_grab_focus (e);
|
||||
if (e && GTK_IS_ENTRY (e)) {
|
||||
gchar *text;
|
||||
text = g_strdup (gtk_entry_get_text (GTK_ENTRY (e)));
|
||||
/* fixme: This is not nice, but it is the only way to force combo to emit 'changed' */
|
||||
gtk_entry_set_text (GTK_ENTRY (e), "");
|
||||
gtk_entry_set_text (GTK_ENTRY (e), text);
|
||||
g_free (text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
GHashTable *unique;
|
||||
|
||||
text_editors = gnome_vfs_mime_get_all_applications ("text/plain");
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
update_editor_sensitivity (GladeXML *dialog)
|
||||
{
|
||||
gboolean predefined = GTK_TOGGLE_BUTTON (WID ("text_select_radio"))->active;
|
||||
|
||||
gtk_widget_set_sensitive (WID ("text_select_combo"), predefined);
|
||||
gtk_widget_set_sensitive (WID ("text_custom_hbox"), !predefined);
|
||||
}
|
||||
|
||||
static void
|
||||
read_editor (GConfClient *client,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
GnomeVFSMimeApplication *mime_app;
|
||||
GList *li;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("text_default_viewer_toggle")),
|
||||
gnome_vfs_mime_get_default_action_type ("text/plain") == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION);
|
||||
|
||||
mime_app = gnome_vfs_mime_get_default_application ("text/plain");
|
||||
|
||||
if (mime_app == NULL || !strcmp (mime_app->id, MIME_APPLICATION_ID))
|
||||
goto read_editor_custom;
|
||||
|
||||
for (li = text_editors; li; li = li->next) {
|
||||
GnomeVFSMimeApplication *li_app = li->data;
|
||||
|
||||
if (strcmp (mime_app->command, li_app->command) == 0 &&
|
||||
mime_app->requires_terminal == li_app->requires_terminal) {
|
||||
gtk_entry_set_text (GTK_ENTRY (WID ("text_select_combo_entry")), _(mime_app->name));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("text_custom_radio")), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("text_select_radio")), TRUE);
|
||||
gnome_vfs_mime_application_free (mime_app);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* the default editor wasn't set by us, and it wasn't in the
|
||||
* list.
|
||||
*/
|
||||
|
||||
g_free (mime_app->id);
|
||||
mime_app->id = g_strdup (MIME_APPLICATION_ID);
|
||||
|
||||
gnome_vfs_application_registry_save_mime_application (mime_app);
|
||||
|
||||
gnome_vfs_mime_set_default_application ("text/plain", mime_app->id);
|
||||
gnome_vfs_application_registry_sync ();
|
||||
|
||||
read_editor_custom:
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("text_select_radio")), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("text_custom_radio")), TRUE);
|
||||
if (mime_app)
|
||||
gnome_vfs_mime_application_free (mime_app);
|
||||
}
|
||||
|
||||
static void
|
||||
text_apply_editor (GtkWidget *entry,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
GList *li;
|
||||
GnomeVFSMimeApplication *mime_app;
|
||||
const gchar *editor;
|
||||
|
||||
if (!GTK_TOGGLE_BUTTON (WID ("text_select_radio"))->active)
|
||||
return;
|
||||
|
||||
update_editor_sensitivity (dialog);
|
||||
|
||||
editor = gtk_entry_get_text (GTK_ENTRY (WID ("text_select_combo_entry")));
|
||||
|
||||
/* don't do anything if it was cleared. */
|
||||
if (!*editor)
|
||||
return;
|
||||
|
||||
for (li = text_editors; li; li = li->next) {
|
||||
mime_app = li->data;
|
||||
if (! strcmp (mime_app->name, editor)) {
|
||||
gnome_vfs_mime_set_default_application ("text/plain", mime_app->id);
|
||||
gnome_vfs_application_registry_sync ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
static void
|
||||
text_apply_custom (GtkWidget *entry,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
GnomeVFSMimeApplication *mime_app;
|
||||
|
||||
if (!GTK_TOGGLE_BUTTON (WID ("text_custom_radio"))->active)
|
||||
return;
|
||||
|
||||
mime_app = gnome_vfs_application_registry_get_mime_application (MIME_APPLICATION_ID);
|
||||
if (!mime_app) {
|
||||
on_text_custom_properties_clicked (entry, dialog);
|
||||
mime_app = gnome_vfs_application_registry_get_mime_application (MIME_APPLICATION_ID);
|
||||
if (!mime_app) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("text_select_radio")), TRUE);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
gnome_vfs_mime_set_default_application ("text/plain", mime_app->id);
|
||||
gnome_vfs_mime_application_free (mime_app);
|
||||
|
||||
gnome_vfs_application_registry_sync ();
|
||||
}
|
||||
|
||||
update_editor_sensitivity (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_peditors (GConfClient *client,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
GConfChangeSet *changeset = NULL;
|
||||
|
||||
gconf_peditor_new_boolean (changeset, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM,
|
||||
WID ("web_custom_terminal_toggle"), NULL);
|
||||
gconf_peditor_new_string (changeset, DEFAULT_APPS_KEY_HTTP_EXEC,
|
||||
WID ("web_custom_command_entry"), NULL);
|
||||
|
||||
gconf_peditor_new_boolean (changeset, DEFAULT_APPS_KEY_HTTPS_NEEDS_TERM,
|
||||
WID ("web_custom_terminal_toggle"), NULL);
|
||||
gconf_peditor_new_string (changeset, DEFAULT_APPS_KEY_HTTPS_EXEC,
|
||||
WID ("web_custom_command_entry"), NULL);
|
||||
|
||||
gconf_peditor_new_boolean (changeset, DEFAULT_APPS_KEY_UNKNOWN_NEEDS_TERM,
|
||||
WID ("web_custom_terminal_toggle"), NULL);
|
||||
gconf_peditor_new_string (changeset, DEFAULT_APPS_KEY_UNKNOWN_EXEC,
|
||||
WID ("web_custom_command_entry"), NULL);
|
||||
|
||||
gconf_peditor_new_boolean (changeset, DEFAULT_APPS_KEY_ABOUT_NEEDS_TERM,
|
||||
WID ("web_custom_terminal_toggle"), NULL);
|
||||
gconf_peditor_new_string (changeset, DEFAULT_APPS_KEY_ABOUT_EXEC,
|
||||
WID ("web_custom_command_entry"), NULL);
|
||||
|
||||
gconf_peditor_new_boolean (changeset, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM,
|
||||
WID ("mail_custom_terminal_toggle"), NULL);
|
||||
gconf_peditor_new_string (changeset, DEFAULT_APPS_KEY_MAILER_EXEC,
|
||||
WID ("mail_custom_command_entry"), NULL);
|
||||
|
||||
gconf_peditor_new_string (changeset, DEFAULT_APPS_KEY_TERMINAL_EXEC,
|
||||
WID ("terminal_custom_command_entry"), NULL);
|
||||
gconf_peditor_new_string (changeset, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG,
|
||||
WID ("terminal_custom_exec_entry"), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
read_browser (GConfClient *client,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gchar *browser;
|
||||
gboolean needs_term;
|
||||
gint i;
|
||||
|
||||
needs_term = gconf_client_get_bool (client, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, &error);
|
||||
if (error) {
|
||||
/* hp will shoot me -- I'll do this later. */
|
||||
return;
|
||||
}
|
||||
browser = gconf_client_get_string (client, DEFAULT_APPS_KEY_HTTP_EXEC, &error);
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (possible_browsers); i++ ) {
|
||||
if (possible_browsers[i].in_path == FALSE)
|
||||
continue;
|
||||
|
||||
if (browser && strcmp (browser, possible_browsers[i].command) == 0 &&
|
||||
needs_term == possible_browsers[i].needs_term) {
|
||||
gtk_entry_set_text (GTK_ENTRY (WID ("web_select_combo_entry")),
|
||||
_(possible_browsers[i].name));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("web_custom_radio")), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("web_select_radio")), TRUE);
|
||||
g_free (browser);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (browser && strlen(browser) != 0) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("web_select_radio")), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("web_custom_radio")), TRUE);
|
||||
} else {
|
||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (WID ("web_select_radio")), TRUE);
|
||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (WID ("web_custom_radio")), TRUE);
|
||||
}
|
||||
|
||||
g_free (browser);
|
||||
}
|
||||
|
||||
static void
|
||||
read_mailer (GConfClient *client,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gchar *mailer;
|
||||
gboolean needs_term;
|
||||
gint i;
|
||||
|
||||
needs_term = gconf_client_get_bool (client, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, &error);
|
||||
if (error) {
|
||||
/* hp will shoot me -- I'll do this later. */
|
||||
return;
|
||||
}
|
||||
mailer = gconf_client_get_string (client, DEFAULT_APPS_KEY_MAILER_EXEC, &error);
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (possible_mailers); i++ ) {
|
||||
if (possible_mailers[i].in_path == FALSE)
|
||||
continue;
|
||||
|
||||
if (mailer && strcmp (mailer, possible_mailers[i].command) == 0 &&
|
||||
needs_term == possible_mailers[i].needs_term) {
|
||||
gtk_entry_set_text (GTK_ENTRY (WID ("mail_select_combo_entry")),
|
||||
_(possible_mailers[i].name));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("mail_custom_radio")), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("mail_select_radio")), TRUE);
|
||||
g_free (mailer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mailer && strlen(mailer) != 0) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("mail_select_radio")), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("mail_custom_radio")), TRUE);
|
||||
} else {
|
||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (WID ("mail_select_radio")), TRUE);
|
||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (WID ("mail_custom_radio")), TRUE);
|
||||
}
|
||||
g_free (mailer);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
browser_setup_custom (GtkWidget *entry,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
gint i;
|
||||
const gchar *browser = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (possible_browsers); i++ ) {
|
||||
if (! strcmp (_(possible_browsers[i].name), browser) && possible_browsers[i].in_path) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("web_custom_terminal_toggle")),
|
||||
possible_browsers[i].needs_term);
|
||||
gtk_entry_set_text (GTK_ENTRY (WID ("web_custom_command_entry")),
|
||||
possible_browsers[i].command);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mailer_setup_custom (GtkWidget *entry,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
gint i;
|
||||
const gchar *mailer = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (possible_mailers); i++ ) {
|
||||
if (! strcmp (_(possible_mailers[i].name), mailer) && possible_mailers[i].in_path) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("mail_custom_terminal_toggle")),
|
||||
possible_mailers[i].needs_term);
|
||||
gtk_entry_set_text (GTK_ENTRY (WID ("mail_custom_command_entry")),
|
||||
possible_mailers[i].command);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
read_terminal (GConfClient *client,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gchar *exec;
|
||||
gchar *exec_arg;
|
||||
gint i;
|
||||
|
||||
exec = gconf_client_get_string (client, DEFAULT_APPS_KEY_TERMINAL_EXEC, &error);
|
||||
if (error) {
|
||||
return;
|
||||
}
|
||||
exec_arg = gconf_client_get_string (client, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, &error);
|
||||
if (error) {
|
||||
exec_arg = NULL;
|
||||
}
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (WID ("terminal_custom_command_entry")), exec?exec:"");
|
||||
gtk_entry_set_text (GTK_ENTRY (WID ("terminal_custom_exec_entry")), exec_arg?exec_arg:"");
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (possible_terminals); i++ ) {
|
||||
if (possible_terminals[i].in_path == FALSE)
|
||||
continue;
|
||||
|
||||
if (strcmp (exec?exec:"", possible_terminals[i].exec) == 0 &&
|
||||
strcmp (exec_arg?exec_arg:"", possible_terminals[i].exec_arg) == 0) {
|
||||
gtk_entry_set_text (GTK_ENTRY (WID ("terminal_select_combo_entry")),
|
||||
_(possible_terminals[i].name));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("terminal_custom_radio")), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("terminal_select_radio")), TRUE);
|
||||
g_free (exec);
|
||||
g_free (exec_arg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("terminal_select_radio")), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("terminal_custom_radio")), TRUE);
|
||||
g_free (exec);
|
||||
g_free (exec_arg);
|
||||
}
|
||||
|
||||
static void
|
||||
terminal_setup_custom (GtkWidget *entry,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
gint i;
|
||||
const gchar *terminal = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (possible_terminals); i++ ) {
|
||||
if (! strcmp (_(possible_terminals[i].name), terminal) && possible_terminals[i].in_path) {
|
||||
gtk_entry_set_text (GTK_ENTRY (WID ("terminal_custom_command_entry")), possible_terminals[i].exec);
|
||||
gtk_entry_set_text (GTK_ENTRY (WID ("terminal_custom_exec_entry")), possible_terminals[i].exec_arg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
value_changed_cb (GConfClient *client,
|
||||
const gchar *key,
|
||||
GConfValue *value,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
g_return_if_fail (key != NULL);
|
||||
if (strncmp (key, DEFAULT_APPS_KEY_MAILER_PATH, strlen (DEFAULT_APPS_KEY_MAILER_PATH)) == 0) {
|
||||
gconf_client_set_bool (client, DEFAULT_APPS_KEY_MAILER_PATH"/enabled", TRUE, NULL);
|
||||
} else if (strncmp (key, DEFAULT_APPS_KEY_HTTP_PATH, strlen (DEFAULT_APPS_KEY_HTTP_PATH)) == 0) {
|
||||
} else if (strncmp (key, DEFAULT_APPS_KEY_TERMINAL_PATH, strlen (DEFAULT_APPS_KEY_TERMINAL_PATH)) == 0) {
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dialog_response (GtkDialog *widget,
|
||||
gint response_id,
|
||||
GladeXML *dialog)
|
||||
{
|
||||
if (response_id == GTK_RESPONSE_HELP)
|
||||
capplet_help (GTK_WINDOW (widget), "user-guide.xml", "goscustdoc-2");
|
||||
else
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static GladeXML *
|
||||
create_dialog (GConfClient *client)
|
||||
{
|
||||
GladeXML *dialog;
|
||||
GList *strings = NULL, *li;
|
||||
gint i;
|
||||
dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gnome-default-applications-properties.glade", NULL, NULL);
|
||||
capplet_set_icon (WID ("default_applications_dialog"), "gnome-settings-default-applications");
|
||||
|
||||
setup_peditors (client, dialog);
|
||||
|
||||
/* Editors page */
|
||||
for (li = text_editors; li; li = li->next) {
|
||||
strings = g_list_append (strings, _(((GnomeVFSMimeApplication *)li->data)->name));
|
||||
}
|
||||
if (strings) {
|
||||
/* We have default editors */
|
||||
gtk_combo_set_popdown_strings (GTK_COMBO(WID ("text_select_combo")), strings);
|
||||
g_list_free (strings);
|
||||
strings = NULL;
|
||||
} else {
|
||||
/* No default editors */
|
||||
gtk_widget_set_sensitive (WID ("text_select_radio"), FALSE);
|
||||
}
|
||||
|
||||
read_editor (client, dialog);
|
||||
update_editor_sensitivity (dialog);
|
||||
|
||||
g_signal_connect (G_OBJECT (WID ("text_select_combo_entry")),
|
||||
"changed", G_CALLBACK (text_apply_editor),
|
||||
dialog);
|
||||
g_signal_connect (WID ("text_custom_properties"), "clicked",
|
||||
G_CALLBACK (on_text_custom_properties_clicked),
|
||||
dialog);
|
||||
g_signal_connect (WID ("text_default_viewer_toggle"), "toggled",
|
||||
G_CALLBACK (on_text_default_viewer_toggle),
|
||||
dialog);
|
||||
g_signal_connect_after (G_OBJECT (WID ("text_select_radio")), "toggled",
|
||||
G_CALLBACK (text_apply_editor), dialog);
|
||||
g_signal_connect_after (G_OBJECT (WID ("text_custom_radio")), "toggled",
|
||||
G_CALLBACK (text_apply_custom), dialog);
|
||||
|
||||
/* Web browsers page */
|
||||
for (i = 0; i < G_N_ELEMENTS (possible_browsers); i++ ) {
|
||||
if (possible_browsers[i].in_path)
|
||||
strings = g_list_append (strings, _(possible_browsers[i].name));
|
||||
}
|
||||
if (strings) {
|
||||
/* We have default browsers */
|
||||
gtk_combo_set_popdown_strings (GTK_COMBO(WID ("web_select_combo")), strings);
|
||||
g_list_free (strings);
|
||||
strings = NULL;
|
||||
} else {
|
||||
/* No default browsers */
|
||||
gtk_widget_set_sensitive (WID ("web_select_radio"), FALSE);
|
||||
}
|
||||
|
||||
/* Source of command string */
|
||||
g_object_set_data (G_OBJECT (WID ("web_select_radio")), "entry", WID ("web_select_combo_entry"));
|
||||
/* Source of command string */
|
||||
g_object_set_data (G_OBJECT (WID ("web_custom_radio")), "entry", WID ("web_custom_command_entry"));
|
||||
|
||||
g_signal_connect (G_OBJECT (WID ("web_select_combo_entry")),
|
||||
"changed", (GCallback) browser_setup_custom,
|
||||
dialog);
|
||||
g_signal_connect (G_OBJECT (WID ("web_select_radio")),
|
||||
"clicked", (GCallback) generic_guard,
|
||||
WID ("web_select_combo"));
|
||||
g_signal_connect (G_OBJECT (WID ("web_custom_radio")),
|
||||
"clicked", (GCallback) generic_guard,
|
||||
WID ("web_custom_vbox"));
|
||||
|
||||
read_browser (client, dialog);
|
||||
|
||||
|
||||
/* Mail readers page */
|
||||
for (i = 0; i < G_N_ELEMENTS (possible_mailers); i++ ) {
|
||||
if (possible_mailers[i].in_path)
|
||||
strings = g_list_append (strings, _(possible_mailers[i].name));
|
||||
}
|
||||
if (strings) {
|
||||
/* We have default browsers */
|
||||
gtk_combo_set_popdown_strings (GTK_COMBO(WID ("mail_select_combo")), strings);
|
||||
g_list_free (strings);
|
||||
strings = NULL;
|
||||
} else {
|
||||
/* No default browsers */
|
||||
gtk_widget_set_sensitive (WID ("mail_select_radio"), FALSE);
|
||||
}
|
||||
|
||||
/* Source of command string */
|
||||
g_object_set_data (G_OBJECT (WID ("mail_select_radio")), "entry", WID ("mail_select_combo_entry"));
|
||||
/* Source of command string */
|
||||
g_object_set_data (G_OBJECT (WID ("mail_custom_radio")), "entry", WID ("mail_custom_command_entry"));
|
||||
|
||||
g_signal_connect (G_OBJECT (WID ("mail_select_combo_entry")),
|
||||
"changed", (GCallback) mailer_setup_custom,
|
||||
dialog);
|
||||
g_signal_connect (G_OBJECT (WID ("mail_select_radio")),
|
||||
"clicked", (GCallback) generic_guard,
|
||||
WID ("mail_select_combo"));
|
||||
g_signal_connect (G_OBJECT (WID ("mail_custom_radio")),
|
||||
"clicked", (GCallback) generic_guard,
|
||||
WID ("mail_custom_vbox"));
|
||||
|
||||
read_mailer (client, dialog);
|
||||
|
||||
|
||||
/* Terminal */
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (possible_terminals); i++ ) {
|
||||
if (possible_terminals[i].in_path)
|
||||
strings = g_list_append (strings, _(possible_terminals[i].name));
|
||||
}
|
||||
if (strings) {
|
||||
/* We have default terminals */
|
||||
gtk_combo_set_popdown_strings (GTK_COMBO (WID ("terminal_select_combo")), strings);
|
||||
g_list_free (strings);
|
||||
strings = NULL;
|
||||
} else {
|
||||
/* No default terminals */
|
||||
gtk_widget_set_sensitive (WID ("terminal_select_radio"), FALSE);
|
||||
}
|
||||
|
||||
/* Source of command string */
|
||||
g_object_set_data (G_OBJECT (WID ("terminal_select_radio")), "entry", WID ("terminal_select_combo_entry"));
|
||||
/* Source of command string */
|
||||
g_object_set_data (G_OBJECT (WID ("terminal_custom_radio")), "entry", WID ("terminal_custom_command_entry"));
|
||||
|
||||
g_signal_connect (G_OBJECT (WID ("terminal_select_combo_entry")),
|
||||
"changed", (GCallback) terminal_setup_custom,
|
||||
dialog);
|
||||
g_signal_connect (G_OBJECT (WID ("terminal_select_radio")),
|
||||
"toggled", (GCallback) generic_guard,
|
||||
WID ("terminal_select_combo"));
|
||||
g_signal_connect (G_OBJECT (WID ("terminal_custom_radio")),
|
||||
"toggled", (GCallback) generic_guard,
|
||||
WID ("terminal_custom_table"));
|
||||
read_terminal (client, dialog);
|
||||
|
||||
|
||||
g_signal_connect (G_OBJECT (client), "value-changed", (GCallback) value_changed_cb, dialog);
|
||||
g_signal_connect (G_OBJECT (WID ("default_applications_dialog")), "response", (GCallback) dialog_response, dialog);
|
||||
|
||||
gtk_widget_show (WID ("default_applications_dialog"));
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
get_legacy_settings (void)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GladeXML *dialog;
|
||||
|
||||
static gboolean get_legacy;
|
||||
static struct poptOption cap_options[] = {
|
||||
{ "get-legacy", '\0', POPT_ARG_NONE, &get_legacy, 0,
|
||||
N_("Retrieve and store legacy settings"), NULL },
|
||||
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
gnome_program_init ("gnome-default-applications-properties", VERSION,
|
||||
LIBGNOMEUI_MODULE, argc, argv,
|
||||
GNOME_PARAM_POPT_TABLE, cap_options,
|
||||
GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR,
|
||||
NULL);
|
||||
|
||||
client = gconf_client_get_default ();
|
||||
|
||||
gconf_client_add_dir (client, "/desktop/gnome/applications/browser", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
gconf_client_add_dir (client, "/desktop/gnome/applications/terminal", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||
|
||||
if (get_legacy) {
|
||||
get_legacy_settings ();
|
||||
} else {
|
||||
initialize_default_applications ();
|
||||
dialog = create_dialog (client);
|
||||
gtk_main ();
|
||||
}
|
||||
g_object_unref (client);
|
||||
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load diff
291
capplets/default-applications/gnome-default-applications.xml.in
Normal file
291
capplets/default-applications/gnome-default-applications.xml.in
Normal file
|
@ -0,0 +1,291 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE default-apps SYSTEM "gnome-da-list.dtd">
|
||||
<default-apps>
|
||||
|
||||
<!-- Remember to never use the same string for <command>, <tab-command> and <win-command> entries -->
|
||||
|
||||
<web-browsers>
|
||||
<web-browser>
|
||||
<_name>Opera</_name>
|
||||
<executable>opera</executable>
|
||||
<command>opera %s</command>
|
||||
<icon-name>opera</icon-name>
|
||||
<run-in-terminal>fasle</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>opera -newpage %s</tab-command>
|
||||
<win-command>opera -newwindow %s</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Debian Sensible Browser</_name>
|
||||
<executable>sensible-browser</executable>
|
||||
<command>sensible-browser %s</command>
|
||||
<icon-name></icon-name>
|
||||
<run-in-terminal>fasle</run-in-terminal>
|
||||
<netscape-remote>false</netscape-remote>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Epiphany</_name>
|
||||
<executable>epiphany</executable>
|
||||
<command>epiphany %s</command>
|
||||
<icon-name>web-browser</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>epiphany -n %s</tab-command>
|
||||
<win-command>epiphany -w %s</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Galeon</_name>
|
||||
<executable>galeon</executable>
|
||||
<command>galeon %s</command>
|
||||
<icon-name>galeon</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>galeon -n %s</tab-command>
|
||||
<win-command>galeon -w %s</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Encompass</_name>
|
||||
<executable>encompass</executable>
|
||||
<command>encompass %s</command>
|
||||
<icon-name>encompass</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>false</netscape-remote>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Firebird</_name>
|
||||
<executable>mozilla-firebird</executable>
|
||||
<command>mozilla-firebird %s</command>
|
||||
<icon-name></icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>mozilla-firebird -remote "openurl(%s,new-tab)"</tab-command>
|
||||
<win-command>mozilla-firebird -remote "openurl(%s,new-window)"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Firefox</_name>
|
||||
<executable>firefox</executable>
|
||||
<command>firefox %s</command>
|
||||
<icon-name>firefox</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>firefox -remote "openurl(%s,new-tab)"</tab-command>
|
||||
<win-command>firefox -remote "openurl(%s,new-window)"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Mozilla 1.6</_name>
|
||||
<executable>mozilla-1.6</executable>
|
||||
<command>mozilla-1.6 %s</command>
|
||||
<icon-name>mozilla-icon</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>mozilla-1.6 -remote "openurl(%s,new-tab)"</tab-command>
|
||||
<win-command>mozilla-1.6 -remote "openurl(%s,new-window)"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Mozilla</_name>
|
||||
<executable>mozilla</executable>
|
||||
<command>mozilla %s</command>
|
||||
<icon-name>mozilla-icon</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>mozilla -remote "openurl(%s,new-tab)"</tab-command>
|
||||
<win-command>mozilla -remote "openurl(%s,new-window)"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Netscape Communicator</_name>
|
||||
<executable>netscape</executable>
|
||||
<command>netscape %s</command>
|
||||
<icon-name>netscape</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>true</netscape-remote>
|
||||
<tab-command>netscape -remote "openurl(%s,new-tab)"</tab-command>
|
||||
<win-command>netscape -remote "openurl(%s,new-window)"</win-command>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Konqueror</_name>
|
||||
<executable>konqueror</executable>
|
||||
<command>konqueror %s</command>
|
||||
<icon-name>konqueror</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
<netscape-remote>false</netscape-remote>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>W3M Text Browser</_name>
|
||||
<executable>w3m</executable>
|
||||
<command>w3m %s</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<run-in-terminal>true</run-in-terminal>
|
||||
<netscape-remote>false</netscape-remote>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Lynx Text Browser</_name>
|
||||
<executable>lynx</executable>
|
||||
<command>lynx %s</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<run-in-terminal>true</run-in-terminal>
|
||||
<netscape-remote>false</netscape-remote>
|
||||
</web-browser>
|
||||
<web-browser>
|
||||
<_name>Links Text Browser</_name>
|
||||
<executable>links</executable>
|
||||
<command>links %s</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<run-in-terminal>true</run-in-terminal>
|
||||
<netscape-remote>false</netscape-remote>
|
||||
</web-browser>
|
||||
</web-browsers>
|
||||
|
||||
<mail-readers>
|
||||
<mail-reader>
|
||||
<_name>Evolution Mail Reader 2.4</_name>
|
||||
<executable>evolution-2.4</executable>
|
||||
<command>evolution-2.4 %s</command>
|
||||
<icon-name>evolution</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Evolution Mail Reader 2.2</_name>
|
||||
<executable>evolution-2.2</executable>
|
||||
<command>evolution-2.2 %s</command>
|
||||
<icon-name>evolution</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Evolution Mail Reader 2.0</_name>
|
||||
<executable>evolution-2.0</executable>
|
||||
<command>evolution-2.0 %s</command>
|
||||
<icon-name>evolution</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Evolution Mail Reader 1.6</_name>
|
||||
<executable>evolution-1.6</executable>
|
||||
<command>evolution-1.6 %s</command>
|
||||
<icon-name>evolution</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Evolution Mail Reader 1.5</_name>
|
||||
<executable>evolution-1.5</executable>
|
||||
<command>evolution-1.5 %s</command>
|
||||
<icon-name>evolution</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Evolution Mail Reader 1.4</_name>
|
||||
<executable>evolution-1.4</executable>
|
||||
<command>evolution-1.4 %s</command>
|
||||
<icon-name>evolution</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Evolution Mail Reader</_name>
|
||||
<executable>evolution</executable>
|
||||
<command>evolution %s</command>
|
||||
<icon-name>evolution</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Balsa</_name>
|
||||
<executable>balsa</executable>
|
||||
<command>balsa -m %s</command>
|
||||
<icon-name>gnome-balsa2</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>KMail</_name>
|
||||
<executable>kmail</executable>
|
||||
<command>kmail %s</command>
|
||||
<icon-name>kmail</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Thunderbird</_name>
|
||||
<executable>thunderbird</executable>
|
||||
<command>thunderbird -mail %s</command>
|
||||
<icon-name>thunderbird</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Mozilla Thunderbird</_name>
|
||||
<executable>mozilla-thunderbird</executable>
|
||||
<command>mozilla-thunderbird -mail %s</command>
|
||||
<icon-name>thunderbird</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Mozilla Mail</_name>
|
||||
<executable>mozilla</executable>
|
||||
<command>mozilla -mail %s</command>
|
||||
<icon-name>mozilla-mail-icon</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Mutt</_name>
|
||||
<executable>mutt</executable>
|
||||
<command>mutt %s</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<run-in-terminal>true</run-in-terminal>
|
||||
</mail-reader>
|
||||
<mail-reader>
|
||||
<_name>Sylpheed-Claws</_name>
|
||||
<executable>ylpheed-claws</executable>
|
||||
<command>sylpheed-claws --compose %s</command>
|
||||
<icon-name>sylpheed</icon-name>
|
||||
<run-in-terminal>false</run-in-terminal>
|
||||
</mail-reader>
|
||||
</mail-readers>
|
||||
|
||||
<terminals>
|
||||
<terminal>
|
||||
<_name>Debian Terminal Emulator</_name>
|
||||
<executable>x-terminal-emulator</executable>
|
||||
<command>x-terminal-emulator</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>GNOME Terminal</_name>
|
||||
<executable>gnome-terminal</executable>
|
||||
<command>gnome-terminal --working-directory=%f</command>
|
||||
<icon-name>gnome-terminal</icon-name>
|
||||
<exec-flag>-x</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>Standard XTerminal</_name>
|
||||
<executable>xterm</executable>
|
||||
<command>xterm</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>NXterm</_name>
|
||||
<executable>nxterm</executable>
|
||||
<command>nxterm</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>RXVT</_name>
|
||||
<executable>rxvt</executable>
|
||||
<command>rxvt</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>aterm</_name>
|
||||
<executable>aterm</executable>
|
||||
<command>aterm</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
<terminal>
|
||||
<_name>ETerm</_name>
|
||||
<executable>ETerm</executable>
|
||||
<command>ETerm</command>
|
||||
<icon-name>gnome-mime-application-x-executable</icon-name>
|
||||
<exec-flag>-e</exec-flag>
|
||||
</terminal>
|
||||
</terminals>
|
||||
|
||||
</default-apps>
|
Loading…
Add table
Add a link
Reference in a new issue