app/widgets/gimpcontainergridview.[ch] removed "reorderable" from

2004-05-28  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpcontainergridview.[ch]
	* app/widgets/gimpcontainertreeview.[ch]: removed "reorderable"
	from gimp_container_foo_view_new().

	* app/widgets/gimpcontainereditor.[ch]: removed "reorderable" from
	gimp_container_editor_construct(). Automatically set the view to
	reorderable if the viewed container has no sort_func.

	* app/widgets/gimpbufferview.c
	* app/widgets/gimpdatafactoryview.c
	* app/widgets/gimpdocumentview.c
	* app/widgets/gimpimageview.c
	* app/widgets/gimptemplateview.c
	* app/widgets/gimptoolview.c
	* app/widgets/gimpundoeditor.c: removed reoderable stuff because
	GimpContainerEditor does this generically now.

	* app/widgets/gimpcontainerpopup.c
	* app/widgets/gimpfontview.c: set reorderable to FALSE because
	they should not be reodered even if they don't have a sort_func.

	* app/gui/font-select.c: removed reorderable stuff. Some cleanup.

	* app/gui/brush-select.c
	* app/gui/gradient-select.c
	* app/gui/palette-select.c
	* app/gui/pattern-select.c: same cleanups as in font-select.c
This commit is contained in:
Michael Natterer 2004-05-28 09:52:15 +00:00 committed by Michael Natterer
parent afb57d59bf
commit a9932fcad8
21 changed files with 94 additions and 83 deletions

View File

@ -1,3 +1,33 @@
2004-05-28 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontainergridview.[ch]
* app/widgets/gimpcontainertreeview.[ch]: removed "reorderable"
from gimp_container_foo_view_new().
* app/widgets/gimpcontainereditor.[ch]: removed "reorderable" from
gimp_container_editor_construct(). Automatically set the view to
reorderable if the viewed container has no sort_func.
* app/widgets/gimpbufferview.c
* app/widgets/gimpdatafactoryview.c
* app/widgets/gimpdocumentview.c
* app/widgets/gimpimageview.c
* app/widgets/gimptemplateview.c
* app/widgets/gimptoolview.c
* app/widgets/gimpundoeditor.c: removed reoderable stuff because
GimpContainerEditor does this generically now.
* app/widgets/gimpcontainerpopup.c
* app/widgets/gimpfontview.c: set reorderable to FALSE because
they should not be reodered even if they don't have a sort_func.
* app/gui/font-select.c: removed reorderable stuff. Some cleanup.
* app/gui/brush-select.c
* app/gui/gradient-select.c
* app/gui/palette-select.c
* app/gui/pattern-select.c: same cleanups as in font-select.c
2004-05-28 Michael Natterer <mitch@gimp.org>
* app/paint/gimpbrushcore.c

View File

