Commit b8cf0e43 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

make "preview-size" and "preview-border-width" construct properties. Fixes

2005-03-18  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpcontainerview.c: make "preview-size" and
	"preview-border-width" construct properties. Fixes creation
	using g_object_new().

	* app/widgets/gimpcontainerentry.c
	* app/widgets/gimpcontainertreeview.c
	* app/widgets/gimplayertreeview.c (set_preview_size): handle
	unset model and/or view gracefully.

	* app/dialogs/image-new-dialog.c: unset "focus-on-click" on the
	template combo-box.
parent 716c3ed2
2005-03-18 Sven Neumann <sven@gimp.org>
* app/widgets/gimpcontainerview.c: make "preview-size" and
"preview-border-width" construct properties. Fixes creation
using g_object_new().
* app/widgets/gimpcontainerentry.c
* app/widgets/gimpcontainertreeview.c
* app/widgets/gimplayertreeview.c (set_preview_size): handle
unset model and/or view gracefully.
* app/dialogs/image-new-dialog.c: unset "focus-on-click" on the
template combo-box.
2005-03-17 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* plug-ins/common/fp.c: major code cleanup, make it
......
......@@ -130,7 +130,12 @@ image_new_dialog_new (Gimp *gimp)
gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
dialog->combo = gimp_container_combo_box_new (gimp->templates, NULL, 16, 0);
dialog->combo = g_object_new (GIMP_TYPE_CONTAINER_COMBO_BOX,
"container", gimp->templates,
"preview-size", 16,
"preview-border-width", 0,
"focus-on-click", FALSE,
NULL);
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
_("_Template:"), 0.0, 0.5,
......
......@@ -395,6 +395,9 @@ gimp_container_entry_set_preview_size (GimpContainerView *view)
gint preview_size;
gint border_width;
if (! model)
return;
preview_size = gimp_container_view_get_preview_size (view, &border_width);
for (iter_valid = gtk_tree_model_get_iter_first (model, &iter);
......
......@@ -718,15 +718,35 @@ gimp_container_tree_view_set_preview_size (GimpContainerView *view)
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
GtkWidget *tree_widget;
GtkTreeIter iter;
gboolean iter_valid;
GList *list;
gboolean iter_valid;
gint preview_size;
gint border_width;
preview_size = gimp_container_view_get_preview_size (view, &border_width);
if (tree_view->model)
{
for (iter_valid = gtk_tree_model_get_iter_first (tree_view->model, &iter);
iter_valid;
iter_valid = gtk_tree_model_iter_next (tree_view->model, &iter))
{
GimpViewRenderer *renderer;
gtk_tree_model_get (tree_view->model, &iter,
COLUMN_RENDERER, &renderer,
-1);
gimp_view_renderer_set_size (renderer, preview_size, border_width);
g_object_unref (renderer);
}
}
tree_widget = GTK_WIDGET (tree_view->view);
if (! tree_widget)
return;
for (list = tree_view->toggle_cells; list; list = g_list_next (list))
{
gchar *stock_id;
......@@ -750,20 +770,6 @@ gimp_container_tree_view_set_preview_size (GimpContainerView *view)
}
}
for (iter_valid = gtk_tree_model_get_iter_first (tree_view->model, &iter);
iter_valid;
iter_valid = gtk_tree_model_iter_next (tree_view->model, &iter))
{
GimpViewRenderer *renderer;
gtk_tree_model_get (tree_view->model, &iter,
COLUMN_RENDERER, &renderer,
-1);
gimp_view_renderer_set_size (renderer, preview_size, border_width);
g_object_unref (renderer);
}
gtk_tree_view_columns_autosize (tree_view->view);
}
......
......@@ -221,14 +221,16 @@ gimp_container_view_iface_base_init (GimpContainerViewInterface *view_iface)
NULL, NULL,
1, GIMP_VIEWABLE_MAX_PREVIEW_SIZE,
GIMP_VIEW_SIZE_MEDIUM,
G_PARAM_READWRITE));
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_interface_install_property (view_iface,
g_param_spec_int ("preview-border-width",
NULL, NULL,
0, GIMP_VIEW_MAX_BORDER_WIDTH,
1,
G_PARAM_READWRITE));
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
}
static void
......
......@@ -614,28 +614,33 @@ static void
gimp_layer_tree_view_set_preview_size (GimpContainerView *view)
{
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
GimpLayerTreeView *layer_view = GIMP_LAYER_TREE_VIEW (view);
GtkTreeIter iter;
gboolean iter_valid;
gint preview_size;
gint border_width;
preview_size = gimp_container_view_get_preview_size (view, &border_width);
for (iter_valid = gtk_tree_model_get_iter_first (tree_view->model, &iter);
iter_valid;
iter_valid = gtk_tree_model_iter_next (tree_view->model, &iter))
if (tree_view->model)
{
GimpViewRenderer *renderer;
GimpLayerTreeView *layer_view = GIMP_LAYER_TREE_VIEW (view);
GtkTreeIter iter;
gboolean iter_valid;
gint preview_size;
gint border_width;
gtk_tree_model_get (tree_view->model, &iter,
layer_view->model_column_mask, &renderer,
-1);
preview_size = gimp_container_view_get_preview_size (view, &border_width);
if (renderer)
for (iter_valid = gtk_tree_model_get_iter_first (tree_view->model, &iter);
iter_valid;
iter_valid = gtk_tree_model_iter_next (tree_view->model, &iter))
{
gimp_view_renderer_set_size (renderer, preview_size, border_width);
g_object_unref (renderer);
GimpViewRenderer *renderer;
gtk_tree_model_get (tree_view->model, &iter,
layer_view->model_column_mask, &renderer,
-1);
if (renderer)
{
gimp_view_renderer_set_size (renderer,
preview_size, border_width);
g_object_unref (renderer);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment