app/widgets/Makefile.am app/widgets/widgets-types.h added new widget
2004-08-24 Sven Neumann <sven@gimp.org> * app/widgets/Makefile.am * app/widgets/widgets-types.h * app/widgets/gimpmessagebox.[ch]: added new widget GimpMessageBox. * app/widgets/gimpwidgets-utils.c: use it for message dialogs.
This commit is contained in:

committed by
Sven Neumann

parent
7894cacc3b
commit
578bd328e0
@ -1,3 +1,11 @@
|
|||||||
|
2004-08-24 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/widgets/Makefile.am
|
||||||
|
* app/widgets/widgets-types.h
|
||||||
|
* app/widgets/gimpmessagebox.[ch]: added new widget GimpMessageBox.
|
||||||
|
|
||||||
|
* app/widgets/gimpwidgets-utils.c: use it for message dialogs.
|
||||||
|
|
||||||
2004-08-23 Sven Neumann <sven@gimp.org>
|
2004-08-23 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimpfiledialog.c (gimp_file_dialog_set_image): unset
|
* app/widgets/gimpfiledialog.c (gimp_file_dialog_set_image): unset
|
||||||
|
@ -170,6 +170,8 @@ libappwidgets_a_sources = \
|
|||||||
gimplayertreeview.h \
|
gimplayertreeview.h \
|
||||||
gimpmenufactory.c \
|
gimpmenufactory.c \
|
||||||
gimpmenufactory.h \
|
gimpmenufactory.h \
|
||||||
|
gimpmessagebox.c \
|
||||||
|
gimpmessagebox.h \
|
||||||
gimpnavigationpreview.c \
|
gimpnavigationpreview.c \
|
||||||
gimpnavigationpreview.h \
|
gimpnavigationpreview.h \
|
||||||
gimppaletteeditor.c \
|
gimppaletteeditor.c \
|
||||||
|
383
app/widgets/gimpmessagebox.c
Normal file
383
app/widgets/gimpmessagebox.c
Normal file
@ -0,0 +1,383 @@
|
|||||||
|
/* The GIMP -- an image manipulation program
|
||||||
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
|
*
|
||||||
|
* gimpmessagebox.c
|
||||||
|
* Copyright (C) 2004 Sven Neumann <sven@gimp.org>
|
||||||
|
*
|
||||||
|
* 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 "config.h"
|
||||||
|
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#include "libgimpwidgets/gimpwidgets.h"
|
||||||
|
|
||||||
|
#include "widgets-types.h"
|
||||||
|
|
||||||
|
#include "gimpmessagebox.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define GIMP_MESSAGE_BOX_SPACING 12
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
PROP_TITLE,
|
||||||
|
PROP_MESSAGE,
|
||||||
|
PROP_STOCK_ID
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void gimp_message_box_class_init (GimpMessageBoxClass *klass);
|
||||||
|
|
||||||
|
static GObject * gimp_message_box_constructor (GType type,
|
||||||
|
guint n_params,
|
||||||
|
GObjectConstructParam *params);
|
||||||
|
|
||||||
|
static void gimp_message_box_init (GimpMessageBox *box);
|
||||||
|
static void gimp_message_box_finalize (GObject *object);
|
||||||
|
static void gimp_message_box_set_property (GObject *object,
|
||||||
|
guint property_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec);
|
||||||
|
static void gimp_message_box_get_property (GObject *object,
|
||||||
|
guint property_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec);
|
||||||
|
static void gimp_message_box_destroy (GtkObject *object);
|
||||||
|
|
||||||
|
static void gimp_message_box_forall (GtkContainer *container,
|
||||||
|
gboolean include_internals,
|
||||||
|
GtkCallback callback,
|
||||||
|
gpointer callback_data);
|
||||||
|
|
||||||
|
static void gimp_message_box_size_request (GtkWidget *widget,
|
||||||
|
GtkRequisition *requisition);
|
||||||
|
static void gimp_message_box_size_allocate (GtkWidget *widget,
|
||||||
|
GtkAllocation *allocation);
|
||||||
|
|
||||||
|
|
||||||
|
static GtkVBoxClass *parent_class = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
GType
|
||||||
|
gimp_message_box_get_type (void)
|
||||||
|
{
|
||||||
|
static GType box_type = 0;
|
||||||
|
|
||||||
|
if (! box_type)
|
||||||
|
{
|
||||||
|
static const GTypeInfo box_info =
|
||||||
|
{
|
||||||
|
sizeof (GimpMessageBoxClass),
|
||||||
|
(GBaseInitFunc) NULL,
|
||||||
|
(GBaseFinalizeFunc) NULL,
|
||||||
|
(GClassInitFunc) gimp_message_box_class_init,
|
||||||
|
NULL, /* class_finalize */
|
||||||
|
NULL, /* class_data */
|
||||||
|
sizeof (GimpMessageBox),
|
||||||
|
0, /* n_preallocs */
|
||||||
|
(GInstanceInitFunc) gimp_message_box_init
|
||||||
|
};
|
||||||
|
|
||||||
|
box_type = g_type_register_static (GTK_TYPE_VBOX,
|
||||||
|
"GimpMessageBox",
|
||||||
|
&box_info, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return box_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_message_box_class_init (GimpMessageBoxClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
|
||||||
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||||
|
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
|
||||||
|
|
||||||
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
|
object_class->constructor = gimp_message_box_constructor;
|
||||||
|
object_class->set_property = gimp_message_box_set_property;
|
||||||
|
object_class->get_property = gimp_message_box_get_property;
|
||||||
|
object_class->finalize = gimp_message_box_finalize;
|
||||||
|
|
||||||
|
gtk_object_class->destroy = gimp_message_box_destroy;
|
||||||
|
|
||||||
|
widget_class->size_request = gimp_message_box_size_request;
|
||||||
|
widget_class->size_allocate = gimp_message_box_size_allocate;
|
||||||
|
|
||||||
|
container_class->forall = gimp_message_box_forall;
|
||||||
|
|
||||||
|
g_object_class_install_property (object_class, PROP_TITLE,
|
||||||
|
g_param_spec_string ("title", NULL, NULL,
|
||||||
|
NULL,
|
||||||
|
G_PARAM_READWRITE |
|
||||||
|
G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
g_object_class_install_property (object_class, PROP_MESSAGE,
|
||||||
|
g_param_spec_string ("message", NULL, NULL,
|
||||||
|
NULL,
|
||||||
|
G_PARAM_READWRITE |
|
||||||
|
G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
g_object_class_install_property (object_class, PROP_STOCK_ID,
|
||||||
|
g_param_spec_string ("stock-id", NULL, NULL,
|
||||||
|
NULL,
|
||||||
|
G_PARAM_READWRITE |
|
||||||
|
G_PARAM_CONSTRUCT_ONLY));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_message_box_init (GimpMessageBox *box)
|
||||||
|
{
|
||||||
|
gtk_box_set_spacing (GTK_BOX (box), 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_message_box_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
GimpMessageBox *box = GIMP_MESSAGE_BOX (object);
|
||||||
|
|
||||||
|
if (box->title)
|
||||||
|
{
|
||||||
|
g_free (box->title);
|
||||||
|
box->title = NULL;
|
||||||
|
}
|
||||||
|
if (box->message)
|
||||||
|
{
|
||||||
|
g_free (box->message);
|
||||||
|
box->message = NULL;
|
||||||
|
}
|
||||||
|
if (box->stock_id)
|
||||||
|
{
|
||||||
|
g_free (box->stock_id);
|
||||||
|
box->stock_id = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static GObject *
|
||||||
|
gimp_message_box_constructor (GType type,
|
||||||
|
guint n_params,
|
||||||
|
GObjectConstructParam *params)
|
||||||
|
{
|
||||||
|
GObject *object;
|
||||||
|
GimpMessageBox *box;
|
||||||
|
|
||||||
|
object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
|
||||||
|
|
||||||
|
box = GIMP_MESSAGE_BOX (object);
|
||||||
|
|
||||||
|
if (box->title)
|
||||||
|
{
|
||||||
|
GtkWidget *label = gtk_label_new (box->title);
|
||||||
|
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||||
|
gimp_label_set_attributes (GTK_LABEL (label),
|
||||||
|
PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
|
||||||
|
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show (label);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (box->message)
|
||||||
|
{
|
||||||
|
GtkWidget *label = gtk_label_new (box->message);
|
||||||
|
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||||
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||||
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
||||||
|
|
||||||
|
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
|
||||||
|
gtk_widget_show (label);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (box->stock_id)
|
||||||
|
{
|
||||||
|
gtk_widget_push_composite_child ();
|
||||||
|
box->image = gtk_image_new_from_stock (box->stock_id,
|
||||||
|
GTK_ICON_SIZE_DIALOG);
|
||||||
|
gtk_widget_pop_composite_child ();
|
||||||
|
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (box->image), 0.5, 0.0);
|
||||||
|
gtk_widget_set_parent (box->image, GTK_WIDGET (box));
|
||||||
|
gtk_widget_show (box->image);
|
||||||
|
}
|
||||||
|
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_message_box_set_property (GObject *object,
|
||||||
|
guint property_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GimpMessageBox *box = GIMP_MESSAGE_BOX (object);
|
||||||
|
|
||||||
|
switch (property_id)
|
||||||
|
{
|
||||||
|
case PROP_TITLE:
|
||||||
|
box->title = g_value_dup_string (value);
|
||||||
|
break;
|
||||||
|
case PROP_MESSAGE:
|
||||||
|
box->message = g_value_dup_string (value);
|
||||||
|
break;
|
||||||
|
case PROP_STOCK_ID:
|
||||||
|
box->stock_id = g_value_dup_string (value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_message_box_get_property (GObject *object,
|
||||||
|
guint property_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
GimpMessageBox *box = GIMP_MESSAGE_BOX (object);
|
||||||
|
|
||||||
|
switch (property_id)
|
||||||
|
{
|
||||||
|
case PROP_TITLE:
|
||||||
|
g_value_set_string (value, box->title);
|
||||||
|
break;
|
||||||
|
case PROP_MESSAGE:
|
||||||
|
g_value_set_string (value, box->message);
|
||||||
|
break;
|
||||||
|
case PROP_STOCK_ID:
|
||||||
|
g_value_set_string (value, box->stock_id);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_message_box_destroy (GtkObject *object)
|
||||||
|
{
|
||||||
|
GimpMessageBox *box = GIMP_MESSAGE_BOX (object);
|
||||||
|
|
||||||
|
if (box->image)
|
||||||
|
{
|
||||||
|
gtk_widget_unparent (box->image);
|
||||||
|
box->image = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_message_box_size_request (GtkWidget *widget,
|
||||||
|
GtkRequisition *requisition)
|
||||||
|
{
|
||||||
|
GimpMessageBox *box = GIMP_MESSAGE_BOX (widget);
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
|
||||||
|
|
||||||
|
if (box->image && GTK_WIDGET_VISIBLE (box->image))
|
||||||
|
{
|
||||||
|
GtkRequisition child_requisition;
|
||||||
|
|
||||||
|
gtk_widget_size_request (box->image, &child_requisition);
|
||||||
|
|
||||||
|
requisition->width += child_requisition.width + GIMP_MESSAGE_BOX_SPACING;
|
||||||
|
requisition->height = MAX (requisition->height,
|
||||||
|
child_requisition.height +
|
||||||
|
2 * GTK_CONTAINER (widget)->border_width);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_message_box_size_allocate (GtkWidget *widget,
|
||||||
|
GtkAllocation *allocation)
|
||||||
|
{
|
||||||
|
GimpMessageBox *box = GIMP_MESSAGE_BOX (widget);
|
||||||
|
GtkContainer *container = GTK_CONTAINER (widget);
|
||||||
|
gint width = 0;
|
||||||
|
|
||||||
|
if (box->image)
|
||||||
|
{
|
||||||
|
GtkRequisition child_requisition;
|
||||||
|
GtkAllocation child_allocation;
|
||||||
|
gint height;
|
||||||
|
|
||||||
|
gtk_widget_size_request (box->image, &child_requisition);
|
||||||
|
|
||||||
|
width = MIN (allocation->width - 2 * container->border_width,
|
||||||
|
child_requisition.width);
|
||||||
|
width = MAX (1, width);
|
||||||
|
|
||||||
|
height = allocation->height - 2 * container->border_width;
|
||||||
|
height = MAX (1, height);
|
||||||
|
|
||||||
|
child_allocation.x = allocation->x + container->border_width;
|
||||||
|
child_allocation.y = allocation->y + container->border_width;
|
||||||
|
child_allocation.width = width;
|
||||||
|
child_allocation.height = height;
|
||||||
|
|
||||||
|
gtk_widget_size_allocate (box->image, &child_allocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
allocation->x += width;
|
||||||
|
allocation->width -= width;
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
||||||
|
|
||||||
|
allocation->x -= width;
|
||||||
|
allocation->width += width;
|
||||||
|
|
||||||
|
widget->allocation = *allocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_message_box_forall (GtkContainer *container,
|
||||||
|
gboolean include_internals,
|
||||||
|
GtkCallback callback,
|
||||||
|
gpointer callback_data)
|
||||||
|
{
|
||||||
|
if (include_internals)
|
||||||
|
{
|
||||||
|
GimpMessageBox *box = GIMP_MESSAGE_BOX (container);
|
||||||
|
|
||||||
|
if (box->image)
|
||||||
|
(* callback) (box->image, callback_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
GTK_CONTAINER_CLASS (parent_class)->forall (container, include_internals,
|
||||||
|
callback, callback_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* public functions */
|
||||||
|
|
||||||
|
GtkWidget *
|
||||||
|
gimp_message_box_new (const gchar *title,
|
||||||
|
const gchar *message,
|
||||||
|
const gchar *stock_id)
|
||||||
|
{
|
||||||
|
return g_object_new (GIMP_TYPE_MESSAGE_BOX,
|
||||||
|
"title", title,
|
||||||
|
"message", message,
|
||||||
|
"stock_id", stock_id,
|
||||||
|
NULL);
|
||||||
|
}
|
64
app/widgets/gimpmessagebox.h
Normal file
64
app/widgets/gimpmessagebox.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
/* The GIMP -- an image manipulation program
|
||||||
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||||
|
*
|
||||||
|
* gimpmessagebox.h
|
||||||
|
* Copyright (C) 2004 Sven Neumann <sven@gimp.org>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GIMP_MESSAGE_BOX_H__
|
||||||
|
#define __GIMP_MESSAGE_BOX_H__
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
||||||
|
#define GIMP_TYPE_MESSAGE_BOX (gimp_message_box_get_type ())
|
||||||
|
#define GIMP_MESSAGE_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_MESSAGE_BOX, GimpMessageBox))
|
||||||
|
#define GIMP_MESSAGE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_MESSAGE_BOX, GimpMessageBoxClass))
|
||||||
|
#define GIMP_IS_MESSAGE_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_MESSAGE_BOX))
|
||||||
|
#define GIMP_IS_MESSAGE_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MESSAGE_BOX))
|
||||||
|
#define GIMP_MESSAGE_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MESSAGE_BOX, GimpMessageBoxClass))
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _GimpMessageBoxClass GimpMessageBoxClass;
|
||||||
|
|
||||||
|
struct _GimpMessageBox
|
||||||
|
{
|
||||||
|
GtkVBox parent_instance;
|
||||||
|
|
||||||
|
gchar *title;
|
||||||
|
gchar *message;
|
||||||
|
gchar *stock_id;
|
||||||
|
|
||||||
|
GtkWidget *image;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _GimpMessageBoxClass
|
||||||
|
{
|
||||||
|
GtkVBoxClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
GType gimp_message_box_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
GtkWidget * gimp_message_box_new (const gchar *title,
|
||||||
|
const gchar *message,
|
||||||
|
const gchar *stock_id);
|
||||||
|
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __GIMP_MESSAGE_BOX_H__ */
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "widgets-types.h"
|
#include "widgets-types.h"
|
||||||
|
|
||||||
|
#include "gimpmessagebox.h"
|
||||||
#include "gimpwidgets-utils.h"
|
#include "gimpwidgets-utils.h"
|
||||||
|
|
||||||
#include "gimp-intl.h"
|
#include "gimp-intl.h"
|
||||||
@ -45,7 +46,7 @@ typedef struct _MessageBox MessageBox;
|
|||||||
struct _MessageBox
|
struct _MessageBox
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *vbox;
|
GtkWidget *box;
|
||||||
GtkWidget *repeat_label;
|
GtkWidget *repeat_label;
|
||||||
gchar *domain;
|
gchar *domain;
|
||||||
gchar *message;
|
gchar *message;
|
||||||
@ -77,12 +78,9 @@ gimp_message_box (const gchar *stock_id,
|
|||||||
{
|
{
|
||||||
MessageBox *msg_box;
|
MessageBox *msg_box;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *hbox;
|
GtkWidget *box;
|
||||||
GtkWidget *vbox;
|
|
||||||
GtkWidget *image;
|
|
||||||
GtkWidget *label;
|
|
||||||
GList *list;
|
GList *list;
|
||||||
gchar *str;
|
gchar *title;
|
||||||
|
|
||||||
g_return_if_fail (stock_id != NULL);
|
g_return_if_fail (stock_id != NULL);
|
||||||
g_return_if_fail (message != NULL);
|
g_return_if_fail (message != NULL);
|
||||||
@ -121,8 +119,7 @@ gimp_message_box (const gchar *stock_id,
|
|||||||
gimp_label_set_attributes (GTK_LABEL (label),
|
gimp_label_set_attributes (GTK_LABEL (label),
|
||||||
PANGO_ATTR_STYLE, PANGO_STYLE_OBLIQUE,
|
PANGO_ATTR_STYLE, PANGO_STYLE_OBLIQUE,
|
||||||
-1);
|
-1);
|
||||||
gtk_box_pack_end (GTK_BOX (msg_box->vbox), label,
|
gtk_box_pack_end (GTK_BOX (msg_box->box), label, FALSE, FALSE, 0);
|
||||||
FALSE, FALSE, 0);
|
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
msg_box->repeat_label = label;
|
msg_box->repeat_label = label;
|
||||||
@ -159,41 +156,18 @@ gimp_message_box (const gchar *stock_id,
|
|||||||
G_CALLBACK (gimp_message_box_response),
|
G_CALLBACK (gimp_message_box_response),
|
||||||
msg_box);
|
msg_box);
|
||||||
|
|
||||||
hbox = gtk_hbox_new (FALSE, 12);
|
title = g_strdup_printf (_("%s Message"), domain);
|
||||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
|
|
||||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
|
|
||||||
gtk_widget_show (hbox);
|
|
||||||
|
|
||||||
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_DIALOG);
|
box = gimp_message_box_new (title, message, stock_id);
|
||||||
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
|
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
|
|
||||||
gtk_widget_show (image);
|
|
||||||
|
|
||||||
vbox = gtk_vbox_new (FALSE, 12);
|
g_free (title);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
||||||
gtk_widget_show (vbox);
|
|
||||||
|
|
||||||
str = g_strdup_printf (_("%s Message"), domain);
|
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
|
||||||
label = gtk_label_new (str);
|
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), box);
|
||||||
g_free (str);
|
gtk_widget_show (box);
|
||||||
|
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
||||||
gimp_label_set_attributes (GTK_LABEL (label),
|
|
||||||
PANGO_ATTR_SCALE, PANGO_SCALE_LARGE,
|
|
||||||
PANGO_ATTR_WEIGHT, PANGO_WEIGHT_BOLD,
|
|
||||||
-1);
|
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
|
||||||
gtk_widget_show (label);
|
|
||||||
|
|
||||||
label = gtk_label_new (message);
|
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
|
||||||
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
|
||||||
gtk_widget_show (label);
|
|
||||||
|
|
||||||
msg_box->dialog = dialog;
|
msg_box->dialog = dialog;
|
||||||
msg_box->vbox = vbox;
|
msg_box->box = box;
|
||||||
msg_box->domain = g_strdup (domain);
|
msg_box->domain = g_strdup (domain);
|
||||||
msg_box->message = g_strdup (message);
|
msg_box->message = g_strdup (message);
|
||||||
msg_box->callback = callback;
|
msg_box->callback = callback;
|
||||||
|
@ -154,6 +154,7 @@ typedef struct _GimpFileProcView GimpFileProcView;
|
|||||||
typedef struct _GimpGridEditor GimpGridEditor;
|
typedef struct _GimpGridEditor GimpGridEditor;
|
||||||
typedef struct _GimpHistogramBox GimpHistogramBox;
|
typedef struct _GimpHistogramBox GimpHistogramBox;
|
||||||
typedef struct _GimpHistogramView GimpHistogramView;
|
typedef struct _GimpHistogramView GimpHistogramView;
|
||||||
|
typedef struct _GimpMessageBox GimpMessageBox;
|
||||||
typedef struct _GimpProgressBox GimpProgressBox;
|
typedef struct _GimpProgressBox GimpProgressBox;
|
||||||
typedef struct _GimpStrokeEditor GimpStrokeEditor;
|
typedef struct _GimpStrokeEditor GimpStrokeEditor;
|
||||||
typedef struct _GimpTemplateEditor GimpTemplateEditor;
|
typedef struct _GimpTemplateEditor GimpTemplateEditor;
|
||||||
|
Reference in New Issue
Block a user