implement GimpDocked::get_title() and add "(read only)" to the dialog's

2005-04-16  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpdataeditor.[ch]: implement
	GimpDocked::get_title() and add "(read only)" to the dialog's
	title if the data is not editable. Fixes bug .

	(gimp_data_editor_real_set_data): call gimp_docked_title_changed()
	when the editable state changes.

	(struct GimpDataEditorClass): added "const gchar *title" member.

	* app/widgets/gimpbrusheditor.c
	* app/widgets/gimpgradienteditor.c
	* app/widgets/gimppaletteeditor.c (class_init): set titles.
This commit is contained in:
Michael Natterer 2005-04-16 20:48:33 +00:00 committed by Michael Natterer
parent 5448fc9056
commit b8e8822c7d
6 changed files with 48 additions and 6 deletions

View File

@ -1,3 +1,18 @@
2005-04-16 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpdataeditor.[ch]: implement
GimpDocked::get_title() and add "(read only)" to the dialog's
title if the data is not editable. Fixes bug #164003.
(gimp_data_editor_real_set_data): call gimp_docked_title_changed()
when the editable state changes.
(struct GimpDataEditorClass): added "const gchar *title" member.
* app/widgets/gimpbrusheditor.c
* app/widgets/gimpgradienteditor.c
* app/widgets/gimppaletteeditor.c (class_init): set titles.
2005-04-16 Sven Neumann <sven@gimp.org>
* libgimpbase/gimpbase.def: added gimp_desaturate_mode_get_type.

View File

@ -99,6 +99,7 @@ gimp_brush_editor_class_init (GimpBrushEditorClass *klass)
parent_class = g_type_class_peek_parent (klass);
editor_class->set_data = gimp_brush_editor_set_data;
editor_class->title = _("Brush Editor");
}
static void

View File

@ -73,6 +73,7 @@ static void gimp_data_editor_dispose (GObject *object);
static void gimp_data_editor_set_aux_info (GimpDocked *docked,
GList *aux_info);
static GList * gimp_data_editor_get_aux_info (GimpDocked *docked);
static gchar * gimp_data_editor_get_title (GimpDocked *docked);
static void gimp_data_editor_real_set_data (GimpDataEditor *editor,
GimpData *data);
@ -185,6 +186,7 @@ gimp_data_editor_docked_iface_init (GimpDockedInterface *docked_iface)
{
docked_iface->set_aux_info = gimp_data_editor_set_aux_info;
docked_iface->get_aux_info = gimp_data_editor_get_aux_info;
docked_iface->get_title = gimp_data_editor_get_title;
}
static GObject *
@ -329,10 +331,24 @@ gimp_data_editor_get_aux_info (GimpDocked *docked)
return aux_info;
}
static gchar *
gimp_data_editor_get_title (GimpDocked *docked)
{
GimpDataEditor *editor = GIMP_DATA_EDITOR (docked);
GimpDataEditorClass *editor_class = GIMP_DATA_EDITOR_GET_CLASS (editor);
if (editor->data_editable)
return g_strdup (editor_class->title);
else
return g_strdup_printf (_("%s (read only)"), editor_class->title);
}
static void
gimp_data_editor_real_set_data (GimpDataEditor *editor,
GimpData *data)
{
gboolean editable;
if (editor->data)
{
g_signal_handlers_disconnect_by_func (editor->data,
@ -360,9 +376,15 @@ gimp_data_editor_real_set_data (GimpDataEditor *editor,
gtk_entry_set_text (GTK_ENTRY (editor->name_entry), "");
}
editor->data_editable = (editor->data && editor->data->writable);
editable = (editor->data && editor->data->writable);
gtk_widget_set_sensitive (editor->name_entry, editor->data_editable);
if (editor->data_editable != editable)
{
editor->data_editable = editable;
gtk_widget_set_sensitive (editor->name_entry, editable);
gimp_docked_title_changed (GIMP_DOCKED (editor));
}
}
void

View File

@ -57,6 +57,8 @@ struct _GimpDataEditorClass
/* virtual functions */
void (* set_data) (GimpDataEditor *editor,
GimpData *data);
const gchar *title;
};

View File

@ -277,6 +277,7 @@ gimp_gradient_editor_class_init (GimpGradientEditorClass *klass)
object_class->constructor = gimp_gradient_editor_constructor;
editor_class->set_data = gimp_gradient_editor_set_data;
editor_class->title = _("Gradient Editor");
}
static void

View File

@ -184,13 +184,14 @@ gimp_palette_editor_class_init (GimpPaletteEditorClass *klass)
parent_class = g_type_class_peek_parent (klass);
object_class->constructor = gimp_palette_editor_constructor;
object_class->constructor = gimp_palette_editor_constructor;
gtk_object_class->destroy = gimp_palette_editor_destroy;
gtk_object_class->destroy = gimp_palette_editor_destroy;
widget_class->unmap = gimp_palette_editor_unmap;
widget_class->unmap = gimp_palette_editor_unmap;
editor_class->set_data = gimp_palette_editor_set_data;
editor_class->set_data = gimp_palette_editor_set_data;
editor_class->title = _("Palette Editor");
}
static void