Permalink
Browse files

Changes suggested from jberitz

  • Loading branch information...
1 parent c357677 commit 90e42f14adaf3c4c614e7bb6f6778692e3521276 Günther Wutz committed Sep 29, 2012
Showing with 21 additions and 4 deletions.
  1. +2 −1 src/basic-gtk/basic.c
  2. +18 −2 src/basic-gtk/sync_window.c
  3. +1 −1 src/basic-gtk/text_window.c
@@ -13,7 +13,8 @@ gint main ( gint argc, gchar* argv[] )
GtkWidget *window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_window_set_title( GTK_WINDOW(window), "First GTK+ Program" );
- g_object_set( window, "window-position", GTK_WIN_POS_CENTER, "border-width", 10, NULL );
+ gtk_window_set_position( GTK_WINDOW(window), GTK_WIN_POS_CENTER );
+ gtk_container_set_border_width( GTK_CONTAINER(window), 10 );
gtk_window_set_default_size( GTK_WINDOW(window), 350, 70 );
g_signal_connect ( GTK_WIDGET(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
@@ -17,7 +17,7 @@ void
spin_value_changed(GtkSpinButton *spinbutton, gpointer user_data) {
GtkScale *scale = (GtkScale*)user_data;
gdouble value;
- g_object_get(spinbutton, "value", &value, NULL);
+ value = gtk_spin_button_get_value(spinbutton);
gtk_range_set_value(GTK_RANGE(scale), value);
}
@@ -32,17 +32,33 @@ void
gu_syncwindow_init(GuSyncwindow *window) {
gtk_window_set_default_size(GTK_WINDOW(window), 300, 20);
gtk_window_set_title(GTK_WINDOW(window), "Enter your Age");
- g_object_set( window, "window-position", GTK_WIN_POS_CENTER, "border-width", 10, NULL );
+ gtk_window_set_position (GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+ gtk_container_set_border_width( GTK_CONTAINER(window), 10);
g_signal_connect(GTK_WIDGET(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
/* Widgets */
GtkWidget *spin = gtk_spin_button_new_with_range(0, 130, 1);
GtkWidget *scale = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 0, 130, 1);
+ /* According to http://developer.gnome.org/gtk3/stable/GtkVBox.html#gtk-vbox-new
+ * GtkBox is going away eventually in the future
+ *
+ * Using GtkGrid instead
+ */
+
+ /*
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_set_homogeneous(GTK_BOX(box), TRUE);
gtk_box_pack_start(GTK_BOX(box), spin, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(box), scale, TRUE, TRUE, 0);
+ */
+
+ GtkWidget *box = gtk_grid_new();
+ gtk_grid_set_column_homogeneous(GTK_GRID(box), TRUE);
+ gtk_grid_set_column_spacing(GTK_GRID(box), 5);
+ gtk_grid_attach_next_to(GTK_GRID(box), scale, NULL, GTK_POS_LEFT, 1,1);
+ gtk_grid_attach_next_to(GTK_GRID(box), spin, NULL, GTK_POS_LEFT, 1,1);
+
g_signal_connect(spin, "value-changed", G_CALLBACK(spin_value_changed), scale);
g_signal_connect(scale, "value-changed", G_CALLBACK(scale_value_changed), spin);
@@ -56,7 +56,7 @@ gu_textwindow_init(GuTextwindow *window) {
gtk_window_set_default_size(GTK_WINDOW(window), 400, 300);
gtk_window_set_title(GTK_WINDOW(window), "Text File Viewer");
- g_object_set( window, "window-position", GTK_WIN_POS_CENTER, NULL );
+ gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
g_signal_connect(GTK_WIDGET(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
/* Toolbar */

0 comments on commit 90e42f1

Please sign in to comment.