diff options
author | Yongha Hwang <mshrimp@sogang.ac.kr> | 2021-05-24 21:32:37 +0000 |
---|---|---|
committer | Alexander Schwinn <alexxcons@xfce.org> | 2021-05-24 21:32:37 +0000 |
commit | adfeba54206cff25ea01dbd90f7dd62a62882a2c (patch) | |
tree | 553e2992a27713cc3f0327dc0b857cb5f387a0a4 | |
parent | 455204287d72695fe5258cead4609544242ba48f (diff) | |
download | exo-adfeba54206cff25ea01dbd90f7dd62a62882a2c.tar.gz |
Deprecate ExoBinding and ExoMutualBinding In favor of GBinding
As well deprecate 'exo_g_value_transform_negate', since the only use for this function is for ExoBinding.
Related: #60
MR: !42
-rw-r--r-- | exo-desktop-item-edit/exo-die-command-entry.c | 2 | ||||
-rw-r--r-- | exo-desktop-item-edit/exo-die-editor.c | 65 | ||||
-rw-r--r-- | exo-desktop-item-edit/main.c | 2 | ||||
-rw-r--r-- | exo/exo-binding.c | 24 | ||||
-rw-r--r-- | exo/exo-binding.h | 24 | ||||
-rw-r--r-- | exo/exo-gobject-extensions.c | 2 | ||||
-rw-r--r-- | exo/exo-gobject-extensions.h | 1 | ||||
-rw-r--r-- | exo/exo-icon-chooser-dialog.c | 5 | ||||
-rw-r--r-- | exo/make-exo-alias.pl | 4 |
9 files changed, 98 insertions, 31 deletions
diff --git a/exo-desktop-item-edit/exo-die-command-entry.c b/exo-desktop-item-edit/exo-die-command-entry.c index db2dfa1..6a11319 100644 --- a/exo-desktop-item-edit/exo-die-command-entry.c +++ b/exo-desktop-item-edit/exo-die-command-entry.c @@ -147,7 +147,7 @@ exo_die_command_entry_init (ExoDieCommandEntry *command_entry) command_entry->entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (command_entry->entry), TRUE); - exo_mutual_binding_new (G_OBJECT (command_entry->entry), "text", G_OBJECT (command_entry), "text"); + g_object_bind_property (G_OBJECT (command_entry->entry), "text", G_OBJECT (command_entry), "text", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); gtk_box_pack_start (GTK_BOX (command_entry), command_entry->entry, TRUE, TRUE, 0); gtk_widget_show (command_entry->entry); diff --git a/exo-desktop-item-edit/exo-die-editor.c b/exo-desktop-item-edit/exo-die-editor.c index 62f49b9..9be14fa 100644 --- a/exo-desktop-item-edit/exo-die-editor.c +++ b/exo-desktop-item-edit/exo-die-editor.c @@ -245,7 +245,8 @@ exo_die_editor_class_init (ExoDieEditorClass *klass) static gboolean -exo_die_true_if_application (const GValue *src_value, +exo_die_true_if_application (GBinding *binding, + const GValue *src_value, GValue *dst_value, gpointer user_data) { @@ -256,7 +257,8 @@ exo_die_true_if_application (const GValue *src_value, static gboolean -exo_die_true_if_link (const GValue *src_value, +exo_die_true_if_link (GBinding *binding, + const GValue *src_value, GValue *dst_value, gpointer user_data) { @@ -300,7 +302,7 @@ exo_die_editor_init (ExoDieEditor *editor) editor->name_entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (editor->name_entry), TRUE); - exo_mutual_binding_new (G_OBJECT (editor), "name", G_OBJECT (editor->name_entry), "text"); + g_object_bind_property (G_OBJECT (editor), "name", G_OBJECT (editor->name_entry), "text", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); gtk_grid_attach (GTK_GRID (editor), editor->name_entry, 1, row, 1, 1); g_object_set (editor->name_entry, "hexpand", TRUE, NULL); gtk_label_set_mnemonic_widget (GTK_LABEL (label), editor->name_entry); @@ -317,7 +319,7 @@ exo_die_editor_init (ExoDieEditor *editor) entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); - exo_mutual_binding_new (G_OBJECT (editor), "comment", G_OBJECT (entry), "text"); + g_object_bind_property (G_OBJECT (editor), "comment", G_OBJECT (entry), "text", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); gtk_grid_attach (GTK_GRID (editor), entry, 1, row, 1, 1); g_object_set (entry, "hexpand", TRUE, NULL); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); @@ -329,12 +331,18 @@ exo_die_editor_init (ExoDieEditor *editor) label = gtk_label_new_with_mnemonic (_("Comm_and:")); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); g_object_set (label, "xalign", 1.0f, "yalign", 0.5f, NULL); - exo_binding_new_full (G_OBJECT (editor), "mode", G_OBJECT (label), "visible", exo_die_true_if_application, NULL, NULL); + g_object_bind_property_full (editor, "mode", label, "visible", + G_BINDING_SYNC_CREATE, + exo_die_true_if_application, NULL, + NULL, NULL); gtk_grid_attach (GTK_GRID (editor), label, 0, row, 1, 1); entry = exo_die_command_entry_new (); - exo_mutual_binding_new (G_OBJECT (editor), "command", G_OBJECT (entry), "text"); - exo_binding_new_full (G_OBJECT (editor), "mode", G_OBJECT (entry), "visible", exo_die_true_if_application, NULL, NULL); + g_object_bind_property (G_OBJECT (editor), "command", G_OBJECT (entry), "text", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); + g_object_bind_property_full (editor, "mode", entry, "visible", + G_BINDING_SYNC_CREATE, + exo_die_true_if_application, NULL, + NULL, NULL); gtk_grid_attach (GTK_GRID (editor), entry, 1, row, 1, 1); g_object_set (entry, "hexpand", TRUE, NULL); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); @@ -345,13 +353,19 @@ exo_die_editor_init (ExoDieEditor *editor) label = gtk_label_new_with_mnemonic (_("_URL:")); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); g_object_set (label, "xalign", 1.0f, "yalign", 0.5f, NULL); - exo_binding_new_full (G_OBJECT (editor), "mode", G_OBJECT (label), "visible", exo_die_true_if_link, NULL, NULL); + g_object_bind_property_full (editor, "mode", label, "visible", + G_BINDING_SYNC_CREATE, + exo_die_true_if_link, NULL, + NULL, NULL); gtk_grid_attach (GTK_GRID (editor), label, 0, row, 1, 1); entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); - exo_mutual_binding_new (G_OBJECT (editor), "url", G_OBJECT (entry), "text"); - exo_binding_new_full (G_OBJECT (editor), "mode", G_OBJECT (entry), "visible", exo_die_true_if_link, NULL, NULL); + g_object_bind_property (G_OBJECT (editor), "url", G_OBJECT (entry), "text", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); + g_object_bind_property_full (editor, "mode", entry, "visible", + G_BINDING_SYNC_CREATE, + exo_die_true_if_link, NULL, + NULL, NULL); gtk_grid_attach (GTK_GRID (editor), entry, 1, row, 1, 1); g_object_set (entry, "hexpand", TRUE, NULL); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); @@ -362,17 +376,23 @@ exo_die_editor_init (ExoDieEditor *editor) label = gtk_label_new_with_mnemonic (_("Working _Directory:")); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); g_object_set (label, "xalign", 1.0f, "yalign", 0.5f, NULL); - exo_binding_new_full (G_OBJECT (editor), "mode", G_OBJECT (label), "visible", exo_die_true_if_application, NULL, NULL); + g_object_bind_property_full (editor, "mode", label, "visible", + G_BINDING_SYNC_CREATE, + exo_die_true_if_application, NULL, + NULL, NULL); gtk_grid_attach (GTK_GRID (editor), label, 0, row, 1, 1); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_grid_attach (GTK_GRID (editor), box, 1, row, 1, 1); g_object_set (box, "hexpand", TRUE, NULL); - exo_binding_new_full (G_OBJECT (editor), "mode", G_OBJECT (box), "visible", exo_die_true_if_application, NULL, NULL); + g_object_bind_property_full (editor, "mode", box, "visible", + G_BINDING_SYNC_CREATE, + exo_die_true_if_application, NULL, + NULL, NULL); entry = gtk_entry_new (); gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE); - exo_mutual_binding_new (G_OBJECT (editor), "path", G_OBJECT (entry), "text"); + g_object_bind_property (G_OBJECT (editor), "path", G_OBJECT (entry), "text", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 0); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); gtk_widget_show (entry); @@ -412,7 +432,10 @@ exo_die_editor_init (ExoDieEditor *editor) label = gtk_label_new (_("Options:")); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); g_object_set (label, "xalign", 1.0f, "yalign", 0.5f, NULL); - exo_binding_new_full (G_OBJECT (editor), "mode", G_OBJECT (label), "visible", exo_die_true_if_application, NULL, NULL); + g_object_bind_property_full (editor, "mode", label, "visible", + G_BINDING_SYNC_CREATE, + exo_die_true_if_application, NULL, + NULL, NULL); gtk_grid_attach (GTK_GRID (editor), label, 0, row, 1, 1); /* TRANSLATORS: Check button label in "Create Launcher" dialog, make sure to avoid mnemonic conflicts @@ -422,8 +445,11 @@ exo_die_editor_init (ExoDieEditor *editor) gtk_widget_set_tooltip_text (button, _("Select this option to enable startup notification when the command " "is run from the file manager or the menu. Not every application supports " "startup notification.")); - exo_mutual_binding_new (G_OBJECT (editor), "snotify", G_OBJECT (button), "active"); - exo_binding_new_full (G_OBJECT (editor), "mode", G_OBJECT (button), "visible", exo_die_true_if_application, NULL, NULL); + g_object_bind_property (G_OBJECT (editor), "snotify", G_OBJECT (button), "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); + g_object_bind_property_full (editor, "mode", button, "visible", + G_BINDING_SYNC_CREATE, + exo_die_true_if_application, NULL, + NULL, NULL); gtk_grid_attach (GTK_GRID (editor), button, 1, row, 1, 1); g_object_set (button, "hexpand", TRUE, NULL); @@ -434,8 +460,11 @@ exo_die_editor_init (ExoDieEditor *editor) */ button = gtk_check_button_new_with_mnemonic (_("Run in _terminal")); gtk_widget_set_tooltip_text (button, _("Select this option to run the command in a terminal window.")); - exo_mutual_binding_new (G_OBJECT (editor), "terminal", G_OBJECT (button), "active"); - exo_binding_new_full (G_OBJECT (editor), "mode", G_OBJECT (button), "visible", exo_die_true_if_application, NULL, NULL); + g_object_bind_property (G_OBJECT (editor), "terminal", G_OBJECT (button), "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); + g_object_bind_property_full (editor, "mode", button, "visible", + G_BINDING_SYNC_CREATE, + exo_die_true_if_application, NULL, + NULL, NULL); gtk_grid_attach (GTK_GRID (editor), button, 1, row, 1, 1); g_object_set (button, "hexpand", TRUE, NULL); } diff --git a/exo-desktop-item-edit/main.c b/exo-desktop-item-edit/main.c index fcac433..6af5aa9 100644 --- a/exo-desktop-item-edit/main.c +++ b/exo-desktop-item-edit/main.c @@ -351,7 +351,7 @@ main (int argc, char **argv) editor = exo_die_editor_new (); exo_die_editor_set_mode (EXO_DIE_EDITOR (editor), mode); gtk_container_set_border_width (GTK_CONTAINER (editor), 12); - exo_binding_new (G_OBJECT (editor), "complete", G_OBJECT (button), "sensitive"); + g_object_bind_property (G_OBJECT (editor), "complete", G_OBJECT (button), "sensitive", G_BINDING_SYNC_CREATE); gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), editor, TRUE, TRUE, 0); gtk_widget_show (editor); diff --git a/exo/exo-binding.c b/exo/exo-binding.c index a546e6d..5bc2452 100644 --- a/exo/exo-binding.c +++ b/exo/exo-binding.c @@ -94,6 +94,8 @@ ExoBindingLink; * * Opaque structure representing a one-way binding between two properties. * It is automatically removed if one of the bound objects is finalized. + * + * Deprecated: xfce 4.18: In favor of GBinding **/ struct _ExoBinding { @@ -107,6 +109,8 @@ struct _ExoBinding * * Opaque structure representing a mutual binding between two properties. * It is automatically freed if one of the bound objects is finalized. + * + * Deprecated: xfce 4.18: In favor of GBinding **/ struct _ExoMutualBinding { @@ -302,6 +306,8 @@ exo_binding_link_init (ExoBindingLink *blink, * Before binding the value of @dst_property is set to the * value of @src_property. * + * Deprecated: xfce 4.18: In favor of GBinding + * * Returns: The descriptor of the binding. It is automatically * removed if one of the objects is finalized. **/ @@ -334,6 +340,8 @@ exo_binding_new (GObject *src_object, * Before binding the value of @dst_property is set to the * value of @src_property. * + * Deprecated: xfce 4.18: In favor of GBinding + * * Returns: The descriptor of the binding. It is automatically * removed if one of the objects is finalized. **/ @@ -395,6 +403,8 @@ exo_binding_new_full (GObject *src_object, * * Convenience function for binding with boolean negation of value. * + * Deprecated: xfce 4.18: In favor of GBinding + * * Returns: The descriptor of the binding. It is automatically * removed if one of the objects is finalized. **/ @@ -404,11 +414,13 @@ exo_binding_new_with_negation (GObject *src_object, GObject *dst_object, const gchar *dst_property) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS ExoBindingTransform transform = (ExoBindingTransform) (void (*)(void)) exo_g_value_transform_negate; return exo_binding_new_full (src_object, src_property, dst_object, dst_property, transform, NULL, NULL); + G_GNUC_END_IGNORE_DEPRECATIONS } @@ -422,6 +434,8 @@ exo_binding_new_with_negation (GObject *src_object, * * This functions also calls the @destroy_notify function that * was specified when @binding was created. + * + * Deprecated: xfce 4.18: In favor of GBinding **/ void exo_binding_unbind (ExoBinding *binding) @@ -443,6 +457,8 @@ exo_binding_unbind (ExoBinding *binding) * Before binding the value of @property2 is set to the value * of @property1. * + * Deprecated: xfce 4.18: In favor of GBinding + * * Returns: The descriptor of the binding. It is automatically * removed if one of the objects is finalized. **/ @@ -479,6 +495,8 @@ exo_mutual_binding_new (GObject *object1, * %NULL or non-%NULL. If they are non-%NULL, they should be reverse * in each other. * + * Deprecated: xfce 4.18: In favor of GBinding + * * Returns: The descriptor of the binding. It is automatically * removed if one of the objects is finalized. **/ @@ -558,6 +576,8 @@ exo_mutual_binding_new_full (GObject *object1, * * Convenience function for binding with boolean negation of value. * + * Deprecated: xfce 4.18: In favor of GBinding + * * Returns: The descriptor of the binding. It is automatically removed * if one of the objects if finalized. **/ @@ -567,12 +587,14 @@ exo_mutual_binding_new_with_negation (GObject *object1, GObject *object2, const gchar *property2) { + G_GNUC_BEGIN_IGNORE_DEPRECATIONS ExoBindingTransform transform = (ExoBindingTransform) (void (*)(void)) exo_g_value_transform_negate; return exo_mutual_binding_new_full (object1, property1, object2, property2, transform, transform, NULL, NULL); + G_GNUC_END_IGNORE_DEPRECATIONS } @@ -586,6 +608,8 @@ exo_mutual_binding_new_with_negation (GObject *object1, * * This functions also calls the @destroy_notify function that * was specified when @binding was created. + * + * Deprecated: xfce 4.18: In favor of GBinding **/ void exo_mutual_binding_unbind (ExoMutualBinding *binding) diff --git a/exo/exo-binding.h b/exo/exo-binding.h index 24f1e84..5571439 100644 --- a/exo/exo-binding.h +++ b/exo/exo-binding.h @@ -57,24 +57,29 @@ typedef gboolean (*ExoBindingTransform) (const GValue *src_value, ExoBinding *exo_binding_new (GObject *src_object, const gchar *src_property, GObject *dst_object, - const gchar *dst_property); + const gchar *dst_property) + G_GNUC_DEPRECATED_FOR (g_object_bind_property() with G_BINDING_SYNC_CREATE flag); ExoBinding *exo_binding_new_full (GObject *src_object, const gchar *src_property, GObject *dst_object, const gchar *dst_property, ExoBindingTransform transform, GDestroyNotify destroy_notify, - gpointer user_data); + gpointer user_data) +G_GNUC_DEPRECATED_FOR (g_object_bind_property_full() with G_BINDING_SYNC_CREATE flag); ExoBinding *exo_binding_new_with_negation (GObject *src_object, const gchar *src_property, GObject *dst_object, - const gchar *dst_property); -void exo_binding_unbind (ExoBinding *binding); + const gchar *dst_property) + G_GNUC_DEPRECATED_FOR (g_object_bind_property() with G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE flag); +void exo_binding_unbind (ExoBinding *binding) + G_GNUC_DEPRECATED_FOR (g_binding_unbind() or g_object_unref()); ExoMutualBinding *exo_mutual_binding_new (GObject *object1, const gchar *property1, GObject *object2, - const gchar *property2); + const gchar *property2) + G_GNUC_DEPRECATED_FOR (g_object_bind_property() with G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE flag); ExoMutualBinding *exo_mutual_binding_new_full (GObject *object1, const gchar *property1, GObject *object2, @@ -82,12 +87,15 @@ ExoMutualBinding *exo_mutual_binding_new_full (GObject *obj ExoBindingTransform transform, ExoBindingTransform reverse_transform, GDestroyNotify destroy_notify, - gpointer user_data); + gpointer user_data) +G_GNUC_DEPRECATED_FOR (g_object_bind_property_full() with G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE flag); ExoMutualBinding *exo_mutual_binding_new_with_negation (GObject *object1, const gchar *property1, GObject *object2, - const gchar *property2); -void exo_mutual_binding_unbind (ExoMutualBinding *binding); + const gchar *property2) + G_GNUC_DEPRECATED_FOR (g_object_bind_property() with G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE flag); +void exo_mutual_binding_unbind (ExoMutualBinding *binding) + G_GNUC_DEPRECATED_FOR (g_binding_unbind() or g_object_unref()); G_END_DECLS diff --git a/exo/exo-gobject-extensions.c b/exo/exo-gobject-extensions.c index 5cafcdb..b14dede 100644 --- a/exo/exo-gobject-extensions.c +++ b/exo/exo-gobject-extensions.c @@ -51,6 +51,8 @@ * This function is mostly useful for binding boolean properties * with inversing. * + * Deprecated: xfce 4.18: Rarely used API + * * Returns: %TRUE on successful transformation. **/ gboolean diff --git a/exo/exo-gobject-extensions.h b/exo/exo-gobject-extensions.h index 74ae8fd..61b59fc 100644 --- a/exo/exo-gobject-extensions.h +++ b/exo/exo-gobject-extensions.h @@ -30,6 +30,7 @@ G_BEGIN_DECLS +G_DEPRECATED gboolean exo_g_value_transform_negate (const GValue *src_value, GValue *dst_value); diff --git a/exo/exo-icon-chooser-dialog.c b/exo/exo-icon-chooser-dialog.c index bca57cb..aae3054 100644 --- a/exo/exo-icon-chooser-dialog.c +++ b/exo/exo-icon-chooser-dialog.c @@ -33,7 +33,6 @@ #include <gdk/gdkkeysyms.h> -#include <exo/exo-binding.h> #include <exo/exo-cell-renderer-icon.h> #include <exo/exo-gtk-extensions.h> #include <exo/exo-icon-chooser-dialog.h> @@ -223,7 +222,7 @@ exo_icon_chooser_dialog_init (ExoIconChooserDialog *icon_chooser_dialog) priv->filter_entry_timeout_source_id = 0; priv->filter_entry = gtk_entry_new (); - exo_binding_new (G_OBJECT (priv->filter_entry), "visible", G_OBJECT (label), "visible"); + g_object_bind_property (G_OBJECT (priv->filter_entry), "visible", G_OBJECT (label), "visible", G_BINDING_SYNC_CREATE); gtk_grid_attach (GTK_GRID (table), priv->filter_entry, 1, 1, 1, 1); g_object_set (priv->filter_entry, "hexpand", TRUE, NULL); gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->filter_entry); @@ -242,7 +241,7 @@ exo_icon_chooser_dialog_init (ExoIconChooserDialog *icon_chooser_dialog) /* setup the icon chooser (shown by default) */ priv->icon_chooser = exo_icon_view_new (); - exo_binding_new (G_OBJECT (priv->icon_chooser), "visible", G_OBJECT (scrolled_window), "visible"); + g_object_bind_property (G_OBJECT (priv->icon_chooser), "visible", G_OBJECT (scrolled_window), "visible", G_BINDING_SYNC_CREATE); g_signal_connect_swapped (priv->icon_chooser, "item-activated", G_CALLBACK (gtk_window_activate_default), icon_chooser_dialog); g_signal_connect_swapped (priv->icon_chooser, "selection-changed", G_CALLBACK (exo_icon_chooser_dialog_selection_changed), icon_chooser_dialog); g_signal_connect_swapped (priv->icon_chooser, "start-interactive-search", G_CALLBACK (exo_icon_chooser_dialog_start_interactive_search), icon_chooser_dialog); diff --git a/exo/make-exo-alias.pl b/exo/make-exo-alias.pl index 5d423ea..21e4bfc 100644 --- a/exo/make-exo-alias.pl +++ b/exo/make-exo-alias.pl @@ -33,6 +33,8 @@ print <<EOF; #include <glib.h> +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + EOF my $in_comment = 0; @@ -148,6 +150,8 @@ EOF print <<EOF; +G_GNUC_END_IGNORE_DEPRECATIONS + #endif /* HAVE_GNUC_VISIBILITY */ EOF |