turn off help tab, put browser tab first, and fix things for the editor
2002-05-16 jacob berkman <jacob@ximian.com> * gnome-default-applications-properties.glade: turn off help tab, put browser tab first, and fix things for the editor * gnome-default-applications-properties.c: make the editor changes use gnome-vfs, and make the browser use the default key rather than http fixes #78037
This commit is contained in:
parent
58aa365845
commit
5fc0063d42
4 changed files with 1859 additions and 1438 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2002-05-16 jacob berkman <jacob@ximian.com>
|
||||||
|
|
||||||
|
* gnome-default-applications-properties.glade: turn off help tab,
|
||||||
|
put browser tab first, and fix things for the editor
|
||||||
|
|
||||||
|
* gnome-default-applications-properties.c: make the editor changes
|
||||||
|
use gnome-vfs, and make the browser use the default key rather
|
||||||
|
than http
|
||||||
|
|
||||||
|
fixes #78037
|
||||||
|
|
||||||
Wed Apr 10 18:05:13 2002 Jonathan Blandford <jrb@gnome.org>
|
Wed Apr 10 18:05:13 2002 Jonathan Blandford <jrb@gnome.org>
|
||||||
|
|
||||||
* default-applications.desktop.in (Exec): s/gnome2/gnome
|
* default-applications.desktop.in (Exec): s/gnome2/gnome
|
||||||
|
|
|
@ -1,17 +1,8 @@
|
||||||
|
|
||||||
struct _EditorDescription
|
|
||||||
{
|
|
||||||
gchar *name;
|
|
||||||
gchar *executable_name;
|
|
||||||
gboolean needs_term;
|
|
||||||
gboolean accepts_lineno;
|
|
||||||
gboolean in_path;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _BrowserDescription
|
struct _BrowserDescription
|
||||||
{
|
{
|
||||||
gchar *name;
|
gchar *name;
|
||||||
gchar *executable_name;
|
gchar *executable_name;
|
||||||
|
gchar *command;
|
||||||
gboolean needs_term;
|
gboolean needs_term;
|
||||||
gboolean nremote;
|
gboolean nremote;
|
||||||
gboolean in_path;
|
gboolean in_path;
|
||||||
|
@ -34,34 +25,15 @@ struct _TerminalDesciption
|
||||||
gboolean in_path;
|
gboolean in_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
EditorDescription possible_editors[] =
|
|
||||||
{
|
|
||||||
{ "gedit", "gedit", FALSE, FALSE, FALSE },
|
|
||||||
{ "Emacs", "emacs", FALSE, TRUE, FALSE },
|
|
||||||
{ "Emacs (terminal)", "emacs", TRUE, TRUE, FALSE },
|
|
||||||
{ "XEmacs", "xemacs", FALSE, TRUE, FALSE },
|
|
||||||
{ "vi", "vi", TRUE, TRUE, FALSE },
|
|
||||||
{ "Go", "go", FALSE, FALSE, FALSE },
|
|
||||||
{ "GWP", "gwp", FALSE, FALSE, FALSE },
|
|
||||||
{ "Jed", "jed", TRUE, TRUE, FALSE },
|
|
||||||
{ "Joe", "joe", TRUE, TRUE, FALSE },
|
|
||||||
{ "Pico", "pico", TRUE, TRUE, FALSE },
|
|
||||||
{ "vim", "vim", TRUE, TRUE, FALSE },
|
|
||||||
{ "gvim", "gvim", FALSE, TRUE, FALSE },
|
|
||||||
{ "ed", "ed", TRUE, FALSE, FALSE },
|
|
||||||
{ "GMC/CoolEdit", "gmc -e", FALSE, FALSE, FALSE },
|
|
||||||
{ "Nedit", "nedit", FALSE, FALSE, FALSE }
|
|
||||||
};
|
|
||||||
|
|
||||||
BrowserDescription possible_browsers[] =
|
BrowserDescription possible_browsers[] =
|
||||||
{
|
{
|
||||||
{ "Lynx Text Browser", "lynx", TRUE, FALSE, FALSE },
|
{ "Lynx Text Browser", "lynx", "lynx %s", TRUE, FALSE, FALSE },
|
||||||
{ "Links Text Browser" , "links", TRUE, FALSE, FALSE },
|
{ "Links Text Browser" , "links", "links %s", TRUE, FALSE, FALSE },
|
||||||
{ "Netscape Communicator", "netscape", FALSE, TRUE, FALSE },
|
{ "Netscape Communicator", "netscape", "netscape %s", FALSE, TRUE, FALSE },
|
||||||
{ "Mozilla/Netscape 6", "mozilla", FALSE, TRUE, FALSE },
|
{ "Mozilla/Netscape 6", "mozilla", "mozilla %s", FALSE, TRUE, FALSE },
|
||||||
{ "Galeon", "galeon", FALSE, FALSE, FALSE },
|
{ "Galeon", "galeon", "galeon %s", FALSE, FALSE, FALSE },
|
||||||
{ "Encompass", "encompass", FALSE, FALSE, FALSE },
|
{ "Encompass", "encompass", "encompass %s", FALSE, FALSE, FALSE },
|
||||||
{ "Konqueror", "konqueror", FALSE, FALSE, FALSE }
|
{ "Konqueror", "konqueror", "konqueror %s", FALSE, FALSE, FALSE }
|
||||||
};
|
};
|
||||||
|
|
||||||
HelpViewDescription possible_help_viewers[] =
|
HelpViewDescription possible_help_viewers[] =
|
||||||
|
|
|
@ -33,31 +33,129 @@
|
||||||
#include <glade/glade.h>
|
#include <glade/glade.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
|
||||||
|
#include <libgnomevfs/gnome-vfs-application-registry.h>
|
||||||
|
|
||||||
#include "capplet-util.h"
|
#include "capplet-util.h"
|
||||||
#include "gconf-property-editor.h"
|
#include "gconf-property-editor.h"
|
||||||
|
|
||||||
#define DEFAULT_APPS_KEY_EDITOR_NEEDS_TERM "/desktop/gnome/applications/editor/needs_term"
|
#define DEFAULT_APPS_KEY_BROWSER_NEEDS_TERM "/desktop/gnome/url-handlers/unknown/need-terminal"
|
||||||
#define DEFAULT_APPS_KEY_EDITOR_ACCEPTS_LINENO "/desktop/gnome/applications/editor/accepts_lineno"
|
#define DEFAULT_APPS_KEY_BROWSER_EXEC "/desktop/gnome/url-handlers/unknown/command"
|
||||||
#define DEFAULT_APPS_KEY_EDITOR_EXEC "/desktop/gnome/applications/editor/exec"
|
|
||||||
#define DEFAULT_APPS_KEY_BROWSER_NEEDS_TERM "/desktop/gnome/applications/browser/needs_term"
|
|
||||||
#define DEFAULT_APPS_KEY_BROWSER_NREMOTE "/desktop/gnome/applications/browser/nremote"
|
|
||||||
#define DEFAULT_APPS_KEY_BROWSER_EXEC "/desktop/gnome/applications/browser/exec"
|
|
||||||
#define DEFAULT_APPS_KEY_HELP_VIEWER_NEEDS_TERM "/desktop/gnome/applications/help_viewer/needs_term"
|
#define DEFAULT_APPS_KEY_HELP_VIEWER_NEEDS_TERM "/desktop/gnome/applications/help_viewer/needs_term"
|
||||||
#define DEFAULT_APPS_KEY_HELP_VIEWER_ACCEPTS_URLS "/desktop/gnome/applications/help_viewer/accepts_urls"
|
#define DEFAULT_APPS_KEY_HELP_VIEWER_ACCEPTS_URLS "/desktop/gnome/applications/help_viewer/accepts_urls"
|
||||||
#define DEFAULT_APPS_KEY_HELP_VIEWER_EXEC "/desktop/gnome/applications/help_viewer/exec"
|
#define DEFAULT_APPS_KEY_HELP_VIEWER_EXEC "/desktop/gnome/applications/help_viewer/exec"
|
||||||
|
|
||||||
#define DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG "/desktop/gnome/applications/terminal/exec_arg"
|
#define DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG "/desktop/gnome/applications/terminal/exec_arg"
|
||||||
#define DEFAULT_APPS_KEY_TERMINAL_EXEC "/desktop/gnome/applications/terminal/exec"
|
#define DEFAULT_APPS_KEY_TERMINAL_EXEC "/desktop/gnome/applications/terminal/exec"
|
||||||
|
|
||||||
|
#define MIME_APPLICATION_ID "gnome-default-applications-editor"
|
||||||
|
|
||||||
typedef struct _BrowserDescription BrowserDescription;
|
typedef struct _BrowserDescription BrowserDescription;
|
||||||
typedef struct _EditorDescription EditorDescription;
|
|
||||||
typedef struct _HelpViewDescription HelpViewDescription;
|
typedef struct _HelpViewDescription HelpViewDescription;
|
||||||
typedef struct _TerminalDesciption TerminalDescription;
|
typedef struct _TerminalDesciption TerminalDescription;
|
||||||
|
|
||||||
/* All defined below */
|
/* All defined below */
|
||||||
#include "gnome-default-applications-properties-structs.c"
|
#include "gnome-default-applications-properties-structs.c"
|
||||||
|
|
||||||
|
static GList *text_editors = NULL;
|
||||||
|
|
||||||
static GConfClient *client = 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
|
static void
|
||||||
generic_guard (GtkWidget *toggle, GtkWidget *widget)
|
generic_guard (GtkWidget *toggle, GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
@ -84,10 +182,8 @@ initialize_default_applications (void)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (possible_editors); i++ ) {
|
text_editors = gnome_vfs_mime_get_all_applications ("text/plain");
|
||||||
if (g_find_program_in_path (possible_editors[i].executable_name))
|
|
||||||
possible_editors[i].in_path = TRUE;
|
|
||||||
}
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (possible_browsers); i++ ) {
|
for (i = 0; i < G_N_ELEMENTS (possible_browsers); i++ ) {
|
||||||
if (g_find_program_in_path (possible_browsers[i].executable_name))
|
if (g_find_program_in_path (possible_browsers[i].executable_name))
|
||||||
possible_browsers[i].in_path = TRUE;
|
possible_browsers[i].in_path = TRUE;
|
||||||
|
@ -103,67 +199,112 @@ initialize_default_applications (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_editor (GConfClient *client,
|
update_editor_sensitivity (GladeXML *dialog)
|
||||||
GladeXML *dialog)
|
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
gboolean predefined = GTK_TOGGLE_BUTTON (WID ("text_select_radio"))->active;
|
||||||
gchar *editor;
|
|
||||||
gboolean needs_term;
|
|
||||||
gboolean accepts_lineno;
|
|
||||||
gint i;
|
|
||||||
|
|
||||||
needs_term = gconf_client_get_bool (client, DEFAULT_APPS_KEY_EDITOR_NEEDS_TERM, &error);
|
gtk_widget_set_sensitive (WID ("text_select_combo"), predefined);
|
||||||
if (error) {
|
gtk_widget_set_sensitive (WID ("text_custom_hbox"), !predefined);
|
||||||
/* hp will shoot me -- I'll do this later. */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
accepts_lineno = gconf_client_get_bool (client, DEFAULT_APPS_KEY_EDITOR_ACCEPTS_LINENO, &error);
|
|
||||||
if (error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
editor = gconf_client_get_string (client, DEFAULT_APPS_KEY_EDITOR_EXEC, &error);
|
|
||||||
if (error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (possible_editors); i++ ) {
|
|
||||||
if (possible_editors[i].in_path == FALSE)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (editor && strcmp (editor, possible_editors[i].executable_name) == 0 &&
|
|
||||||
needs_term == possible_editors[i].needs_term &&
|
|
||||||
accepts_lineno == possible_editors[i].accepts_lineno) {
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (WID ("text_select_combo_entry")),
|
|
||||||
_(possible_editors[i].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);
|
|
||||||
g_free (editor);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
g_free (editor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
text_setup_custom (GtkWidget *entry,
|
read_editor (GConfClient *client,
|
||||||
GladeXML *dialog)
|
GladeXML *dialog)
|
||||||
{
|
{
|
||||||
gint i;
|
GnomeVFSMimeApplication *mime_app;
|
||||||
const gchar *editor = gtk_entry_get_text (GTK_ENTRY (entry));
|
GList *li;
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (possible_editors); i++ ) {
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("text_default_viewer_toggle")),
|
||||||
if (! strcmp (_(possible_editors[i].name), editor)) {
|
gnome_vfs_mime_get_default_action_type ("text/plain") == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION);
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("text_custom_terminal_toggle")),
|
|
||||||
possible_editors[i].needs_term);
|
mime_app = gnome_vfs_mime_get_default_application ("text/plain");
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("text_custom_line_toggle")),
|
if (!strcmp (mime_app->id, MIME_APPLICATION_ID))
|
||||||
possible_editors[i].accepts_lineno);
|
goto read_editor_custom;
|
||||||
gtk_entry_set_text (GTK_ENTRY (WID ("text_custom_command_entry")),
|
|
||||||
possible_editors[i].executable_name);
|
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);
|
||||||
return;
|
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_mime_application_free (mime_app);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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")));
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
|
@ -172,17 +313,8 @@ setup_peditors (GConfClient *client,
|
||||||
{
|
{
|
||||||
GConfChangeSet *changeset = NULL;
|
GConfChangeSet *changeset = NULL;
|
||||||
|
|
||||||
gconf_peditor_new_boolean (changeset, DEFAULT_APPS_KEY_EDITOR_NEEDS_TERM,
|
|
||||||
WID ("text_custom_terminal_toggle"), NULL);
|
|
||||||
gconf_peditor_new_boolean (changeset, DEFAULT_APPS_KEY_EDITOR_ACCEPTS_LINENO,
|
|
||||||
WID ("text_custom_line_toggle"), NULL);
|
|
||||||
gconf_peditor_new_string (changeset, DEFAULT_APPS_KEY_EDITOR_EXEC,
|
|
||||||
WID ("text_custom_command_entry"), NULL);
|
|
||||||
|
|
||||||
gconf_peditor_new_boolean (changeset, DEFAULT_APPS_KEY_BROWSER_NEEDS_TERM,
|
gconf_peditor_new_boolean (changeset, DEFAULT_APPS_KEY_BROWSER_NEEDS_TERM,
|
||||||
WID ("web_custom_terminal_toggle"), NULL);
|
WID ("web_custom_terminal_toggle"), NULL);
|
||||||
gconf_peditor_new_boolean (changeset, DEFAULT_APPS_KEY_BROWSER_NREMOTE,
|
|
||||||
WID ("web_custom_remote_toggle"), NULL);
|
|
||||||
gconf_peditor_new_string (changeset, DEFAULT_APPS_KEY_BROWSER_EXEC,
|
gconf_peditor_new_string (changeset, DEFAULT_APPS_KEY_BROWSER_EXEC,
|
||||||
WID ("web_custom_command_entry"), NULL);
|
WID ("web_custom_command_entry"), NULL);
|
||||||
|
|
||||||
|
@ -206,7 +338,6 @@ read_browser (GConfClient *client,
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gchar *browser;
|
gchar *browser;
|
||||||
gboolean needs_term;
|
gboolean needs_term;
|
||||||
gboolean nremote;
|
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
needs_term = gconf_client_get_bool (client, DEFAULT_APPS_KEY_BROWSER_NEEDS_TERM, &error);
|
needs_term = gconf_client_get_bool (client, DEFAULT_APPS_KEY_BROWSER_NEEDS_TERM, &error);
|
||||||
|
@ -214,10 +345,6 @@ read_browser (GConfClient *client,
|
||||||
/* hp will shoot me -- I'll do this later. */
|
/* hp will shoot me -- I'll do this later. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nremote = gconf_client_get_bool (client, DEFAULT_APPS_KEY_BROWSER_NREMOTE, &error);
|
|
||||||
if (error) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
browser = gconf_client_get_string (client, DEFAULT_APPS_KEY_BROWSER_EXEC, &error);
|
browser = gconf_client_get_string (client, DEFAULT_APPS_KEY_BROWSER_EXEC, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
return;
|
return;
|
||||||
|
@ -227,9 +354,8 @@ read_browser (GConfClient *client,
|
||||||
if (possible_browsers[i].in_path == FALSE)
|
if (possible_browsers[i].in_path == FALSE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (browser && strcmp (browser, possible_browsers[i].executable_name) == 0 &&
|
if (browser && strcmp (browser, possible_browsers[i].command) == 0 &&
|
||||||
needs_term == possible_browsers[i].needs_term &&
|
needs_term == possible_browsers[i].needs_term) {
|
||||||
nremote == possible_browsers[i].nremote) {
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (WID ("web_select_combo_entry")),
|
gtk_entry_set_text (GTK_ENTRY (WID ("web_select_combo_entry")),
|
||||||
_(possible_browsers[i].name));
|
_(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_custom_radio")), TRUE);
|
||||||
|
@ -256,10 +382,8 @@ browser_setup_custom (GtkWidget *entry,
|
||||||
if (! strcmp (_(possible_browsers[i].name), browser)) {
|
if (! strcmp (_(possible_browsers[i].name), browser)) {
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("web_custom_terminal_toggle")),
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("web_custom_terminal_toggle")),
|
||||||
possible_browsers[i].needs_term);
|
possible_browsers[i].needs_term);
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("web_custom_remote_toggle")),
|
|
||||||
possible_browsers[i].nremote);
|
|
||||||
gtk_entry_set_text (GTK_ENTRY (WID ("web_custom_command_entry")),
|
gtk_entry_set_text (GTK_ENTRY (WID ("web_custom_command_entry")),
|
||||||
possible_browsers[i].executable_name);
|
possible_browsers[i].command);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,35 +535,35 @@ dialog_response (GtkDialog *widget,
|
||||||
gint response_id,
|
gint response_id,
|
||||||
GladeXML *dialog)
|
GladeXML *dialog)
|
||||||
{
|
{
|
||||||
|
if (response_id == GTK_RESPONSE_HELP) {
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
switch (response_id) {
|
/* TODO : get this written */
|
||||||
case 1: /* Apply */
|
gnome_help_display_desktop (NULL,
|
||||||
break;
|
"control-center-manual",
|
||||||
case 2: /* Close */
|
"config-default-apps.xml",
|
||||||
case -4: /* keyboard esc or WM close */
|
"CONFIGURATION", &error);
|
||||||
|
if (error) {
|
||||||
|
g_warning ("help error: %s\n", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
}
|
||||||
|
} else
|
||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
break;
|
|
||||||
default:
|
|
||||||
g_assert_not_reached ();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GladeXML *
|
static GladeXML *
|
||||||
create_dialog (GConfClient *client)
|
create_dialog (GConfClient *client)
|
||||||
{
|
{
|
||||||
GladeXML *dialog;
|
GladeXML *dialog;
|
||||||
GList *strings = NULL;
|
GList *strings = NULL, *li;
|
||||||
gint i;
|
gint i;
|
||||||
dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gnome-default-applications-properties.glade",
|
dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gnome-default-applications-properties.glade", NULL, NULL);
|
||||||
"default_applications_dialog",
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
setup_peditors (client, dialog);
|
setup_peditors (client, dialog);
|
||||||
|
|
||||||
/* Editors page */
|
/* Editors page */
|
||||||
for (i = 0; i < G_N_ELEMENTS (possible_editors); i++ ) {
|
for (li = text_editors; li; li = li->next) {
|
||||||
if (possible_editors[i].in_path)
|
strings = g_list_append (strings, ((GnomeVFSMimeApplication *)li->data)->name);
|
||||||
strings = g_list_append (strings, _(possible_editors[i].name));
|
|
||||||
}
|
}
|
||||||
if (strings) {
|
if (strings) {
|
||||||
/* We have default editors */
|
/* We have default editors */
|
||||||
|
@ -451,22 +575,22 @@ create_dialog (GConfClient *client)
|
||||||
gtk_widget_set_sensitive (WID ("text_select_radio"), FALSE);
|
gtk_widget_set_sensitive (WID ("text_select_radio"), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Source of command string */
|
read_editor (client, dialog);
|
||||||
g_object_set_data (G_OBJECT (WID ("text_select_radio")), "entry", WID ("text_select_combo_entry"));
|
update_editor_sensitivity (dialog);
|
||||||
/* Source of command string */
|
|
||||||
g_object_set_data (G_OBJECT (WID ("text_custom_radio")), "entry", WID ("text_custom_command_entry"));
|
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (WID ("text_select_combo_entry")),
|
g_signal_connect (G_OBJECT (WID ("text_select_combo_entry")),
|
||||||
"changed", (GCallback) text_setup_custom,
|
"changed", G_CALLBACK (text_apply_editor),
|
||||||
dialog);
|
dialog);
|
||||||
g_signal_connect (G_OBJECT (WID ("text_select_radio")),
|
g_signal_connect (WID ("text_custom_properties"), "clicked",
|
||||||
"toggled", (GCallback) generic_guard,
|
G_CALLBACK (on_text_custom_properties_clicked),
|
||||||
WID ("text_select_combo"));
|
dialog);
|
||||||
g_signal_connect (G_OBJECT (WID ("text_custom_radio")),
|
g_signal_connect (WID ("text_default_viewer_toggle"), "toggled",
|
||||||
"toggled", (GCallback) generic_guard,
|
G_CALLBACK (on_text_default_viewer_toggle),
|
||||||
WID ("text_custom_vbox"));
|
dialog);
|
||||||
|
g_signal_connect_after (G_OBJECT (WID ("text_select_radio")), "toggled",
|
||||||
read_editor (client, dialog);
|
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 */
|
/* Web browsers page */
|
||||||
for (i = 0; i < G_N_ELEMENTS (possible_browsers); i++ ) {
|
for (i = 0; i < G_N_ELEMENTS (possible_browsers); i++ ) {
|
||||||
|
@ -565,12 +689,11 @@ create_dialog (GConfClient *client)
|
||||||
WID ("terminal_custom_table"));
|
WID ("terminal_custom_table"));
|
||||||
read_terminal (client, dialog);
|
read_terminal (client, dialog);
|
||||||
|
|
||||||
gtk_notebook_remove_page (GTK_NOTEBOOK (WID ("notebook")), 4);
|
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (client), "value-changed", (GCallback) value_changed_cb, 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);
|
g_signal_connect (G_OBJECT (WID ("default_applications_dialog")), "response", (GCallback) dialog_response, dialog);
|
||||||
|
|
||||||
gtk_widget_show_all (WID ("default_applications_dialog"));
|
gtk_widget_show (WID ("default_applications_dialog"));
|
||||||
|
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
@ -604,7 +727,6 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
client = gconf_client_get_default ();
|
client = gconf_client_get_default ();
|
||||||
|
|
||||||
gconf_client_add_dir (client, "/desktop/gnome/applications/editor", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
|
||||||
gconf_client_add_dir (client, "/desktop/gnome/applications/browser", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
gconf_client_add_dir (client, "/desktop/gnome/applications/browser", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
gconf_client_add_dir (client, "/desktop/gnome/applications/help_viewer", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
gconf_client_add_dir (client, "/desktop/gnome/applications/help_viewer", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
gconf_client_add_dir (client, "/desktop/gnome/applications/terminal", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
gconf_client_add_dir (client, "/desktop/gnome/applications/terminal", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue