added a writeable field to GimpData and set it from

2003-02-26  Sven Neumann  <sven@gimp.org>

	* app/core/gimpdata.[ch]: added a writeable field to GimpData and
	set it from gimp_data_set_filename().

	* app/gui/brushes-menu.c
	* app/gui/gradients-menu.c
	* app/gui/palettes-menu.c
	* app/gui/patterns-menu.c
	* app/widgets/gimpbrushfactoryview.c
	* app/widgets/gimpdatafactoryview.c
	* app/widgets/gimpgradienteditor.c: look at data->writeable when
	setting widgets sensitivity.

	* app/gui/user-install-dialog.c (user_install_dialog_create): reduce
	some of the dialog clutter by not showing the directories created for
	plug-ins.

	* app/core/gimpviewable.[ch]: added a default_stock_id to
	GimpViewableClass so we don't need to hold a copy in each instance.
	Added accessor functions to set and get the stock_id.

	* app/core/gimptoolinfo.c
	* app/gui/dialogs-constructors.c
	* app/gui/image-menu.c
	* app/tools/gimpcroptool.c
	* app/tools/gimphistogramtool.c
	* app/tools/gimpimagemaptool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimptransformtool.c
	* app/widgets/gimpcellrendererviewable.c
	* app/widgets/gimppreview.c
	* app/widgets/gimptoolbox.c: use gimp_viewable_get_stock_id().

	* app/text/gimptextlayer.c: set a text icon as default stock_id.
This commit is contained in:
Sven Neumann 2003-02-26 18:08:26 +00:00 committed by Sven Neumann
parent 305db405b2
commit 0ceeeb0254
31 changed files with 247 additions and 149 deletions

View File

@ -1,3 +1,39 @@
2003-02-26 Sven Neumann <sven@gimp.org>
* app/core/gimpdata.[ch]: added a writeable field to GimpData and
set it from gimp_data_set_filename().
* app/gui/brushes-menu.c
* app/gui/gradients-menu.c
* app/gui/palettes-menu.c
* app/gui/patterns-menu.c
* app/widgets/gimpbrushfactoryview.c
* app/widgets/gimpdatafactoryview.c
* app/widgets/gimpgradienteditor.c: look at data->writeable when
setting widgets sensitivity.
* app/gui/user-install-dialog.c (user_install_dialog_create): reduce
some of the dialog clutter by not showing the directories created for
plug-ins.
* app/core/gimpviewable.[ch]: added a default_stock_id to
GimpViewableClass so we don't need to hold a copy in each instance.
Added accessor functions to set and get the stock_id.
* app/core/gimptoolinfo.c
* app/gui/dialogs-constructors.c
* app/gui/image-menu.c
* app/tools/gimpcroptool.c
* app/tools/gimphistogramtool.c
* app/tools/gimpimagemaptool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimptransformtool.c
* app/widgets/gimpcellrendererviewable.c
* app/widgets/gimppreview.c
* app/widgets/gimptoolbox.c: use gimp_viewable_get_stock_id().
* app/text/gimptextlayer.c: set a text icon as default stock_id.
2003-02-26 Michael Natterer <mitch@gimp.org>
* app/core/gimpviewable.[ch]: added "gchar *stock_id" to the

View File

@ -24,6 +24,7 @@
#include <errno.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@ -125,9 +126,10 @@ gimp_data_class_init (GimpDataClass *klass)
static void
gimp_data_init (GimpData *data)
{
data->filename = NULL;
data->dirty = FALSE;
data->internal = FALSE;
data->filename = NULL;
data->writeable = TRUE;
data->dirty = FALSE;
data->internal = FALSE;
}
static void
@ -255,7 +257,24 @@ gimp_data_set_filename (GimpData *data,
g_free (data->filename);
data->filename = g_strdup (filename);
data->filename = NULL;
data->writeable = TRUE;
if (filename)
{
data->filename = g_strdup (filename);
if (access (filename, W_OK) && /* check if the file is writeable */
access (filename, F_OK) == 0) /* or doesn't exist */
{
gchar *dirname = g_path_get_dirname (filename);
if (access (dirname, W_OK | X_OK)) /* check if we can write to the dir */
data->writeable = FALSE;
g_free (dirname);
}
}
}
void

