Commit 960c32e9 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

connect to "editing-canceled" of the name cell renderer and restore the

2004-07-06  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpcontainertreeview.c: connect to
	"editing-canceled" of the name cell renderer and restore the
	original text in the callback. Doesn't work reliably until GTK+
	bug #145463 is fixed.
parent 51aa9957
2004-07-06 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontainertreeview.c: connect to
"editing-canceled" of the name cell renderer and restore the
original text in the callback. Doesn't work reliably until GTK+
bug #145463 is fixed.
2004-07-05 Sven Neumann <sven@gimp.org> 2004-07-05 Sven Neumann <sven@gimp.org>
* app/plug-in/plug-in-rc.c (plug_in_icon_deserialize): fixed a * app/plug-in/plug-in-rc.c (plug_in_icon_deserialize): fixed a
......
...@@ -86,6 +86,9 @@ static gboolean gimp_container_tree_view_select_item (GimpContainerView *v ...@@ -86,6 +86,9 @@ static gboolean gimp_container_tree_view_select_item (GimpContainerView *v
static void gimp_container_tree_view_clear_items (GimpContainerView *view); static void gimp_container_tree_view_clear_items (GimpContainerView *view);
static void gimp_container_tree_view_set_preview_size (GimpContainerView *view); static void gimp_container_tree_view_set_preview_size (GimpContainerView *view);
static void gimp_container_tree_view_name_canceled (GtkCellRendererText *cell,
GimpContainerTreeView *tree_view);
static void gimp_container_tree_view_selection_changed (GtkTreeSelection *sel, static void gimp_container_tree_view_selection_changed (GtkTreeSelection *sel,
GimpContainerTreeView *tree_view); GimpContainerTreeView *tree_view);
static gboolean gimp_container_tree_view_button_press (GtkWidget *widget, static gboolean gimp_container_tree_view_button_press (GtkWidget *widget,
...@@ -259,6 +262,10 @@ gimp_container_tree_view_constructor (GType type, ...@@ -259,6 +262,10 @@ gimp_container_tree_view_constructor (GType type,
"attributes", COLUMN_NAME_ATTRIBUTES, "attributes", COLUMN_NAME_ATTRIBUTES,
NULL); NULL);
g_signal_connect (tree_view->name_cell, "editing-canceled",
G_CALLBACK (gimp_container_tree_view_name_canceled),
tree_view);
tree_view->renderer_cells = g_list_prepend (tree_view->renderer_cells, tree_view->renderer_cells = g_list_prepend (tree_view->renderer_cells,
tree_view->renderer_cell); tree_view->renderer_cell);
...@@ -727,6 +734,36 @@ gimp_container_tree_view_set_preview_size (GimpContainerView *view) ...@@ -727,6 +734,36 @@ gimp_container_tree_view_set_preview_size (GimpContainerView *view)
/* callbacks */ /* callbacks */
static void
gimp_container_tree_view_name_canceled (GtkCellRendererText *cell,
GimpContainerTreeView *tree_view)
{
GtkTreeIter iter;
g_print ("editing canceled\n");
if (gtk_tree_selection_get_selected (tree_view->selection, NULL, &iter))
{
GimpPreviewRenderer *renderer;
gchar *name;
gtk_tree_model_get (tree_view->model, &iter,
tree_view->model_column_renderer, &renderer,
-1);
name = gimp_viewable_get_description (renderer->viewable, NULL);
g_print ("restoring '%s'\n", name);
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), &iter,
tree_view->model_column_name, name,
-1);
g_free (name);
g_object_unref (renderer);
}
}
static void static void
gimp_container_tree_view_selection_changed (GtkTreeSelection *selection, gimp_container_tree_view_selection_changed (GtkTreeSelection *selection,
GimpContainerTreeView *tree_view) GimpContainerTreeView *tree_view)
...@@ -906,9 +943,6 @@ gimp_container_tree_view_button_press (GtkWidget *widget, ...@@ -906,9 +943,6 @@ gimp_container_tree_view_button_press (GtkWidget *widget,
{ {
if (edit_cell) if (edit_cell)
{ {
#ifdef __GNUC__
#warning FIXME: make sure the orig text gets restored when cancelling editing
#endif
if (edit_cell == tree_view->name_cell) if (edit_cell == tree_view->name_cell)
{ {
const gchar *real_name; const gchar *real_name;
......
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