[glade3] * plugins/gtk+/glade-model-data.c, plugins/gtk+/glade-attributes.c: Use GladeCellRendererIcon in
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] * plugins/gtk+/glade-model-data.c, plugins/gtk+/glade-attributes.c: Use GladeCellRendererIcon in
- Date: Mon, 29 Mar 2010 04:04:43 +0000 (UTC)
commit c4dc31af6fec6e6d80606e1aaf6d2d4b56f9a365
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Mon Mar 29 00:04:13 2010 -0400
* plugins/gtk+/glade-model-data.c, plugins/gtk+/glade-attributes.c: Use GladeCellRendererIcon
instead of GladeCellRendererButton which was more convoluted (included only an icon when editing).
* plugins/gtk+/Makefile.am: Removed glade-cell-renderer-button.[ch]
ChangeLog | 5 +
gladeui/glade-signal-editor.c | 4 +-
gladeui/glade.h | 1 +
plugins/gtk+/Makefile.am | 4 +-
plugins/gtk+/glade-attributes.c | 29 ++-
plugins/gtk+/glade-cell-renderer-button.c | 360 -----------------------------
plugins/gtk+/glade-cell-renderer-button.h | 57 -----
plugins/gtk+/glade-model-data.c | 29 ++-
8 files changed, 47 insertions(+), 442 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d90529b..4171cfc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,11 @@
* gladeui/glade-signal-editor.c: Use new activatable pixbuf renderer to render a devhelp icon
and fire signal contextual devhelp searches.
+ * plugins/gtk+/glade-model-data.c, plugins/gtk+/glade-attributes.c: Use GladeCellRendererIcon
+ instead of GladeCellRendererButton which was more convoluted (included only an icon when editing).
+
+ * plugins/gtk+/Makefile.am: Removed glade-cell-renderer-button.[ch]
+
2010-03-28 Marco Diego Aurélio Mesquita <marcodiegomesquita gmail com>
* gladeui/glade-base-editor.c: Avoid GtkEntry feedback loop with g_signal_handlers_block_by_func(),
diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c
index af8f8d8..0cb00b7 100644
--- a/gladeui/glade-signal-editor.c
+++ b/gladeui/glade-signal-editor.c
@@ -789,6 +789,8 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
g_object_set (G_OBJECT (renderer),
"width", 20,
NULL);
+ g_object_set_data (G_OBJECT (renderer), "signal-after-cell",
+ GINT_TO_POINTER (TRUE));
g_signal_connect (renderer, "toggled",
G_CALLBACK (glade_signal_editor_after_swapped_toggled), editor);
@@ -824,8 +826,6 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
}
gtk_tree_view_append_column (view, column);
- g_object_set_data (G_OBJECT (renderer), "signal-after-cell",
- GINT_TO_POINTER (TRUE));
editor->signals_list = view_widget;
diff --git a/gladeui/glade.h b/gladeui/glade.h
index 287f538..580fbc4 100644
--- a/gladeui/glade.h
+++ b/gladeui/glade.h
@@ -46,5 +46,6 @@
#include <gladeui/glade-name-context.h>
#include <gladeui/glade-editable.h>
#include <gladeui/glade-displayable-values.h>
+#include <gladeui/glade-cell-renderer-icon.h>
#endif /* __GLADE_H__ */
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 4147986..032397d 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -24,7 +24,7 @@ libgladegtk_la_CFLAGS = \
$(AM_CFLAGS)
libgladegtk_la_SOURCES = glade-gtk.c glade-accels.c glade-attributes.c glade-convert.c fixed-bg.xpm \
- glade-column-types.c glade-model-data.c glade-text-button.c glade-cell-renderer-button.c \
+ glade-column-types.c glade-model-data.c glade-text-button.c \
glade-icon-sources.c glade-button-editor.c glade-tool-button-editor.c glade-image-editor.c \
glade-image-item-editor.c glade-icon-factory-editor.c glade-store-editor.c glade-label-editor.c \
glade-cell-renderer-editor.c glade-treeview-editor.c glade-entry-editor.c glade-activatable-editor.c
@@ -34,7 +34,7 @@ libgladegtk_la_LIBADD = $(libgladeui) $(GTK_LIBS)
libgladegtkincludedir= $(includedir)/libgladeui-1.0/gladeui
libgladegtkinclude_HEADERS = glade-gtk.h glade-accels.h glade-attributes.h glade-column-types.h glade-model-data.h \
- glade-text-button.h glade-cell-renderer-button.h glade-icon-sources.h glade-button-editor.h \
+ glade-text-button.h glade-icon-sources.h glade-button-editor.h \
glade-tool-button-editor.h glade-image-editor.h glade-image-item-editor.h glade-icon-factory-editor.h \
glade-store-editor.h glade-label-editor.h glade-cell-renderer-editor.h glade-treeview-editor.h \
glade-entry-editor.h glade-activatable-editor.h
diff --git a/plugins/gtk+/glade-attributes.c b/plugins/gtk+/glade-attributes.c
index a1f2a44..0d945a5 100755
--- a/plugins/gtk+/glade-attributes.c
+++ b/plugins/gtk+/glade-attributes.c
@@ -32,7 +32,6 @@
#include <glib/gi18n-lib.h>
#include "glade-attributes.h"
-#include "glade-cell-renderer-button.h"
#define GLADE_RESPONSE_CLEAR 42
@@ -695,9 +694,9 @@ get_row_by_type (GtkTreeModel *model,
static void
-value_button_clicked (GtkCellRendererToggle *cell_renderer,
- gchar *path,
- GladeEPropAttrs *eprop_attrs)
+value_icon_activate (GtkCellRendererToggle *cell_renderer,
+ gchar *path,
+ GladeEPropAttrs *eprop_attrs)
{
GtkWidget *dialog;
GtkWidget *colorsel;
@@ -881,9 +880,9 @@ glade_eprop_attrs_view (GladeEditorProperty *eprop)
G_CALLBACK (value_toggled), eprop);
- /* Button renderer */
- renderer = glade_cell_renderer_button_new ();
- g_object_set (G_OBJECT (renderer), "entry-editable", FALSE, NULL);
+ /* Text renderer */
+ renderer = gtk_cell_renderer_text_new ();
+ g_object_set (G_OBJECT (renderer), "editable", FALSE, NULL);
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_attributes (column, renderer,
"editable", COLUMN_BUTTON_ACTIVE,
@@ -892,8 +891,20 @@ glade_eprop_attrs_view (GladeEditorProperty *eprop)
"style", COLUMN_TEXT_STYLE,
"foreground", COLUMN_TEXT_FG,
NULL);
- g_signal_connect (G_OBJECT (renderer), "clicked",
- G_CALLBACK (value_button_clicked), eprop);
+
+ /* Icon renderer */
+ renderer = glade_cell_renderer_icon_new ();
+ g_object_set (G_OBJECT (renderer),
+ "icon-name", GTK_STOCK_EDIT,
+ NULL);
+ gtk_tree_view_column_pack_start (column, renderer, FALSE);
+ gtk_tree_view_column_set_attributes (column, renderer,
+ "activatable", COLUMN_BUTTON_ACTIVE,
+ "visible", COLUMN_BUTTON_ACTIVE,
+ NULL);
+
+ g_signal_connect (G_OBJECT (renderer), "activate",
+ G_CALLBACK (value_icon_activate), eprop);
/* Combo renderer */
renderer = gtk_cell_renderer_combo_new ();
diff --git a/plugins/gtk+/glade-model-data.c b/plugins/gtk+/glade-model-data.c
index 57b5c6a..f17ff2e 100644
--- a/plugins/gtk+/glade-model-data.c
+++ b/plugins/gtk+/glade-model-data.c
@@ -30,7 +30,6 @@
#include "glade-model-data.h"
#include "glade-column-types.h"
-#include "glade-cell-renderer-button.h"
GladeModelData *
glade_model_data_new (GType type, const gchar *column_name)
@@ -666,9 +665,9 @@ value_toggled (GtkCellRendererToggle *cell,
}
static void
-value_i18n_clicked (GladeCellRendererButton *cell,
- const gchar *path,
- GladeEditorProperty *eprop)
+value_i18n_activate (GladeCellRendererIcon *cell,
+ const gchar *path,
+ GladeEditorProperty *eprop)
{
GladeEPropModelData *eprop_data = GLADE_EPROP_MODEL_DATA (eprop);
GtkTreeIter iter;
@@ -863,10 +862,7 @@ eprop_model_generate_column (GladeEditorProperty *eprop,
type == GDK_TYPE_PIXBUF)
{
/* Text renderer */
- if (type == G_TYPE_STRING)
- renderer = glade_cell_renderer_button_new ();
- else
- renderer = gtk_cell_renderer_text_new ();
+ renderer = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (renderer),
"editable", TRUE,
@@ -874,7 +870,6 @@ eprop_model_generate_column (GladeEditorProperty *eprop,
"width", 90,
NULL);
-
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_attributes (column, renderer,
"text", NUM_COLUMNS + colnum,
@@ -892,8 +887,18 @@ eprop_model_generate_column (GladeEditorProperty *eprop,
/* Trigger i18n dialog from here */
if (type == G_TYPE_STRING)
{
- g_signal_connect (G_OBJECT (renderer), "clicked",
- G_CALLBACK (value_i18n_clicked), eprop);
+ GtkCellRenderer *icon_renderer = glade_cell_renderer_icon_new ();
+
+ g_object_set (G_OBJECT (icon_renderer),
+ "activatable", TRUE,
+ "icon-name", GTK_STOCK_EDIT,
+ NULL);
+
+ gtk_tree_view_column_pack_start (column, icon_renderer, FALSE);
+
+ g_object_set_data (G_OBJECT (icon_renderer), "column-number", GINT_TO_POINTER (colnum));
+ g_signal_connect (G_OBJECT (icon_renderer), "activate",
+ G_CALLBACK (value_i18n_activate), eprop);
}
}
@@ -1261,7 +1266,7 @@ glade_eprop_model_data_create_input (GladeEditorProperty *eprop)
G_CALLBACK (eprop_treeview_key_press),
eprop);
-
+ gtk_tree_view_set_grid_lines (GTK_TREE_VIEW (eprop_data->view), GTK_TREE_VIEW_GRID_LINES_BOTH);
gtk_tree_view_set_reorderable (GTK_TREE_VIEW (eprop_data->view), TRUE);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (eprop_data->view), TRUE);
gtk_container_add (GTK_CONTAINER (swin), GTK_WIDGET (eprop_data->view));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]