[gedit: 5/5] PrintJob: bind properties for wrap mode settings



commit 9eb5939cf6f602c86692011177bd5791d5220f9f
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Feb 20 13:36:24 2015 +0100

    PrintJob: bind properties for wrap mode settings

 gedit/gedit-print-job.c |   36 ++++++------------------------------
 1 files changed, 6 insertions(+), 30 deletions(-)
---
diff --git a/gedit/gedit-print-job.c b/gedit/gedit-print-job.c
index 9577d03..b5c95d2 100644
--- a/gedit/gedit-print-job.c
+++ b/gedit/gedit-print-job.c
@@ -230,24 +230,6 @@ gedit_print_job_init (GeditPrintJob *job)
 }
 
 static void
-wrap_mode_checkbutton_toggled (GtkToggleButton *button,
-                              GeditPrintJob   *job)
-{
-       if (!gtk_toggle_button_get_active (job->priv->text_wrapping_checkbutton))
-       {
-               gtk_widget_set_sensitive (GTK_WIDGET (job->priv->do_not_split_checkbutton),
-                                         FALSE);
-               gtk_toggle_button_set_inconsistent (job->priv->do_not_split_checkbutton, TRUE);
-       }
-       else
-       {
-               gtk_widget_set_sensitive (GTK_WIDGET (job->priv->do_not_split_checkbutton),
-                                         TRUE);
-               gtk_toggle_button_set_inconsistent (job->priv->do_not_split_checkbutton, FALSE);
-       }
-}
-
-static void
 restore_button_clicked (GtkButton     *button,
                        GeditPrintJob *job)
 
@@ -381,22 +363,16 @@ create_custom_widget_cb (GtkPrintOperation *operation,
 
                default:
                        gtk_toggle_button_set_active (job->priv->text_wrapping_checkbutton, FALSE);
-                       gtk_toggle_button_set_inconsistent (job->priv->do_not_split_checkbutton, TRUE);
                        break;
        }
 
-       gtk_widget_set_sensitive (GTK_WIDGET (job->priv->do_not_split_checkbutton),
-                                 wrap_mode != GTK_WRAP_NONE);
-
-       g_signal_connect (job->priv->text_wrapping_checkbutton,
-                         "toggled",
-                         G_CALLBACK (wrap_mode_checkbutton_toggled),
-                         job);
+       g_object_bind_property (job->priv->text_wrapping_checkbutton, "active",
+                               job->priv->do_not_split_checkbutton, "sensitive",
+                               G_BINDING_SYNC_CREATE);
 
-       g_signal_connect (job->priv->do_not_split_checkbutton,
-                         "toggled",
-                         G_CALLBACK (wrap_mode_checkbutton_toggled),
-                         job);
+       g_object_bind_property (job->priv->text_wrapping_checkbutton, "active",
+                               job->priv->do_not_split_checkbutton, "inconsistent",
+                               G_BINDING_INVERT_BOOLEAN | G_BINDING_SYNC_CREATE);
 
        /* Restore */
        g_signal_connect (job->priv->restore_button,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]