Commit b8e8822c authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

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 #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.
parent 5448fc90
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.
......
......@@ -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
......
......@@ -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);
if (editor->data_editable != editable)
{
editor->data_editable = editable;
gtk_widget_set_sensitive (editor->name_entry, editor->data_editable);
gtk_widget_set_sensitive (editor->name_entry, editable);
gimp_docked_title_changed (GIMP_DOCKED (editor));
}
}
void
......
......@@ -57,6 +57,8 @@ struct _GimpDataEditorClass
/* virtual functions */
void (* set_data) (GimpDataEditor *editor,
GimpData *data);
const gchar *title;
};
......
......@@ -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
......
......@@ -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
......
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