View File

@ -50,8 +50,9 @@ struct _GimpData
GimpViewable parent_instance;
gchar *filename;
gboolean dirty;
gboolean internal;
guint writeable : 1;
guint dirty : 1;
guint internal : 1;
};
struct _GimpDataClass

View File

@ -205,9 +205,7 @@ gimp_tool_info_new (Gimp *gimp,
tool_info->help_domain = g_strdup (help_domain);
tool_info->help_data = g_strdup (help_data);
if (viewable->stock_id)
g_free (viewable->stock_id);
viewable->stock_id = g_strdup (stock_id);
gimp_viewable_set_stock_id (viewable, stock_id);
return tool_info;
}

View File

@ -128,6 +128,7 @@ gimp_viewable_class_init (GimpViewableClass *klass)
gimp_object_class->get_memsize = gimp_viewable_get_memsize;
klass->default_stock_id = "gtk-dialog-question";
klass->name_changed_signal = "name_changed";
klass->invalidate_preview = gimp_viewable_real_invalidate_preview;
@ -141,7 +142,7 @@ gimp_viewable_class_init (GimpViewableClass *klass)
static void
gimp_viewable_init (GimpViewable *viewable)
{
viewable->stock_id = g_strdup ("gtk-dialog-question");
viewable->stock_id = NULL;
}
static void
@ -446,3 +447,24 @@ gimp_viewable_get_new_preview_pixbuf (GimpViewable *viewable,
return pixbuf;
}
const gchar *
gimp_viewable_get_stock_id (GimpViewable *viewable)
{
g_return_val_if_fail (GIMP_IS_VIEWABLE (viewable), NULL);
if (viewable->stock_id)
return (const gchar *) viewable->stock_id;
return GIMP_VIEWABLE_GET_CLASS (viewable)->default_stock_id;
}
void
gimp_viewable_set_stock_id (GimpViewable *viewable,
const gchar *stock_id)
{
g_return_if_fail (GIMP_IS_VIEWABLE (viewable));
g_free (viewable->stock_id);
viewable->stock_id = g_strdup (stock_id);
}

View File

