On Mon, 14 Aug 2006, rupert wrote: > void crypto_mount_set_pixbuf(struct treedata *treedata){ > > gchar *mountpoint; > GtkTreeIter iter; > gtk_tree_model_get_iter_first(treedata->store,&iter); >
A couple of stylistic points: 1) put the opening brace as the first thing on the next line 2) add an empty line between the variable declarations and the first line of code (the gtk_tree_model_get_iter_first() call). 3) put a space after the ',' that separetes the arguments to gtk_tree_moedl_get_iter_first(). In Java the normal thing seems to be to put the brace on the first line, the way you did (except that they would add a space between ')' and '{'). Different languages have different idioms. Almost *all* C programmers would agree with 1, 2, and 3 above. > do > { Most C programmers would put these on the same line as 'do {' (note the space). > gtk_tree_model_get(treedata->store, &iter, MOUNTPOINT_COLUMN, > &mountpoint, -1); > g_print("MOUNTPOINT_COLUMN: %s\n", mountpoint); > > if(crypto_mount_check(mountpoint)) > { Likewise. > g_print("%s FOUND\n", mountpoint); > treedata->pixbuf_mount = > gdk_pixbuf_new_from_file("pics/mount.png", NULL); > gtk_list_store_set(treedata->store, &iter, MOUNT_COLUMN, > treedata->pixbuf_mount, -1); > g_object_unref(treedata->pixbuf_mount); > > } > else > { Most C programmers would put these three on the same line: '} else {'. > g_print("%s NOT FOUND\n", mountpoint); > treedata->pixbuf_mount = > gdk_pixbuf_new_from_file("pics/unmount.png", NULL); > gtk_list_store_set(treedata->store, &iter, MOUNT_COLUMN, > treedata->pixbuf_mount, -1); > g_object_unref(treedata->pixbuf_mount); > > } > > }while(gtk_tree_model_iter_next(treedata->store, &iter)); Almost all C programmers would have a space between '{' and 'while'. Most would also have a space between 'while' and '(', as 'while' is a keyword, not a function call (the same goes for 'if', 'for', 'switch'). > gtk_tree_model_get_iter_first(treedata->store,&iter); No need to do the final gtk_tree_model_get_iter_first(). I mean, iter is a local variable and you are done with it and besides it gets destroyed anyway as soon as the function returns... > } > > > I have to give me a timeframe of a day or two before asking question,(this > gets a note on the monitor.)... ;) -Peter _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list