/* Copyright (C) 1999 Southern Gold Development * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gview.h" void killInfo(GtkWidget *widget, gpointer data) { ren *infoD; infoD = (ren *) data; infoD->view = NULL; g_free(infoD); } void closeInfo(GtkWidget *widget, gpointer data) { gtk_widget_destroy(GTK_WIDGET (((ren *)data)->rsp)); } void refreshInfo(GtkWidget *widget, gpointer data) { } void loadInfo(sgview *view, const gchar *fname) { GtkWidget *win, *fix, *lbl, *hbox; gchar *title; ren *infoD; GdkImlibImage *img; struct stat buff; gint err; infoD = g_malloc(sizeof(ren) * 1); infoD->view = view; win = gtk_window_new(GTK_WINDOW_TOPLEVEL); infoD->rsp = win; gtk_window_set_title(GTK_WINDOW (win), _("Image Details")); gtk_widget_set_usize(GTK_WIDGET (win), 245, 115); gtk_window_set_policy(GTK_WINDOW (win), FALSE, FALSE, FALSE); gtk_signal_connect(GTK_OBJECT (win), "destroy", (GtkSignalFunc) killInfo, (gpointer) infoD); gtk_container_border_width(GTK_CONTAINER (win), 5); fix = gtk_fixed_new(); gtk_container_add(GTK_CONTAINER (win), fix); lbl = gtk_label_new("Specs:"); gtk_fixed_put(GTK_FIXED (fix), lbl, 0, 1); gtk_widget_show(lbl); lbl = gtk_label_new(""); infoD->ent = lbl; gtk_widget_set_usize(GTK_WIDGET (lbl), 195, 65); gtk_label_set_justify(GTK_LABEL(lbl), GTK_JUSTIFY_LEFT); gtk_fixed_put(GTK_FIXED (fix), lbl, 40, 0); gtk_widget_show(lbl); hbox = gtk_hbox_new(TRUE, 10); gtk_widget_set_usize(GTK_WIDGET (hbox), 235, 25); gtk_fixed_put(GTK_FIXED (fix), hbox, 0, 75); gAddButtonBox(view, (gpointer) infoD, GTK_BOX (hbox), _("Refresh"), _("Refresh Image Information"), (GtkSignalFunc) refreshInfo); gAddButtonBox(view, (gpointer) infoD, GTK_BOX (hbox), _("Close"), _("Close Information Window"), (GtkSignalFunc) closeInfo); gtk_widget_show(hbox); gtk_widget_show(fix); gtk_widget_show(win); img = gdk_imlib_load_image((gchar *) fname); if (img) { err = stat(fname, &buff); title = g_strdup_printf(_("Filename: %s\nDate: %sSize: %d\nDimensions: %dx%d"), (rindex(fname, '/') + 1), ctime(&(buff.st_mtime)), (int) buff.st_size, img->rgb_width, img->rgb_height); } else { title = g_strdup(_("Error Loading Image")); } gdk_imlib_kill_image(img); gtk_label_set_text(GTK_LABEL (infoD->ent), title); g_free(title); }