How do I set the size of a widget/window? How do I prevent the user resizing my window?

The gtk_widget_set_uposition() function is used to set the position of any widget.

The gtk_widget_set_usize() function is used to set the size of a widget. In order to use all the features that are provided by this function when it acts on a window, you may want to use the gtk_window_set_policy function. The definition of these functions are:

void gtk_widget_set_usize (GtkWidget *widget,
                           gint width,
                           gint height);

void gtk_window_set_policy (GtkWindow *window,
                            gint allow_shrink,
                            gint allow_grow,
                            gint auto_shrink);

auto_shrink will automatically shrink the window when the requested size of the child widgets goes below the current size of the window. allow_shrink will give the user the authorisation to make the window smaller that it should normally be. allow_grow gives the user the ability to make the window bigger. The default values for these parameters are:

allow_shrink = FALSE
allow_grow   = TRUE
auto_shrink  = FALSE

The gtk_widget_set_usize() functions is not the easiest way to set a window size since you cannot decrease this window size with another call to this function unless you call it twice, as in:

     gtk_widget_set_usize(your_widget, -1, -1);
     gtk_widget_set_usize(your_widget, new_x_size, new_y_size);

Another way to set the size of and/or move a window is to use the gdk_window_move_resize() function which uses to work fine both to grow or to shrink the window:

     gdk_window_move_resize(window->window, 
                            x_pos, y_pos, 
                            x_size, y_size);