diff --git a/capplets/default-applications/ChangeLog b/capplets/default-applications/ChangeLog index f66542de0..cfd50f4e4 100644 --- a/capplets/default-applications/ChangeLog +++ b/capplets/default-applications/ChangeLog @@ -1,3 +1,8 @@ +2008-05-18 Thomas Wood + + * gnome-da-capplet.c: Convert to use GConfPropertyEditor and remove + a lot of duplicated code in the process. + ==================== 2.23.2 ==================== 2008-04-16 Jens Granseuer diff --git a/capplets/default-applications/gnome-da-capplet.c b/capplets/default-applications/gnome-da-capplet.c index f09e318e0..76b2b8482 100644 --- a/capplets/default-applications/gnome-da-capplet.c +++ b/capplets/default-applications/gnome-da-capplet.c @@ -2,6 +2,7 @@ * Authors: Luca Cavalli * * Copyright 2005-2006 Luca Cavalli + * Copyright 2008 Thomas Wood * * 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 @@ -26,13 +27,12 @@ #include #include +#include "gconf-property-editor.h" #include "gnome-da-capplet.h" #include "gnome-da-xml.h" #include "gnome-da-item.h" #include "capplet-util.h" -/* TODO: it doesn't use GConfPropertyEditor, use it when/if moved to control-center */ - enum { PIXBUF_COL, @@ -52,89 +52,6 @@ close_cb (GtkWidget *window, gint response, gpointer user_data) } } -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); - } - else if (widget == capplet->media_player_command_entry) { - gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_EXEC, text, &error); - } - - if (error != NULL) { - g_warning (_("Error saving configuration: %s"), error->message); - g_error_free (error); - } - else if (widget == capplet->visual_command_entry) { - gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_EXEC, text, NULL); - } - else if (widget == capplet->mobility_command_entry) { - gconf_client_set_string (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_EXEC, text, NULL); - } - - return FALSE; -} - -static void -terminal_checkbutton_toggled_cb (GtkWidget *togglebutton, GnomeDACapplet *capplet) -{ - gboolean is_active; - GError *error = NULL; - - is_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton)); - - if (togglebutton == capplet->web_browser_terminal_checkbutton) { - gconf_client_set_bool (capplet->gconf, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, is_active, &error); - } - else if (togglebutton == capplet->mail_reader_terminal_checkbutton) { - gconf_client_set_bool (capplet->gconf, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, is_active, &error); - } - else if (togglebutton == capplet->media_player_terminal_checkbutton) { - gconf_client_set_bool (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM, is_active, &error); - } - - if (error != NULL) { - g_warning (_("Error saving configuration: %s"), error->message); - g_error_free (error); - } -} - -static void -a11y_checkbutton_toggled_cb (GtkWidget *togglebutton, GnomeDACapplet *capplet) -{ - gboolean is_active; - GError *error = NULL; - - is_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (togglebutton)); - - if (togglebutton == capplet->visual_startup_checkbutton) { - gconf_client_set_bool (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_STARTUP, is_active, &error); - } - else if (togglebutton == capplet->mobility_startup_checkbutton) { - gconf_client_set_bool (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_STARTUP, is_active, &error); - } - - if (error != NULL) { - g_warning (_("Error saving configuration: %s"), error->message); - g_error_free (error); - } -} - static void set_icon (GtkImage *image, GtkIconTheme *theme, const char *name) { @@ -182,61 +99,24 @@ web_radiobutton_toggled_cb (GtkWidget *togglebutton, GnomeDACapplet *capplet) 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; - char *http_cmd; - 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); + current_index = gtk_combo_box_get_active (combo); 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); - } - - gconf_change_set_unref (cs); } else { - has_net_remote = FALSE; - is_custom_active = TRUE; + has_net_remote = FALSE; + is_custom_active = TRUE; } - - http_cmd = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_HTTP_EXEC, NULL); - gtk_entry_set_text (GTK_ENTRY (capplet->web_browser_command_entry), - http_cmd ? http_cmd : ""); - g_free (http_cmd); - 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); @@ -250,48 +130,11 @@ web_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet) static void mail_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet) { - GtkTreeIter iter; - GtkTreePath *path; guint current_index; gboolean is_custom_active; - GnomeDASimpleItem *item; - GConfChangeSet *cs; - GError *error = NULL; - char *mailer_cmd; - 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 = (GnomeDASimpleItem*) 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); - } - - gconf_change_set_unref (cs); - } - else { - is_custom_active = TRUE; - } - - mailer_cmd = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_MAILER_EXEC, NULL); - gtk_entry_set_text (GTK_ENTRY (capplet->mail_reader_command_entry), - mailer_cmd ? mailer_cmd : ""); - g_free (mailer_cmd); - 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)); + current_index = gtk_combo_box_get_active (combo); + is_custom_active = (current_index >= g_list_length (capplet->mail_readers)); gtk_widget_set_sensitive (capplet->mail_reader_command_entry, is_custom_active); gtk_widget_set_sensitive (capplet->mail_reader_command_label, is_custom_active); @@ -301,48 +144,11 @@ mail_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet) static void media_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet) { - GtkTreeIter iter; - GtkTreePath *path; guint current_index; gboolean is_custom_active; - GnomeDASimpleItem *item; - GConfChangeSet *cs; - GError *error = NULL; - char *media_cmd; - 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->media_players)) { - item = (GnomeDASimpleItem *) g_list_nth_data (capplet->media_players, current_index); - is_custom_active = FALSE; - - cs = gconf_change_set_new (); - - gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_MEDIA_EXEC, item->generic.command); - gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_MEDIA_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); - } - - gconf_change_set_unref (cs); - } - else { - is_custom_active = TRUE; - } - - media_cmd = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_EXEC, NULL); - gtk_entry_set_text (GTK_ENTRY (capplet->media_player_command_entry), - media_cmd ? media_cmd : ""); - g_free (media_cmd); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->media_player_terminal_checkbutton), - gconf_client_get_bool (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM, NULL)); + current_index = gtk_combo_box_get_active (combo); + is_custom_active = (current_index >= g_list_length (capplet->media_players)); gtk_widget_set_sensitive (capplet->media_player_command_entry, is_custom_active); gtk_widget_set_sensitive (capplet->media_player_command_label, is_custom_active); @@ -352,49 +158,11 @@ media_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet) 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; - char *terminal_cmd, *terminal_cmd_arg; - 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); - } - - gconf_change_set_unref (cs); - } - else { - is_custom_active = TRUE; - } - terminal_cmd = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC, NULL); - terminal_cmd_arg = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, NULL); - gtk_entry_set_text (GTK_ENTRY (capplet->terminal_command_entry), - terminal_cmd ? terminal_cmd : ""); - gtk_entry_set_text (GTK_ENTRY (capplet->terminal_exec_flag_entry), - terminal_cmd_arg ? terminal_cmd_arg : ""); - g_free (terminal_cmd); - g_free (terminal_cmd_arg); + current_index = gtk_combo_box_get_active (combo); + is_custom_active = (current_index >= g_list_length (capplet->terminals)); gtk_widget_set_sensitive (capplet->terminal_command_entry, is_custom_active); gtk_widget_set_sensitive (capplet->terminal_command_label, is_custom_active); @@ -405,97 +173,24 @@ terminal_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet) static void visual_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet) { - GtkTreeIter iter; - GtkTreePath *path; guint current_index; gboolean is_custom_active; - GnomeDAVisualItem *item; - GConfChangeSet *cs; - GError *error = NULL; - gchar *cmd; - 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->visual_ats)) { - item = (GnomeDAVisualItem *) g_list_nth_data (capplet->visual_ats, current_index); - is_custom_active = FALSE; - - cs = gconf_change_set_new (); - - gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_VISUAL_EXEC, item->generic.command); - gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_VISUAL_STARTUP, item->run_at_startup); - - 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); - } - - gconf_change_set_unref (cs); - } - else { - is_custom_active = TRUE; - } - - cmd = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_EXEC, NULL); - gtk_entry_set_text (GTK_ENTRY (capplet->visual_command_entry), cmd ? cmd : ""); - g_free (cmd); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->visual_startup_checkbutton), - gconf_client_get_bool (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_STARTUP, NULL)); + current_index = gtk_combo_box_get_active (combo); + is_custom_active = (current_index >= g_list_length (capplet->visual_ats)); gtk_widget_set_sensitive (capplet->visual_command_entry, is_custom_active); gtk_widget_set_sensitive (capplet->visual_command_label, is_custom_active); - } static void mobility_combo_changed_cb (GtkComboBox *combo, GnomeDACapplet *capplet) { - GtkTreeIter iter; - GtkTreePath *path; guint current_index; gboolean is_custom_active; - GnomeDAMobilityItem *item; - GConfChangeSet *cs; - GError *error = NULL; - gchar *cmd; - 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->mobility_ats)) { - item = (GnomeDAMobilityItem *) g_list_nth_data (capplet->mobility_ats, current_index); - is_custom_active = FALSE; - - cs = gconf_change_set_new (); - - gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_MOBILITY_EXEC, item->generic.command); - gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_MOBILITY_STARTUP, item->run_at_startup); - - 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); - } - - gconf_change_set_unref (cs); - } - else { - is_custom_active = TRUE; - } - - cmd = gconf_client_get_string (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_EXEC, NULL); - gtk_entry_set_text (GTK_ENTRY (capplet->mobility_command_entry), cmd ? cmd : ""); - g_free (cmd); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mobility_startup_checkbutton), - gconf_client_get_bool (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_STARTUP, NULL)); + current_index = gtk_combo_box_get_active (combo); + is_custom_active = (current_index >= g_list_length (capplet->mobility_ats)); gtk_widget_set_sensitive (capplet->mobility_command_entry, is_custom_active); gtk_widget_set_sensitive (capplet->mobility_command_label, is_custom_active); @@ -607,33 +302,74 @@ web_item_comp (gconstpointer item, gconstpointer command) } static void -web_browser_update_combo_box (GnomeDACapplet *capplet, const gchar *command) +web_gconf_changed_cb (GConfPropertyEditor *peditor, gchar *key, GConfValue *value, GnomeDACapplet *capplet) { - GList *entry; - gint index; - gboolean is_custom_active; + GConfChangeSet *cs; + GError *error = NULL; + GList *list_entry; - entry = g_list_find_custom (capplet->web_browsers, command, (GCompareFunc) web_item_comp); + /* This function is used to update HTTPS,ABOUT and UNKNOWN handlers, which + * should also use the same value as HTTP + */ - if (entry) { - index = g_list_position (capplet->web_browsers, entry); - is_custom_active = FALSE; + if (strcmp (key, DEFAULT_APPS_KEY_HTTP_EXEC) == 0) { + gchar *short_browser, *pos; + const gchar *value_str = 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); + pos = strstr (value_str, " "); + if (pos == NULL) + short_browser = g_strdup (value_str); + else + short_browser = g_strndup (value_str, pos - value_str); + gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_BROWSER_EXEC, short_browser); + g_free (short_browser); + + list_entry = g_list_find_custom (capplet->web_browsers, + value_str, + (GCompareFunc) web_item_comp); + + if (list_entry) { + GnomeDAWebItem *item = (GnomeDAWebItem *) list_entry->data; + + gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_BROWSER_NREMOTE, item->netscape_remote); + } + + 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); } - else { - /* index of 'Custom' combo box entry */ - index = g_list_length (capplet->web_browsers) + 1; - is_custom_active = TRUE; + else if (strcmp (key, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM) == 0) { + 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_change_set_set (cs, DEFAULT_APPS_KEY_BROWSER_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); } - - /* TODO: Remove when GConfPropertyEditor will be used */ - gtk_entry_set_text (GTK_ENTRY (capplet->web_browser_command_entry), command); - - 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 @@ -682,328 +418,142 @@ web_browser_update_radio_buttons (GnomeDACapplet *capplet, const gchar *command) gtk_widget_set_sensitive (capplet->new_tab_radiobutton, has_net_remote); } -/* FIXME: Refactor these two functions below into single one... */ -static void -mail_reader_update_combo_box (GnomeDACapplet *capplet, const gchar *command) +static GConfValue* +web_combo_conv_to_widget (GConfPropertyEditor *peditor, const GConfValue *value) { - GList *entry; + GConfValue *ret; + GList *entry, *handlers; + const gchar *command; gint index; - gboolean is_custom_active; + GnomeDACapplet *capplet; - entry = g_list_find_custom (capplet->mail_readers, command, (GCompareFunc) generic_item_comp); + g_object_get (G_OBJECT (peditor), "data", &capplet, NULL); - if (entry) { - index = g_list_position (capplet->mail_readers, entry); - is_custom_active = FALSE; + command = gconf_value_get_string (value); + handlers = capplet->web_browsers; + + if (handlers) + { + entry = g_list_find_custom (handlers, command, (GCompareFunc) web_item_comp); + if (entry) + index = g_list_position (handlers, entry); + else + index = g_list_length (handlers) + 1; } - else { - /* index of 'Custom' combo box entry */ - index = g_list_length (capplet->mail_readers) + 1; - is_custom_active = TRUE; + else + { + /* if the item has no handlers lsit then select the Custom item */ + index = 1; } - gtk_entry_set_text (GTK_ENTRY (capplet->mail_reader_command_entry), command); + web_browser_update_radio_buttons (capplet, 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); + ret = gconf_value_new (GCONF_VALUE_INT); + gconf_value_set_int (ret, index); + return ret; } -static void -media_player_update_combo_box (GnomeDACapplet *capplet, const gchar *command) +static GConfValue* +web_combo_conv_from_widget (GConfPropertyEditor *peditor, const GConfValue *value) { - GList *entry; + GConfValue *ret; + GList *handlers; gint index; - gboolean is_custom_active; + GnomeDAWebItem *item; + const gchar *command; + GnomeDACapplet *capplet; - entry = g_list_find_custom (capplet->media_players, command, (GCompareFunc) generic_item_comp); + g_object_get (G_OBJECT (peditor), "data", &capplet, NULL); - if (entry) { - index = g_list_position (capplet->media_players, entry); - is_custom_active = FALSE; + index = gconf_value_get_int (value); + handlers = capplet->web_browsers; + + item = g_list_nth_data (handlers, index); + + ret = gconf_value_new (GCONF_VALUE_STRING); + if (!item) + { + /* if item was not found, this is probably the "Custom" item */ + + /* XXX: returning "" as the value here is not ideal, but required to + * prevent the combo box from jumping back to the previous value if the + * user has selected Custom */ + gconf_value_set_string (ret, ""); + return ret; } - else { - /* index of 'Custom' combo box entry */ - index = g_list_length (capplet->media_players) + 1; - is_custom_active = TRUE; + else + { + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_win_radiobutton)) && item->netscape_remote == TRUE) + command = item->win_command; + else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (capplet->new_tab_radiobutton)) && item->netscape_remote == TRUE) + command = item->tab_command; + else + command = item->generic.command; + + gconf_value_set_string (ret, command); + return ret; } - - gtk_entry_set_text (GTK_ENTRY (capplet->media_player_command_entry), command); - - gtk_widget_set_sensitive (capplet->media_player_command_entry, is_custom_active); - gtk_widget_set_sensitive (capplet->media_player_command_label, is_custom_active); - gtk_widget_set_sensitive (capplet->media_player_terminal_checkbutton, is_custom_active); - - if (gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->media_combo_box)) != index) - gtk_combo_box_set_active (GTK_COMBO_BOX (capplet->media_combo_box), index); } -static void -terminal_update_combo_box (GnomeDACapplet *capplet, const gchar *command) +static GConfValue* +combo_conv_to_widget (GConfPropertyEditor *peditor, const GConfValue *value) { - GList *entry; + GConfValue *ret; + GList *entry, *handlers; + const gchar *command; gint index; - gboolean is_custom_active; - entry = g_list_find_custom (capplet->terminals, command, (GCompareFunc) generic_item_comp); + g_object_get (G_OBJECT (peditor), "data", &handlers, NULL); - if (entry) { - index = g_list_position (capplet->terminals, entry); - is_custom_active = FALSE; + command = gconf_value_get_string (value); + + if (handlers) + { + entry = g_list_find_custom (handlers, command, (GCompareFunc) generic_item_comp); + if (entry) + index = g_list_position (handlers, entry); + else + index = g_list_length (handlers) + 1; } - else { - /* index of 'Custom' combo box entry */ - index = g_list_length (capplet->terminals) + 1; - is_custom_active = TRUE; + else + { + /* if the item has no handlers lsit then select the Custom item */ + index = 1; } - 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); + ret = gconf_value_new (GCONF_VALUE_INT); + gconf_value_set_int (ret, index); + return ret; } -static void -visual_update_combo_box (GnomeDACapplet *capplet, const gchar *command) +static GConfValue* +combo_conv_from_widget (GConfPropertyEditor *peditor, const GConfValue *value) { - GList *entry; + GConfValue *ret; + GList *handlers; gint index; - gboolean is_custom_active; + GnomeDAItem *item; - entry = g_list_find_custom (capplet->visual_ats, command, (GCompareFunc) generic_item_comp); + g_object_get (G_OBJECT (peditor), "data", &handlers, NULL); + index = gconf_value_get_int (value); - if (entry) { - index = g_list_position (capplet->visual_ats, entry); - is_custom_active = FALSE; + item = g_list_nth_data (handlers, index); + ret = gconf_value_new (GCONF_VALUE_STRING); + + if (!item) + { + /* if item was not found, this is probably the "Custom" item */ + + /* XXX: returning "" as the value here is not ideal, but required to + * prevent the combo box from jumping back to the previous value if the + * user has selected Custom */ + gconf_value_set_string (ret, ""); + return NULL; } - else { - /* index of 'Custom' combo box entry */ - index = g_list_length (capplet->visual_ats) + 1; - is_custom_active = TRUE; - } - - gtk_entry_set_text (GTK_ENTRY (capplet->visual_command_entry), command); - - gtk_widget_set_sensitive (capplet->visual_command_entry, is_custom_active); - gtk_widget_set_sensitive (capplet->visual_command_label, is_custom_active); - - if (gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->visual_combo_box)) != index) - gtk_combo_box_set_active (GTK_COMBO_BOX (capplet->visual_combo_box), index); -} - - -static void -mobility_update_combo_box (GnomeDACapplet *capplet, const gchar *command) -{ - GList *entry; - gint index; - gboolean is_custom_active; - - entry = g_list_find_custom (capplet->mobility_ats, command, (GCompareFunc) generic_item_comp); - - if (entry) { - index = g_list_position (capplet->mobility_ats, entry); - is_custom_active = FALSE; - } - else { - /* index of 'Custom' combo box entry */ - index = g_list_length (capplet->mobility_ats) + 1; - is_custom_active = TRUE; - } - - gtk_entry_set_text (GTK_ENTRY (capplet->mobility_command_entry), command); - - gtk_widget_set_sensitive (capplet->mobility_command_entry, is_custom_active); - gtk_widget_set_sensitive (capplet->mobility_command_label, is_custom_active); - - if (gtk_combo_box_get_active (GTK_COMBO_BOX (capplet->mobility_combo_box)) != index) - gtk_combo_box_set_active (GTK_COMBO_BOX (capplet->mobility_combo_box), index); -} - -static void -web_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet) -{ - GConfValue *value; - GConfChangeSet *cs; - GError *error = NULL; - GList *list_entry; - - 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) { - gchar *short_browser, *pos; - const gchar *value_str = gconf_value_get_string (value); - - web_browser_update_combo_box (capplet, value_str); - web_browser_update_radio_buttons (capplet, value_str); - - 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); - pos = strstr (value_str, " "); - if (pos == NULL) - short_browser = g_strdup (value_str); - else - short_browser = g_strndup (value_str, pos - value_str); - gconf_change_set_set_string (cs, DEFAULT_APPS_KEY_BROWSER_EXEC, short_browser); - g_free (short_browser); - - list_entry = g_list_find_custom (capplet->web_browsers, - value_str, - (GCompareFunc) web_item_comp); - - if (list_entry) { - GnomeDAWebItem *item = (GnomeDAWebItem *) list_entry->data; - - gconf_change_set_set_bool (cs, DEFAULT_APPS_KEY_BROWSER_NREMOTE, item->netscape_remote); - } - - 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) { - 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_change_set_set (cs, DEFAULT_APPS_KEY_BROWSER_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); - } -} - -/* FIXME: Refactor these two functions below into single one... */ -static void -mail_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet) -{ - GConfValue *value; - - 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) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mail_reader_terminal_checkbutton), - gconf_value_get_bool (value)); - } -} - -static void -media_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet) -{ - GConfValue *value; - - 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_MEDIA_EXEC) == 0) { - media_player_update_combo_box (capplet, gconf_value_get_string (value)); - } - /* TODO: Remove when GConfPropertyEditor will be used */ - else if (strcmp (entry->key, DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM) == 0) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->media_player_terminal_checkbutton), - gconf_value_get_bool (value)); - } -} - -static void -term_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet) -{ - GConfValue *value; - - 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) { - gtk_entry_set_text (GTK_ENTRY (capplet->terminal_exec_flag_entry), - gconf_value_get_string (value)); - } -} - - -static void -visual_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet) -{ - GConfValue *value; - - 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_VISUAL_EXEC) == 0) { - visual_update_combo_box (capplet, gconf_value_get_string (value)); - } - /* TODO: Remove when GConfPropertyEditor will be used */ - else if (strcmp (entry->key, DEFAULT_APPS_KEY_VISUAL_STARTUP) == 0) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->visual_startup_checkbutton), - gconf_value_get_bool (value)); - } -} - -static void -mobility_gconf_changed_cb (GConfClient *client, guint id, GConfEntry *entry, GnomeDACapplet *capplet) -{ - GConfValue *value; - - 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_MOBILITY_EXEC) == 0) { - mobility_update_combo_box (capplet, gconf_value_get_string (value)); - } - /* TODO: Remove when GConfPropertyEditor will be used */ - else if (strcmp (entry->key, DEFAULT_APPS_KEY_MOBILITY_STARTUP) == 0) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mobility_startup_checkbutton), - gconf_value_get_bool (value)); + else + { + gconf_value_set_string (ret, item->command); + return ret; } } @@ -1084,7 +634,7 @@ fill_combo_box (GtkIconTheme *theme, GtkComboBox *combo_box, GList *app_list) static void show_dialog (GnomeDACapplet *capplet, const gchar *start_page) { - GConfValue *value; + GObject *obj; if (g_file_test (GNOMECC_GLADE_DIR "/gnome-default-applications-properties.glade", G_FILE_TEST_EXISTS) != FALSE) { capplet->xml = glade_xml_new (GNOMECC_GLADE_DIR "/gnome-default-applications-properties.glade", NULL, NULL); @@ -1155,104 +705,6 @@ show_dialog (GnomeDACapplet *capplet, const gchar *start_page) fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->visual_combo_box), capplet->visual_ats); fill_combo_box (capplet->icon_theme, GTK_COMBO_BOX (capplet->mobility_combo_box), capplet->mobility_ats); - /* update ui to gconf content */ - value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_HTTP_EXEC, NULL); - if (value) - { - web_browser_update_combo_box (capplet, gconf_value_get_string (value)); - web_browser_update_radio_buttons (capplet, gconf_value_get_string (value)); - gconf_value_free (value); - } - - value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, NULL); - if (value) - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->web_browser_terminal_checkbutton), - gconf_value_get_bool (value)); - gconf_value_free (value); - } - - value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MAILER_EXEC, NULL); - if (value) - { - mail_reader_update_combo_box (capplet, gconf_value_get_string (value)); - gconf_value_free (value); - } - - value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, NULL); - if (value) - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->mail_reader_terminal_checkbutton), - gconf_value_get_bool (value)); - gconf_value_free (value); - } - - value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC, NULL); - if (value) - { - terminal_update_combo_box (capplet, gconf_value_get_string (value)); - gconf_value_free (value); - } - - value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, NULL); - if (value) - { - gtk_entry_set_text (GTK_ENTRY (capplet->terminal_exec_flag_entry), - gconf_value_get_string (value)); - gconf_value_free (value); - } - - value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_EXEC, NULL); - if (value) - { - media_player_update_combo_box (capplet, gconf_value_get_string (value)); - gconf_value_free (value); - } - - value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM, NULL); - if (value) - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (capplet->media_player_terminal_checkbutton), - gconf_value_get_bool (value)); - gconf_value_free (value); - } - - value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_EXEC, NULL); - - if (value) - { - visual_update_combo_box (capplet, gconf_value_get_string (value)); - gconf_value_free (value); - } - - value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_STARTUP, NULL); - - if (value) - { - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (capplet->visual_startup_checkbutton), - gconf_value_get_bool (value)); - gconf_value_free (value); - } - - value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_EXEC, NULL); - - if (value) - { - mobility_update_combo_box (capplet, gconf_value_get_string (value)); - gconf_value_free (value); - } - - value = gconf_client_get (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_STARTUP, NULL); - - if (value) - { - gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON (capplet->mobility_startup_checkbutton), - gconf_value_get_bool (value)); - gconf_value_free (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); @@ -1260,31 +712,130 @@ show_dialog (GnomeDACapplet *capplet, const gchar *start_page) g_signal_connect (capplet->visual_combo_box, "changed", G_CALLBACK (visual_combo_changed_cb), capplet); g_signal_connect (capplet->mobility_combo_box, "changed", G_CALLBACK (mobility_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); - g_signal_connect (capplet->media_player_terminal_checkbutton, "toggled", - G_CALLBACK (terminal_checkbutton_toggled_cb), capplet); - g_signal_connect (capplet->visual_startup_checkbutton, "toggled", - G_CALLBACK (a11y_checkbutton_toggled_cb), capplet); - g_signal_connect (capplet->mobility_startup_checkbutton, "toggled", - G_CALLBACK (a11y_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->media_player_command_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet); - g_signal_connect (capplet->visual_command_entry, "focus-out-event", G_CALLBACK (entry_focus_out_event_cb), capplet); - g_signal_connect (capplet->mobility_command_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); + /* Setup GConfPropertyEditors */ + + /* Web Browser */ + gconf_peditor_new_combo_box (NULL, + DEFAULT_APPS_KEY_HTTP_EXEC, + capplet->web_combo_box, + "conv-from-widget-cb", web_combo_conv_from_widget, + "conv-to-widget-cb", web_combo_conv_to_widget, + "data", capplet, + NULL); + + obj = gconf_peditor_new_string (NULL, + DEFAULT_APPS_KEY_HTTP_EXEC, + capplet->web_browser_command_entry, + NULL); + g_signal_connect (obj, "value-changed", G_CALLBACK (web_gconf_changed_cb), capplet); + + obj = gconf_peditor_new_boolean (NULL, + DEFAULT_APPS_KEY_HTTP_NEEDS_TERM, + capplet->web_browser_terminal_checkbutton, + NULL); + g_signal_connect (obj, "value-changed", G_CALLBACK (web_gconf_changed_cb), capplet); + + /* Mailer */ + gconf_peditor_new_combo_box (NULL, + DEFAULT_APPS_KEY_MAILER_EXEC, + capplet->mail_combo_box, + "conv-from-widget-cb", combo_conv_from_widget, + "conv-to-widget-cb", combo_conv_to_widget, + "data", capplet->mail_readers, + NULL); + + gconf_peditor_new_string (NULL, + DEFAULT_APPS_KEY_MAILER_EXEC, + capplet->mail_reader_command_entry, + NULL); + + gconf_peditor_new_boolean (NULL, + DEFAULT_APPS_KEY_MAILER_NEEDS_TERM, + capplet->mail_reader_terminal_checkbutton, + NULL); + + /* Media player */ + gconf_peditor_new_combo_box (NULL, + DEFAULT_APPS_KEY_MEDIA_EXEC, + capplet->media_combo_box, + "conv-from-widget-cb", combo_conv_from_widget, + "conv-to-widget-cb", combo_conv_to_widget, + "data", capplet->media_players, + NULL); + + gconf_peditor_new_string (NULL, + DEFAULT_APPS_KEY_MEDIA_EXEC, + capplet->media_player_command_entry, + NULL); + + gconf_peditor_new_boolean (NULL, + DEFAULT_APPS_KEY_MEDIA_NEEDS_TERM, + capplet->media_player_terminal_checkbutton, + NULL); + + /* Terminal */ + gconf_peditor_new_combo_box (NULL, + DEFAULT_APPS_KEY_TERMINAL_EXEC, + capplet->term_combo_box, + "conv-from-widget-cb", combo_conv_from_widget, + "conv-to-widget-cb", combo_conv_to_widget, + "data", capplet->terminals, + NULL); + + gconf_peditor_new_string (NULL, + DEFAULT_APPS_KEY_TERMINAL_EXEC, + capplet->terminal_command_entry, + NULL); + gconf_peditor_new_string (NULL, + DEFAULT_APPS_KEY_TERMINAL_EXEC_ARG, + capplet->terminal_exec_flag_entry, + NULL); + + + /* Visual */ + gconf_peditor_new_combo_box (NULL, + DEFAULT_APPS_KEY_VISUAL_EXEC, + capplet->visual_combo_box, + "conv-from-widget-cb", combo_conv_from_widget, + "conv-to-widget-cb", combo_conv_to_widget, + "data", capplet->visual_ats, + NULL); + + gconf_peditor_new_string (NULL, + DEFAULT_APPS_KEY_VISUAL_EXEC, + capplet->visual_command_entry, + NULL); + + gconf_peditor_new_boolean (NULL, + DEFAULT_APPS_KEY_VISUAL_STARTUP, + capplet->visual_startup_checkbutton, + NULL); + + + /* Mobility */ + gconf_peditor_new_combo_box (NULL, + DEFAULT_APPS_KEY_MOBILITY_EXEC, + capplet->mobility_combo_box, + "conv-from-widget-cb", combo_conv_from_widget, + "conv-to-widget-cb", combo_conv_to_widget, + "data", capplet->mobility_ats, + NULL); + + gconf_peditor_new_string (NULL, + DEFAULT_APPS_KEY_MOBILITY_EXEC, + capplet->mobility_command_entry, + NULL); + + gconf_peditor_new_boolean (NULL, + DEFAULT_APPS_KEY_MOBILITY_STARTUP, + capplet->mobility_startup_checkbutton, + NULL); + gtk_window_set_icon_name (GTK_WINDOW (capplet->window), "gnome-settings-default-applications"); @@ -1348,32 +899,6 @@ main (int argc, char **argv) capplet = g_new0 (GnomeDACapplet, 1); 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/applications/media", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - gconf_client_add_dir (capplet->gconf, "/desktop/gnome/url-handlers", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - gconf_client_add_dir (capplet->gconf, "/desktop/gnome/accessibility/at", GCONF_CLIENT_PRELOAD_RECURSIVE, 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); - gconf_client_notify_add (capplet->gconf, DEFAULT_APPS_KEY_MEDIA_PATH, - (GConfClientNotifyFunc) media_gconf_changed_cb, - capplet, NULL, NULL); - gconf_client_notify_add (capplet->gconf, DEFAULT_APPS_KEY_VISUAL_PATH, - (GConfClientNotifyFunc) visual_gconf_changed_cb, - capplet, NULL, NULL); - gconf_client_notify_add (capplet->gconf, DEFAULT_APPS_KEY_MOBILITY_PATH, - (GConfClientNotifyFunc) mobility_gconf_changed_cb, - capplet, NULL, NULL); - gnome_da_xml_load_list (capplet); show_dialog (capplet, start_page);