@ -42,6 +42,7 @@ struct _GimpViewable
{
GimpObject parent_instance;
/*< private >*/
gchar *stock_id;
};
@ -49,6 +50,7 @@ struct _GimpViewableClass
{
GimpObjectClass parent_class;
const gchar *default_stock_id;
const gchar *name_changed_signal;
/* signals */
@ -107,6 +109,9 @@ GdkPixbuf * gimp_viewable_get_preview_pixbuf (GimpViewable *viewable,
GdkPixbuf * gimp_viewable_get_new_preview_pixbuf (GimpViewable *viewable,
gint width,
gint height);
const gchar * gimp_viewable_get_stock_id (GimpViewable *viewable);
void gimp_viewable_set_stock_id (GimpViewable *viewable,
const gchar *stock_id);
#endif /* __GIMP_VIEWABLE_H__ */

View File

@ -1280,9 +1280,10 @@ dialogs_tool_tab_tool_changed (GimpContext *context,
GimpToolInfo *tool_info,
GtkImage *image)
{
gtk_image_set_from_stock (image,
GIMP_VIEWABLE (tool_info)->stock_id,
image->icon_size);
const gchar *stock_id;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
gtk_image_set_from_stock (image, stock_id, image->icon_size);
}
static GtkWidget *
@ -1298,7 +1299,8 @@ dialogs_tool_tab_func (GimpDockable *dockable,
viewable = GIMP_VIEWABLE (gimp_context_get_tool (context));
image = gtk_image_new_from_stock (viewable->stock_id, size);
image = gtk_image_new_from_stock (gimp_viewable_get_stock_id (viewable),
size);
g_signal_connect_object (context, "tool_changed",
G_CALLBACK (dialogs_tool_tab_tool_changed),
@ -1316,9 +1318,12 @@ dialogs_tool_options_tool_changed (GimpContext *context,
GtkImage *image;
if ((image = g_object_get_data (G_OBJECT (label), "tool-icon")))
gtk_image_set_from_stock (image,
GIMP_VIEWABLE (tool_info)->stock_id,
image->icon_size);
{
const gchar *stock_id;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
gtk_image_set_from_stock (image, stock_id, image->icon_size);
}
gtk_label_set_text (label, tool_info->blurb);
@ -1339,6 +1344,7 @@ dialogs_tool_options_tab_func (GimpDockable *dockable,
GtkWidget *label;
gint width;
gint height;
const gchar *stock_id;
context = dockbook->dock->context;
@ -1348,8 +1354,8 @@ dialogs_tool_options_tab_func (GimpDockable *dockable,
hbox = gtk_hbox_new (FALSE, 2);
image = gtk_image_new_from_stock (GIMP_VIEWABLE (tool_info)->stock_id,
size);
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
image = gtk_image_new_from_stock (stock_id, size);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);

View File

@ -284,34 +284,22 @@ tree_items[] =
},
{
TRUE, "fractalexplorer",
N_("This is folder used to store user defined fractals to\n"
"be used by the FractalExplorer plug-in. The GIMP\n"
"checks this folder in addition to the systemwide\n"
"FractalExplorer installation when searching for fractals."),
NULL,
TREE_ITEM_MKDIR_ONLY, NULL
},
{
TRUE, "gfig",
N_("This folder is used to store user defined figures to\n"
"be used by the GFig plug-in. The GIMP checks this\n"
"folder in addition to the systemwide GFig installation\n"
"when searching for gfig figures."),
NULL,
TREE_ITEM_MKDIR_ONLY, NULL
},
{
TRUE, "gflare",
N_("This folder is used to store user defined gflares to\n"
"be used by the GFlare plug-in. The GIMP checks this\n"
"folder in addition to the systemwide GFlares\n"
"installation when searching for gflares."),
NULL,
TREE_ITEM_MKDIR_ONLY, NULL
},
{
TRUE, "gimpressionist",
N_("This folder is used to store user defined data to be\n"
"used by the Gimpressionist plug-in. The GIMP checks\n"
"this folder in addition to the systemwide Gimpressionist\n"
"installation when searching for data."),
NULL,
TREE_ITEM_MKDIR_ONLY, NULL
}
};
@ -867,6 +855,9 @@ user_install_dialog_create (const gchar *alternate_system_gimprc,
for (i = 0; i < G_N_ELEMENTS (tree_items); i++)
{
if (!tree_items[i].description)
continue;
gtk_tree_store_append (tree, &child, &iter);
gtk_tree_store_set (tree, &child,
DIRENT_COLUMN, tree_items[i].text,

View File

@ -76,28 +76,28 @@ gint n_brushes_menu_entries = G_N_ELEMENTS (brushes_menu_entries);
void
brushes_menu_update (GtkItemFactory *factory,
gpointer data)
gpointer user_data)
{
GimpContainerEditor *editor;
GimpBrush *brush;
gboolean internal = FALSE;
GimpData *data = NULL;
editor = GIMP_CONTAINER_EDITOR (data);
editor = GIMP_CONTAINER_EDITOR (user_data);
brush = gimp_context_get_brush (editor->view->context);
if (brush)
internal = GIMP_DATA (brush)->internal;
data = GIMP_DATA (brush);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Duplicate Brush",
brush && GIMP_DATA_GET_CLASS (brush)->duplicate);
brush && GIMP_DATA_GET_CLASS (data)->duplicate);
SET_SENSITIVE ("/Edit Brush...",
brush && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Brush...",
brush && ! internal);
brush && data->writeable && !data->internal);
#undef SET_SENSITIVE
}

View File

@ -1280,9 +1280,10 @@ dialogs_tool_tab_tool_changed (GimpContext *context,
GimpToolInfo *tool_info,
GtkImage *image)
{
gtk_image_set_from_stock (image,
GIMP_VIEWABLE (tool_info)->stock_id,
image->icon_size);
const gchar *stock_id;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
gtk_image_set_from_stock (image, stock_id, image->icon_size);
}
static GtkWidget *
@ -1298,7 +1299,8 @@ dialogs_tool_tab_func (GimpDockable *dockable,
viewable = GIMP_VIEWABLE (gimp_context_get_tool (context));
image = gtk_image_new_from_stock (viewable->stock_id, size);
image = gtk_image_new_from_stock (gimp_viewable_get_stock_id (viewable),
size);
g_signal_connect_object (context, "tool_changed",
G_CALLBACK (dialogs_tool_tab_tool_changed),
@ -1316,9 +1318,12 @@ dialogs_tool_options_tool_changed (GimpContext *context,
GtkImage *image;
if ((image = g_object_get_data (G_OBJECT (label), "tool-icon")))
gtk_image_set_from_stock (image,
GIMP_VIEWABLE (tool_info)->stock_id,
image->icon_size);
{
const gchar *stock_id;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
gtk_image_set_from_stock (image, stock_id, image->icon_size);
}
gtk_label_set_text (label, tool_info->blurb);
@ -1339,6 +1344,7 @@ dialogs_tool_options_tab_func (GimpDockable *dockable,
GtkWidget *label;
gint width;
gint height;
const gchar *stock_id;
context = dockbook->dock->context;
@ -1348,8 +1354,8 @@ dialogs_tool_options_tab_func (GimpDockable *dockable,
hbox = gtk_hbox_new (FALSE, 2);
image = gtk_image_new_from_stock (GIMP_VIEWABLE (tool_info)->stock_id,
size);
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
image = gtk_image_new_from_stock (stock_id, size);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
gtk_widget_show (image);

View File

@ -85,28 +85,28 @@ gint n_gradients_menu_entries = G_N_ELEMENTS (gradients_menu_entries);
void
gradients_menu_update (GtkItemFactory *factory,
gpointer data)
gpointer user_data)
{
GimpContainerEditor *editor;
GimpGradient *gradient;
gboolean internal = FALSE;
GimpData *data = NULL;
editor = GIMP_CONTAINER_EDITOR (data);
editor = GIMP_CONTAINER_EDITOR (user_data);
gradient = gimp_context_get_gradient (editor->view->context);
if (gradient)
internal = GIMP_DATA (gradient)->internal;
data = GIMP_DATA (gradient);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Duplicate Gradient",
gradient && GIMP_DATA_GET_CLASS (gradient)->duplicate);
gradient && GIMP_DATA_GET_CLASS (data)->duplicate);
SET_SENSITIVE ("/Edit Gradient...",
gradient && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Gradient...",
gradient && ! internal);
gradient && data->writeable && !data->internal);
SET_SENSITIVE ("/Save as POV-Ray...",
gradient);

View File

@ -853,14 +853,17 @@ image_menu_setup (GimpItemFactory *factory)
if (tool_info->menu_path)
{
GimpItemFactoryEntry entry;
GimpItemFactoryEntry entry;
const gchar *stock_id;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
entry.entry.path = tool_info->menu_path;
entry.entry.accelerator = tool_info->menu_accel;
entry.entry.callback = tools_select_cmd_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = "<StockItem>";
entry.entry.extra_data = GIMP_VIEWABLE (tool_info)->stock_id;
entry.entry.extra_data = stock_id;
entry.quark_string = NULL;
entry.help_page = tool_info->help_data;
entry.description = NULL;

View File

@ -89,28 +89,28 @@ gint n_palettes_menu_entries = G_N_ELEMENTS (palettes_menu_entries);
void
palettes_menu_update (GtkItemFactory *factory,
gpointer data)
gpointer user_data)
{
GimpContainerEditor *editor;
GimpPalette *palette;
gboolean internal = FALSE;
GimpData *data = NULL;
editor = GIMP_CONTAINER_EDITOR (data);
editor = GIMP_CONTAINER_EDITOR (user_data);
palette = gimp_context_get_palette (editor->view->context);
if (palette)
internal = GIMP_DATA (palette)->internal;
data = GIMP_DATA (palette);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Duplicate Palette",
palette && GIMP_DATA_GET_CLASS (palette)->duplicate);
palette && GIMP_DATA_GET_CLASS (data)->duplicate);
SET_SENSITIVE ("/Edit Palette...",
palette && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Palette...",
palette && ! internal);
palette && data->writeable && !data->internal);
SET_SENSITIVE ("/Merge Palettes...",
FALSE); /* FIXME palette && GIMP_IS_CONTAINER_LIST_VIEW (editor->view)); */

View File

@ -76,28 +76,28 @@ gint n_patterns_menu_entries = G_N_ELEMENTS (patterns_menu_entries);
void
patterns_menu_update (GtkItemFactory *factory,
gpointer data)
gpointer user_data)
{
GimpContainerEditor *editor;
GimpPattern *pattern;
gboolean internal = FALSE;
GimpData *data = NULL;
editor = GIMP_CONTAINER_EDITOR (data);
editor = GIMP_CONTAINER_EDITOR (user_data);
pattern = gimp_context_get_pattern (editor->view->context);
if (pattern)
internal = GIMP_DATA (pattern)->internal;
data = GIMP_DATA (pattern);
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Duplicate Pattern",
pattern && GIMP_DATA_GET_CLASS (pattern)->duplicate);
pattern && GIMP_DATA_GET_CLASS (data)->duplicate);
SET_SENSITIVE ("/Edit Pattern...",
pattern && GIMP_DATA_FACTORY_VIEW (editor)->data_edit_func);
SET_SENSITIVE ("/Delete Pattern...",
pattern && ! internal);
pattern && data->writeable && !data->internal);
#undef SET_SENSITIVE
}

