cropper

diff support.c @ 11:c18ba4ea1514

just cosmetic changes
author meillo@marmaro.de
date Thu, 04 Mar 2010 14:18:19 +0100
parents 5e282003f0c1
children
line diff
     1.1 --- a/support.c	Thu Mar 04 13:54:17 2010 +0100
     1.2 +++ b/support.c	Thu Mar 04 14:18:19 2010 +0100
     1.3 @@ -3,24 +3,26 @@
     1.4  #include <unistd.h>
     1.5  #include <string.h>
     1.6  #include <stdio.h>
     1.7 -
     1.8  #include <gtk/gtk.h>
     1.9 -
    1.10  #include "support.h"
    1.11  
    1.12 +static GList *pixmaps_directories = NULL;
    1.13  
    1.14 -GtkWidget* lookup_widget(GtkWidget* widget, const gchar* widget_name) {
    1.15 +
    1.16 +GtkWidget*
    1.17 +lookup_widget(GtkWidget* widget, const gchar* widget_name)
    1.18 +{
    1.19  	GtkWidget* parent;
    1.20  	GtkWidget* found_widget;
    1.21  
    1.22  	for (;;) {
    1.23 -		if (GTK_IS_MENU (widget)) {
    1.24 -			parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
    1.25 +		if (GTK_IS_MENU(widget)) {
    1.26 +			parent = gtk_menu_get_attach_widget(GTK_MENU(widget));
    1.27  		} else {
    1.28  			parent = widget->parent;
    1.29  		}
    1.30  		if (!parent) {
    1.31 -			parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
    1.32 +			parent = (GtkWidget*) g_object_get_data(G_OBJECT(widget), "GladeParentKey");
    1.33  		}
    1.34  		if (parent == NULL) {
    1.35  			break;
    1.36 @@ -28,33 +30,36 @@
    1.37  		widget = parent;
    1.38  	}
    1.39  
    1.40 -	found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), widget_name);
    1.41 +	found_widget = (GtkWidget*) g_object_get_data(G_OBJECT(widget), widget_name);
    1.42  	if (!found_widget) {
    1.43 -		g_warning ("Widget not found: %s", widget_name);
    1.44 +		g_warning("Widget not found: %s", widget_name);
    1.45  	}
    1.46  	return found_widget;
    1.47  }
    1.48  
    1.49  
    1.50 -static GList *pixmaps_directories = NULL;
    1.51 -
    1.52  /* Use this function to set the directory containing installed pixmaps. */
    1.53 -void add_pixmap_directory(const gchar* directory) {
    1.54 -	pixmaps_directories = g_list_prepend (pixmaps_directories, g_strdup (directory));
    1.55 +void
    1.56 +add_pixmap_directory(const gchar* directory)
    1.57 +{
    1.58 +	pixmaps_directories = g_list_prepend(pixmaps_directories, g_strdup(directory));
    1.59  }
    1.60  
    1.61 +
    1.62  /* This is an internally used function to find pixmap files. */
    1.63 -static gchar* find_pixmap_file(const gchar* filename) {
    1.64 +static gchar*
    1.65 +find_pixmap_file(const gchar* filename)
    1.66 +{
    1.67  	GList* elem;
    1.68  
    1.69  	/* We step through each of the pixmaps directory to find it. */
    1.70  	elem = pixmaps_directories;
    1.71  	while (elem) {
    1.72 -		gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data, G_DIR_SEPARATOR_S, filename);
    1.73 -		if (g_file_test (pathname, G_FILE_TEST_EXISTS)) {
    1.74 +		gchar *pathname = g_strdup_printf("%s%s%s", (gchar*)elem->data, G_DIR_SEPARATOR_S, filename);
    1.75 +		if (g_file_test(pathname, G_FILE_TEST_EXISTS)) {
    1.76  			return pathname;
    1.77  		}
    1.78 -		g_free (pathname);
    1.79 +		g_free(pathname);
    1.80  		elem = elem->next;
    1.81  	}
    1.82  	return NULL;
    1.83 @@ -62,29 +67,33 @@
    1.84  
    1.85  
    1.86  /* This is an internally used function to create pixmaps. */
    1.87 -GtkWidget* create_pixmap(GtkWidget* widget, const gchar* filename) {
    1.88 +GtkWidget*
    1.89 +create_pixmap(GtkWidget* widget, const gchar* filename)
    1.90 +{
    1.91  	gchar* pathname = NULL;
    1.92  	GtkWidget* pixmap;
    1.93  
    1.94  	if (!filename || !filename[0]) {
    1.95 -		return gtk_image_new ();
    1.96 +		return gtk_image_new();
    1.97  	}
    1.98  
    1.99 -	pathname = find_pixmap_file (filename);
   1.100 +	pathname = find_pixmap_file(filename);
   1.101  
   1.102  	if (!pathname) {
   1.103 -		g_warning ("Couldn't find pixmap file: %s", filename);
   1.104 -		return gtk_image_new ();
   1.105 +		g_warning("Couldn't find pixmap file: %s", filename);
   1.106 +		return gtk_image_new();
   1.107  	}
   1.108  
   1.109 -	pixmap = gtk_image_new_from_file (pathname);
   1.110 +	pixmap = gtk_image_new_from_file(pathname);
   1.111  	g_free(pathname);
   1.112  	return pixmap;
   1.113  }
   1.114  
   1.115  
   1.116  /* This is an internally used function to create pixmaps. */
   1.117 -GdkPixbuf* create_pixbuf(const gchar* filename) {
   1.118 +GdkPixbuf*
   1.119 +create_pixbuf(const gchar* filename)
   1.120 +{
   1.121  	gchar* pathname = NULL;
   1.122  	GdkPixbuf* pixbuf;
   1.123  	GError* error = NULL;
   1.124 @@ -96,11 +105,11 @@
   1.125  	pathname = find_pixmap_file(filename);
   1.126  
   1.127  	if (!pathname) {
   1.128 -		g_warning ("Couldn't find pixmap file: %s", filename);
   1.129 +		g_warning("Couldn't find pixmap file: %s", filename);
   1.130  		return NULL;
   1.131  	}
   1.132  
   1.133 -	pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
   1.134 +	pixbuf = gdk_pixbuf_new_from_file(pathname, &error);
   1.135  	if (!pixbuf) {
   1.136  		fprintf(stderr, "Failed to load pixbuf file: %s: %s\n", pathname, error->message);
   1.137  		g_error_free(error);
   1.138 @@ -111,15 +120,16 @@
   1.139  
   1.140  
   1.141  /* This is used to set ATK action descriptions. */
   1.142 -void glade_set_atk_action_description(AtkAction* action, const gchar* action_name, const gchar* description) {
   1.143 +void
   1.144 +glade_set_atk_action_description(AtkAction* action, const gchar* action_name, const gchar* description)
   1.145 +{
   1.146  	gint n_actions;
   1.147  	gint i;
   1.148  
   1.149 -	n_actions = atk_action_get_n_actions (action);
   1.150 +	n_actions = atk_action_get_n_actions(action);
   1.151  	for (i = 0; i < n_actions; i++) {
   1.152 -		if (!strcmp (atk_action_get_name (action, i), action_name)) {
   1.153 -			atk_action_set_description (action, i, description);
   1.154 +		if (!strcmp(atk_action_get_name(action, i), action_name)) {
   1.155 +			atk_action_set_description(action, i, description);
   1.156  		}
   1.157  	}
   1.158  }
   1.159 -