diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-09-02 09:12:44 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-09-02 09:12:44 +0800 |
commit | 8962868ff902e58456c545478e62796029d1fe5c (patch) | |
tree | d43efa77beba51f716a259a3538dd55a38711923 /modules/mail | |
parent | 6b2a55be48922c9fe5c94d654a4d463f23a428f2 (diff) | |
download | gsoc2013-evolution-8962868ff902e58456c545478e62796029d1fe5c.tar.gz gsoc2013-evolution-8962868ff902e58456c545478e62796029d1fe5c.tar.zst gsoc2013-evolution-8962868ff902e58456c545478e62796029d1fe5c.zip |
Relax the EBinding API to reduce GObject casting.
Also make it more fault-tolerant by warning about non-existent
property names instead of just crashing.
Diffstat (limited to 'modules/mail')
-rw-r--r-- | modules/mail/e-mail-shell-backend.c | 12 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-content.c | 8 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-sidebar.c | 4 | ||||
-rw-r--r-- | modules/mail/e-mail-shell-view-actions.c | 40 | ||||
-rw-r--r-- | modules/mail/em-composer-prefs.c | 68 | ||||
-rw-r--r-- | modules/mail/em-mailer-prefs.c | 128 |
6 files changed, 130 insertions, 130 deletions
diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index fd99edcfa0..681fd68a74 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -728,16 +728,16 @@ mail_shell_backend_window_created_cb (EShell *shell, GList *spell_languages; e_binding_new ( - G_OBJECT (shell_settings), "composer-inline-spelling", - G_OBJECT (window), "inline-spelling"); + shell_settings, "composer-inline-spelling", + window, "inline-spelling"); e_binding_new ( - G_OBJECT (shell_settings), "composer-magic-links", - G_OBJECT (window), "magic-links"); + shell_settings, "composer-magic-links", + window, "magic-links"); e_binding_new ( - G_OBJECT (shell_settings), "composer-magic-smileys", - G_OBJECT (window), "magic-smileys"); + shell_settings, "composer-magic-smileys", + window, "magic-smileys"); spell_languages = e_load_spell_languages (); gtkhtml_editor_set_spell_languages ( diff --git a/modules/mail/e-mail-shell-content.c b/modules/mail/e-mail-shell-content.c index 0f4a9335a1..ac740fb6c5 100644 --- a/modules/mail/e-mail-shell-content.c +++ b/modules/mail/e-mail-shell-content.c @@ -466,8 +466,8 @@ mail_shell_content_constructed (GObject *object) gtk_widget_show (widget); e_binding_new ( - G_OBJECT (object), "orientation", - G_OBJECT (widget), "orientation"); + object, "orientation", + widget, "orientation"); container = widget; @@ -481,8 +481,8 @@ mail_shell_content_constructed (GObject *object) gtk_widget_show (widget); e_binding_new ( - G_OBJECT (object), "preview-visible", - G_OBJECT (widget), "visible"); + object, "preview-visible", + widget, "visible"); container = widget; diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c index 0f8e4f5783..b45e30ddee 100644 --- a/modules/mail/e-mail-shell-sidebar.c +++ b/modules/mail/e-mail-shell-sidebar.c @@ -458,8 +458,8 @@ mail_shell_sidebar_constructed (GObject *object) gtk_widget_show (widget); e_binding_new ( - G_OBJECT (shell_settings), "mail-side-bar-search", - G_OBJECT (widget), "enable-search"); + shell_settings, "mail-side-bar-search", + widget, "enable-search"); tree_view = GTK_TREE_VIEW (mail_shell_sidebar->priv->folder_tree); selection = gtk_tree_view_get_selection (tree_view); diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c index 11cedfbb3d..a16c752e84 100644 --- a/modules/mail/e-mail-shell-view-actions.c +++ b/modules/mail/e-mail-shell-view-actions.c @@ -1507,8 +1507,6 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) GtkRadioAction *radio_action; GConfBridge *bridge; GObject *object; - GObject *src_object; - GObject *dst_object; const gchar *key; g_return_if_fail (E_IS_MAIL_SHELL_VIEW (mail_shell_view)); @@ -1565,37 +1563,39 @@ e_mail_shell_view_actions_init (EMailShellView *mail_shell_view) /* Fine tuning. */ - src_object = G_OBJECT (ACTION (MAIL_THREADS_GROUP_BY)); - - dst_object = G_OBJECT (ACTION (MAIL_FOLDER_SELECT_THREAD)); - e_binding_new (src_object, "active", dst_object, "sensitive"); + e_binding_new ( + ACTION (MAIL_THREADS_GROUP_BY), "active", + ACTION (MAIL_FOLDER_SELECT_THREAD), "sensitive"); - dst_object = G_OBJECT (ACTION (MAIL_FOLDER_SELECT_SUBTHREAD)); - e_binding_new (src_object, "active", dst_object, "sensitive"); + e_binding_new ( + ACTION (MAIL_THREADS_GROUP_BY), "active", + ACTION (MAIL_FOLDER_SELECT_SUBTHREAD), "sensitive"); - dst_object = G_OBJECT (ACTION (MAIL_THREADS_COLLAPSE_ALL)); - e_binding_new (src_object, "active", dst_object, "sensitive"); + e_binding_new ( + ACTION (MAIL_THREADS_GROUP_BY), "active", + ACTION (MAIL_THREADS_COLLAPSE_ALL), "sensitive"); - dst_object = G_OBJECT (ACTION (MAIL_THREADS_EXPAND_ALL)); - e_binding_new (src_object, "active", dst_object, "sensitive"); + e_binding_new ( + ACTION (MAIL_THREADS_GROUP_BY), "active", + ACTION (MAIL_THREADS_EXPAND_ALL), "sensitive"); e_mutual_binding_new ( - G_OBJECT (ACTION (MAIL_PREVIEW)), "active", - G_OBJECT (shell_content), "preview-visible"); + ACTION (MAIL_PREVIEW), "active", + shell_content, "preview-visible"); e_binding_new ( - G_OBJECT (ACTION (MAIL_PREVIEW)), "active", - G_OBJECT (ACTION (MAIL_VIEW_CLASSIC)), "sensitive"); + ACTION (MAIL_PREVIEW), "active", + ACTION (MAIL_VIEW_CLASSIC), "sensitive"); e_binding_new ( - G_OBJECT (ACTION (MAIL_PREVIEW)), "active", - G_OBJECT (ACTION (MAIL_VIEW_VERTICAL)), "sensitive"); + ACTION (MAIL_PREVIEW), "active", + ACTION (MAIL_VIEW_VERTICAL), "sensitive"); /* XXX The boolean sense of the GConf key is the inverse of * the menu item, so we have to maintain two properties. */ e_mutual_binding_new_with_negation ( - G_OBJECT (shell_content), "show-deleted", - G_OBJECT (ACTION (MAIL_HIDE_DELETED)), "active"); + shell_content, "show-deleted", + ACTION (MAIL_HIDE_DELETED), "active"); g_signal_connect ( ACTION (GAL_SAVE_CUSTOM_VIEW), "activate", diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c index 4c29125c0b..6ca42321d9 100644 --- a/modules/mail/em-composer-prefs.c +++ b/modules/mail/em-composer-prefs.c @@ -405,56 +405,56 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, /* Default Behavior */ widget = glade_xml_get_widget (gui, "chkSendHTML"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "composer-format-html", - G_OBJECT (widget), "active"); + shell_settings, "composer-format-html", + widget, "active"); widget = glade_xml_get_widget (gui, "chkPromptEmptySubject"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "composer-prompt-empty-subject", - G_OBJECT (widget), "active"); + shell_settings, "composer-prompt-empty-subject", + widget, "active"); widget = glade_xml_get_widget (gui, "chkPromptBccOnly"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "composer-prompt-only-bcc", - G_OBJECT (widget), "active"); + shell_settings, "composer-prompt-only-bcc", + widget, "active"); widget = glade_xml_get_widget (gui, "chkAutoSmileys"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "composer-magic-smileys", - G_OBJECT (widget), "active"); + shell_settings, "composer-magic-smileys", + widget, "active"); widget = glade_xml_get_widget (gui, "chkRequestReceipt"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "composer-request-receipt", - G_OBJECT (widget), "active"); + shell_settings, "composer-request-receipt", + widget, "active"); widget = glade_xml_get_widget (gui, "chkReplyStartBottom"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "composer-reply-start-bottom", - G_OBJECT (widget), "active"); + shell_settings, "composer-reply-start-bottom", + widget, "active"); widget = glade_xml_get_widget (gui, "chkOutlookFilenames"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "composer-outlook-filenames", - G_OBJECT (widget), "active"); + shell_settings, "composer-outlook-filenames", + widget, "active"); widget = glade_xml_get_widget (gui, "chkTopSignature"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "composer-top-signature", - G_OBJECT (widget), "active"); + shell_settings, "composer-top-signature", + widget, "active"); widget = glade_xml_get_widget (gui, "chkEnableSpellChecking"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "composer-inline-spelling", - G_OBJECT (widget), "active"); + shell_settings, "composer-inline-spelling", + widget, "active"); widget = e_charset_combo_box_new (); container = glade_xml_get_widget (gui, "hboxComposerCharset"); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); e_mutual_binding_new ( - G_OBJECT (shell_settings), "composer-charset", - G_OBJECT (widget), "charset"); + shell_settings, "composer-charset", + widget, "charset"); /* Spell Checking */ widget = glade_xml_get_widget (gui, "listSpellCheckLanguage"); @@ -487,8 +487,8 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, widget = glade_xml_get_widget (gui, "colorButtonSpellCheckColor"); e_mutual_binding_new_full ( - G_OBJECT (shell_settings), "composer-spell-color", - G_OBJECT (widget), "color", + shell_settings, "composer-spell-color", + widget, "color", transform_string_to_color, transform_color_to_string, NULL, NULL); @@ -498,13 +498,13 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, /* Forwards and Replies */ widget = glade_xml_get_widget (gui, "comboboxForwardStyle"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-forward-style", - G_OBJECT (widget), "active"); + shell_settings, "mail-forward-style", + widget, "active"); widget = glade_xml_get_widget (gui, "comboboxReplyStyle"); e_mutual_binding_new_full ( - G_OBJECT (shell_settings), "mail-reply-style", - G_OBJECT (widget), "active", + shell_settings, "mail-reply-style", + widget, "active", transform_old_to_new_reply_style, transform_new_to_old_reply_style, NULL, NULL); @@ -523,12 +523,12 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, G_CALLBACK (e_shell_watch_window), shell); e_binding_new ( - G_OBJECT (shell_settings), "composer-format-html", - G_OBJECT (widget), "prefer-html"); + shell_settings, "composer-format-html", + widget, "prefer-html"); e_binding_new_with_negation ( - G_OBJECT (shell_settings), "disable-command-line", - G_OBJECT (widget), "allow-scripts"); + shell_settings, "disable-command-line", + widget, "allow-scripts"); signature_tree_view = e_signature_manager_get_tree_view ( E_SIGNATURE_MANAGER (widget)); @@ -539,12 +539,12 @@ em_composer_prefs_construct (EMComposerPrefs *prefs, gtk_widget_show (widget); e_binding_new_with_negation ( - G_OBJECT (shell_settings), "disable-command-line", - G_OBJECT (widget), "allow-scripts"); + shell_settings, "disable-command-line", + widget, "allow-scripts"); e_binding_new ( - G_OBJECT (signature_tree_view), "selected", - G_OBJECT (widget), "signature"); + signature_tree_view, "selected", + widget, "signature"); /* get our toplevel widget */ target = em_config_target_new_prefs (ec, client); diff --git a/modules/mail/em-mailer-prefs.c b/modules/mail/em-mailer-prefs.c index 621dae4ce5..b1434665dd 100644 --- a/modules/mail/em-mailer-prefs.c +++ b/modules/mail/em-mailer-prefs.c @@ -854,8 +854,8 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, /* Message Display */ widget = glade_xml_get_widget (gui, "chkMarkTimeout"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-mark-seen", - G_OBJECT (widget), "active"); + shell_settings, "mail-mark-seen", + widget, "active"); /* The "mark seen" timeout requires special transform functions * because we display the timeout value to the user in seconds @@ -863,113 +863,113 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, widget = glade_xml_get_widget (gui, "spinMarkTimeout"); prefs->timeout = GTK_SPIN_BUTTON (widget); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-mark-seen", - G_OBJECT (widget), "sensitive"); + shell_settings, "mail-mark-seen", + widget, "sensitive"); e_mutual_binding_new_full ( - G_OBJECT (shell_settings), "mail-mark-seen-timeout", - G_OBJECT (widget), "value", + shell_settings, "mail-mark-seen-timeout", + widget, "value", mark_seen_timeout_transform, mark_seen_timeout_reverse_transform, NULL, NULL); widget = glade_xml_get_widget (gui, "mlimit_checkbutton"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-force-message-limit", - G_OBJECT (widget), "active"); + shell_settings, "mail-force-message-limit", + widget, "active"); widget = glade_xml_get_widget (gui, "mlimit_spin"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-force-message-limit", - G_OBJECT (widget), "sensitive"); + shell_settings, "mail-force-message-limit", + widget, "sensitive"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-message-text-part-limit", - G_OBJECT (widget), "value"); + shell_settings, "mail-message-text-part-limit", + widget, "value"); widget = glade_xml_get_widget (gui, "address_checkbox"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-address-compress", - G_OBJECT (widget), "active"); + shell_settings, "mail-address-compress", + widget, "active"); widget = glade_xml_get_widget (gui, "address_spin"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-address-compress", - G_OBJECT (widget), "sensitive"); + shell_settings, "mail-address-compress", + widget, "sensitive"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-address-count", - G_OBJECT (widget), "value"); + shell_settings, "mail-address-count", + widget, "value"); widget = glade_xml_get_widget (gui, "magic_spacebar_checkbox"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-magic-spacebar", - G_OBJECT (widget), "active"); + shell_settings, "mail-magic-spacebar", + widget, "active"); widget = e_charset_combo_box_new (); container = glade_xml_get_widget (gui, "hboxDefaultCharset"); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-charset", - G_OBJECT (widget), "charset"); + shell_settings, "mail-charset", + widget, "charset"); widget = glade_xml_get_widget (gui, "chkHighlightCitations"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-mark-citations", - G_OBJECT (widget), "active"); + shell_settings, "mail-mark-citations", + widget, "active"); widget = glade_xml_get_widget (gui, "colorButtonHighlightCitations"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-mark-citations", - G_OBJECT (widget), "sensitive"); + shell_settings, "mail-mark-citations", + widget, "sensitive"); e_mutual_binding_new_full ( - G_OBJECT (shell_settings), "mail-citation-color", - G_OBJECT (widget), "color", + shell_settings, "mail-citation-color", + widget, "color", e_binding_transform_string_to_color, e_binding_transform_color_to_string, NULL, NULL); widget = glade_xml_get_widget (gui, "chkEnableSearchFolders"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-enable-search-folders", - G_OBJECT (widget), "active"); + shell_settings, "mail-enable-search-folders", + widget, "active"); /* Deleting Mail */ widget = glade_xml_get_widget (gui, "chkEmptyTrashOnExit"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-empty-trash-on-exit", - G_OBJECT (widget), "active"); + shell_settings, "mail-empty-trash-on-exit", + widget, "active"); widget = glade_xml_get_widget (gui, "comboboxEmptyTrashDays"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-empty-trash-on-exit", - G_OBJECT (widget), "sensitive"); + shell_settings, "mail-empty-trash-on-exit", + widget, "sensitive"); emmp_empty_trash_init (prefs, GTK_COMBO_BOX (widget)); widget = glade_xml_get_widget (gui, "chkConfirmExpunge"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-confirm-expunge", - G_OBJECT (widget), "active"); + shell_settings, "mail-confirm-expunge", + widget, "active"); /* Mail Fonts */ widget = glade_xml_get_widget (gui, "radFontUseSame"); e_mutual_binding_new_with_negation ( - G_OBJECT (shell_settings), "mail-use-custom-fonts", - G_OBJECT (widget), "active"); + shell_settings, "mail-use-custom-fonts", + widget, "active"); widget = glade_xml_get_widget (gui, "FontFixed"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-font-monospace", - G_OBJECT (widget), "font-name"); + shell_settings, "mail-font-monospace", + widget, "font-name"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-use-custom-fonts", - G_OBJECT (widget), "sensitive"); + shell_settings, "mail-use-custom-fonts", + widget, "sensitive"); widget = glade_xml_get_widget (gui, "FontVariable"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-font-variable", - G_OBJECT (widget), "font-name"); + shell_settings, "mail-font-variable", + widget, "font-name"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-use-custom-fonts", - G_OBJECT (widget), "sensitive"); + shell_settings, "mail-use-custom-fonts", + widget, "sensitive"); /* HTML Mail tab */ @@ -998,13 +998,13 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, widget = glade_xml_get_widget (gui, "chkShowAnimatedImages"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-show-animated-images", - G_OBJECT (widget), "active"); + shell_settings, "mail-show-animated-images", + widget, "active"); widget = glade_xml_get_widget (gui, "chkPromptWantHTML"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-confirm-unwanted-html", - G_OBJECT (widget), "active"); + shell_settings, "mail-confirm-unwanted-html", + widget, "active"); container = glade_xml_get_widget (gui, "labels-alignment"); widget = e_mail_label_manager_new (); @@ -1012,24 +1012,24 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, gtk_widget_show (widget); e_binding_new ( - G_OBJECT (shell_settings), "mail-label-list-store", - G_OBJECT (widget), "list-store"); + shell_settings, "mail-label-list-store", + widget, "list-store"); /* headers */ locked = !gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/headers", NULL); widget = glade_xml_get_widget (gui, "photo_show"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-show-sender-photo", - G_OBJECT (widget), "active"); + shell_settings, "mail-show-sender-photo", + widget, "active"); widget = glade_xml_get_widget (gui, "photo_local"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-show-sender-photo", - G_OBJECT (widget), "sensitive"); + shell_settings, "mail-show-sender-photo", + widget, "sensitive"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-only-local-photos", - G_OBJECT (widget), "active"); + shell_settings, "mail-only-local-photos", + widget, "active"); /* always de-sensitised until the user types something in the entry */ prefs->add_header = GTK_BUTTON (glade_xml_get_widget (gui, "cmdHeadersAdd")); @@ -1143,18 +1143,18 @@ em_mailer_prefs_construct (EMMailerPrefs *prefs, /* Junk prefs */ widget = glade_xml_get_widget (gui, "chkCheckIncomingMail"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-check-for-junk", - G_OBJECT (widget), "active"); + shell_settings, "mail-check-for-junk", + widget, "active"); widget = glade_xml_get_widget (gui, "junk_empty_check"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-empty-junk-on-exit", - G_OBJECT (widget), "active"); + shell_settings, "mail-empty-junk-on-exit", + widget, "active"); widget = glade_xml_get_widget (gui, "junk_empty_combobox"); e_mutual_binding_new ( - G_OBJECT (shell_settings), "mail-empty-junk-on-exit", - G_OBJECT (widget), "sensitive"); + shell_settings, "mail-empty-junk-on-exit", + widget, "sensitive"); emmp_empty_junk_init (prefs, GTK_COMBO_BOX (widget)); prefs->default_junk_plugin = GTK_COMBO_BOX (glade_xml_get_widget (gui, "default_junk_plugin")); |