fixed stereo.fixed preferences
authorVladimir Nadvornik <nadvornik@suse.cz>
Tue, 27 Sep 2011 20:03:47 +0000 (22:03 +0200)
committerVladimir Nadvornik <nadvornik@suse.cz>
Tue, 27 Sep 2011 20:03:47 +0000 (22:03 +0200)
src/preferences.c
src/ui_misc.c
src/ui_misc.h

index ecca75f..19f8db9 100644 (file)
@@ -146,12 +146,6 @@ static void slideshow_delay_cb(GtkWidget *spin, gpointer data)
                                   (gdouble)SLIDESHOW_SUBSECOND_PRECISION + 0.01);
 }
 
-static void pref_spin_int_cb(GtkWidget *widget, gpointer data)
-{
-        gint *var = data;
-        *var = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
-}
-
 /*
  *-----------------------------------------------------------------------------
  * sync progam to config window routine (private)
@@ -2143,18 +2137,18 @@ static void config_tab_stereo(GtkWidget *notebook)
 
        group2 = pref_group_new(box2, FALSE, _("Fixed position"), GTK_ORIENTATION_VERTICAL);
        table = pref_table_new(group2, 5, 3, FALSE, FALSE);
-       pref_table_spin(table, 0, 0, _("Width"), NULL,
-                         1, 5000, 1, 0, options->stereo.fixed_w, G_CALLBACK(pref_spin_int_cb), &c_options->stereo.fixed_w);
-       pref_table_spin(table, 3, 0,  _("Height"), NULL,
-                         1, 5000, 1, 0, options->stereo.fixed_h, G_CALLBACK(pref_spin_int_cb), &c_options->stereo.fixed_h);
-       pref_table_spin(table, 0, 1,  _("Left X"), NULL,
-                         0, 5000, 1, 0, options->stereo.fixed_x1, G_CALLBACK(pref_spin_int_cb), &c_options->stereo.fixed_x1);
-       pref_table_spin(table, 3, 1,  _("Left Y"), NULL,
-                         0, 5000, 1, 0, options->stereo.fixed_y1, G_CALLBACK(pref_spin_int_cb), &c_options->stereo.fixed_y1);
-       pref_table_spin(table, 0, 2,  _("Right X"), NULL,
-                         0, 5000, 1, 0, options->stereo.fixed_x2, G_CALLBACK(pref_spin_int_cb), &c_options->stereo.fixed_x2);
-       pref_table_spin(table, 3, 2,  _("Right Y"), NULL,
-                         0, 5000, 1, 0, options->stereo.fixed_y2, G_CALLBACK(pref_spin_int_cb), &c_options->stereo.fixed_y2);
+       pref_table_spin_new_int(table, 0, 0, _("Width"), NULL,
+                         1, 5000, 1, options->stereo.fixed_w, &c_options->stereo.fixed_w);
+       pref_table_spin_new_int(table, 3, 0,  _("Height"), NULL,
+                         1, 5000, 1, options->stereo.fixed_h, &c_options->stereo.fixed_h);
+       pref_table_spin_new_int(table, 0, 1,  _("Left X"), NULL,
+                         0, 5000, 1, options->stereo.fixed_x1, &c_options->stereo.fixed_x1);
+       pref_table_spin_new_int(table, 3, 1,  _("Left Y"), NULL,
+                         0, 5000, 1, options->stereo.fixed_y1, &c_options->stereo.fixed_y1);
+       pref_table_spin_new_int(table, 0, 2,  _("Right X"), NULL,
+                         0, 5000, 1, options->stereo.fixed_x2, &c_options->stereo.fixed_x2);
+       pref_table_spin_new_int(table, 3, 2,  _("Right Y"), NULL,
+                         0, 5000, 1, options->stereo.fixed_y2, &c_options->stereo.fixed_y2);
 
 }
 
index 2335c14..770899d 100644 (file)
@@ -722,6 +722,20 @@ GtkWidget *pref_table_spin(GtkWidget *table, gint column, gint row,
        return spin;
 }
 
+GtkWidget *pref_table_spin_new_int(GtkWidget *table, gint column, gint row,
+                                  const gchar *text, const gchar *suffix,
+                                  gint min, gint max, gint step,
+                                  gint value, gint *value_var)
+{
+       *value_var = value;
+       return pref_table_spin(table, column, row,
+                              text, suffix,
+                              (gdouble)min, (gdouble)max, (gdouble)step, 0,
+                              value,
+                              G_CALLBACK(pref_spin_int_cb), value_var);
+}
+
+
 #if ! GTK_CHECK_VERSION(2,12,0)
 
 static void pref_toolbar_destroy_cb(GtkWidget *widget, gpointer data)
index a87b3b3..d940cd6 100644 (file)
@@ -136,6 +136,11 @@ GtkWidget *pref_table_spin(GtkWidget *table, gint column, gint row,
                           gdouble value,
                           GCallback func, gpointer data);
 
+GtkWidget *pref_table_spin_new_int(GtkWidget *table, gint column, gint row,
+                                  const gchar *text, const gchar *suffix,
+                                  gint min, gint max, gint step,
+                                  gint value, gint *value_var);
+
 
 GtkWidget *pref_toolbar_new(GtkWidget *parent_box, GtkToolbarStyle style);
 GtkWidget *pref_toolbar_button(GtkWidget *toolbar,