cropper

diff support.c @ 10:5e282003f0c1

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