1
/* GIMP - The GNU Image Manipulation Program
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
* image-properties-dialog.c
5
* Copyright (C) 2005 Michael Natterer <mitch@gimp.org>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
#include "libgimpbase/gimpbase.h"
27
#include "libgimpwidgets/gimpwidgets.h"
29
#include "dialogs-types.h"
31
#include "core/gimpcontext.h"
32
#include "core/gimpimage.h"
34
#include "widgets/gimphelp-ids.h"
35
#include "widgets/gimpimagepropview.h"
36
#include "widgets/gimpimageprofileview.h"
37
#include "widgets/gimpviewabledialog.h"
39
#include "image-properties-dialog.h"
41
#include "gimp-intl.h"
44
static void image_comment_update (GtkWidget *page,
48
/* public functions */
51
image_properties_dialog_new (GimpImage *image,
60
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
61
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
62
g_return_val_if_fail (parent == NULL || GTK_IS_WIDGET (parent), NULL);
64
dialog = gimp_viewable_dialog_new (GIMP_VIEWABLE (image), context,
65
_("Image Properties"),
66
"gimp-image-properties",
68
_("Image Properties"),
70
gimp_standard_help_func,
71
GIMP_HELP_IMAGE_PROPERTIES,
73
GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
77
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
79
g_signal_connect (dialog, "response",
80
G_CALLBACK (gtk_widget_destroy),
83
notebook = gtk_notebook_new ();
84
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook,
86
gtk_widget_show (notebook);
88
view = gimp_image_prop_view_new (image);
89
gtk_container_set_border_width (GTK_CONTAINER (view), 12);
90
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
91
view, gtk_label_new (_("Properties")));
92
gtk_widget_show (view);
94
view = gimp_image_profile_view_new (image);
95
gtk_container_set_border_width (GTK_CONTAINER (view), 12);
96
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
97
view, gtk_label_new (_("Color Profile")));
98
gtk_widget_show (view);
100
view = gimp_image_parasite_view_new (image, "gimp-comment");
101
gtk_container_set_border_width (GTK_CONTAINER (view), 12);
102
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
103
view, gtk_label_new (_("Comment")));
105
label = g_object_new (GTK_TYPE_LABEL,
107
"justify", GTK_JUSTIFY_LEFT,
112
gtk_container_add (GTK_CONTAINER (view), label);
113
gtk_widget_show (label);
115
g_signal_connect (view, "update",
116
G_CALLBACK (image_comment_update),
119
image_comment_update (view, label);
125
image_comment_update (GtkWidget *page,
128
GimpImageParasiteView *view = GIMP_IMAGE_PARASITE_VIEW (page);
129
const GimpParasite *parasite;
131
parasite = gimp_image_parasite_view_get_parasite (view);
135
gchar *text = g_strndup (gimp_parasite_data (parasite),
136
gimp_parasite_data_size (parasite));
138
if (! g_utf8_validate (text, -1, NULL))
140
gchar *tmp = gimp_any_to_utf8 (text, -1, NULL);
146
gtk_label_set_text (GTK_LABEL (label), text);
149
gtk_widget_show (page);
153
gtk_widget_hide (page);
154
gtk_label_set_text (GTK_LABEL (label), NULL);