[Patch] Icon Tree improvements
Nicolas Centa <[email protected]> Sun, 26 Oct 2003 19:23:24 +0100
| Newsgroups | gmane.editors.mlview.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello In this patch : some icon tree modifications. See the screenshot :-) http://happypeng.free.fr/mlview-icons.png Nicolas Centa "HappyPeng"
patch.diff
(application/octet-stream, 6.4 KB)
? patch.diff
? pixmaps/folder_violet_open.png
Index: pixmaps/Makefile.am
===================================================================
RCS file: /cvs/gnome/mlview/pixmaps/Makefile.am,v
retrieving revision 1.6
diff -a -u -r1.6 Makefile.am
--- pixmaps/Makefile.am 26 Oct 2003 09:53:12 -0000 1.6
+++ pixmaps/Makefile.am 26 Oct 2003 18:18:23 -0000
@@ -6,6 +6,7 @@
mlview-app-icon.xpm \
control-center2.png \
folder_violet.png \
+ folder_violet_open.png \
misc_doc.png \
txt.png \
unknown.png \
Index: src/mlview-icon-tree.c
===================================================================
RCS file: /cvs/gnome/mlview/src/mlview-icon-tree.c,v
retrieving revision 1.1
diff -a -u -r1.1 mlview-icon-tree.c
--- src/mlview-icon-tree.c 26 Oct 2003 09:53:13 -0000 1.1
+++ src/mlview-icon-tree.c 26 Oct 2003 18:18:24 -0000
@@ -11,6 +11,7 @@
ARE_ATTRIBUTES_EDITABLE_COLUMN,
/*the first visible column, etc.*/
ICON_COLUMN,
+ OPEN_ICON_COLUMN,
NODE_COLUMN,
ATTRIBUTES_COLUMN,
/*
@@ -100,6 +101,7 @@
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
GDK_TYPE_PIXBUF,
+ GDK_TYPE_PIXBUF,
G_TYPE_STRING,
G_TYPE_STRING);
g_return_val_if_fail (model, MLVIEW_BAD_PARAM_ERROR);
@@ -124,7 +126,10 @@
"<span foreground=\"#bbbb00\">XML Document Root</span>", -1);
gtk_tree_store_set (model, &iter, ICON_COLUMN,
MLVIEW_ICON_TREE_CLASS
- (G_OBJECT_GET_CLASS (a_this))->icons.root,
+ (G_OBJECT_GET_CLASS (a_this))->icons.root,
+ OPEN_ICON_COLUMN,
+ MLVIEW_ICON_TREE_CLASS
+ (G_OBJECT_GET_CLASS (a_this))->icons.root,
ARE_ATTRIBUTES_EDITABLE_COLUMN, FALSE, -1);
xml_tree = a_doc->children;
status = build_tree_model_from_xml_tree
@@ -253,6 +258,9 @@
TRUE, ICON_COLUMN,
MLVIEW_ICON_TREE_CLASS
(G_OBJECT_GET_CLASS (a_this))->icons.element,
+ OPEN_ICON_COLUMN,
+ MLVIEW_ICON_TREE_CLASS
+ (G_OBJECT_GET_CLASS (a_this))->icons.open_element,
ATTRIBUTES_COLUMN,
mlview_tree_editor2_build_attrs_list_str (cur_node),
ARE_ATTRIBUTES_EDITABLE_COLUMN,
@@ -270,7 +278,7 @@
} else if (cur_node->type == XML_TEXT_NODE) {
gtk_tree_store_set (model, &iter,
IS_EDITABLE_COLUMN,
- TRUE, ICON_COLUMN,
+ TRUE, OPEN_ICON_COLUMN,
MLVIEW_ICON_TREE_CLASS
(G_OBJECT_GET_CLASS (a_this))->icons.text,
ARE_ATTRIBUTES_EDITABLE_COLUMN,
@@ -280,7 +288,7 @@
gtk_tree_store_set (model, &iter,
IS_EDITABLE_COLUMN,
FALSE,
- ICON_COLUMN,
+ OPEN_ICON_COLUMN,
MLVIEW_ICON_TREE_CLASS
(G_OBJECT_GET_CLASS (a_this))->icons.comment,
ARE_ATTRIBUTES_EDITABLE_COLUMN,
@@ -290,7 +298,7 @@
gtk_tree_store_set (model, &iter,
IS_EDITABLE_COLUMN,
FALSE,
- ICON_COLUMN,
+ OPEN_ICON_COLUMN,
MLVIEW_ICON_TREE_CLASS
(G_OBJECT_GET_CLASS (a_this))->icons.pi,
ARE_ATTRIBUTES_EDITABLE_COLUMN,
@@ -715,6 +723,7 @@
enum MlViewStatus status = MLVIEW_OK ;
struct MlViewAppSettings *settings = NULL ;
gboolean is_ok = TRUE ;
+ GtkTreeViewColumn *column;
g_return_val_if_fail (a_this
&& MLVIEW_IS_TREE_EDITOR2 (a_this)
@@ -740,22 +749,26 @@
g_return_val_if_fail (tree_view, NULL);
+ column = gtk_tree_view_column_new ();
+ gtk_tree_view_column_set_title (column, _("Element name"));
renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_tree_view_insert_column_with_attributes
- (tree_view, ICON_COLUMN, "", renderer, "pixbuf", ICON_COLUMN, NULL);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes
- (tree_view, NODE_COLUMN, _("Element name"),
- renderer, "markup", NODE_COLUMN,
- "editable", IS_EDITABLE_COLUMN, NULL);
- g_signal_connect (G_OBJECT (renderer),
- "edited", G_CALLBACK (node_cell_edited_cb),
- a_this) ;
+ gtk_tree_view_column_pack_start (column, renderer, FALSE);
+ gtk_tree_view_column_set_attributes (column, renderer,
+ "pixbuf", OPEN_ICON_COLUMN,
+ "pixbuf-expander-open", OPEN_ICON_COLUMN,
+ "pixbuf-expander-closed", ICON_COLUMN,
+ NULL);
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_tree_view_column_pack_start (column, renderer, FALSE);
+ gtk_tree_view_column_set_attributes (column, renderer,
+ "markup", NODE_COLUMN,
+ "editable", IS_EDITABLE_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (tree_view, column);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes
- (tree_view, ATTRIBUTES_COLUMN, _("Attributes"),
+ (tree_view, 1, _("Attributes"),
renderer, "markup", ATTRIBUTES_COLUMN, "editable",
ARE_ATTRIBUTES_EDITABLE_COLUMN, NULL);
g_signal_connect (G_OBJECT (renderer),
@@ -780,6 +793,11 @@
g_free (path);
path = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_DATADIR,
+ "pixmaps/folder_violet_open.png", TRUE, NULL);
+ a_klass->icons.open_element = gdk_pixbuf_new_from_file (path, NULL);
+ g_free (path);
+
+ path = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_APP_DATADIR,
"pixmaps/txt.png", TRUE, NULL);
a_klass->icons.text = gdk_pixbuf_new_from_file (path, NULL);
g_free (path);
@@ -804,6 +822,7 @@
mlview_icon_tree_free_icons (MlViewIconTreeClass *a_klass)
{
g_object_unref (G_OBJECT (a_klass->icons.element));
+ g_object_unref (G_OBJECT (a_klass->icons.open_element));
g_object_unref (G_OBJECT (a_klass->icons.text));
g_object_unref (G_OBJECT (a_klass->icons.root));
g_object_unref (G_OBJECT (a_klass->icons.comment));
Index: src/mlview-icon-tree.h
===================================================================
RCS file: /cvs/gnome/mlview/src/mlview-icon-tree.h,v
retrieving revision 1.1
diff -a -u -r1.1 mlview-icon-tree.h
--- src/mlview-icon-tree.h 26 Oct 2003 09:53:13 -0000 1.1
+++ src/mlview-icon-tree.h 26 Oct 2003 18:18:24 -0000
@@ -53,6 +53,7 @@
struct
{
GdkPixbuf *element;
+ GdkPixbuf *open_element;
GdkPixbuf *text;
GdkPixbuf *root;
GdkPixbuf *comment;
pixmaps.tar.gz
(application/gzip, 992 B) - not displayed