glade3 r1984 - in trunk: . gladeui
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r1984 - in trunk: . gladeui
- Date: Tue, 21 Oct 2008 15:04:02 +0000 (UTC)
Author: tvb
Date: Tue Oct 21 15:04:02 2008
New Revision: 1984
URL: http://svn.gnome.org/viewvc/glade3?rev=1984&view=rev
Log:
* gladeui/glade-editor.c, gladeui/glade-editor-property.c: Implemented something
based on Pavel's patch, wordwrapping in the editor works better now.
* gladeui/glade-project.c: Fixed regression, now the inspector updates on widget
name changes.
Modified:
trunk/ChangeLog
trunk/gladeui/glade-editor-property.c
trunk/gladeui/glade-editor.c
trunk/gladeui/glade-project.c
trunk/gladeui/glade-property-class.c
Modified: trunk/gladeui/glade-editor-property.c
==============================================================================
--- trunk/gladeui/glade-editor-property.c (original)
+++ trunk/gladeui/glade-editor-property.c Tue Oct 21 15:04:02 2008
@@ -248,6 +248,43 @@
}
+#define EDITOR_COLUMN_SIZE 90
+
+static void
+eprop_item_label_size_request (GtkWidget *widget, GtkRequisition *requisition,
+ GladeEditorProperty *eprop)
+{
+ requisition->width = EDITOR_COLUMN_SIZE;
+}
+
+static void
+eprop_item_label_size_allocate_after (GtkWidget *widget, GtkAllocation *allocation,
+ GladeEditorProperty *eprop)
+{
+ gint width = EDITOR_COLUMN_SIZE;
+ gint icon_width = 0;
+
+ if (GTK_WIDGET_VISIBLE (eprop->warning))
+ {
+ GtkRequisition req = { -1, -1 };
+ gtk_widget_size_request (eprop->warning, &req);
+ /* Here we have to subtract the icon and remaining
+ * padding inside eprop->item_label so that we are
+ * only dealing with the size of the label.
+ * (note the '4' here comes from the hbox spacing).
+ */
+ icon_width = req.width + 4;
+ }
+
+ if (allocation->width > width)
+ width = allocation->width;
+
+ gtk_widget_set_size_request (eprop->label, width - icon_width, -1);
+ /* Sometimes labels aren't drawn correctly after resize without this */
+ gtk_widget_queue_draw (eprop->label);
+}
+
+
static GObject *
glade_editor_property_constructor (GType type,
guint n_construct_properties,
@@ -256,7 +293,7 @@
GtkRequisition req = { -1, -1 };
GObject *obj;
GladeEditorProperty *eprop;
- GtkWidget *hbox, *alignment;
+ GtkWidget *hbox;
/* Invoke parent constructor (eprop->klass should be resolved by this point) . */
obj = G_OBJECT_CLASS (table_class)->constructor
@@ -286,10 +323,10 @@
/* Create & setup label */
eprop->item_label = gtk_event_box_new ();
- alignment = gtk_alignment_new (1.0, 0.5, 0.0, 0.0);
- hbox = gtk_hbox_new (FALSE, 4);
eprop->label = gtk_label_new (NULL);
+ hbox = gtk_hbox_new (FALSE, 4);
+
gtk_label_set_line_wrap (GTK_LABEL(eprop->label), TRUE);
gtk_label_set_line_wrap_mode (GTK_LABEL(eprop->label), PANGO_WRAP_WORD_CHAR);
@@ -298,13 +335,17 @@
gtk_widget_size_request (eprop->label, &req);
gtk_widget_set_size_request(GTK_WIDGET(eprop->label), req.width, -1);
- gtk_label_set_justify (GTK_LABEL(eprop->label), GTK_JUSTIFY_RIGHT);
+ /* A Hack to that PANGO_WRAP_WORD_CHAR works nicely */
+ g_signal_connect (G_OBJECT (eprop->item_label), "size-request",
+ G_CALLBACK (eprop_item_label_size_request), eprop);
+ g_signal_connect_after (G_OBJECT (eprop->item_label), "size-allocate",
+ G_CALLBACK (eprop_item_label_size_allocate_after), eprop);
+
gtk_misc_set_alignment (GTK_MISC(eprop->label), 1.0, 0.5);
- gtk_box_pack_start (GTK_BOX (hbox), eprop->warning, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), eprop->label, TRUE, TRUE, 0);
- gtk_container_add (GTK_CONTAINER (alignment), hbox);
- gtk_container_add (GTK_CONTAINER (eprop->item_label), alignment);
+ gtk_box_pack_start (GTK_BOX (hbox), eprop->warning, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (eprop->item_label), hbox);
gtk_widget_show_all (eprop->item_label);
glade_editor_property_fix_label (eprop);
Modified: trunk/gladeui/glade-editor.c
==============================================================================
--- trunk/gladeui/glade-editor.c (original)
+++ trunk/gladeui/glade-editor.c Tue Oct 21 15:04:02 2008
@@ -497,7 +497,7 @@
{
gtk_table_attach (GTK_TABLE (table), child,
pos, pos+1, row, row +1,
- pos ? GTK_EXPAND | GTK_FILL : GTK_FILL,
+ GTK_EXPAND | GTK_FILL,
GTK_EXPAND | GTK_FILL,
3, 1);
}
@@ -541,7 +541,7 @@
/* Name */
label = gtk_label_new (_("Name:"));
- gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_widget_show (label);
table->name_entry = gtk_entry_new ();
Modified: trunk/gladeui/glade-project.c
==============================================================================
--- trunk/gladeui/glade-project.c (original)
+++ trunk/gladeui/glade-project.c Tue Oct 21 15:04:02 2008
@@ -2384,6 +2384,10 @@
glade_project_release_widget_name (project, widget, widget->name);
glade_widget_set_name (widget, new_name);
+ g_signal_emit (G_OBJECT (project),
+ glade_project_signals [WIDGET_NAME_CHANGED],
+ 0, widget);
+
g_free (new_name);
}
Modified: trunk/gladeui/glade-property-class.c
==============================================================================
--- trunk/gladeui/glade-property-class.c (original)
+++ trunk/gladeui/glade-property-class.c Tue Oct 21 15:04:02 2008
@@ -678,7 +678,7 @@
object = G_OBJECT (gtk_adjustment_new (value, lower, upper, step_increment, page_increment, page_size));
}
- else
+ else if (project)
{
GladeWidget *gwidget;
if ((gwidget = glade_project_get_widget_by_name
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]