changeset 4164:2a6d9dd09ec1

More prettying.
author William Pitcock <nenolod@atheme.org>
date Thu, 10 Jan 2008 05:44:38 -0600
parents a12876b41f01
children d4b13079f476
files src/audacious/ui_fileinfo.c
diffstat 1 files changed, 58 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_fileinfo.c	Thu Jan 10 05:30:59 2008 -0600
+++ b/src/audacious/ui_fileinfo.c	Thu Jan 10 05:44:38 2008 -0600
@@ -220,41 +220,42 @@
 static void
 fileinfo_entry_set_image(GtkWidget *widget, const char *text)
 {
-        GdkPixbuf *pixbuf;
-        int width, height;
-        double aspect;
-        GdkPixbuf *pixbuf2;
-
-        if (widget == NULL)
-                return;
+    GdkPixbuf *pixbuf;
+    int width, height;
+    double aspect;
+    GdkPixbuf *pixbuf2;
 
-        pixbuf = gdk_pixbuf_new_from_file(text, NULL);
+    if (widget == NULL)
+        return;
 
-        if (pixbuf == NULL)
-                return;
+    pixbuf = gdk_pixbuf_new_from_file(text, NULL);
 
-        width  = gdk_pixbuf_get_width(GDK_PIXBUF(pixbuf));
-        height = gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf));
+    if (pixbuf == NULL)
+        return;
 
-        if(strcmp(DATA_DIR "/images/audio.png", text))
-        {
-                if(width == 0)
-                        width = 1;
-                aspect = (double)height / (double)width;
-                if(aspect > 1.0) {
-                        height = (int)(cfg.filepopup_pixelsize * aspect);
-                        width = cfg.filepopup_pixelsize;
-                } else {
-                        height = cfg.filepopup_pixelsize;
-                        width = (int)(cfg.filepopup_pixelsize / aspect);
-                }
-                pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), width, height, GDK_INTERP_BILINEAR);
-                g_object_unref(G_OBJECT(pixbuf));
-                pixbuf = pixbuf2;
+    width  = gdk_pixbuf_get_width(GDK_PIXBUF(pixbuf));
+    height = gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf));
+
+    if (strcmp(DATA_DIR "/images/audio.png", text)) {
+        if (width == 0)
+            width = 1;
+        aspect = (double)height / (double)width;
+
+        if (aspect > 1.0) {
+            height = (int)(cfg.filepopup_pixelsize * aspect);
+            width = cfg.filepopup_pixelsize;
+        } else {
+            height = cfg.filepopup_pixelsize;
+            width = (int)(cfg.filepopup_pixelsize / aspect);
         }
 
-        gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf));
+        pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), width, height, GDK_INTERP_BILINEAR);
         g_object_unref(G_OBJECT(pixbuf));
+        pixbuf = pixbuf2;
+    }
+
+    gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf));
+    g_object_unref(G_OBJECT(pixbuf));
 }
 
 void fileinfo_hide(gpointer unused)
@@ -334,39 +335,37 @@
 static void
 fileinfo_update_tuple(gpointer data)
 {
-        Tuple *tuple;
-        VFSFile *fd;
-        if(current_file != NULL && current_ip != NULL && current_ip->update_song_tuple != NULL && something_changed) {
+    Tuple *tuple;
+    VFSFile *fd;
 
-            tuple = tuple_new();
-            fd = vfs_fopen(current_file, "r+b");
+    if (current_file != NULL && current_ip != NULL && current_ip->update_song_tuple != NULL && something_changed) {
+        tuple = tuple_new();
+        fd = vfs_fopen(current_file, "r+b");
 
-            if (fd != NULL) {
-                set_field_str_from_entry(tuple, FIELD_TITLE, entry_title);
-                set_field_str_from_entry(tuple, FIELD_ARTIST, entry_artist);
-                set_field_str_from_entry(tuple, FIELD_ALBUM, entry_album);
-                set_field_str_from_entry(tuple, FIELD_COMMENT, entry_comment);
-                set_field_str_from_entry(tuple, FIELD_GENRE, gtk_bin_get_child(GTK_BIN(entry_genre)));
+        if (fd != NULL) {
+            set_field_str_from_entry(tuple, FIELD_TITLE, entry_title);
+            set_field_str_from_entry(tuple, FIELD_ARTIST, entry_artist);
+            set_field_str_from_entry(tuple, FIELD_ALBUM, entry_album);
+            set_field_str_from_entry(tuple, FIELD_COMMENT, entry_comment);
+            set_field_str_from_entry(tuple, FIELD_GENRE, gtk_bin_get_child(GTK_BIN(entry_genre)));
 
-                set_field_int_from_entry(tuple, FIELD_YEAR, entry_year);
-                set_field_int_from_entry(tuple, FIELD_TRACK_NUMBER, entry_track);
+            set_field_int_from_entry(tuple, FIELD_YEAR, entry_year);
+            set_field_int_from_entry(tuple, FIELD_TRACK_NUMBER, entry_track);
                 
-                if(current_ip->update_song_tuple(tuple, fd)) {
-                    message_update_successfull();
-                    something_changed = FALSE;
-                    gtk_widget_set_sensitive(btn_apply, FALSE);
-                } else {
-                    message_update_failed();
-                }
+            if (current_ip->update_song_tuple(tuple, fd)) {
+                message_update_successfull();
+                something_changed = FALSE;
+                gtk_widget_set_sensitive(btn_apply, FALSE);
+            } else
+                message_update_failed();
 
-                vfs_fclose(fd);
+            vfs_fclose(fd);
 
-            } else {
-                message_update_failed();
-            }
+        } else
+            message_update_failed();
 
-            mowgli_object_unref(tuple);
-        }
+        mowgli_object_unref(tuple);
+    }
 }
 
 /**
@@ -387,9 +386,12 @@
 
     icon_theme = gtk_icon_theme_get_default ();
     pixbuf = gtk_icon_theme_load_icon (icon_theme, name, size, 0, &error);
-    if(pixbuf) return pixbuf;
+
+    if (pixbuf != NULL)
+        return pixbuf;
     
-    if(error != NULL) g_error_free(error);
+    if (error != NULL)
+        g_error_free(error);
 
     /* fallback */
     va_start(par, name);