From de38aaef11fe27ada765fb6d970dce55f00c77a2 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Fri, 14 Oct 2011 12:52:51 +0200 Subject: Migrate external editor plugin to GSettings --- data/evolution.convert | 152 ++++++++++----------- ...volution.eplugin.external-editor.gschema.xml.in | 4 +- plugins/external-editor/external-editor.c | 52 +++---- 3 files changed, 100 insertions(+), 108 deletions(-) diff --git a/data/evolution.convert b/data/evolution.convert index cb4308d0a6..4d9377de6f 100644 --- a/data/evolution.convert +++ b/data/evolution.convert @@ -75,8 +75,15 @@ gnome-calendar-done-calendar = /apps/evolution/importer/gnome-calendar/calendar gnome-calendar-done-tasks = /apps/evolution/importer/gnome-calendar/tasks [org.gnome.evolution.mail] +address-compress = /apps/evolution/mail/display/address_compress +address-count = /apps/evolution/mail/display/address_count +animate-images = /apps/evolution/mail/display/animate_images +caret-mode = /apps/evolution/mail/display/caret_mode +charset = /apps/evolution/mail/display/charset check-if-default-mailer = /apps/evolution/mail/prompts/checkdefault +citation-colour = /apps/evolution/mail/display/citation_colour composer-charset = /apps/evolution/mail/composer/charset +composer-current-folder = /apps/evolution/mail/composer/current_folder composer-inline-spelling = /apps/evolution/mail/composer/inline_spelling composer-magic-links = /apps/evolution/mail/composer/magic_links composer-magic-smileys = /apps/evolution/mail/composer/magic_smileys @@ -97,96 +104,89 @@ composer-no-signature-delim = /apps/evolution/mail/composer/no_signature_delim composer-width = /apps/evolution/mail/composer/width composer-height = /apps/evolution/mail/composer/height composer-ignore-list-reply-to = /apps/evolution/mail/composer/ignore_list_reply_to -show-animated-images = /apps/evolution/mail/display/animated_images -side-bar-search = /apps/evolution/mail/display/side_bar_search -no-folder-dots = /apps/evolution/mail/display/no_folder_dots -magic-spacebar = /apps/evolution/mail/display/magic_spacebar +default-account = /apps/evolution/mail/default_account +enable-vfolders = /apps/evolution/mail/display/enable_vfolders +error-level = /apps/evolution/mail/display/error_level +error-timeout = /apps/evolution/mail/display/error_timeout +filter-editor-height = /apps/evolution/mail/filter_editor_height +filter-editor-maximized = /apps/evolution/mail/filter_editor_maximized +filter-editor-width = /apps/evolution/mail/filter_editor_width +filters-log-actions = /apps/evolution/mail/filters/log +filters-log-file = /apps/evolution/mail/filters/logfile +flush-outbox = /apps/evolution/mail/filters/flush-outbox +force-message-limit = /apps/evolution/mail/display/force_message_limit +forward-style = /apps/evolution/mail/format/forward_style global-view-setting = /apps/evolution/mail/display/global_view_setting -mark-citations = /apps/evolution/mail/display/mark_citations -citation-colour = /apps/evolution/mail/display/citation_colour -caret-mode = /apps/evolution/mail/display/caret_mode -charset = /apps/evolution/mail/display/charset -load-http-images = /apps/evolution/mail/display/load_http_images -animate-images = /apps/evolution/mail/display/animate_images -shoe-all-headers = /apps/evolution/mail/display/show_all_headers headers = /apps/evolution/mail/display/headers -show-sender-photo = /apps/evolution/mail/display/sender_photo -photo-local = /apps/evolution/mail/display/photo_local -mime-types = /apps/evolution/mail/display/mime_types -mark-seen = /apps/evolution/mail/display/mark_seen -mark-seen-timeout = /apps/evolution/mail/display/mark_seen_timeout -show-email = /apps/evolution/mail/display/show_email -vertical-view-fonts = /apps/evolution/mail/display/vertical_view_fonts -show-deleted = /apps/evolution/mail/display/show_deleted -enable-vfolders = /apps/evolution/mail/display/enable_vfolders -safe-list = /apps/evolution/mail/display/safe_list -paned-size = /apps/evolution/mail/display/paned_size hpaned-size = /apps/evolution/mail/display/hpaned_size +junk-check-custom-header = /apps/evolution/mail/junk/check_custom_header +junk-check-incoming = /apps/evolution/mail/junk/check_incoming +junk-custom-header = /apps/evolution/mail/junk/custom_header +junk-default-plugin = /apps/evolution/mail/junk/default_plugin +junk-empty-date = /apps/evolution/mail/junk/empty_date +junk-empty-on-exit = /apps/evolution/mail/junk/empty_on_exit +junk-empty-on-exit-days = /apps/evolution/mail/junk/empty_on_exit_days +junk-lookup-addressbook = /apps/evolution/mail/junk/lookup_addressbook +junk-lookup-addressbook-local-only = /apps/evolution/mail/junk/lookup_addressbook_local_only +junk-sa-local-only = /apps/evolution/mail/junk/sa/local_only +junk-sa-use-daemon = /apps/evolution/mail/junk/sa/use_daemon +labels = /apps/evolution/mail/labels layout = /apps/evolution/mail/display/layout -variable-width-font = /apps/evolution/mail/display/fonts/variable -monospace-font = /apps/evolution/mail/display/fonts/monospace -use-custom-font = /apps/evolution/mail/display/fonts/use_custom -address-compress = /apps/evolution/mail/display/address_compress -force-message-limit = /apps/evolution/mail/display/force_message_limit -message-text-part-limit = /apps/evolution/mail/display/message_text_part_limit -address-count = /apps/evolution/mail/display/address_count -thread-subject = /apps/evolution/mail/display/thread_subject -thread-expand = /apps/evolution/mail/display/thread_expand -thread-latest = /apps/evolution/mail/display/thread_latest -mail-browser-width = /apps/evolution/mail/mail_browser_width +load-http-images = /apps/evolution/mail/display/load_http_images +magic-spacebar = /apps/evolution/mail/display/magic_spacebar mail-browser-height = /apps/evolution/mail/mail_browser_height mail-browser-maximized = /apps/evolution/mail/mail_browser_maximized -subscription-editor-height = /apps/evolution/mail/subscription_editor_height -subscription-editor-maximized = /apps/evolution/mail/subscription_editor_maximized -subscription-editor-width = /apps/evolution/mail/subscription_editor_width -filters-log-actions = /apps/evolution/mail/filters/log -filters-log-file = /apps/evolution/mail/filters/logfile -flush-outbox = /apps/evolution/mail/filters/flush-outbox -forward-style = /apps/evolution/mail/format/forward_style -reply-style = /apps/evolution/mail/format/reply_style +mail-browser-width = /apps/evolution/mail/mail_browser_width +mark-citations = /apps/evolution/mail/display/mark_citations +mark-seen = /apps/evolution/mail/display/mark_seen +mark-seen-timeout = /apps/evolution/mail/display/mark_seen_timeout message-display-style = /apps/evolution/mail/format/message_display_style +message-text-part-limit = /apps/evolution/mail/display/message_text_part_limit +mime-types = /apps/evolution/mail/display/mime_types +monospace-font = /apps/evolution/mail/display/fonts/monospace +no-folder-dots = /apps/evolution/mail/display/no_folder_dots +paned-size = /apps/evolution/mail/display/paned_size +photo-local = /apps/evolution/mail/display/photo_local +prompt-on-delete-in-vfolder = /apps/evolution/mail/prompts/delete_in_vfolder prompt-on-empty-subject = /apps/evolution/mail/prompts/empty_subject prompt-on-expunge = /apps/evolution/mail/prompts/expunge +prompt-on-list-reply-to = /apps/evolution/mail/prompts/list_reply_to +prompt-on-mark-all-read = /apps/evolution/mail/prompts/mark_all_read prompt-on-only-bcc = /apps/evolution/mail/prompts/only_bcc -prompt-on-unwanted-html = /apps/evolution/mail/prompts/unwanted_html prompt-on-open-many = /apps/evolution/mail/prompts/open_many -prompt-on-mark-all-read = /apps/evolution/mail/prompts/mark_all_read -prompt-on-delete-in-vfolder = /apps/evolution/mail/prompts/delete_in_vfolder prompt-on-private-list-reply = /apps/evolution/mail/prompts/private_list_reply -prompt-on-list-reply-to = /apps/evolution/mail/prompts/list_reply_to -prompt-on-reply-many-recips = /apps/evolution/mail/prompts/reply_many_recips prompt-on-reply-close-browser = /apps/evolution/mail/prompts/reply_close_browser -trash-empty-on-exit = /apps/evolution/mail/trash/empty_on_exit -trash-empty-on-exit-days = /apps/evolution/mail/trash/empty_on_exit_days -trash-empty-date = /apps/evolution/mail/trash/empty_date -error-timeout = /apps/evolution/mail/display/error_timeout -error-level = /apps/evolution/mail/display/error_level -show-real-date = /apps/evolution/mail/display/show_real_date -labels = /apps/evolution/mail/labels -junk-check-incoming = /apps/evolution/mail/junk/check_incoming -junk-empty-on-exit = /apps/evolution/mail/junk/empty_on_exit -junk-empty-on-exit-days = /apps/evolution/mail/junk/empty_on_exit_days -junk-empty-date = /apps/evolution/mail/junk/empty_date -junk-default-plugin = /apps/evolution/mail/junk/default_plugin -junk-sa-local-only = /apps/evolution/mail/junk/sa/local_only -junk-sa-use-daemon = /apps/evolution/mail/junk/sa/use_daemon -junk-lookup-addressbook = /apps/evolution/mail/junk/lookup_addressbook -junk-lookup-addressbook-local-only = /apps/evolution/mail/junk/lookup_addressbook_local_only -junk-check-custom-header = /apps/evolution/mail/junk/check_custom_header -junk-custom-header = /apps/evolution/mail/junk/custom_header -default-account = /apps/evolution/mail/default_account +prompt-on-reply-many-recips = /apps/evolution/mail/prompts/reply_many_recips +prompt-on-unwanted-html = /apps/evolution/mail/prompts/unwanted_html +reply-style = /apps/evolution/mail/format/reply_style save-dir = /apps/evolution/mail/save_dir -composer-current-folder = /apps/evolution/mail/composer/current_folder -filter-editor-height = /apps/evolution/mail/filter_editor_height -filter-editor-maximized = /apps/evolution/mail/filter_editor_maximized -filter-editor-width = /apps/evolution/mail/filter_editor_width +safe-list = /apps/evolution/mail/display/safe_list send-recv-height = /apps/evolution/mail/send_recv_height send-recv-maximized = /apps/evolution/mail/send_recv_maximized send-recv-width = /apps/evolution/mail/send_recv_width +show-all-headers = /apps/evolution/mail/display/show_all_headers +show-animated-images = /apps/evolution/mail/display/animated_images +show-deleted = /apps/evolution/mail/display/show_deleted +show-email = /apps/evolution/mail/display/show_email +show-real-date = /apps/evolution/mail/display/show_real_date +show-sender-photo = /apps/evolution/mail/display/sender_photo +side-bar-search = /apps/evolution/mail/display/side_bar_search +subscription-editor-height = /apps/evolution/mail/subscription_editor_height +subscription-editor-maximized = /apps/evolution/mail/subscription_editor_maximized +subscription-editor-width = /apps/evolution/mail/subscription_editor_width +sync-interval = /apps/evolution/mail/sync_interval +thread-expand = /apps/evolution/mail/display/thread_expand +thread-latest = /apps/evolution/mail/display/thread_latest +thread-subject = /apps/evolution/mail/display/thread_subject +trash-empty-date = /apps/evolution/mail/trash/empty_date +trash-empty-on-exit = /apps/evolution/mail/trash/empty_on_exit +trash-empty-on-exit-days = /apps/evolution/mail/trash/empty_on_exit_days +use-custom-font = /apps/evolution/mail/display/fonts/use_custom +variable-width-font = /apps/evolution/mail/display/fonts/variable +vertical-view-fonts = /apps/evolution/mail/display/vertical_view_fonts vfolder-editor-height = /apps/evolution/mail/vfolder_editor_height vfolder-editor-maximized = /apps/evolution/mail/vfolder_editor_maximized vfolder-editor-width = /apps/evolution/mail/vfolder_editor_width -sync-interval = /apps/evolution/mail/sync_interval [org.gnome.evolution.eplugin.attachment-reminder] attachment-reminder-clues = /apps/evolution/mail/attachment_reminder_clues @@ -198,21 +198,21 @@ utf8-for-spam-filter = /apps/evolution/mail/junk/bogofilter/unicode custom-header = /apps/evolution/eplugin/email_custom_header/customHeader [org.gnome.evolution.eplugin.external-editor] -external-editor-command = /apps/evolution/eplugin/external-editor/editor-command -external-editor-launch-on-key-press = /apps/evolution/eplugin/external-editor/launch-on-key-press +command = /apps/evolution/eplugin/external-editor/editor-command +launch-on-key-press = /apps/evolution/eplugin/external-editor/launch-on-key-press [org.gnome.evolution.eplugin.face-picture] insert-face-picture = /apps/evolution/eplugin/face/insert_by_default [org.gnome.evolution.eplugin.mail-notification] -notify-only-inbox = /apps/evolution/eplugin/mail-notification/notify-only-inbox notify-dbus-enabled = /apps/evolution/eplugin/mail-notification/dbus-enabled -notify-status-enabled = /apps/evolution/eplugin/mail-notification/status-enabled -notify-status-notification = /apps/evolution/eplugin/mail-notification/status-notification -notify-sound-enabled = /apps/evolution/eplugin/mail-notification/sound-enabled +notify-only-inbox = /apps/evolution/eplugin/mail-notification/notify-only-inbox notify-sound-beep = /apps/evolution/eplugin/mail-notification/sound-beep +notify-sound-enabled = /apps/evolution/eplugin/mail-notification/sound-enabled notify-sound-file = /apps/evolution/eplugin/mail-notification/sound-file notify-sound-use-theme = /apps/evolution/eplugin/mail-notification/sound-use-theme +notify-status-enabled = /apps/evolution/eplugin/mail-notification/status-enabled +notify-status-notification = /apps/evolution/eplugin/mail-notification/status-notification [org.gnome.evolution.eplugin.prefer-plain] mode = /apps/evolution/eplugin/prefer_plain/mode" diff --git a/data/org.gnome.evolution.eplugin.external-editor.gschema.xml.in b/data/org.gnome.evolution.eplugin.external-editor.gschema.xml.in index 114cfd3990..5ee175adf0 100644 --- a/data/org.gnome.evolution.eplugin.external-editor.gschema.xml.in +++ b/data/org.gnome.evolution.eplugin.external-editor.gschema.xml.in @@ -1,11 +1,11 @@ - + 'gedit' <_summary>Default External Editor <_description>The default command that must be used as the editor. - + false <_summary>Automatically launch when a new mail is edited <_description>Automatically launch editor when key is pressed in the mail composer. diff --git a/plugins/external-editor/external-editor.c b/plugins/external-editor/external-editor.c index b9386caa87..d2d74797b8 100644 --- a/plugins/external-editor/external-editor.c +++ b/plugins/external-editor/external-editor.c @@ -43,15 +43,8 @@ #include #include -#include - #define d(x) -#define EDITOR_GCONF_KEY_COMMAND \ - "/apps/evolution/eplugin/external-editor/editor-command" -#define EDITOR_GCONF_KEY_IMMEDIATE \ - "/apps/evolution/eplugin/external-editor/launch-on-key-press" - gboolean e_plugin_ui_init (GtkUIManager *manager, EMsgComposer *composer); GtkWidget * e_plugin_lib_get_configure_widget @@ -82,29 +75,29 @@ void ee_editor_command_changed (GtkWidget *textbox) { const gchar *editor; - GConfClient *gconf; + GSettings *settings; editor = gtk_entry_get_text (GTK_ENTRY (textbox)); d(printf ("\n\aeditor is : [%s] \n\a", editor)); - /* gconf access for every key-press. Sucky ? */ - gconf = gconf_client_get_default (); - gconf_client_set_string (gconf, EDITOR_GCONF_KEY_COMMAND, editor, NULL); - g_object_unref (gconf); + /* GSettings access for every key-press. Sucky ? */ + settings = g_settings_new ("org.gnome.evolution.eplugin.external-editor"); + g_settings_set_string (settings, "command", editor); + g_object_unref (settings); } void ee_editor_immediate_launch_changed (GtkWidget *checkbox) { gboolean immediately; - GConfClient *gconf; + GSettings *settings; immediately = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)); d(printf ("\n\aimmediate launch is : [%d] \n\a", immediately)); - gconf = gconf_client_get_default (); - gconf_client_set_bool (gconf, EDITOR_GCONF_KEY_IMMEDIATE, immediately, NULL); - g_object_unref (gconf); + settings = g_settings_new ("org.gnome.evolution.eplugin.external-editor"); + g_settings_set_boolean (settings, "launch-on-key-press", immediately); + g_object_unref (settings); } GtkWidget * @@ -112,7 +105,7 @@ e_plugin_lib_get_configure_widget (EPlugin *epl) { GtkWidget *vbox, *textbox, *label, *help; GtkWidget *checkbox; - GConfClient *gconf; + GSettings *settings; gchar *editor; gboolean checked; @@ -120,9 +113,9 @@ e_plugin_lib_get_configure_widget (EPlugin *epl) textbox = gtk_entry_new (); label = gtk_label_new (_("Command to be executed to launch the editor: ")); help = gtk_label_new (_("For Emacs use \"xemacs\"\nFor VI use \"gvim -f\"")); - gconf = gconf_client_get_default (); + settings = g_settings_new ("org.gnome.evolution.eplugin.external-editor"); - editor = gconf_client_get_string (gconf, EDITOR_GCONF_KEY_COMMAND, NULL); + editor = g_settings_get_string (settings, "command"); if (editor) { gtk_entry_set_text (GTK_ENTRY (textbox), editor); g_free (editor); @@ -130,10 +123,10 @@ e_plugin_lib_get_configure_widget (EPlugin *epl) checkbox = gtk_check_button_new_with_label ( _("Automatically launch when a new mail is edited")); - checked = gconf_client_get_bool (gconf, EDITOR_GCONF_KEY_IMMEDIATE, NULL); + checked = g_settings_get_boolean (settings, "launch-on-key-press"); if (checked) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE); - g_object_unref (gconf); + g_object_unref (settings); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), textbox, FALSE, FALSE, 0); @@ -261,7 +254,7 @@ async_external_editor (EMsgComposer *composer) { gchar *filename = NULL; gint status = 0; - GConfClient *gconf; + GSettings *settings; gchar *editor_cmd_line = NULL, *editor_cmd = NULL, *content; gint fd, position = -1, offset = -1; @@ -289,9 +282,8 @@ async_external_editor (EMsgComposer *composer) return; } - gconf = gconf_client_get_default (); - editor_cmd = gconf_client_get_string ( - gconf, EDITOR_GCONF_KEY_COMMAND, NULL); + settings = g_settings_new ("org.gnome.evolution.eplugin.external-editor"); + editor_cmd = g_settings_get_string (settings, "command"); if (!editor_cmd) { if (!(editor_cmd = g_strdup (g_getenv ("EDITOR"))) ) /* Make gedit the default external editor, @@ -299,7 +291,7 @@ async_external_editor (EMsgComposer *composer) * and no $EDITOR is set. */ editor_cmd = g_strdup ("gedit"); } - g_object_unref (gconf); + g_object_unref (settings); if (g_strrstr (editor_cmd, "vim") != NULL && gtk_html_get_cursor_pos ( @@ -410,7 +402,7 @@ key_press_cb (GtkWidget *widget, GdkEventKey *event, EMsgComposer *composer) { - GConfClient *gconf; + GSettings *settings; gboolean immediately; /* we don't want to start the editor on any modifier keys */ @@ -426,9 +418,9 @@ key_press_cb (GtkWidget *widget, break; } - gconf = gconf_client_get_default (); - immediately = gconf_client_get_bool (gconf, EDITOR_GCONF_KEY_IMMEDIATE, NULL); - g_object_unref (gconf); + settings = g_settings_new ("org.gnome.evolution.eplugin.external-editor"); + immediately = g_settings_get_boolean (settings, "launch-on-key-press"); + g_object_unref (settings); if (!immediately) return FALSE; -- cgit v1.2.3