@ -245,12 +245,11 @@ brush_select_free (BrushSelect *bsp)
BrushSelect *
brush_select_get_by_callback (const gchar *callback_name)
{
GSList *list;
BrushSelect *bsp;
GSList *list;
for (list = brush_active_dialogs; list; list = g_slist_next (list))
{
bsp = (BrushSelect *) list->data;
BrushSelect *bsp = list->data;
if (bsp->callback_name && ! strcmp (callback_name, bsp->callback_name))
return bsp;
@ -290,7 +289,7 @@ brush_select_change_callbacks (BrushSelect *bsp,
static gboolean busy = FALSE;
if (! (bsp && bsp->callback_name) || busy)
if (! bsp->callback_name || busy)
return;
busy = TRUE;
@ -303,13 +302,13 @@ brush_select_change_callbacks (BrushSelect *bsp,
if (proc && brush)
{
Argument *return_vals;
gint nreturn_vals;
gint n_return_vals;
return_vals =
procedural_db_run_proc (bsp->context->gimp,
bsp->context,
bsp->callback_name,
&nreturn_vals,
&n_return_vals,
GIMP_PDB_STRING, GIMP_OBJECT (brush)->name,
GIMP_PDB_FLOAT, gimp_context_get_opacity (bsp->context) * 100.0,
GIMP_PDB_INT32, bsp->spacing_value,
@ -327,7 +326,7 @@ brush_select_change_callbacks (BrushSelect *bsp,
"The corresponding plug-in may have crashed."));
if (return_vals)
procedural_db_destroy_args (return_vals, nreturn_vals);
procedural_db_destroy_args (return_vals, n_return_vals);
}
busy = FALSE;

View File

@ -120,8 +120,7 @@ font_select_new (Gimp *gimp,
/* The Font List */
font_select->view = gimp_container_tree_view_new (gimp->fonts,
font_select->context,
GIMP_PREVIEW_SIZE_MEDIUM, 1,
FALSE);
GIMP_PREVIEW_SIZE_MEDIUM, 1);
gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (font_select->view),
5 * (GIMP_PREVIEW_SIZE_MEDIUM + 2),
@ -159,12 +158,11 @@ font_select_free (FontSelect *font_select)
FontSelect *
font_select_get_by_callback (const gchar *callback_name)
{
GSList *list;
FontSelect *font_select;
GSList *list;
for (list = font_active_dialogs; list; list = g_slist_next (list))
{
font_select = (FontSelect *) list->data;
FontSelect *font_select = list->data;
if (font_select->callback_name && !
strcmp (callback_name, font_select->callback_name))
@ -177,21 +175,20 @@ font_select_get_by_callback (const gchar *callback_name)
void
font_select_dialogs_check (void)
{
FontSelect *font_select;
GSList *list;
GSList *list;
list = font_active_dialogs;
while (list)
{
font_select = (FontSelect *) list->data;
FontSelect *font_select = list->data;
list = g_slist_next (list);
if (font_select->callback_name)
{
if (! procedural_db_lookup (font_select->context->gimp,
font_select->callback_name))
if (! procedural_db_lookup (font_select->context->gimp,
font_select->callback_name))
font_select_response (NULL, GTK_RESPONSE_CLOSE, font_select);
}
}
@ -209,7 +206,7 @@ font_select_change_callbacks (FontSelect *font_select,
static gboolean busy = FALSE;
if (! (font_select && font_select->callback_name) || busy)
if (! font_select->callback_name || busy)
return;
busy = TRUE;
@ -223,13 +220,13 @@ font_select_change_callbacks (FontSelect *font_select,
if (proc && font)
{
Argument *return_vals;
gint nreturn_vals;
gint n_return_vals;
return_vals =
procedural_db_run_proc (font_select->context->gimp,
font_select->context,
font_select->callback_name,
&nreturn_vals,
&n_return_vals,
GIMP_PDB_STRING, GIMP_OBJECT (font)->name,
GIMP_PDB_INT32, closing,
GIMP_PDB_END);
@ -239,7 +236,7 @@ font_select_change_callbacks (FontSelect *font_select,
"The corresponding plug-in may have crashed."));
if (return_vals)
procedural_db_destroy_args (return_vals, nreturn_vals);
procedural_db_destroy_args (return_vals, n_return_vals);
}
busy = FALSE;

View File

@ -177,12 +177,11 @@ gradient_select_free (GradientSelect *gsp)
GradientSelect *
gradient_select_get_by_callback (const gchar *callback_name)
{
GSList *list;
GradientSelect *gsp;
GSList *list;
for (list = gradient_active_dialogs; list; list = g_slist_next (list))
{
gsp = (GradientSelect *) list->data;
GradientSelect *gsp = list->data;
if (gsp->callback_name && ! strcmp (callback_name, gsp->callback_name))
return gsp;
@ -194,14 +193,13 @@ gradient_select_get_by_callback (const gchar *callback_name)
void
gradient_select_dialogs_check (void)
{
GradientSelect *gsp;
GSList *list;
GSList *list;
list = gradient_active_dialogs;
while (list)
{
gsp = (GradientSelect *) list->data;
GradientSelect *gsp = list->data;
list = g_slist_next (list);
@ -225,7 +223,7 @@ gradient_select_change_callbacks (GradientSelect *gsp,
static gboolean busy = FALSE;
if (! (gsp && gsp->callback_name) || busy)
if (! gsp->callback_name || busy)
return;
busy = TRUE;
@ -238,7 +236,7 @@ gradient_select_change_callbacks (GradientSelect *gsp,
if (proc && gradient)
{
Argument *return_vals;
gint nreturn_vals;
gint n_return_vals;
gdouble *values, *pv;
double pos, delta;
GimpRGB color;
@ -267,7 +265,7 @@ gradient_select_change_callbacks (GradientSelect *gsp,
procedural_db_run_proc (gsp->context->gimp,
gsp->context,
gsp->callback_name,
&nreturn_vals,
&n_return_vals,
GIMP_PDB_STRING, GIMP_OBJECT (gradient)->name,
GIMP_PDB_INT32, gsp->sample_size * 4,
GIMP_PDB_FLOATARRAY, values,
@ -279,7 +277,7 @@ gradient_select_change_callbacks (GradientSelect *gsp,
"The corresponding plug-in may have crashed."));
if (return_vals)
procedural_db_destroy_args (return_vals, nreturn_vals);
procedural_db_destroy_args (return_vals, n_return_vals);
}
busy = FALSE;

View File

@ -179,12 +179,11 @@ palette_select_free (PaletteSelect *psp)
PaletteSelect *
palette_select_get_by_callback (const gchar *callback_name)
{
GSList *list;
PaletteSelect *psp;
GSList *list;
for (list = palette_active_dialogs; list; list = g_slist_next (list))
{
psp = (PaletteSelect *) list->data;
PaletteSelect *psp = list->data;
if (psp->callback_name && ! strcmp (callback_name, psp->callback_name))
return psp;
@ -196,20 +195,19 @@ palette_select_get_by_callback (const gchar *callback_name)
void
palette_select_dialogs_check (void)
{
PaletteSelect *psp;
GSList *list;
GSList *list;
list = palette_active_dialogs;
while (list)
{
psp = (PaletteSelect *) list->data;
PaletteSelect *psp = list->data;
list = g_slist_next (list);
if (psp->callback_name)
{
if (! procedural_db_lookup (psp->context->gimp, psp->callback_name))
if (! procedural_db_lookup (psp->context->gimp, psp->callback_name))
palette_select_response (NULL, GTK_RESPONSE_CLOSE, psp);
}
}
@ -227,7 +225,7 @@ palette_select_change_callbacks (PaletteSelect *psp,
static gboolean busy = FALSE;
if (! (psp && psp->callback_name) || busy)
if (! psp->callback_name || busy)
return;
busy = TRUE;
@ -240,13 +238,13 @@ palette_select_change_callbacks (PaletteSelect *psp,
if (proc && palette)
{
Argument *return_vals;
gint nreturn_vals;
gint n_return_vals;
return_vals =
procedural_db_run_proc (psp->context->gimp,
psp->context,
psp->callback_name,
&nreturn_vals,
&n_return_vals,
GIMP_PDB_STRING, GIMP_OBJECT (palette)->name,
GIMP_PDB_INT32, palette->n_colors,
GIMP_PDB_INT32, closing,
@ -257,7 +255,7 @@ palette_select_change_callbacks (PaletteSelect *psp,
"The corresponding plug-in may have crashed."));
if (return_vals)
procedural_db_destroy_args (return_vals, nreturn_vals);
procedural_db_destroy_args (return_vals, n_return_vals);
}
busy = FALSE;

View File

@ -175,12 +175,11 @@ pattern_select_free (PatternSelect *psp)
PatternSelect *
pattern_select_get_by_callback (const gchar *callback_name)
{
GSList *list;
PatternSelect *psp;
GSList *list;
for (list = pattern_active_dialogs; list; list = g_slist_next (list))
{
psp = (PatternSelect *) list->data;
PatternSelect *psp = list->data;
if (psp->callback_name && ! strcmp (callback_name, psp->callback_name))
return psp;
@ -192,14 +191,13 @@ pattern_select_get_by_callback (const gchar *callback_name)
void
pattern_select_dialogs_check (void)
{
PatternSelect *psp;
GSList *list;
GSList *list;
list = pattern_active_dialogs;
while (list)
{
psp = (PatternSelect *) list->data;
PatternSelect *psp = list->data;
list = g_slist_next (list);
@ -223,7 +221,7 @@ pattern_select_change_callbacks (PatternSelect *psp,
static gboolean busy = FALSE;
if (! (psp && psp->callback_name) || busy)
if (! psp->callback_name || busy)
return;
busy = TRUE;
@ -236,13 +234,13 @@ pattern_select_change_callbacks (PatternSelect *psp,
if (proc && pattern)
{
Argument *return_vals;
gint nreturn_vals;
gint n_return_vals;
return_vals =
procedural_db_run_proc (psp->context->gimp,
psp->context,
psp->callback_name,
&nreturn_vals,
&n_return_vals,
GIMP_PDB_STRING, GIMP_OBJECT (pattern)->name,
GIMP_PDB_INT32, pattern->mask->width,
GIMP_PDB_INT32, pattern->mask->height,
@ -259,7 +257,7 @@ pattern_select_change_callbacks (PatternSelect *psp,
"The corresponding plug-in may have crashed."));
if (return_vals)
procedural_db_destroy_args (return_vals, nreturn_vals);
procedural_db_destroy_args (return_vals, n_return_vals);
}
busy = FALSE;

View File

@ -116,7 +116,6 @@ gimp_buffer_view_new (GimpViewType view_type,
view_type,
container,context,
preview_size, preview_border_width,
TRUE, /* reorderable */
menu_factory, "<Buffers>",
"/buffers-popup"))
{

View File

@ -28,7 +28,7 @@
#include "widgets-types.h"
#include "core/gimpcontext.h"
#include "core/gimpcontainer.h"
#include "core/gimplist.h"
#include "core/gimpviewable.h"
#include "gimpcontainereditor.h"
@ -142,7 +142,6 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
GimpContext *context,
gint preview_size,
gint preview_border_width,
gboolean reorderable,
GimpMenuFactory *menu_factory,
const gchar *menu_identifier,
const gchar *ui_identifier)
@ -165,8 +164,7 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
GIMP_CONTAINER_VIEW (gimp_container_grid_view_new (container,
context,
preview_size,
preview_border_width,
reorderable));
preview_border_width));
break;
case GIMP_VIEW_TYPE_LIST:
@ -174,8 +172,7 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
GIMP_CONTAINER_VIEW (gimp_container_tree_view_new (container,
context,
preview_size,
preview_border_width,
reorderable));
preview_border_width));
break;
default:
@ -183,6 +180,10 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
return FALSE;
}
if (GIMP_IS_LIST (container))
gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (editor->view),
! GIMP_LIST (container)->sort_func);
if (menu_factory && menu_identifier && ui_identifier)
gimp_editor_create_menu (GIMP_EDITOR (editor->view),
menu_factory, menu_identifier, ui_identifier,

View File

@ -67,7 +67,6 @@ gboolean gimp_container_editor_construct (GimpContainerEditor *editor,
GimpContext *context,
gint preview_size,
gint preview_border_width,
gboolean reorderable,
GimpMenuFactory *menu_factory,
const gchar *menu_identifier,
const gchar *ui_path);

View File

@ -239,8 +239,7 @@ GtkWidget *
gimp_container_grid_view_new (GimpContainer *container,
GimpContext *context,
gint preview_size,
gint preview_border_width,
gboolean reorderable)
gint preview_border_width)
{
GimpContainerGridView *grid_view;
GimpContainerView *view;
@ -254,9 +253,7 @@ gimp_container_grid_view_new (GimpContainer *container,
preview_border_width <= GIMP_PREVIEW_MAX_BORDER_WIDTH,
NULL);
grid_view = g_object_new (GIMP_TYPE_CONTAINER_GRID_VIEW,
"reorderable", reorderable,
NULL);
grid_view = g_object_new (GIMP_TYPE_CONTAINER_GRID_VIEW, NULL);
view = GIMP_CONTAINER_VIEW (grid_view);

View File

@ -65,8 +65,7 @@ GType gimp_container_grid_view_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_container_grid_view_new (GimpContainer *container,
GimpContext *context,
gint preview_size,
gint preview_border_width,
gboolean reorderable);
gint preview_border_width);
#endif /* __GIMP_CONTAINER_GRID_VIEW_H__ */

View File

@ -479,10 +479,12 @@ gimp_container_popup_create_view (GimpContainerPopup *popup)
popup->context,
popup->preview_size,
popup->preview_border_width,
FALSE, /* reorderable */
NULL, NULL, NULL);
gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (GIMP_CONTAINER_EDITOR (popup->editor)->view),
gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (popup->editor->view),
FALSE);
gimp_container_box_set_size_request (GIMP_CONTAINER_BOX (popup->editor->view),
6 * (popup->default_preview_size +
2 * popup->preview_border_width),
10 * (popup->default_preview_size +

View File

@ -376,8 +376,7 @@ GtkWidget *
gimp_container_tree_view_new (GimpContainer *container,
GimpContext *context,
gint preview_size,
gint preview_border_width,
gboolean reorderable)
gint preview_border_width)
{
GimpContainerTreeView *tree_view;
GimpContainerView *view;
@ -391,9 +390,7 @@ gimp_container_tree_view_new (GimpContainer *container,
preview_border_width <= GIMP_PREVIEW_MAX_BORDER_WIDTH,
NULL);
tree_view = g_object_new (GIMP_TYPE_CONTAINER_TREE_VIEW,
"reorderable", reorderable,
NULL);
tree_view = g_object_new (GIMP_TYPE_CONTAINER_TREE_VIEW, NULL);
view = GIMP_CONTAINER_VIEW (tree_view);

View File

@ -89,8 +89,7 @@ GType gimp_container_tree_view_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_container_tree_view_new (GimpContainer *container,
GimpContext *context,
gint preview_size,
gint preview_border_width,
gboolean reorderable);
gint preview_border_width);
#endif /* __GIMP_CONTAINER_TREE_VIEW_H__ */

View File

@ -176,7 +176,6 @@ gimp_data_factory_view_construct (GimpDataFactoryView *factory_view,
view_type,
factory->container, context,
preview_size, preview_border_width,
FALSE, /* reorderable */
menu_factory, menu_identifier,
ui_identifier))
{

View File

@ -118,7 +118,6 @@ gimp_document_view_new (GimpViewType view_type,
view_type,
container, context,
preview_size, preview_border_width,
TRUE, /* reorderable */
menu_factory, "<Documents>",
"/documents-popup"))
{

View File

@ -109,7 +109,6 @@ gimp_font_view_new (GimpViewType view_type,
view_type,
container,context,
preview_size, preview_border_width,
FALSE, /* reorderable */
menu_factory, "<Fonts>",
"/fonts-popup"))
{
@ -119,6 +118,9 @@ gimp_font_view_new (GimpViewType view_type,
editor = GIMP_CONTAINER_EDITOR (font_view);
gimp_container_view_set_reorderable (GIMP_CONTAINER_VIEW (editor->view),
FALSE);
font_view->refresh_button =
gimp_editor_add_action_button (GIMP_EDITOR (editor->view), "fonts",
"fonts-refresh", NULL);

View File

@ -112,7 +112,6 @@ gimp_image_view_new (GimpViewType view_type,
view_type,
container, context,
preview_size, preview_border_width,
TRUE, /* reorderable */
menu_factory, "<Images>",
"/images-popup"))
{

View File

@ -127,7 +127,6 @@ gimp_template_view_new (GimpViewType view_type,
view_type,
container, context,
preview_size, preview_border_width,
TRUE, /* reorderable */
menu_factory, "<Templates>",
"/templates-popup"))
{

View File

@ -155,7 +155,6 @@ gimp_tool_view_new (GimpViewType view_type,
view_type,
container, context,
preview_size, preview_border_width,
TRUE, /* reorderable */
menu_factory, "<Tools>",
"/tools-popup"))
{

View File

@ -148,7 +148,8 @@ gimp_undo_editor_constructor (GType type,
undo_editor->view = gimp_container_tree_view_new (NULL, NULL,
undo_editor->preview_size,
1, FALSE);
1);
gtk_container_add (GTK_CONTAINER (undo_editor), undo_editor->view);
gtk_widget_show (undo_editor->view);