2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-02-13 21:17:15 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2001-04-22 08:38:56 +08:00
|
|
|
* gimpdatafactoryview.c
|
2003-03-19 22:54:37 +08:00
|
|
|
* Copyright (C) 2001-2003 Michael Natterer <mitch@gimp.org>
|
2001-04-22 08:38:56 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-02-13 21:17:15 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-02-13 21:17:15 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2001-02-13 21:17:15 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2004-12-11 06:11:29 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2001-02-13 21:17:15 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "widgets-types.h"
|
2001-02-13 21:17:15 +08:00
|
|
|
|
2002-12-01 00:31:39 +08:00
|
|
|
#include "config/gimpbaseconfig.h"
|
|
|
|
|
|
|
|
#include "core/gimp.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpcontainer.h"
|
|
|
|
#include "core/gimpcontext.h"
|
|
|
|
#include "core/gimpdata.h"
|
|
|
|
#include "core/gimpdatafactory.h"
|
2008-12-20 22:46:54 +08:00
|
|
|
#include "core/gimpfilteredcontainer.h"
|
|
|
|
#include "core/gimplist.h"
|
2001-05-09 10:32:03 +08:00
|
|
|
#include "core/gimpmarshal.h"
|
|
|
|
|
2008-12-20 22:46:54 +08:00
|
|
|
#include "gimpcombotagentry.h"
|
2001-02-13 21:17:15 +08:00
|
|
|
#include "gimpcontainergridview.h"
|
2003-03-19 22:54:37 +08:00
|
|
|
#include "gimpcontainertreeview.h"
|
2008-12-05 05:58:45 +08:00
|
|
|
#include "gimpcontainerview.h"
|
|
|
|
#include "gimpdatafactoryview.h"
|
2001-02-19 03:44:28 +08:00
|
|
|
#include "gimpdnd.h"
|
2008-12-20 22:46:54 +08:00
|
|
|
#include "gimptagentry.h"
|
2004-05-12 00:05:21 +08:00
|
|
|
#include "gimpuimanager.h"
|
2008-12-05 05:58:45 +08:00
|
|
|
#include "gimpviewrenderer.h"
|
2001-07-09 05:44:52 +08:00
|
|
|
#include "gimpwidgets-utils.h"
|
2001-05-08 11:48:54 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2001-02-13 21:17:15 +08:00
|
|
|
|
|
|
|
|
2008-12-20 20:08:28 +08:00
|
|
|
struct _GimpDataFactoryViewPriv
|
|
|
|
{
|
|
|
|
GimpDataFactory *factory;
|
|
|
|
|
2008-12-20 22:46:54 +08:00
|
|
|
GimpContainer *tag_filtered_container;
|
|
|
|
GtkWidget *query_tag_entry;
|
|
|
|
GtkWidget *assign_tag_entry;
|
|
|
|
GList *selected_items;
|
|
|
|
|
2008-12-20 20:08:28 +08:00
|
|
|
GtkWidget *edit_button;
|
|
|
|
GtkWidget *new_button;
|
|
|
|
GtkWidget *duplicate_button;
|
|
|
|
GtkWidget *delete_button;
|
|
|
|
GtkWidget *refresh_button;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-05-12 00:05:21 +08:00
|
|
|
static void gimp_data_factory_view_activate_item (GimpContainerEditor *editor,
|
|
|
|
GimpViewable *viewable);
|
2008-12-20 22:46:54 +08:00
|
|
|
static void gimp_data_factory_view_select_item (GimpContainerEditor *editor,
|
|
|
|
GimpViewable *viewable);
|
2004-05-12 00:05:21 +08:00
|
|
|
static void gimp_data_factory_view_tree_name_edited (GtkCellRendererText *cell,
|
|
|
|
const gchar *path,
|
|
|
|
const gchar *name,
|
|
|
|
GimpDataFactoryView *view);
|
2001-02-14 09:42:12 +08:00
|
|
|
|
2001-02-13 21:17:15 +08:00
|
|
|
|
2005-12-20 06:37:49 +08:00
|
|
|
G_DEFINE_TYPE (GimpDataFactoryView, gimp_data_factory_view,
|
2006-05-15 17:46:31 +08:00
|
|
|
GIMP_TYPE_CONTAINER_EDITOR)
|
2001-02-13 21:17:15 +08:00
|
|
|
|
2005-12-20 06:37:49 +08:00
|
|
|
#define parent_class gimp_data_factory_view_parent_class
|
2001-02-13 21:17:15 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2001-02-14 03:53:07 +08:00
|
|
|
gimp_data_factory_view_class_init (GimpDataFactoryViewClass *klass)
|
2001-02-13 21:17:15 +08:00
|
|
|
{
|
2004-05-11 18:01:25 +08:00
|
|
|
GimpContainerEditorClass *editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass);
|
2001-02-13 21:17:15 +08:00
|
|
|
|
2008-12-20 22:46:54 +08:00
|
|
|
editor_class->select_item = gimp_data_factory_view_select_item;
|
2001-06-30 03:25:03 +08:00
|
|
|
editor_class->activate_item = gimp_data_factory_view_activate_item;
|
2008-12-20 20:08:28 +08:00
|
|
|
|
|
|
|
g_type_class_add_private (klass, sizeof (GimpDataFactoryViewPriv));
|
2001-02-13 21:17:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-02-14 03:53:07 +08:00
|
|
|
gimp_data_factory_view_init (GimpDataFactoryView *view)
|
2001-02-13 21:17:15 +08:00
|
|
|
{
|
2008-12-20 20:08:28 +08:00
|
|
|
view->priv = G_TYPE_INSTANCE_GET_PRIVATE (view,
|
|
|
|
GIMP_TYPE_DATA_FACTORY_VIEW,
|
|
|
|
GimpDataFactoryViewPriv);
|
2008-12-20 22:46:54 +08:00
|
|
|
|
|
|
|
view->priv->tag_filtered_container = NULL;
|
|
|
|
view->priv->query_tag_entry = NULL;
|
|
|
|
view->priv->assign_tag_entry = NULL;
|
|
|
|
view->priv->selected_items = NULL;
|
|
|
|
view->priv->edit_button = NULL;
|
|
|
|
view->priv->new_button = NULL;
|
|
|
|
view->priv->duplicate_button = NULL;
|
|
|
|
view->priv->delete_button = NULL;
|
|
|
|
view->priv->refresh_button = NULL;
|
2001-02-13 21:17:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *
|
2001-11-30 22:41:56 +08:00
|
|
|
gimp_data_factory_view_new (GimpViewType view_type,
|
2004-08-26 06:31:44 +08:00
|
|
|
GimpDataFactory *factory,
|
|
|
|
GimpContext *context,
|
2006-01-17 18:08:50 +08:00
|
|
|
gint view_size,
|
|
|
|
gint view_border_width,
|
2004-08-26 06:31:44 +08:00
|
|
|
GimpMenuFactory *menu_factory,
|
2004-04-22 00:33:17 +08:00
|
|
|
const gchar *menu_identifier,
|
2004-05-12 00:05:21 +08:00
|
|
|
const gchar *ui_identifier,
|
|
|
|
const gchar *action_group)
|
2001-02-13 21:17:15 +08:00
|
|
|
{
|
2001-02-14 03:53:07 +08:00
|
|
|
GimpDataFactoryView *factory_view;
|
2001-02-13 21:17:15 +08:00
|
|
|
|
2001-08-10 22:41:39 +08:00
|
|
|
factory_view = g_object_new (GIMP_TYPE_DATA_FACTORY_VIEW, NULL);
|
2001-02-14 03:53:07 +08:00
|
|
|
|
2001-06-30 03:25:03 +08:00
|
|
|
if (! gimp_data_factory_view_construct (factory_view,
|
2004-08-26 06:31:44 +08:00
|
|
|
view_type,
|
|
|
|
factory,
|
|
|
|
context,
|
2006-01-17 18:08:50 +08:00
|
|
|
view_size,
|
|
|
|
view_border_width,
|
2004-08-26 06:31:44 +08:00
|
|
|
menu_factory,
|
2004-04-22 00:33:17 +08:00
|
|
|
menu_identifier,
|
2004-05-12 00:05:21 +08:00
|
|
|
ui_identifier,
|
|
|
|
action_group))
|
2001-06-30 03:25:03 +08:00
|
|
|
{
|
2003-01-06 06:07:10 +08:00
|
|
|
g_object_unref (factory_view);
|
2001-06-30 03:25:03 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GTK_WIDGET (factory_view);
|
|
|
|
}
|
|
|
|
|
2008-12-20 20:08:28 +08:00
|
|
|
GtkWidget *
|
|
|
|
gimp_data_factory_view_get_edit_button (GimpDataFactoryView *factory_view)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DATA_FACTORY_VIEW (factory_view), NULL);
|
|
|
|
|
|
|
|
return factory_view->priv->edit_button;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkWidget *
|
|
|
|
gimp_data_factory_view_get_duplicate_button (GimpDataFactoryView *factory_view)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DATA_FACTORY_VIEW (factory_view), NULL);
|
|
|
|
|
|
|
|
return factory_view->priv->duplicate_button;
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpDataFactory *
|
|
|
|
gimp_data_factory_view_get_data_factory (GimpDataFactoryView *factory_view)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DATA_FACTORY_VIEW (factory_view), NULL);
|
|
|
|
|
|
|
|
return factory_view->priv->factory;
|
|
|
|
}
|
|
|
|
|
2008-12-20 20:27:52 +08:00
|
|
|
GType
|
|
|
|
gimp_data_factory_view_get_children_type (GimpDataFactoryView *factory_view)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DATA_FACTORY_VIEW (factory_view), G_TYPE_NONE);
|
|
|
|
|
|
|
|
return gimp_container_get_children_type (gimp_data_factory_get_container (factory_view->priv->factory));
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_data_factory_view_has_data_new_func (GimpDataFactoryView *factory_view)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DATA_FACTORY_VIEW (factory_view), FALSE);
|
|
|
|
|
|
|
|
return gimp_data_factory_has_data_new_func (factory_view->priv->factory);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_data_factory_view_have (GimpDataFactoryView *factory_view,
|
|
|
|
GimpObject *object)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_DATA_FACTORY_VIEW (factory_view), FALSE);
|
|
|
|
|
|
|
|
return gimp_container_have (gimp_data_factory_get_container (factory_view->priv->factory),
|
|
|
|
object);
|
|
|
|
}
|
|
|
|
|
2001-06-30 03:25:03 +08:00
|
|
|
gboolean
|
2001-11-30 22:41:56 +08:00
|
|
|
gimp_data_factory_view_construct (GimpDataFactoryView *factory_view,
|
2004-08-26 06:31:44 +08:00
|
|
|
GimpViewType view_type,
|
|
|
|
GimpDataFactory *factory,
|
|
|
|
GimpContext *context,
|
2006-01-17 18:08:50 +08:00
|
|
|
gint view_size,
|
|
|
|
gint view_border_width,
|
2004-08-26 06:31:44 +08:00
|
|
|
GimpMenuFactory *menu_factory,
|
2004-04-22 00:33:17 +08:00
|
|
|
const gchar *menu_identifier,
|
2004-05-12 00:05:21 +08:00
|
|
|
const gchar *ui_identifier,
|
|
|
|
const gchar *action_group)
|
2001-06-30 03:25:03 +08:00
|
|
|
{
|
|
|
|
GimpContainerEditor *editor;
|
2004-05-12 00:05:21 +08:00
|
|
|
gchar *str;
|
2001-06-30 03:25:03 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_DATA_FACTORY_VIEW (factory_view), FALSE);
|
|
|
|
g_return_val_if_fail (GIMP_IS_DATA_FACTORY (factory), FALSE);
|
2006-01-17 18:08:50 +08:00
|
|
|
g_return_val_if_fail (view_size > 0 &&
|
|
|
|
view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE, FALSE);
|
|
|
|
g_return_val_if_fail (view_border_width >= 0 &&
|
|
|
|
view_border_width <= GIMP_VIEW_MAX_BORDER_WIDTH,
|
2003-04-08 20:39:02 +08:00
|
|
|
FALSE);
|
2001-06-30 03:25:03 +08:00
|
|
|
|
2008-12-20 20:08:28 +08:00
|
|
|
factory_view->priv->factory = factory;
|
2001-02-13 21:17:15 +08:00
|
|
|
|
2008-12-20 22:46:54 +08:00
|
|
|
factory_view->priv->tag_filtered_container =
|
|
|
|
gimp_filtered_container_new (gimp_data_factory_get_container (factory),
|
|
|
|
(GCompareFunc) gimp_data_compare);
|
|
|
|
|
2001-06-26 20:09:43 +08:00
|
|
|
if (! gimp_container_editor_construct (GIMP_CONTAINER_EDITOR (factory_view),
|
2004-08-26 06:31:44 +08:00
|
|
|
view_type,
|
2008-12-20 22:46:54 +08:00
|
|
|
factory_view->priv->tag_filtered_container, context,
|
2006-01-17 18:08:50 +08:00
|
|
|
view_size, view_border_width,
|
2004-08-26 06:31:44 +08:00
|
|
|
menu_factory, menu_identifier,
|
2004-04-22 00:33:17 +08:00
|
|
|
ui_identifier))
|
2001-02-13 21:17:15 +08:00
|
|
|
{
|
2001-06-30 03:25:03 +08:00
|
|
|
return FALSE;
|
2001-02-13 21:17:15 +08:00
|
|
|
}
|
|
|
|
|
2001-06-30 03:25:03 +08:00
|
|
|
editor = GIMP_CONTAINER_EDITOR (factory_view);
|
2001-02-14 22:57:14 +08:00
|
|
|
|
2003-03-19 22:54:37 +08:00
|
|
|
if (GIMP_IS_CONTAINER_TREE_VIEW (editor->view))
|
|
|
|
{
|
|
|
|
GimpContainerTreeView *tree_view;
|
|
|
|
|
|
|
|
tree_view = GIMP_CONTAINER_TREE_VIEW (editor->view);
|
|
|
|
|
2008-06-29 00:05:05 +08:00
|
|
|
gimp_container_tree_view_connect_name_edited (tree_view,
|
|
|
|
G_CALLBACK (gimp_data_factory_view_tree_name_edited),
|
|
|
|
factory_view);
|
2003-03-19 22:54:37 +08:00
|
|
|
}
|
|
|
|
|
2004-09-27 18:45:49 +08:00
|
|
|
str = g_strdup_printf ("%s-edit", action_group);
|
2008-12-20 20:08:28 +08:00
|
|
|
factory_view->priv->edit_button =
|
2004-09-27 18:45:49 +08:00
|
|
|
gimp_editor_add_action_button (GIMP_EDITOR (editor->view), action_group,
|
|
|
|
str, NULL);
|
|
|
|
g_free (str);
|
2003-09-18 06:54:48 +08:00
|
|
|
|
2008-12-20 20:27:52 +08:00
|
|
|
if (gimp_data_factory_view_has_data_new_func (factory_view))
|
2004-03-17 22:14:18 +08:00
|
|
|
{
|
2004-05-12 00:05:21 +08:00
|
|
|
str = g_strdup_printf ("%s-new", action_group);
|
2008-12-20 20:08:28 +08:00
|
|
|
factory_view->priv->new_button =
|
2004-05-12 00:05:21 +08:00
|
|
|
gimp_editor_add_action_button (GIMP_EDITOR (editor->view), action_group,
|
2004-05-13 02:36:33 +08:00
|
|
|
str, NULL);
|
2004-05-12 00:05:21 +08:00
|
|
|
g_free (str);
|
2004-03-17 22:14:18 +08:00
|
|
|
}
|
2001-08-05 04:38:54 +08:00
|
|
|
|
2004-05-12 00:05:21 +08:00
|
|
|
str = g_strdup_printf ("%s-duplicate", action_group);
|
2008-12-20 20:08:28 +08:00
|
|
|
factory_view->priv->duplicate_button =
|
2004-05-12 00:05:21 +08:00
|
|
|
gimp_editor_add_action_button (GIMP_EDITOR (editor->view), action_group,
|
2004-05-13 02:36:33 +08:00
|
|
|
str, NULL);
|
2004-05-12 00:05:21 +08:00
|
|
|
g_free (str);
|
|
|
|
|
|
|
|
str = g_strdup_printf ("%s-delete", action_group);
|
2008-12-20 20:08:28 +08:00
|
|
|
factory_view->priv->delete_button =
|
2004-05-12 00:05:21 +08:00
|
|
|
gimp_editor_add_action_button (GIMP_EDITOR (editor->view), action_group,
|
2004-05-13 02:36:33 +08:00
|
|
|
str, NULL);
|
2004-05-12 00:05:21 +08:00
|
|
|
g_free (str);
|
|
|
|
|
|
|
|
str = g_strdup_printf ("%s-refresh", action_group);
|
2008-12-20 20:08:28 +08:00
|
|
|
factory_view->priv->refresh_button =
|
2004-05-12 00:05:21 +08:00
|
|
|
gimp_editor_add_action_button (GIMP_EDITOR (editor->view), action_group,
|
2004-05-13 02:36:33 +08:00
|
|
|
str, NULL);
|
2004-05-12 00:05:21 +08:00
|
|
|
g_free (str);
|
2001-08-05 04:38:54 +08:00
|
|
|
|
2008-12-20 22:46:54 +08:00
|
|
|
/* Query tag entry */
|
|
|
|
factory_view->priv->query_tag_entry =
|
|
|
|
gimp_combo_tag_entry_new (GIMP_FILTERED_CONTAINER (factory_view->priv->tag_filtered_container),
|
|
|
|
GIMP_TAG_ENTRY_MODE_QUERY);
|
|
|
|
gtk_widget_show (factory_view->priv->query_tag_entry);
|
|
|
|
gtk_box_pack_start (GTK_BOX (editor->view),
|
|
|
|
factory_view->priv->query_tag_entry,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
gtk_box_reorder_child (GTK_BOX (editor->view),
|
|
|
|
factory_view->priv->query_tag_entry, 0);
|
|
|
|
|
|
|
|
/* Assign tag entry */
|
|
|
|
factory_view->priv->assign_tag_entry =
|
|
|
|
gimp_combo_tag_entry_new (GIMP_FILTERED_CONTAINER (factory_view->priv->tag_filtered_container),
|
|
|
|
GIMP_TAG_ENTRY_MODE_ASSIGN);
|
|
|
|
gimp_tag_entry_set_selected_items (GIMP_TAG_ENTRY (factory_view->priv->assign_tag_entry),
|
|
|
|
factory_view->priv->selected_items);
|
|
|
|
g_list_free (factory_view->priv->selected_items);
|
|
|
|
factory_view->priv->selected_items = NULL;
|
|
|
|
gtk_widget_show (factory_view->priv->assign_tag_entry);
|
|
|
|
gtk_box_pack_start (GTK_BOX (editor->view),
|
|
|
|
factory_view->priv->assign_tag_entry,
|
|
|
|
FALSE, FALSE, 0);
|
|
|
|
|
2004-09-27 18:45:49 +08:00
|
|
|
gimp_container_view_enable_dnd (editor->view,
|
2008-12-20 20:08:28 +08:00
|
|
|
GTK_BUTTON (factory_view->priv->edit_button),
|
2008-12-20 05:58:17 +08:00
|
|
|
gimp_container_get_children_type (gimp_data_factory_get_container (factory)));
|
2001-08-05 04:38:54 +08:00
|
|
|
gimp_container_view_enable_dnd (editor->view,
|
2008-12-20 20:08:28 +08:00
|
|
|
GTK_BUTTON (factory_view->priv->duplicate_button),
|
2008-12-20 05:58:17 +08:00
|
|
|
gimp_container_get_children_type (gimp_data_factory_get_container (factory)));
|
2001-08-05 04:38:54 +08:00
|
|
|
gimp_container_view_enable_dnd (editor->view,
|
2008-12-20 20:08:28 +08:00
|
|
|
GTK_BUTTON (factory_view->priv->delete_button),
|
2008-12-20 05:58:17 +08:00
|
|
|
gimp_container_get_children_type (gimp_data_factory_get_container (factory)));
|
2001-06-30 03:25:03 +08:00
|
|
|
|
2004-05-12 00:05:21 +08:00
|
|
|
gimp_ui_manager_update (GIMP_EDITOR (editor->view)->ui_manager, editor);
|
2001-02-18 05:20:10 +08:00
|
|
|
|
2004-05-12 00:05:21 +08:00
|
|
|
return TRUE;
|
2001-02-14 09:42:12 +08:00
|
|
|
}
|
|
|
|
|
2008-12-20 22:46:54 +08:00
|
|
|
static void
|
|
|
|
gimp_data_factory_view_select_item (GimpContainerEditor *editor,
|
|
|
|
GimpViewable *viewable)
|
|
|
|
{
|
|
|
|
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (editor);
|
|
|
|
|
|
|
|
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item)
|
|
|
|
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item (editor, viewable);
|
|
|
|
|
|
|
|
if (view->priv->assign_tag_entry)
|
|
|
|
{
|
|
|
|
GList *active_items = NULL;
|
|
|
|
|
|
|
|
if (viewable)
|
|
|
|
{
|
|
|
|
active_items = g_list_append (active_items, viewable);
|
|
|
|
}
|
|
|
|
gimp_tag_entry_set_selected_items (GIMP_TAG_ENTRY (view->priv->assign_tag_entry),
|
|
|
|
active_items);
|
|
|
|
g_list_free (active_items);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
view->priv->selected_items = g_list_append (view->priv->selected_items, viewable);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-02-19 03:44:28 +08:00
|
|
|
static void
|
2001-06-30 03:25:03 +08:00
|
|
|
gimp_data_factory_view_activate_item (GimpContainerEditor *editor,
|
2004-08-26 06:31:44 +08:00
|
|
|
GimpViewable *viewable)
|
2001-02-19 03:44:28 +08:00
|
|
|
{
|
2004-05-12 00:05:21 +08:00
|
|
|
GimpDataFactoryView *view = GIMP_DATA_FACTORY_VIEW (editor);
|
|
|
|
GimpData *data = GIMP_DATA (viewable);
|
2001-06-30 03:25:03 +08:00
|
|
|
|
|
|
|
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->activate_item)
|
|
|
|
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->activate_item (editor, viewable);
|
|
|
|
|
2008-12-20 20:27:52 +08:00
|
|
|
if (data && gimp_data_factory_view_have (view,
|
|
|
|
GIMP_OBJECT (data)))
|
2001-02-19 03:44:28 +08:00
|
|
|
{
|
2008-12-20 20:08:28 +08:00
|
|
|
if (view->priv->edit_button && GTK_WIDGET_SENSITIVE (view->priv->edit_button))
|
|
|
|
gtk_button_clicked (GTK_BUTTON (view->priv->edit_button));
|
2001-02-19 03:44:28 +08:00
|
|
|
}
|
|
|
|
}
|
2003-03-19 22:54:37 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_data_factory_view_tree_name_edited (GtkCellRendererText *cell,
|
|
|
|
const gchar *path_str,
|
|
|
|
const gchar *new_name,
|
|
|
|
GimpDataFactoryView *view)
|
|
|
|
{
|
|
|
|
GimpContainerTreeView *tree_view;
|
|
|
|
GtkTreePath *path;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
|
|
|
tree_view = GIMP_CONTAINER_TREE_VIEW (GIMP_CONTAINER_EDITOR (view)->view);
|
|
|
|
|
|
|
|
path = gtk_tree_path_new_from_string (path_str);
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter (tree_view->model, &iter, path))
|
|
|
|
{
|
2004-08-26 06:31:44 +08:00
|
|
|
GimpViewRenderer *renderer;
|
|
|
|
GimpData *data;
|
2006-05-30 19:56:42 +08:00
|
|
|
gchar *name;
|
2003-03-19 22:54:37 +08:00
|
|
|
|
|
|
|
gtk_tree_model_get (tree_view->model, &iter,
|
2008-11-16 04:01:55 +08:00
|
|
|
GIMP_CONTAINER_TREE_VIEW_COLUMN_RENDERER, &renderer,
|
2003-03-19 22:54:37 +08:00
|
|
|
-1);
|
|
|
|
|
|
|
|
data = GIMP_DATA (renderer->viewable);
|
|
|
|
|
2006-05-30 19:56:42 +08:00
|
|
|
if (! new_name)
|
|
|
|
new_name = "";
|
2004-12-11 05:07:28 +08:00
|
|
|
|
2006-05-30 19:56:42 +08:00
|
|
|
name = g_strstrip (g_strdup (new_name));
|
2004-12-11 05:07:28 +08:00
|
|
|
|
2006-05-30 19:56:42 +08:00
|
|
|
if (data->writable && strlen (name))
|
2004-02-06 06:17:14 +08:00
|
|
|
{
|
2006-05-30 19:56:42 +08:00
|
|
|
gimp_object_take_name (GIMP_OBJECT (data), name);
|
2004-02-06 06:17:14 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-30 19:56:42 +08:00
|
|
|
g_free (name);
|
2004-02-06 06:17:14 +08:00
|
|
|
|
2006-05-30 19:56:42 +08:00
|
|
|
name = gimp_viewable_get_description (renderer->viewable, NULL);
|
2009-07-25 23:38:03 +08:00
|
|
|
gtk_tree_store_set (GTK_TREE_STORE (tree_view->model), &iter,
|
2008-11-16 04:01:55 +08:00
|
|
|
GIMP_CONTAINER_TREE_VIEW_COLUMN_NAME, name,
|
2004-02-06 06:17:14 +08:00
|
|
|
-1);
|
|
|
|
g_free (name);
|
|
|
|
}
|
2003-03-19 22:54:37 +08:00
|
|
|
|
|
|
|
g_object_unref (renderer);
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|