summaryrefslogtreecommitdiff
path: root/test/test.c
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2016-08-29 18:24:05 +0200
committerCarlos Soriano <csoriano@gnome.org>2016-08-29 18:37:10 +0200
commit52d960542b4d5fdf2bd06735d0dbf7934cf2ec12 (patch)
tree5e000d5ed40b52b003c02b597e51ae0b87ff22ac /test/test.c
parent4cafccd82859a4ee0bdfad3e31a310f2d94c0485 (diff)
downloadnautilus-52d960542b4d5fdf2bd06735d0dbf7934cf2ec12.tar.gz
general: run uncrustify
And make the style of Nautilus the same for all files. Hopefully we can fix all the style issues we can find in the next days, so expect a little of movement on this. https://bugzilla.gnome.org/show_bug.cgi?id=770564
Diffstat (limited to 'test/test.c')
-rw-r--r--test/test.c146
1 files changed, 77 insertions, 69 deletions
diff --git a/test/test.c b/test/test.c
index 5481044f5..43e8fbc43 100644
--- a/test/test.c
+++ b/test/test.c
@@ -3,115 +3,123 @@
#include <unistd.h>
void
-test_init (int *argc,
- char ***argv)
+test_init (int *argc,
+ char ***argv)
{
- gtk_init (argc, argv);
+ gtk_init (argc, argv);
- eel_make_warnings_and_criticals_stop_in_debugger ();
+ eel_make_warnings_and_criticals_stop_in_debugger ();
}
int
test_quit (int exit_code)
{
- if (gtk_main_level () > 0) {
- gtk_main_quit ();
- }
+ if (gtk_main_level () > 0)
+ {
+ gtk_main_quit ();
+ }
- return exit_code;
+ return exit_code;
}
void
test_delete_event (GtkWidget *widget,
- GdkEvent *event,
- gpointer callback_data)
+ GdkEvent *event,
+ gpointer callback_data)
{
- test_quit (0);
+ test_quit (0);
}
GtkWidget *
-test_window_new (const char *title, guint border_width)
+test_window_new (const char *title,
+ guint border_width)
{
- GtkWidget *window;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- if (title != NULL) {
- gtk_window_set_title (GTK_WINDOW (window), title);
- }
-
- g_signal_connect (window, "delete_event",
- G_CALLBACK (test_delete_event), NULL);
-
- gtk_container_set_border_width (GTK_CONTAINER (window), border_width);
-
- return window;
+ GtkWidget *window;
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ if (title != NULL)
+ {
+ gtk_window_set_title (GTK_WINDOW (window), title);
+ }
+
+ g_signal_connect (window, "delete_event",
+ G_CALLBACK (test_delete_event), NULL);
+
+ gtk_container_set_border_width (GTK_CONTAINER (window), border_width);
+
+ return window;
}
GdkPixbuf *
-test_pixbuf_new_named (const char *name, float scale)
+test_pixbuf_new_named (const char *name,
+ float scale)
{
- GdkPixbuf *pixbuf;
- char *path;
+ GdkPixbuf *pixbuf;
+ char *path;
- g_return_val_if_fail (name != NULL, NULL);
- g_return_val_if_fail (scale >= 0.0, NULL);
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (scale >= 0.0, NULL);
- if (name[0] == '/') {
- path = g_strdup (name);
- } else {
- path = g_strdup_printf ("%s/%s", NAUTILUS_DATADIR, name);
- }
+ if (name[0] == '/')
+ {
+ path = g_strdup (name);
+ }
+ else
+ {
+ path = g_strdup_printf ("%s/%s", NAUTILUS_DATADIR, name);
+ }
- pixbuf = gdk_pixbuf_new_from_file (path, NULL);
+ pixbuf = gdk_pixbuf_new_from_file (path, NULL);
- g_free (path);
+ g_free (path);
- g_return_val_if_fail (pixbuf != NULL, NULL);
-
- if (scale != 1.0) {
- GdkPixbuf *scaled;
- float width = gdk_pixbuf_get_width (pixbuf) * scale;
- float height = gdk_pixbuf_get_width (pixbuf) * scale;
+ g_return_val_if_fail (pixbuf != NULL, NULL);
- scaled = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
+ if (scale != 1.0)
+ {
+ GdkPixbuf *scaled;
+ float width = gdk_pixbuf_get_width (pixbuf) * scale;
+ float height = gdk_pixbuf_get_width (pixbuf) * scale;
- g_object_unref (pixbuf);
+ scaled = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
- g_return_val_if_fail (scaled != NULL, NULL);
+ g_object_unref (pixbuf);
- pixbuf = scaled;
- }
+ g_return_val_if_fail (scaled != NULL, NULL);
- return pixbuf;
+ pixbuf = scaled;
+ }
+
+ return pixbuf;
}
GtkWidget *
test_label_new (const char *text,
- gboolean with_background,
- int num_sizes_larger)
+ gboolean with_background,
+ int num_sizes_larger)
{
- GtkWidget *label;
+ GtkWidget *label;
+
+ if (text == NULL)
+ {
+ text = "Foo";
+ }
- if (text == NULL) {
- text = "Foo";
- }
-
- label = gtk_label_new (text);
+ label = gtk_label_new (text);
- return label;
+ return label;
}
-void
-test_window_set_title_with_pid (GtkWindow *window,
- const char *title)
+void
+test_window_set_title_with_pid (GtkWindow *window,
+ const char *title)
{
- char *tmp;
-
- g_return_if_fail (GTK_IS_WINDOW (window));
+ char *tmp;
- tmp = g_strdup_printf ("%lu: %s", (gulong) getpid (), title);
- gtk_window_set_title (GTK_WINDOW (window), tmp);
- g_free (tmp);
-}
+ g_return_if_fail (GTK_IS_WINDOW (window));
+ tmp = g_strdup_printf ("%lu: %s", (gulong) getpid (), title);
+ gtk_window_set_title (GTK_WINDOW (window), tmp);
+ g_free (tmp);
+}