In C, if you want to set the value of certain property of a Gtk+ object, you can do it like so
gtk_<type>_set_<property> (GTK_<TYPE> (var_name), <value>);
For example, to set the title of a GtkWindow to "Hello World", do would write
gtk_window_set_title (GTK_WINDOW (window), "Hello World");
This is fine, but what if you want to set the value of a bunch of properties, say for GtkWindow; "app-paintable", "default-width", "default-height", "resizable", and "modal", most beginner would write:
GtkWidget *window = gtk_window_new ();
gtk_widget_set_app_paintable (window), TRUE);
gtk_window_set_default_size (GTK_WINDOW (window), 100,100);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_window_set_modal (GTK_WINDOW (window), TRUE);
Too many characters to type (229 characters excluding spaces and newlines).
I prefer the GObject way to do this task. The following is the code which does the same thing as the code above, but by using g_object_set:
GtkWidget *window = gtk_window_new ();
g_object_set (G_OBJECT (window),
"app-paintable", TRUE,
"default-width", 100, "default-height", 100,
"resizable", FALSE,
"modal", TRUE,
NULL); //the arguments must end with NULL
You have to type much less characters, only 130 characters. You can also remove the G_OBJECT macro from the code above. Moreover, your code would look more beautiful (in my eyes at least). :)