allow to configure the ellipsize property of the text renderer.

2006-08-09  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpcontainercombobox.[ch]: allow to configure the
	ellipsize property of the text renderer.

	* app/dialogs/image-new-dialog.c: don't pack the template
combo-box
	expanding, unset the ellipsize property.
This commit is contained in:
Sven Neumann 2006-08-08 22:15:46 +00:00 committed by Sven Neumann
parent 48d054e8d4
commit fa7427487f
4 changed files with 83 additions and 9 deletions

View File

@ -1,3 +1,11 @@
2006-08-09 Sven Neumann <sven@gimp.org>
* app/widgets/gimpcontainercombobox.[ch]: allow to configure the
ellipsize property of the text renderer.
* app/dialogs/image-new-dialog.c: don't pack the template combo-box
expanding, unset the ellipsize property.
2006-08-08 Sven Neumann <sven@gimp.org>
* app/core/gimp.[ch]: added new function gimp_message() as a

View File

@ -134,12 +134,13 @@ image_new_dialog_new (Gimp *gimp)
"container", gimp->templates,
"view-size", 16,
"view-border-width", 0,
"ellipsize", PANGO_ELLIPSIZE_NONE,
"focus-on-click", FALSE,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("_Template:"), 0.0, 0.5,
dialog->combo, 1, FALSE);
dialog->combo, 1, TRUE);
g_signal_connect (dialog->combo, "select-item",
G_CALLBACK (image_new_template_select),

View File

@ -37,6 +37,12 @@
#include "gimpviewrenderer.h"
enum
{
PROP_0,
PROP_ELLIPSIZE = GIMP_CONTAINER_VIEW_PROP_LAST + 1
};
enum
{
COLUMN_RENDERER,
@ -44,9 +50,17 @@ enum
NUM_COLUMNS
};
static void gimp_container_combo_box_view_iface_init (GimpContainerViewInterface *iface);
static void gimp_container_combo_box_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_container_combo_box_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_container_combo_box_unrealize (GtkWidget *widget);
static gpointer gimp_container_combo_box_insert_item (GimpContainerView *view,
@ -90,12 +104,20 @@ gimp_container_combo_box_class_init (GimpContainerComboBoxClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->set_property = gimp_container_view_set_property;
object_class->get_property = gimp_container_view_get_property;
object_class->set_property = gimp_container_combo_box_set_property;
object_class->get_property = gimp_container_combo_box_get_property;
widget_class->unrealize = gimp_container_combo_box_unrealize;
gimp_container_view_install_properties (object_class);
g_object_class_install_property (object_class,
PROP_ELLIPSIZE,
g_param_spec_enum ("ellipsize", NULL, NULL,
PANGO_TYPE_ELLIPSIZE_MODE,
PANGO_ELLIPSIZE_MIDDLE,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
}
static void
@ -123,14 +145,14 @@ gimp_container_combo_box_init (GimpContainerComboBox *combo_box)
combo_box->viewable_renderer = cell;
cell = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT,
"ellipsize", PANGO_ELLIPSIZE_MIDDLE,
NULL);
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (layout, cell, TRUE);
gtk_cell_layout_set_attributes (layout, cell,
"text", COLUMN_NAME,
NULL);
combo_box->text_renderer = cell;
g_signal_connect (combo_box, "changed",
G_CALLBACK (gimp_container_combo_box_changed),
combo_box);
@ -156,6 +178,48 @@ gimp_container_combo_box_view_iface_init (GimpContainerViewInterface *iface)
iface->insert_data_free = (GDestroyNotify) g_free;
}
static void
gimp_container_combo_box_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpContainerComboBox *combo = GIMP_CONTAINER_COMBO_BOX (object);
switch (property_id)
{
case PROP_ELLIPSIZE:
g_object_set_property (G_OBJECT (combo->text_renderer),
pspec->name, value);
break;
default:
gimp_container_view_set_property (object, property_id, value, pspec);
break;
}
}
static void
gimp_container_combo_box_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpContainerComboBox *combo = GIMP_CONTAINER_COMBO_BOX (object);
switch (property_id)
{
case PROP_ELLIPSIZE:
g_object_get_property (G_OBJECT (combo->text_renderer),
pspec->name, value);
break;
default:
gimp_container_view_get_property (object, property_id, value, pspec);
break;
}
}
GtkWidget *
gimp_container_combo_box_new (GimpContainer *container,
GimpContext *context,

View File

@ -38,9 +38,10 @@ typedef struct _GimpContainerComboBoxClass GimpContainerComboBoxClass;
struct _GimpContainerComboBox
{
GtkComboBox parent_instance;
GtkComboBox parent_instance;
GtkCellRenderer *viewable_renderer;
GtkCellRenderer *text_renderer;
GtkCellRenderer *viewable_renderer;
};
struct _GimpContainerComboBoxClass