From 1e663aa13266cad55e5019c03e768a38955166eb Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 13 Oct 2010 23:40:16 -0400 Subject: Replace EBinding with GBinding. GObject now does property bindings itself. Requires GLib >= 2.26. --- widgets/misc/e-account-manager.c | 7 ++-- widgets/misc/e-attachment-button.c | 38 ++++++++++++---------- widgets/misc/e-attachment-paned.c | 55 +++++++++++++++++++++----------- widgets/misc/e-attachment-view.c | 7 ++-- widgets/misc/e-dateedit.c | 6 ++-- widgets/misc/e-popup-action.c | 1 - widgets/misc/e-search-bar.c | 23 ++++++++----- widgets/misc/e-signature-manager.c | 12 ++++--- widgets/misc/e-signature-script-dialog.c | 1 - widgets/misc/e-web-view.c | 19 +++++++---- 10 files changed, 102 insertions(+), 67 deletions(-) (limited to 'widgets/misc') diff --git a/widgets/misc/e-account-manager.c b/widgets/misc/e-account-manager.c index b3b7f1861f..0c9e464657 100644 --- a/widgets/misc/e-account-manager.c +++ b/widgets/misc/e-account-manager.c @@ -23,7 +23,6 @@ #include #include -#include "e-util/e-binding.h" #include "e-account-tree-view.h" /* backward-compatibility cruft */ @@ -290,9 +289,11 @@ e_account_manager_init (EAccountManager *manager) manager->priv->tree_view = g_object_ref (widget); gtk_widget_show (widget); - e_mutual_binding_new ( + g_object_bind_property ( manager, "account-list", - widget, "account-list"); + widget, "account-list", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); g_signal_connect_swapped ( widget, "key-press-event", diff --git a/widgets/misc/e-attachment-button.c b/widgets/misc/e-attachment-button.c index 3878c1ee8d..77bab884c9 100644 --- a/widgets/misc/e-attachment-button.c +++ b/widgets/misc/e-attachment-button.c @@ -23,8 +23,6 @@ #include "e-attachment-button.h" -#include "e-util/e-binding.h" - #define E_ATTACHMENT_BUTTON_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_ATTACHMENT_BUTTON, EAttachmentButtonPrivate)) @@ -35,8 +33,8 @@ struct _EAttachmentButtonPrivate { EAttachment *attachment; gulong reference_handler_id; - EMutualBinding *can_show_binding; - EMutualBinding *shown_binding; + GBinding *can_show_binding; + GBinding *shown_binding; GtkWidget *expand_button; GtkWidget *toggle_button; @@ -537,9 +535,11 @@ e_attachment_button_init (EAttachmentButton *button) button->priv->expand_button = g_object_ref (widget); gtk_widget_show (widget); - e_mutual_binding_new ( + g_object_bind_property ( button, "expandable", - widget, "sensitive"); + widget, "sensitive", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); widget = gtk_toggle_button_new (); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); @@ -567,9 +567,11 @@ e_attachment_button_init (EAttachmentButton *button) g_object_set (renderer, "is-expander", TRUE, NULL); gtk_cell_layout_pack_start (cell_layout, renderer, FALSE); - e_mutual_binding_new ( + g_object_bind_property ( button, "expanded", - renderer, "is-expanded"); + renderer, "is-expanded", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); renderer = gtk_cell_renderer_pixbuf_new (); g_object_set (renderer, "stock-size", GTK_ICON_SIZE_BUTTON, NULL); @@ -676,11 +678,9 @@ e_attachment_button_set_attachment (EAttachmentButton *button, } if (button->priv->attachment != NULL) { - e_mutual_binding_unbind ( - button->priv->can_show_binding); + g_object_unref (button->priv->can_show_binding); button->priv->can_show_binding = NULL; - e_mutual_binding_unbind ( - button->priv->shown_binding); + g_object_unref (button->priv->shown_binding); button->priv->shown_binding = NULL; g_signal_handler_disconnect ( button->priv->attachment, @@ -691,17 +691,21 @@ e_attachment_button_set_attachment (EAttachmentButton *button, button->priv->attachment = attachment; if (attachment != NULL) { - EMutualBinding *binding; + GBinding *binding; gulong handler_id; - binding = e_mutual_binding_new ( + binding = g_object_bind_property ( attachment, "can-show", - button, "expandable"); + button, "expandable", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); button->priv->can_show_binding = binding; - binding = e_mutual_binding_new ( + binding = g_object_bind_property ( attachment, "shown", - button, "expanded"); + button, "expanded", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); button->priv->shown_binding = binding; handler_id = g_signal_connect_swapped ( diff --git a/widgets/misc/e-attachment-paned.c b/widgets/misc/e-attachment-paned.c index 683da6b933..d1b61e0857 100644 --- a/widgets/misc/e-attachment-paned.c +++ b/widgets/misc/e-attachment-paned.c @@ -23,7 +23,6 @@ #include -#include "e-util/e-binding.h" #include "e-util/gconf-bridge.h" #include "e-attachment-view.h" @@ -292,41 +291,59 @@ attachment_paned_constructed (GObject *object) /* Set up property-to-property bindings. */ - e_mutual_binding_new ( + g_object_bind_property ( object, "active-view", - priv->combo_box, "active"); + priv->combo_box, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); - e_mutual_binding_new ( + g_object_bind_property ( object, "active-view", - priv->notebook, "page"); + priv->notebook, "page", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); - e_mutual_binding_new ( + g_object_bind_property ( object, "dragging", - priv->icon_view, "dragging"); + priv->icon_view, "dragging", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); - e_mutual_binding_new ( + g_object_bind_property ( object, "dragging", - priv->tree_view, "dragging"); + priv->tree_view, "dragging", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); - e_mutual_binding_new ( + g_object_bind_property ( object, "editable", - priv->icon_view, "editable"); + priv->icon_view, "editable", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); - e_mutual_binding_new ( + g_object_bind_property ( object, "editable", - priv->tree_view, "editable"); + priv->tree_view, "editable", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); - e_mutual_binding_new ( + g_object_bind_property ( object, "expanded", - priv->expander, "expanded"); + priv->expander, "expanded", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); - e_mutual_binding_new ( + g_object_bind_property ( object, "expanded", - priv->combo_box, "sensitive"); + priv->combo_box, "sensitive", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); - e_mutual_binding_new ( + g_object_bind_property ( object, "expanded", - priv->notebook, "visible"); + priv->notebook, "visible", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); /* Set up property-to-GConf bindings. */ diff --git a/widgets/misc/e-attachment-view.c b/widgets/misc/e-attachment-view.c index f641f76f1d..5094a54f1d 100644 --- a/widgets/misc/e-attachment-view.c +++ b/widgets/misc/e-attachment-view.c @@ -25,7 +25,6 @@ #include #include -#include "e-util/e-binding.h" #include "e-util/e-selection.h" #include "e-util/e-ui-manager.h" #include "e-util/e-util.h" @@ -858,9 +857,11 @@ e_attachment_view_init (EAttachmentView *view) action_group = e_attachment_view_add_action_group (view, "editable"); - e_mutual_binding_new ( + g_object_bind_property ( view, "editable", - action_group, "visible"); + action_group, "visible", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); gtk_action_group_add_actions ( action_group, editable_entries, G_N_ELEMENTS (editable_entries), view); diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index b976355801..4954ccff2e 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include "e-calendar.h" @@ -684,9 +683,10 @@ create_children (EDateEdit *dedit) gtk_container_add (GTK_CONTAINER (bbox), priv->none_button); g_signal_connect (priv->none_button, "clicked", G_CALLBACK (on_date_popup_none_button_clicked), dedit); - e_binding_new ( + g_object_bind_property ( dedit, "allow-no-date-set", - priv->none_button, "visible"); + priv->none_button, "visible", + G_BINDING_SYNC_CREATE); } /* GtkWidget::mnemonic_activate() handler for the EDateEdit */ diff --git a/widgets/misc/e-popup-action.c b/widgets/misc/e-popup-action.c index 73f9c0778a..99e1994010 100644 --- a/widgets/misc/e-popup-action.c +++ b/widgets/misc/e-popup-action.c @@ -22,7 +22,6 @@ #include "e-popup-action.h" #include -#include "e-util/e-binding.h" #define E_POPUP_ACTION_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c index 9846576a5e..ede2e2fb37 100644 --- a/widgets/misc/e-search-bar.c +++ b/widgets/misc/e-search-bar.c @@ -25,8 +25,6 @@ #include #include -#include "e-util/e-binding.h" - /* backward-compatibility cruft */ #include "e-util/gtk-compat.h" @@ -380,9 +378,11 @@ search_bar_constructed (GObject *object) priv = E_SEARCH_BAR_GET_PRIVATE (object); - e_mutual_binding_new ( + g_object_bind_property ( object, "case-sensitive", - priv->case_sensitive_button, "active"); + priv->case_sensitive_button, "active", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); } static void @@ -584,9 +584,10 @@ e_search_bar_init (ESearchBar *search_bar) search_bar->priv->entry = g_object_ref (widget); gtk_widget_show (widget); - e_binding_new ( + g_object_bind_property ( search_bar, "active-search", - widget, "secondary-icon-sensitive"); + widget, "secondary-icon-sensitive", + G_BINDING_SYNC_CREATE); g_signal_connect_swapped ( widget, "activate", @@ -610,7 +611,10 @@ e_search_bar_init (ESearchBar *search_bar) gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); - e_binding_new (search_bar, "active-search", widget, "sensitive"); + g_object_bind_property ( + search_bar, "active-search", + widget, "sensitive", + G_BINDING_SYNC_CREATE); g_signal_connect_swapped ( widget, "clicked", @@ -626,7 +630,10 @@ e_search_bar_init (ESearchBar *search_bar) gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); gtk_widget_show (widget); - e_binding_new (search_bar, "active-search", widget, "sensitive"); + g_object_bind_property ( + search_bar, "active-search", + widget, "sensitive", + G_BINDING_SYNC_CREATE); g_signal_connect_swapped ( widget, "clicked", diff --git a/widgets/misc/e-signature-manager.c b/widgets/misc/e-signature-manager.c index d6d021cd3d..43b6be6c63 100644 --- a/widgets/misc/e-signature-manager.c +++ b/widgets/misc/e-signature-manager.c @@ -24,7 +24,6 @@ #include #include #include -#include "e-util/e-binding.h" #include "e-signature-tree-view.h" #include "e-signature-script-dialog.h" @@ -535,9 +534,11 @@ e_signature_manager_init (ESignatureManager *manager) manager->priv->tree_view = g_object_ref (widget); gtk_widget_show (widget); - e_mutual_binding_new ( + g_object_bind_property ( manager, "signature-list", - widget, "signature-list"); + widget, "signature-list", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); g_signal_connect_swapped ( widget, "key-press-event", @@ -587,9 +588,10 @@ e_signature_manager_init (ESignatureManager *manager) manager->priv->add_script_button = g_object_ref (widget); gtk_widget_show (widget); - e_binding_new ( + g_object_bind_property ( manager, "allow-scripts", - widget, "sensitive"); + widget, "sensitive", + G_BINDING_SYNC_CREATE); g_signal_connect_swapped ( widget, "clicked", diff --git a/widgets/misc/e-signature-script-dialog.c b/widgets/misc/e-signature-script-dialog.c index fa725081dc..1d514f5da0 100644 --- a/widgets/misc/e-signature-script-dialog.c +++ b/widgets/misc/e-signature-script-dialog.c @@ -22,7 +22,6 @@ #include "e-signature-script-dialog.h" #include -#include "e-util/e-binding.h" #define E_SIGNATURE_SCRIPT_DIALOG_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c index 26613cb686..afc0476ad5 100644 --- a/widgets/misc/e-web-view.c +++ b/widgets/misc/e-web-view.c @@ -28,7 +28,6 @@ #include #include -#include #include #include @@ -1427,9 +1426,11 @@ e_web_view_init (EWebView *web_view) gtk_action_group_add_action (action_group, GTK_ACTION (popup_action)); g_object_unref (popup_action); - e_mutual_binding_new ( + g_object_bind_property ( web_view, "open-proxy", - popup_action, "related-action"); + popup_action, "related-action", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); /* Support lockdown. */ @@ -1442,9 +1443,11 @@ e_web_view_init (EWebView *web_view) gtk_action_group_add_action (action_group, GTK_ACTION (popup_action)); g_object_unref (popup_action); - e_mutual_binding_new ( + g_object_bind_property ( web_view, "print-proxy", - popup_action, "related-action"); + popup_action, "related-action", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); action_group = gtk_action_group_new ("lockdown-save-to-disk"); gtk_action_group_set_translation_domain (action_group, domain); @@ -1455,9 +1458,11 @@ e_web_view_init (EWebView *web_view) gtk_action_group_add_action (action_group, GTK_ACTION (popup_action)); g_object_unref (popup_action); - e_mutual_binding_new ( + g_object_bind_property ( web_view, "save-as-proxy", - popup_action, "related-action"); + popup_action, "related-action", + G_BINDING_BIDIRECTIONAL | + G_BINDING_SYNC_CREATE); /* Because we are loading from a hard-coded string, there is * no chance of I/O errors. Failure here implies a malformed -- cgit v1.2.3