glade3 r1986 - in trunk: . gladeui plugins/gtk+
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r1986 - in trunk: . gladeui plugins/gtk+
- Date: Tue, 21 Oct 2008 20:49:03 +0000 (UTC)
Author: tvb
Date: Tue Oct 21 20:49:03 2008
New Revision: 1986
URL: http://svn.gnome.org/viewvc/glade3?rev=1986&view=rev
Log:
* plugins/gtk+/glade-attributes.c: Use glade-cell-renderer-button for color attributes.
* plugins/gtk+/glade-cell-renderer-button.c: no more button-text property
* plugins/gtk+/glade-text-button.c: Now use a GTK_STOCK_EDIT icon in the cell renderer button
Modified:
trunk/ChangeLog
trunk/gladeui/glade-property.c
trunk/gladeui/glade-widget.c
trunk/plugins/gtk+/glade-attributes.c
trunk/plugins/gtk+/glade-cell-renderer-button.c
trunk/plugins/gtk+/glade-model-data.c
trunk/plugins/gtk+/glade-text-button.c
Modified: trunk/gladeui/glade-property.c
==============================================================================
--- trunk/gladeui/glade-property.c (original)
+++ trunk/gladeui/glade-property.c Tue Oct 21 20:49:03 2008
@@ -1003,7 +1003,6 @@
GladeProjectFormat fmt;
GValue *gvalue = NULL;
gchar /* *id, *name, */ *value;
- const gchar *search_name;
gint translatable, has_context;
gchar *comment = NULL, *context = NULL;
Modified: trunk/gladeui/glade-widget.c
==============================================================================
--- trunk/gladeui/glade-widget.c (original)
+++ trunk/gladeui/glade-widget.c Tue Oct 21 20:49:03 2008
@@ -767,9 +767,6 @@
/* We do not keep a reference to internal widgets */
if (widget->internal == NULL)
{
- g_print ("Destroying internal object (gtkobject %d), ref count %d\n",
- GTK_IS_OBJECT (widget->object), widget->object->ref_count);
-
if (GTK_IS_OBJECT (widget->object))
gtk_object_destroy (GTK_OBJECT (widget->object));
else
@@ -2499,7 +2496,6 @@
GladeProperty *
glade_widget_get_property (GladeWidget *widget, const gchar *id_property)
{
- GList *list;
GladeProperty *property;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
@@ -2522,7 +2518,6 @@
GladeProperty *
glade_widget_get_pack_property (GladeWidget *widget, const gchar *id_property)
{
- GList *list;
GladeProperty *property;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
Modified: trunk/plugins/gtk+/glade-attributes.c
==============================================================================
--- trunk/plugins/gtk+/glade-attributes.c (original)
+++ trunk/plugins/gtk+/glade-attributes.c Tue Oct 21 20:49:03 2008
@@ -32,7 +32,7 @@
#include <glib/gi18n-lib.h>
#include "glade-attributes.h"
-
+#include "glade-cell-renderer-button.h"
#define GLADE_RESPONSE_CLEAR 42
@@ -212,7 +212,7 @@
COLUMN_TOGGLE_ACTIVE, /* whether the toggle renderer is being used */
COLUMN_TOGGLE_DOWN, /* whether the toggle should be displayed in "downstate" */
- COLUMN_TEXT_ACTIVE, /* whether the bare naked text renderer is being used (to launch dialogs) */
+ COLUMN_BUTTON_ACTIVE, /* whether the GladeCellRendererButton is to be used (to launch dialogs) */
COLUMN_TEXT, /* text attribute value for all text derived renderers */
COLUMN_TEXT_STYLE, /* whether to make italic */
COLUMN_TEXT_FG, /* forground colour of the text */
@@ -238,7 +238,7 @@
#define ACTIVATE_COLUMN_FROM_TYPE(type) \
((type) == EDIT_TOGGLE ? COLUMN_TOGGLE_ACTIVE : \
(type) == EDIT_SPIN ? COLUMN_SPIN_ACTIVE : \
- (type) == EDIT_COMBO ? COLUMN_COMBO_ACTIVE: COLUMN_TEXT_ACTIVE)
+ (type) == EDIT_COMBO ? COLUMN_COMBO_ACTIVE: COLUMN_BUTTON_ACTIVE)
static GtkListStore *
get_enum_model_for_combo (PangoAttrType type)
@@ -841,10 +841,9 @@
}
static void
-value_text_editing_started (GtkCellRenderer *renderer,
- GtkCellEditable *editable,
- gchar *path,
- GladeEPropAttrs *eprop_attrs)
+value_button_clicked (GtkCellRendererToggle *cell_renderer,
+ gchar *path,
+ GladeEPropAttrs *eprop_attrs)
{
GtkWidget *dialog;
GtkTreeIter iter;
@@ -853,9 +852,6 @@
GdkColor color;
gchar *text = NULL, *new_text;
- /* stop emission */
- g_signal_stop_emission_by_name (G_OBJECT (renderer), "editing-started");
-
/* Find type etc */
if (!gtk_tree_model_get_iter_from_string (eprop_attrs->model, &iter, path))
return;
@@ -987,7 +983,7 @@
/* Editor renderer related */
G_TYPE_BOOLEAN, // COLUMN_TOGGLE_ACTIVE
G_TYPE_BOOLEAN, // COLUMN_TOGGLE_DOWN
- G_TYPE_BOOLEAN, // COLUMN_TEXT_ACTIVE
+ G_TYPE_BOOLEAN, // COLUMN_BUTTON_ACTIVE
G_TYPE_STRING, // COLUMN_TEXT
G_TYPE_INT, // COLUMN_TEXT_STYLE
G_TYPE_STRING, // COLUMN_TEXT_FG
@@ -1017,7 +1013,6 @@
gtk_tree_view_column_set_title (column, _("Value"));
-
/* Toggle renderer */
renderer = gtk_cell_renderer_toggle_new ();
g_object_set (G_OBJECT (renderer), "activatable", TRUE, NULL);
@@ -1030,17 +1025,21 @@
G_CALLBACK (value_toggled), eprop);
/* Text renderer */
- renderer = gtk_cell_renderer_text_new ();
- g_object_set (G_OBJECT (renderer), "editable", TRUE, NULL);
+ renderer = glade_cell_renderer_button_new ();
+ g_object_set (G_OBJECT (renderer),
+ "editable", TRUE,
+ "entry-editable", FALSE,
+ NULL);
gtk_tree_view_column_pack_start (column, renderer, FALSE);
gtk_tree_view_column_set_attributes (column, renderer,
- "visible", COLUMN_TEXT_ACTIVE,
+ "visible", COLUMN_BUTTON_ACTIVE,
"text", COLUMN_TEXT,
"style", COLUMN_TEXT_STYLE,
"foreground", COLUMN_TEXT_FG,
NULL);
- g_signal_connect (G_OBJECT (renderer), "editing-started",
- G_CALLBACK (value_text_editing_started), eprop);
+
+ g_signal_connect (G_OBJECT (renderer), "clicked",
+ G_CALLBACK (value_button_clicked), eprop);
/* Combo renderer */
renderer = gtk_cell_renderer_combo_new ();
Modified: trunk/plugins/gtk+/glade-cell-renderer-button.c
==============================================================================
--- trunk/plugins/gtk+/glade-cell-renderer-button.c (original)
+++ trunk/plugins/gtk+/glade-cell-renderer-button.c Tue Oct 21 20:49:03 2008
@@ -33,7 +33,6 @@
typedef struct
{
gboolean entry_editable;
- gchar *button_text;
} GladeCellRendererButtonPrivate;
static void glade_cell_renderer_button_finalize (GObject *object);
@@ -56,8 +55,7 @@
GtkCellRendererState flags);
enum {
PROP_0,
- PROP_ENTRY_EDITABLE,
- PROP_BUTTON_TEXT
+ PROP_ENTRY_EDITABLE
};
@@ -85,21 +83,13 @@
cell_class->start_editing = glade_cell_renderer_button_start_editing;
g_object_class_install_property (object_class,
- PROP_BUTTON_TEXT,
+ PROP_ENTRY_EDITABLE,
g_param_spec_boolean ("entry-editable",
_("Entry Editable"),
_("Whether the entry is editable"),
TRUE,
G_PARAM_READWRITE));
- g_object_class_install_property (object_class,
- PROP_BUTTON_TEXT,
- g_param_spec_string ("button-text",
- _("Button Text"),
- _("The text to display in the button"),
- NULL,
- G_PARAM_READWRITE));
-
glade_cell_renderer_signals[CLICKED] =
g_signal_new ("clicked",
G_OBJECT_CLASS_TYPE (object_class),
@@ -120,7 +110,6 @@
priv = GLADE_CELL_RENDERER_BUTTON_GET_PRIVATE (self);
priv->entry_editable = TRUE;
- priv->button_text = NULL;
}
static void
@@ -130,10 +119,6 @@
priv = GLADE_CELL_RENDERER_BUTTON_GET_PRIVATE (object);
- if (priv)
- {
- g_free (priv->button_text);
- }
G_OBJECT_CLASS (glade_cell_renderer_button_parent_class)->finalize (object);
}
@@ -154,9 +139,6 @@
case PROP_ENTRY_EDITABLE:
g_value_set_boolean (value, priv->entry_editable);
break;
- case PROP_BUTTON_TEXT:
- g_value_set_string (value, priv->button_text);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -180,11 +162,6 @@
case PROP_ENTRY_EDITABLE:
priv->entry_editable = g_value_get_boolean (value);
break;
- case PROP_BUTTON_TEXT:
- if (priv->button_text)
- g_free (priv->button_text);
- priv->button_text = g_value_dup_string (value);
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -264,7 +241,6 @@
text_button = (GladeTextButton *)glade_text_button_new ();
gtk_entry_set_text (GTK_ENTRY (text_button->entry), cell_text->text);
gtk_entry_set_editable (GTK_ENTRY (text_button->entry), priv->entry_editable);
- gtk_button_set_label (GTK_BUTTON (text_button->button), priv->button_text);
g_object_set (text_button->entry,
"has-frame", FALSE,
Modified: trunk/plugins/gtk+/glade-model-data.c
==============================================================================
--- trunk/plugins/gtk+/glade-model-data.c (original)
+++ trunk/plugins/gtk+/glade-model-data.c Tue Oct 21 20:49:03 2008
@@ -735,10 +735,7 @@
{
/* Text renderer */
if (type == G_TYPE_STRING)
- {
renderer = glade_cell_renderer_button_new ();
- g_object_set (renderer, "button-text", "\342\200\246", NULL);
- }
else
renderer = gtk_cell_renderer_text_new ();
Modified: trunk/plugins/gtk+/glade-text-button.c
==============================================================================
--- trunk/plugins/gtk+/glade-text-button.c (original)
+++ trunk/plugins/gtk+/glade-text-button.c Tue Oct 21 20:49:03 2008
@@ -62,25 +62,32 @@
static void
glade_text_button_init (GladeTextButton *self)
{
- gtk_alignment_set_padding (GTK_ALIGNMENT (self), 1, 1, 2, 2);
+ GtkWidget *image;
- self->hbox = gtk_hbox_new (FALSE, 2);
-
- gtk_container_add (GTK_CONTAINER (self), self->hbox);
-
- self->entry = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX (self->hbox), self->entry, TRUE, TRUE, 0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (self), 1, 1, 2, 2);
- self->button = gtk_button_new ();
- gtk_box_pack_start (GTK_BOX (self->hbox), self->button, FALSE, FALSE, 0);
+ self->hbox = gtk_hbox_new (FALSE, 2);
+
+ gtk_container_add (GTK_CONTAINER (self), self->hbox);
+
+ self->entry = gtk_entry_new ();
+ gtk_box_pack_start (GTK_BOX (self->hbox), self->entry, TRUE, TRUE, 0);
+
+ self->button = gtk_button_new ();
+ gtk_box_pack_start (GTK_BOX (self->hbox), self->button, FALSE, FALSE, 0);
+
+ image = gtk_image_new_from_stock (GTK_STOCK_EDIT,
+ GTK_ICON_SIZE_MENU);
+ gtk_widget_show (image);
+ gtk_container_add (GTK_CONTAINER (self->button), image);
}
static void
glade_text_button_clicked (GtkWidget *widget,
GladeTextButton *button)
{
- gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (button));
- gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (button));
+ gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (button));
+ gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (button));
}
/* GtkCellEditable method implementations
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]