View File

@ -284,34 +284,22 @@ tree_items[] =
},
{
TRUE, "fractalexplorer",
N_("This is folder used to store user defined fractals to\n"
"be used by the FractalExplorer plug-in. The GIMP\n"
"checks this folder in addition to the systemwide\n"
"FractalExplorer installation when searching for fractals."),
NULL,
TREE_ITEM_MKDIR_ONLY, NULL
},
{
TRUE, "gfig",
N_("This folder is used to store user defined figures to\n"
"be used by the GFig plug-in. The GIMP checks this\n"
"folder in addition to the systemwide GFig installation\n"
"when searching for gfig figures."),
NULL,
TREE_ITEM_MKDIR_ONLY, NULL
},
{
TRUE, "gflare",
N_("This folder is used to store user defined gflares to\n"
"be used by the GFlare plug-in. The GIMP checks this\n"
"folder in addition to the systemwide GFlares\n"
"installation when searching for gflares."),
NULL,
TREE_ITEM_MKDIR_ONLY, NULL
},
{
TRUE, "gimpressionist",
N_("This folder is used to store user defined data to be\n"
"used by the Gimpressionist plug-in. The GIMP checks\n"
"this folder in addition to the systemwide Gimpressionist\n"
"installation when searching for data."),
NULL,
TREE_ITEM_MKDIR_ONLY, NULL
}
};
@ -867,6 +855,9 @@ user_install_dialog_create (const gchar *alternate_system_gimprc,
for (i = 0; i < G_N_ELEMENTS (tree_items); i++)
{
if (!tree_items[i].description)
continue;
gtk_tree_store_append (tree, &child, &iter);
gtk_tree_store_set (tree, &child,
DIRENT_COLUMN, tree_items[i].text,

View File

@ -853,14 +853,17 @@ image_menu_setup (GimpItemFactory *factory)
if (tool_info->menu_path)
{
GimpItemFactoryEntry entry;
GimpItemFactoryEntry entry;
const gchar *stock_id;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
entry.entry.path = tool_info->menu_path;
entry.entry.accelerator = tool_info->menu_accel;
entry.entry.callback = tools_select_cmd_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = "<StockItem>";
entry.entry.extra_data = GIMP_VIEWABLE (tool_info)->stock_id;
entry.entry.extra_data = stock_id;
entry.quark_string = NULL;
entry.help_page = tool_info->help_data;
entry.description = NULL;

View File

@ -106,13 +106,14 @@ gimp_text_layer_class_init (GimpTextLayerClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->dispose = gimp_text_layer_dispose;
object_class->dispose = gimp_text_layer_dispose;
gimp_object_class->get_memsize = gimp_text_layer_get_memsize;
gimp_object_class->get_memsize = gimp_text_layer_get_memsize;
viewable_class->get_preview = gimp_text_layer_get_preview;
viewable_class->default_stock_id = "gimp-tool-text";
viewable_class->get_preview = gimp_text_layer_get_preview;
item_class->duplicate = gimp_text_layer_duplicate;
item_class->duplicate = gimp_text_layer_duplicate;
}
static void

View File

@ -937,16 +937,19 @@ crop_info_create (GimpCropTool *crop)
GtkWidget *spinbutton;
GtkWidget *bbox;
GtkWidget *button;
const gchar *stock_id;
tool = GIMP_TOOL (crop);
gdisp = tool->gdisp;
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
crop->crop_info = info_dialog_new (NULL,
tool->tool_info->blurb,
GIMP_OBJECT (tool->tool_info)->name,
GIMP_VIEWABLE (tool->tool_info)->stock_id,
stock_id,
_("Crop & Resize Information"),
tool_manager_help_func, NULL);

View File

@ -316,13 +316,14 @@ static HistogramToolDialog *
histogram_tool_dialog_new (GimpToolInfo *tool_info)
{
HistogramToolDialog *htd;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *label;
GtkWidget *menu;
gint i;
gint x, y;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *table;
GtkWidget *label;
GtkWidget *menu;
const gchar *stock_id;
gint i;
gint x, y;
static const gchar *histogram_info_names[] =
{
@ -337,12 +338,14 @@ histogram_tool_dialog_new (GimpToolInfo *tool_info)
htd = g_new0 (HistogramToolDialog, 1);
htd->hist = gimp_histogram_new (GIMP_BASE_CONFIG (tool_info->gimp->config));
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
/* The shell and main vbox */
htd->shell =
gimp_viewable_dialog_new (NULL,
tool_info->blurb,
GIMP_OBJECT (tool_info)->name,
GIMP_VIEWABLE (tool_info)->stock_id,
stock_id,
_("View Image Histogram"),
tool_manager_help_func, NULL,

View File

@ -195,15 +195,18 @@ gimp_image_map_tool_initialize (GimpTool *tool,
if (! image_map_tool->shell)
{
GtkWidget *shell;
GtkWidget *vbox;
GtkWidget *toggle;
GtkWidget *shell;
GtkWidget *vbox;
GtkWidget *toggle;
const gchar *stock_id;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
image_map_tool->shell = shell =
gimp_viewable_dialog_new (NULL,
tool_info->blurb,
GIMP_OBJECT (tool_info)->name,
GIMP_VIEWABLE (tool_info)->stock_id,
stock_id,
image_map_tool->shell_desc,
tool_manager_help_func, NULL,

View File

@ -380,10 +380,14 @@ gimp_measure_tool_button_press (GimpTool *tool,
if (! measure_tool_info && (options->use_info_window ||
! GTK_WIDGET_VISIBLE (shell->statusbar)))
{
const gchar *stock_id;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool->tool_info));
measure_tool_info = info_dialog_new (NULL,
tool->tool_info->blurb,
GIMP_OBJECT (tool->tool_info)->name,
GIMP_VIEWABLE (tool->tool_info)->stock_id,
stock_id,
_("Measure Distances and Angles"),
tool_manager_help_func, NULL);
info_dialog_add_label (measure_tool_info, _("Distance:"), distance_buf);

View File

@ -1099,11 +1099,11 @@ gimp_transform_tool_dialog (GimpTransformTool *tr_tool)
if (GIMP_TRANSFORM_TOOL_GET_CLASS (tr_tool)->dialog)
{
GimpToolInfo *tool_info;
gchar *stock_id;
const gchar *stock_id;
tool_info = GIMP_TOOL (tr_tool)->tool_info;
stock_id = GIMP_VIEWABLE (tool_info)->stock_id;
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
tr_tool->info_dialog =
info_dialog_new (NULL,

View File

@ -202,9 +202,7 @@ gimp_brush_factory_view_select_item (GimpContainerEditor *editor,
GimpViewable *viewable)
{
GimpBrushFactoryView *view;
gboolean edit_sensitive = FALSE;
gboolean spacing_sensitive = FALSE;
gboolean spacing_sensitive = FALSE;
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item)
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item (editor, viewable);
@ -219,7 +217,6 @@ gimp_brush_factory_view_select_item (GimpContainerEditor *editor,
brush = GIMP_BRUSH (viewable);
edit_sensitive = GIMP_IS_BRUSH_GENERATED (brush);
spacing_sensitive = TRUE;
g_signal_handlers_block_by_func (view->spacing_adjustment,
@ -234,8 +231,6 @@ gimp_brush_factory_view_select_item (GimpContainerEditor *editor,
view);
}
gtk_widget_set_sensitive (GIMP_DATA_FACTORY_VIEW (view)->edit_button,
edit_sensitive);
gtk_widget_set_sensitive (view->spacing_scale, spacing_sensitive);
}

View File

@ -280,10 +280,12 @@ gimp_cell_renderer_viewable_render (GtkCellRenderer *cell,
gint height_diff = 1024;
GtkIconSize icon_size = GTK_ICON_SIZE_MENU;
GdkPixbuf *pixbuf;
const gchar *stock_id;
viewable = cellviewable->viewable;
icon_set = gtk_style_lookup_icon_set (widget->style, viewable->stock_id);
stock_id = gimp_viewable_get_stock_id (viewable);
icon_set = gtk_style_lookup_icon_set (widget->style, stock_id);
gtk_icon_set_get_sizes (icon_set, &sizes, &n_sizes);

View File

@ -431,14 +431,11 @@ gimp_data_factory_view_select_item (GimpContainerEditor *editor,
if (viewable && gimp_container_have (view->factory->container,
GIMP_OBJECT (viewable)))
{
GimpData *data;
GimpData *data = GIMP_DATA (viewable);
data = GIMP_DATA (viewable);
duplicate_sensitive = (GIMP_DATA_GET_CLASS (viewable)->duplicate != NULL);
edit_sensitive = (view->data_edit_func != NULL);
delete_sensitive = ! data->internal; /* TODO: check permissions */
duplicate_sensitive = (GIMP_DATA_GET_CLASS (data)->duplicate != NULL);
edit_sensitive = (view->data_edit_func != NULL);
delete_sensitive = data->writeable && !data->internal;
}
gtk_widget_set_sensitive (view->duplicate_button, duplicate_sensitive);

View File

@ -507,7 +507,7 @@ gimp_gradient_editor_set_data (GimpDataEditor *editor,
}
}
if (data && ! data->internal)
if (data && data->writeable && !data->internal)
gtk_widget_set_sensitive (gradient_editor->control, TRUE);
else
gtk_widget_set_sensitive (gradient_editor->control, FALSE);

View File

@ -967,8 +967,9 @@ gimp_preview_real_render (GimpPreview *preview)
}
else /* no preview available */
{
GdkPixbuf *pixbuf;
gint width, height;
GdkPixbuf *pixbuf;
const gchar *stock_id;
gint width, height;
if (preview->buffer)
{
@ -982,10 +983,11 @@ gimp_preview_real_render (GimpPreview *preview)
preview->no_preview_pixbuf = NULL;
}
pixbuf = gtk_widget_render_icon (GTK_WIDGET (preview),
preview->viewable->stock_id,
GTK_ICON_SIZE_DIALOG,
NULL);
stock_id = gimp_viewable_get_stock_id (preview->viewable);
pixbuf = gtk_widget_render_icon (GTK_WIDGET (preview),
stock_id,
GTK_ICON_SIZE_DIALOG,
NULL);
if (pixbuf)
{
width = gdk_pixbuf_get_width (pixbuf);

View File

@ -967,8 +967,9 @@ gimp_preview_real_render (GimpPreview *preview)
}
else /* no preview available */
{
GdkPixbuf *pixbuf;
gint width, height;
GdkPixbuf *pixbuf;
const gchar *stock_id;
gint width, height;
if (preview->buffer)
{
@ -982,10 +983,11 @@ gimp_preview_real_render (GimpPreview *preview)
preview->no_preview_pixbuf = NULL;
}
pixbuf = gtk_widget_render_icon (GTK_WIDGET (preview),
preview->viewable->stock_id,
GTK_ICON_SIZE_DIALOG,
NULL);
stock_id = gimp_viewable_get_stock_id (preview->viewable);
pixbuf = gtk_widget_render_icon (GTK_WIDGET (preview),
stock_id,
GTK_ICON_SIZE_DIALOG,
NULL);
if (pixbuf)
{
width = gdk_pixbuf_get_width (pixbuf);

View File

@ -635,6 +635,7 @@ toolbox_create_tools (GimpToolbox *toolbox,
GtkWidget *image;
GtkWidget *menu_item;
GList *accel_closures;
const gchar *stock_id;
tool_info = (GimpToolInfo *) list->data;
@ -648,8 +649,8 @@ toolbox_create_tools (GimpToolbox *toolbox,
g_object_set_data (G_OBJECT (tool_info), "toolbox-button", button);
g_object_set_data (G_OBJECT (button), "tool-info", tool_info);
image = gtk_image_new_from_stock (GIMP_VIEWABLE (tool_info)->stock_id,
GTK_ICON_SIZE_BUTTON);
stock_id = gimp_viewable_get_stock_id (GIMP_VIEWABLE (tool_info));
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);

View File

@ -967,8 +967,9 @@ gimp_preview_real_render (GimpPreview *preview)
}
else /* no preview available */
{
GdkPixbuf *pixbuf;
gint width, height;
GdkPixbuf *pixbuf;
const gchar *stock_id;
gint width, height;
if (preview->buffer)
{
@ -982,10 +983,11 @@ gimp_preview_real_render (GimpPreview *preview)
preview->no_preview_pixbuf = NULL;
}
pixbuf = gtk_widget_render_icon (GTK_WIDGET (preview),
preview->viewable->stock_id,
GTK_ICON_SIZE_DIALOG,
NULL);
stock_id = gimp_viewable_get_stock_id (preview->viewable);
pixbuf = gtk_widget_render_icon (GTK_WIDGET (preview),
stock_id,
GTK_ICON_SIZE_DIALOG,
NULL);
if (pixbuf)
{
width = gdk_pixbuf_get_width (pixbuf);

View File

@ -967,8 +967,9 @@ gimp_preview_real_render (GimpPreview *preview)
}
else /* no preview available */
{
GdkPixbuf *pixbuf;
gint width, height;
GdkPixbuf *pixbuf;
const gchar *stock_id;
gint width, height;
if (preview->buffer)
{
@ -982,10 +983,11 @@ gimp_preview_real_render (GimpPreview *preview)
preview->no_preview_pixbuf = NULL;
}
pixbuf = gtk_widget_render_icon (GTK_WIDGET (preview),
preview->viewable->stock_id,
GTK_ICON_SIZE_DIALOG,
NULL);
stock_id = gimp_viewable_get_stock_id (preview->viewable);
pixbuf = gtk_widget_render_icon (GTK_WIDGET (preview),
stock_id,
GTK_ICON_SIZE_DIALOG,
NULL);
if (pixbuf)
{
width = gdk_pixbuf_get_width (pixbuf);