[cheese] Make CheesePreferencesDialog a template widget



commit 9284c728aaf5241ff4613e28d90725189ea81a31
Author: David King <amigadave amigadave com>
Date:   Mon Nov 11 22:58:18 2013 +0000

    Make CheesePreferencesDialog a template widget

 Makefile.am                 |    9 +-
 configure.ac                |   11 +--
 data/cheese-prefs.ui        |  119 ++++++++----------------
 data/cheese.gresource.xml   |    1 +
 src/cheese-preferences.vala |  217 +++++++++++++++++--------------------------
 5 files changed, 134 insertions(+), 223 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 1efc45a..882308b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -52,9 +52,10 @@ AM_CPPFLAGS = \
        $(WARN_CFLAGS)
 
 AM_VALAFLAGS = \
-       --target-glib=2.32 \
+       --target-glib=2.38 \
        --thread \
        --vapidir $(top_srcdir)/src/vapi \
+       --gresources $(top_srcdir)/data/cheese.gresource.xml \
        --pkg config \
        --pkg posix \
        --pkg gtk+-3.0 \
@@ -196,7 +197,8 @@ endif
 
 noinst_resource_files = \
        data/cheese.css \
-       data/cheese-viewport.json
+       data/cheese-viewport.json \
+       data/cheese-prefs.ui
 
 src/cheese-resource.c src/cheese-resource.h: data/cheese.gresource.xml Makefile $(noinst_resource_files)
        $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/data --generate --c-name 
cheese $<
@@ -311,8 +313,7 @@ gsettings_SCHEMAS = data/org.gnome.Cheese.gschema.xml
 @GSETTINGS_RULES@
 
 dist_pkgdata_DATA = \
-       data/cheese-main-window.ui \
-       data/cheese-prefs.ui
+       data/cheese-main-window.ui
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = \
diff --git a/configure.ac b/configure.ac
index 54417e5..622083e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@ AM_SILENT_RULES([yes])
 # Check for programs
 AC_PROG_CC
 AM_PROG_CC_C_O
-AM_PROG_VALAC([0.18.0])
+AM_PROG_VALAC([0.22.0])
 
 # Initialize libtool
 LT_PREREQ([2.2])
@@ -56,9 +56,7 @@ IT_PROG_INTLTOOL([0.50.0])
 #*******************************************************************************
 
 
-GLIB_REQUIRED="glib-2.0 >= 2.32.0"
-GOBJECT_REQUIRED="gobject-2.0 >= 2.28.0"
-GIO_REQUIRED="gio-2.0 >= 2.32.0"
+GLIB_REQUIRED="glib-2.0 >= 2.38.0"
 GTK_REQUIRED="gtk+-3.0 >= 3.10.0"
 GDK_PIXBUF_REQUIRED="gdk-pixbuf-2.0"
 LIBGNOMEDESKTOP_REQUIRED="gnome-desktop-3.0 >= 2.91.6"
@@ -102,9 +100,7 @@ AM_CONDITIONAL([HAVE_XTEST], test "x$ac_cv_lib_Xtst_XTestFakeKeyEvent" = "xyes")
 
 PKG_CHECK_MODULES([CHEESE],
   [$GLIB_REQUIRED
-  $GIO_REQUIRED
   $X11_REQUIRED
-  $GOBJECT_REQUIRED
   $GDK_PIXBUF_REQUIRED
   $GSTREAMER_REQUIRED
   $GSTREAMER_PLUGINS_BAD_REQUIRED
@@ -116,8 +112,7 @@ PKG_CHECK_MODULES([CHEESE],
   $UDEV_REQUIRED])
 
 PKG_CHECK_MODULES([CHEESE_GTK],
-  [$GIO_REQUIRED
-   $GTK_REQUIRED
+  [$GTK_REQUIRED
    $LIBRSVG_REQUIRED
    $CLUTTERGTK_REQUIRED
    $LIBCANBERRA_REQUIRED
diff --git a/data/cheese-prefs.ui b/data/cheese-prefs.ui
index 5c0e537..ea9c5e0 100644
--- a/data/cheese-prefs.ui
+++ b/data/cheese-prefs.ui
@@ -1,33 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
-  <object class="GtkAdjustment" id="brightness_adjustment">
-    <property name="lower">-1</property>
-    <property name="upper">1</property>
-    <property name="step_increment">0.10000000000000001</property>
-    <property name="page_increment">0.5</property>
-    <signal name="value-changed" handler="cheese_preferences_dialog_on_brightness_change" swapped="no"/>
-  </object>
-  <object class="GtkAdjustment" id="burst_count_adjustment">
-    <property name="lower">3</property>
-    <property name="upper">100000</property>
-    <property name="value">2</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkAdjustment" id="burst_delay_adjustment">
-    <property name="lower">1</property>
-    <property name="upper">10000</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkDialog" id="cheese_prefs_dialog">
+    <!-- interface-requires gtk+ 3.10 -->
+    <template class="CheesePreferencesDialog" parent="GtkDialog">
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
+    <property name="border_width">6</property>
     <property name="title" translatable="yes">Preferences</property>
     <property name="window_position">center-on-parent</property>
     <property name="type_hint">dialog</property>
-    <signal name="delete-event" handler="cheese_preferences_dialog_on_delete" swapped="no"/>
+    <signal name="delete-event" handler="on_delete" swapped="no"/>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -94,11 +74,11 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="camera_combo_box">
+                  <object class="GtkComboBox" id="source_combo">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="hexpand">True</property>
-                    <signal name="changed" handler="cheese_preferences_dialog_on_source_change" 
swapped="no"/>
+                    <signal name="changed" handler="on_source_change" swapped="no"/>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
@@ -108,12 +88,12 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="photo_resolution_combo_box">
+                  <object class="GtkComboBox" id="photo_resolution_combo">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="hexpand">True</property>
-                    <signal name="changed" handler="cheese_preferences_dialog_on_photo_resolution_change" 
swapped="no"/>
+                    <signal name="changed" handler="on_photo_resolution_change" swapped="no"/>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
@@ -123,12 +103,12 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkComboBox" id="video_resolution_combo_box">
+                  <object class="GtkComboBox" id="video_resolution_combo">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                     <property name="hexpand">True</property>
-                    <signal name="changed" handler="cheese_preferences_dialog_on_video_resolution_change" 
swapped="no"/>
+                    <signal name="changed" handler="on_video_resolution_change" swapped="no"/>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
@@ -137,21 +117,6 @@
                     <property name="height">1</property>
                   </packing>
                 </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
               </object>
             </child>
             <child type="tab">
@@ -307,21 +272,6 @@
                     <property name="height">1</property>
                   </packing>
                 </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
               </object>
               <packing>
                 <property name="position">1</property>
@@ -370,7 +320,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="countdown">
+                      <object class="GtkCheckButton" id="countdown_check">
                         <property name="label" translatable="yes">_Countdown</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
@@ -390,7 +340,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="flash">
+                      <object class="GtkCheckButton" id="flash_check">
                         <property name="label" translatable="yes">Fire _flash</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
@@ -470,7 +420,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkSpinButton" id="burst_repeat">
+                      <object class="GtkSpinButton" id="burst_repeat_spin">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
@@ -486,14 +436,14 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkSpinButton" id="burst_delay">
+                      <object class="GtkSpinButton" id="burst_delay_spin">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
                         <property name="invisible_char">●</property>
                         <property name="invisible_char_set">True</property>
                         <property name="adjustment">burst_delay_adjustment</property>
-                        <signal name="value-changed" 
handler="cheese_preferences_dialog_on_burst_delay_change" swapped="no"/>
+                        <signal name="value-changed" handler="on_burst_delay_change" swapped="no"/>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
@@ -502,15 +452,6 @@
                         <property name="height">1</property>
                       </packing>
                     </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
-                    <child>
-                      <placeholder/>
-                    </child>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -553,7 +494,7 @@
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="use-underline">True</property>
-                <signal name="clicked" handler="cheese_preferences_dialog_on_dialog_help" swapped="no"/>
+                <signal name="clicked" handler="on_dialog_help" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -570,7 +511,7 @@
                 <property name="receives_default">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
                 <property name="use-underline">True</property>
-                <signal name="clicked" handler="cheese_preferences_dialog_on_dialog_close" swapped="no"/>
+                <signal name="clicked" handler="on_dialog_close" swapped="no"/>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -592,26 +533,46 @@
       <action-widget response="-11">help</action-widget>
       <action-widget response="-7">close</action-widget>
     </action-widgets>
+    </template>
+  <object class="GtkAdjustment" id="brightness_adjustment">
+    <property name="lower">-1</property>
+    <property name="upper">1</property>
+    <property name="step_increment">0.10000000000000001</property>
+    <property name="page_increment">0.5</property>
+    <signal name="value-changed" handler="on_brightness_change" swapped="no"/>
+  </object>
+  <object class="GtkAdjustment" id="burst_count_adjustment">
+    <property name="lower">3</property>
+    <property name="upper">100000</property>
+    <property name="value">2</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="burst_delay_adjustment">
+    <property name="lower">1</property>
+    <property name="upper">10000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
   </object>
   <object class="GtkAdjustment" id="contrast_adjustment">
     <property name="upper">2</property>
     <property name="value">1</property>
     <property name="step_increment">0.10000000000000001</property>
     <property name="page_increment">0.5</property>
-    <signal name="value-changed" handler="cheese_preferences_dialog_on_contrast_change" swapped="no"/>
+    <signal name="value-changed" handler="on_contrast_change" swapped="no"/>
   </object>
   <object class="GtkAdjustment" id="hue_adjustment">
     <property name="lower">-1</property>
     <property name="upper">1</property>
     <property name="step_increment">0.10000000000000001</property>
     <property name="page_increment">0.5</property>
-    <signal name="value-changed" handler="cheese_preferences_dialog_on_hue_change" swapped="no"/>
+    <signal name="value-changed" handler="on_hue_change" swapped="no"/>
   </object>
   <object class="GtkAdjustment" id="saturation_adjustment">
     <property name="upper">2</property>
     <property name="value">1</property>
     <property name="step_increment">0.10000000000000001</property>
     <property name="page_increment">0.5</property>
-    <signal name="value-changed" handler="cheese_preferences_dialog_on_saturation_change" swapped="no"/>
+    <signal name="value-changed" handler="on_saturation_change" swapped="no"/>
   </object>
 </interface>
diff --git a/data/cheese.gresource.xml b/data/cheese.gresource.xml
index e171e08..9c42497 100644
--- a/data/cheese.gresource.xml
+++ b/data/cheese.gresource.xml
@@ -3,6 +3,7 @@
   <gresource prefix='/org/gnome/Cheese'>
     <file>cheese.css</file>
     <file>cheese-viewport.json</file>
+    <file preprocess="xml-stripblanks">cheese-prefs.ui</file>
   </gresource>
 </gresources>
 
diff --git a/src/cheese-preferences.vala b/src/cheese-preferences.vala
index 8174491..5bf0c74 100644
--- a/src/cheese-preferences.vala
+++ b/src/cheese-preferences.vala
@@ -21,76 +21,49 @@
 
 using Gtk;
 
-public class Cheese.PreferencesDialog : GLib.Object
+[GtkTemplate (ui = "/org/gnome/Cheese/cheese-prefs.ui")]
+public class Cheese.PreferencesDialog : Gtk.Dialog
 {
-  private Cheese.Camera camera;
-
-  private GLib.Settings settings;
-
-  private Gtk.Dialog dialog;
-
-  private Gtk.ComboBox photo_resolution_combo;
-  private Gtk.ComboBox video_resolution_combo;
-  private Gtk.ComboBox source_combo;
-
-  private Gtk.ListStore camera_model;
-
-  private Gtk.Adjustment brightness_adjustment;
-  private Gtk.Adjustment contrast_adjustment;
-  private Gtk.Adjustment hue_adjustment;
-  private Gtk.Adjustment saturation_adjustment;
-
-  private Gtk.Scale brightness_scale;
-  private Gtk.Scale contrast_scale;
-  private Gtk.Scale hue_scale;
-  private Gtk.Scale saturation_scale;
-
-  private Gtk.SpinButton burst_repeat_spin;
-  private Gtk.SpinButton burst_delay_spin;
-
-  private Gtk.CheckButton countdown_check;
-  private Gtk.CheckButton flash_check;
+    private Cheese.Camera camera;
+
+    private GLib.Settings settings;
+
+    [GtkChild]
+    private Gtk.ComboBox photo_resolution_combo;
+    [GtkChild]
+    private Gtk.ComboBox video_resolution_combo;
+    [GtkChild]
+    private Gtk.ComboBox source_combo;
+
+    private Gtk.ListStore camera_model;
+
+    [GtkChild]
+    private Gtk.Adjustment brightness_adjustment;
+    [GtkChild]
+    private Gtk.Adjustment contrast_adjustment;
+    [GtkChild]
+    private Gtk.Adjustment hue_adjustment;
+    [GtkChild]
+    private Gtk.Adjustment saturation_adjustment;
+
+    [GtkChild]
+    private Gtk.SpinButton burst_repeat_spin;
+    [GtkChild]
+    private Gtk.SpinButton burst_delay_spin;
+
+    [GtkChild]
+    private Gtk.CheckButton countdown_check;
+    [GtkChild]
+    private Gtk.CheckButton flash_check;
   
-  private MediaMode current_mode;
+    private MediaMode current_mode;
 
-  public PreferencesDialog (Cheese.Camera camera)
-  {
+public PreferencesDialog (Cheese.Camera camera)
+{
     this.camera = camera;
 
     settings = new GLib.Settings ("org.gnome.Cheese");
 
-    Gtk.Builder builder = new Gtk.Builder ();
-    try
-    {
-      builder.add_from_file (GLib.Path.build_filename (Config.PACKAGE_DATADIR, "cheese-prefs.ui"));
-    }
-    catch (Error err)
-    {
-      error ("Error: %s", err.message);
-    }
-
-    this.dialog = builder.get_object ("cheese_prefs_dialog") as Gtk.Dialog;
-
-    this.brightness_adjustment = builder.get_object ("brightness_adjustment") as Gtk.Adjustment;
-    this.contrast_adjustment = builder.get_object ("contrast_adjustment") as Gtk.Adjustment as 
Gtk.Adjustment as Gtk.Adjustment as Gtk.Adjustment;
-    this.hue_adjustment = builder.get_object ("hue_adjustment") as Gtk.Adjustment;
-    this.saturation_adjustment = builder.get_object ("saturation_adjustment") as Gtk.Adjustment;
-
-    this.brightness_scale = builder.get_object ("brightness_scale") as Gtk.Scale;
-    this.contrast_scale = builder.get_object ("contrast_scale") as Gtk.Scale;
-    this.hue_scale = builder.get_object ("hue_scale") as Gtk.Scale;
-    this.saturation_scale = builder.get_object ("saturation_scale") as Gtk.Scale;
-
-    this.photo_resolution_combo = builder.get_object ("photo_resolution_combo_box") as Gtk.ComboBox;
-    this.video_resolution_combo = builder.get_object ("video_resolution_combo_box") as Gtk.ComboBox;
-    this.source_combo = builder.get_object ("camera_combo_box") as Gtk.ComboBox;
-
-    this.burst_repeat_spin = builder.get_object ("burst_repeat") as Gtk.SpinButton;
-    this.burst_delay_spin = builder.get_object ("burst_delay") as Gtk.SpinButton;
-
-    this.countdown_check = builder.get_object ("countdown") as Gtk.CheckButton;
-    this.flash_check = builder.get_object ("flash") as Gtk.CheckButton;
-
     setup_combo_box_models ();
     initialize_camera_devices ();
     initialize_values_from_settings ();
@@ -99,9 +72,8 @@ public class Cheese.PreferencesDialog : GLib.Object
      * Connect signals only after all the widgets have been setup
      * Stops a bunch of unnecessary signals from being fired
      */
-    builder.connect_signals (this);
     camera.notify["num-camera-devices"].connect(this.on_camera_update_num_camera_devices);
-  }
+}
 
   /**
    * Set up combo box cell renderers.
@@ -210,8 +182,8 @@ public class Cheese.PreferencesDialog : GLib.Object
    *
    * @param combo the video device combo box
    */
-  [CCode (instance_pos = -1)]
-  public void on_source_change (Gtk.ComboBox combo)
+  [GtkCallback]
+  private void on_source_change (Gtk.ComboBox combo)
   {
     // TODO: Handle going from 1 to 0 devices, cleanly!
     return_if_fail (camera.num_camera_devices > 0);
@@ -233,8 +205,8 @@ public class Cheese.PreferencesDialog : GLib.Object
    *
    * @param combo the photo resolution combo box
    */
-  [CCode (instance_pos = -1)]
-  public void on_photo_resolution_change (Gtk.ComboBox combo)
+  [GtkCallback]
+  private void on_photo_resolution_change (Gtk.ComboBox combo)
   {
     TreeIter iter;
 
@@ -256,8 +228,8 @@ public class Cheese.PreferencesDialog : GLib.Object
    *
    * @param combo the video resolution combo box
    */
-  [CCode (instance_pos = -1)]
-  public void on_video_resolution_change (Gtk.ComboBox combo)
+  [GtkCallback]
+  private void on_video_resolution_change (Gtk.ComboBox combo)
   {
     TreeIter iter;
 
@@ -273,46 +245,42 @@ public class Cheese.PreferencesDialog : GLib.Object
     settings.set_int ("video-y-resolution", format.height);
   }
 
-  /**
-   * Hide the dialog when it is closed, rather than deleting it.
-   *
-   * @param dialog the dialog on which the delete event was generated
-   */
-  [CCode (instance_pos = -1)]
-  public void on_delete (Gtk.Dialog dialog)
-  {
-    dialog.hide_on_delete ();
-  }
-
-  /**
-   * Hide the dialog when it is closed, rather than deleting it.
-   *
-   * @param button the close button
-   */
-  [CCode (instance_pos = -1)]
-  public void on_dialog_close (Gtk.Button button)
-  {
-    this.dialog.hide ();
-  }
+    /**
+    * Hide the dialog when it is closed, rather than deleting it.
+    */
+    [GtkCallback]
+    private bool on_delete ()
+    {
+        return this.hide_on_delete ();
+    }
 
-  /**
-   * Show the help for the preferences dialog.
-   *
-   * @param button the help button
-   */
-  [CCode (instance_pos = -1)]
-  public void on_dialog_help (Gtk.Button button)
-  {
-    try
+    /**
+    * Hide the dialog when it is closed, rather than deleting it.
+    */
+    [GtkCallback]
+    private void on_dialog_close (Gtk.Button button)
     {
-      Gtk.show_uri (this.dialog.get_screen (), "help:cheese/index#preferences",
-        Gdk.CURRENT_TIME);
+        this.hide ();
     }
-    catch
+
+    /**
+    * Show the help for the preferences dialog.
+    *
+    * @param button the help button
+    */
+    [GtkCallback]
+    private void on_dialog_help (Gtk.Button button)
     {
-      warning ("%s", "Error showing help");
+        try
+        {
+            Gtk.show_uri (this.get_screen (), "help:cheese/index#preferences",
+                          Gdk.CURRENT_TIME);
+        }
+        catch
+        {
+            warning ("%s", "Error showing help");
+        }
     }
-  }
 
   /**
    * Change the burst-delay GSetting when changing the spin button.
@@ -322,8 +290,8 @@ public class Cheese.PreferencesDialog : GLib.Object
    *
    * @param spinbutton the burst-delay spin button
    */
-  [CCode (instance_pos = -1)]
-  public void on_burst_delay_change (Gtk.SpinButton spinbutton)
+  [GtkCallback]
+  private void on_burst_delay_change (Gtk.SpinButton spinbutton)
   {
     settings.set_int ("burst-delay", (int) spinbutton.value * 1000);
   }
@@ -334,8 +302,8 @@ public class Cheese.PreferencesDialog : GLib.Object
    *
    * @param adjustment the adjustment of the brightness Gtk.Scale
    */
-  [CCode (instance_pos = -1)]
-  public void on_brightness_change (Gtk.Adjustment adjustment)
+  [GtkCallback]
+  private void on_brightness_change (Gtk.Adjustment adjustment)
   {
     this.camera.set_balance_property ("brightness", adjustment.value);
     settings.set_double ("brightness", adjustment.value);
@@ -347,8 +315,8 @@ public class Cheese.PreferencesDialog : GLib.Object
    *
    * @param adjustment the adjustment of the contrast Gtk.Scale
    */
-  [CCode (instance_pos = -1)]
-  public void on_contrast_change (Gtk.Adjustment adjustment)
+  [GtkCallback]
+  private void on_contrast_change (Gtk.Adjustment adjustment)
   {
     this.camera.set_balance_property ("contrast", adjustment.value);
     settings.set_double ("contrast", adjustment.value);
@@ -360,8 +328,8 @@ public class Cheese.PreferencesDialog : GLib.Object
    *
    * @param adjustment the adjustment of the hue Gtk.Scale
    */
-  [CCode (instance_pos = -1)]
-  public void on_hue_change (Gtk.Adjustment adjustment)
+  [GtkCallback]
+  private void on_hue_change (Gtk.Adjustment adjustment)
   {
     this.camera.set_balance_property ("hue", adjustment.value);
     settings.set_double ("hue", adjustment.value);
@@ -373,8 +341,8 @@ public class Cheese.PreferencesDialog : GLib.Object
    *
    * @param adjustment the adjustment of the saturation Gtk.Scale
    */
-  [CCode (instance_pos = -1)]
-  public void on_saturation_change (Gtk.Adjustment adjustment)
+  [GtkCallback]
+  private void on_saturation_change (Gtk.Adjustment adjustment)
   {
     this.camera.set_balance_property ("saturation", adjustment.value);
     settings.set_double ("saturation", adjustment.value);
@@ -482,7 +450,7 @@ public class Cheese.PreferencesDialog : GLib.Object
         if (devices.len > 0)
           set_new_available_camera_device (iter);
         else
-          this.dialog.hide();
+          this.hide ();
       }
       camera_model.remove (iter);
 
@@ -508,23 +476,8 @@ public class Cheese.PreferencesDialog : GLib.Object
     source_combo.set_active_iter (new_iter);
   }
 
-  /**
-   * Show the dialog.
-   */
-  public void show ()
-  {
-    this.dialog.show_all ();
-  }
 
     /**
-     * Hide the dialog.
-     */
-    public void hide ()
-    {
-        this.dialog.hide ();
-    }
-  
-    /**
      * Set the current media mode (photo, video or burst).
      *
      * The current mode is used to update the video format on the Cheese.Camera


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