Commit 932c9c8aa9c7b9c6352ec0f4398cf7d5f389ea8e
- Diff rendering mode:
- inline
- side by side
ChangeLog
(6 / 0)
|   | |||
| 1 | 2009-06-27 Tristan Van Berkom <tvb@gnome.org> | ||
| 2 | |||
| 3 | * plugins/gtk+/gtk+.xml.in, glade/gtk+/glade-gtk.c: Fixed GtkTextView crashes when | ||
| 4 | editing the textview in line, now we update the associated GtkTextBuffer:text property | ||
| 5 | if available or the GtkTextView:text virtual property when in libglade mode. | ||
| 6 | |||
| 1 | 7 | 2009-06-25 Tristan Van Berkom <tvb@gnome.org> | |
| 2 | 8 | ||
| 3 | 9 | * gladeui/glade-property.c: glade_property_sync_impl(), dont sync properties |
plugins/gtk+/glade-gtk.c
(71 / 16)
|   | |||
| 6951 | 6951 | image = gtk_image_new_from_stock (g_value_get_string (value), GTK_ICON_SIZE_MENU); | |
| 6952 | 6952 | gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (object), image); | |
| 6953 | 6953 | ||
| 6954 | if (use_underline) | ||
| 6955 | gtk_label_set_use_underline (GTK_LABEL (label), TRUE); | ||
| 6956 | |||
| 6954 | 6957 | /* Get the label string... */ | |
| 6955 | 6958 | if (text && gtk_stock_lookup (text, &item)) | |
| 6956 | 6959 | gtk_label_set_label (GTK_LABEL (label), item.label); | |
| … | … | ||
| 8459 | 8459 | return editable; | |
| 8460 | 8460 | } | |
| 8461 | 8461 | ||
| 8462 | /* ----------------------------- GtkTextView ------------------------------ */ | ||
| 8462 | |||
| 8463 | |||
| 8464 | /* ----------------------------- GtkTextBuffer ------------------------------ */ | ||
| 8463 | 8465 | static void | |
| 8464 | glade_gtk_text_view_changed (GtkTextBuffer *buffer, GladeWidget *gtext) | ||
| 8466 | glade_gtk_text_buffer_changed (GtkTextBuffer *buffer, GladeWidget *gbuffy) | ||
| 8465 | 8467 | { | |
| 8466 | const gchar *text_prop; | ||
| 8468 | const gchar *text_prop = NULL; | ||
| 8467 | 8469 | GladeProperty *prop; | |
| 8468 | gchar *text; | ||
| 8470 | gchar *text = NULL; | ||
| 8469 | 8471 | ||
| 8470 | 8472 | g_object_get (buffer, "text", &text, NULL); | |
| 8473 | |||
| 8474 | if ((prop = glade_widget_get_property (gbuffy, "text"))) | ||
| 8475 | { | ||
| 8476 | glade_property_get (prop, &text_prop); | ||
| 8471 | 8477 | ||
| 8472 | glade_widget_property_get (gtext, "text", &text_prop); | ||
| 8473 | |||
| 8474 | if (strcmp (text, text_prop)) | ||
| 8475 | if ((prop = glade_widget_get_property (gtext, "text"))) | ||
| 8478 | g_print ("setting new text on buffer %s: %s\n", gbuffy->name, text); | ||
| 8479 | |||
| 8480 | if (text_prop == NULL || text == NULL || strcmp (text, text_prop)) | ||
| 8476 | 8481 | glade_command_set_property (prop, text); | |
| 8482 | } | ||
| 8483 | g_free (text); | ||
| 8484 | } | ||
| 8485 | |||
| 8486 | void | ||
| 8487 | glade_gtk_text_buffer_post_create (GladeWidgetAdaptor *adaptor, | ||
| 8488 | GObject *object, | ||
| 8489 | GladeCreateReason reason) | ||
| 8490 | { | ||
| 8491 | GladeWidget *gbuffy; | ||
| 8477 | 8492 | ||
| 8493 | gbuffy = glade_widget_get_from_gobject (object); | ||
| 8494 | |||
| 8495 | g_signal_connect (object, "changed", | ||
| 8496 | G_CALLBACK (glade_gtk_text_buffer_changed), | ||
| 8497 | gbuffy); | ||
| 8498 | } | ||
| 8499 | |||
| 8500 | /* ----------------------------- GtkTextView ------------------------------ */ | ||
| 8501 | static void | ||
| 8502 | glade_gtk_text_view_changed (GtkTextBuffer *buffer, GladeWidget *gtext) | ||
| 8503 | { | ||
| 8504 | const gchar *text_prop = NULL; | ||
| 8505 | GladeProject *project; | ||
| 8506 | GladeProperty *prop; | ||
| 8507 | gchar *text = NULL; | ||
| 8508 | |||
| 8509 | g_object_get (buffer, "text", &text, NULL); | ||
| 8510 | |||
| 8511 | project = glade_widget_get_project (gtext); | ||
| 8512 | |||
| 8513 | if (glade_project_get_format (project) == GLADE_PROJECT_FORMAT_LIBGLADE) | ||
| 8514 | { | ||
| 8515 | if ((prop = glade_widget_get_property (gtext, "text"))) | ||
| 8516 | { | ||
| 8517 | glade_property_get (prop, &text_prop); | ||
| 8518 | |||
| 8519 | if (text_prop == NULL || text == NULL || strcmp (text, text_prop)) | ||
| 8520 | glade_command_set_property (prop, text); | ||
| 8521 | } | ||
| 8522 | } | ||
| 8478 | 8523 | g_free (text); | |
| 8479 | 8524 | } | |
| 8480 | 8525 | ||
| … | … | ||
| 8538 | 8538 | GObject *object, | |
| 8539 | 8539 | GladeCreateReason reason) | |
| 8540 | 8540 | { | |
| 8541 | GtkTextBuffer *buffy = gtk_text_buffer_new (NULL); | ||
| 8542 | GladeWidget *gtext; | ||
| 8541 | GtkTextBuffer *buffy; | ||
| 8542 | GladeWidget *gtext; | ||
| 8543 | GladeProject *project; | ||
| 8543 | 8544 | ||
| 8544 | 8545 | gtext = glade_widget_get_from_gobject (object); | |
| 8545 | 8546 | ||
| 8546 | 8547 | /* This makes gtk_text_view_set_buffer() stop complaing */ | |
| 8547 | 8548 | gtk_drag_dest_set (GTK_WIDGET (object), 0, NULL, 0, 0); | |
| 8548 | |||
| 8549 | gtk_text_view_set_buffer (GTK_TEXT_VIEW (object), buffy); | ||
| 8550 | g_signal_connect (buffy, "changed", | ||
| 8551 | G_CALLBACK (glade_gtk_text_view_changed), | ||
| 8552 | gtext); | ||
| 8549 | |||
| 8550 | project = glade_widget_get_project (gtext); | ||
| 8551 | |||
| 8552 | if (glade_project_get_format (project) == GLADE_PROJECT_FORMAT_LIBGLADE) | ||
| 8553 | { | ||
| 8554 | buffy = gtk_text_buffer_new (NULL); | ||
| 8555 | gtk_text_view_set_buffer (GTK_TEXT_VIEW (object), buffy); | ||
| 8556 | g_signal_connect (buffy, "changed", | ||
| 8557 | G_CALLBACK (glade_gtk_text_view_changed), | ||
| 8558 | gtext); | ||
| 8553 | 8559 | ||
| 8554 | g_object_unref (G_OBJECT (buffy)); | ||
| 8560 | g_object_unref (G_OBJECT (buffy)); | ||
| 8561 | } | ||
| 8555 | 8562 | ||
| 8556 | 8563 | /* Glade3 hangs when a TextView gets a double click. So we stop them */ | |
| 8557 | 8564 | g_signal_connect (object, "button-press-event", |
plugins/gtk+/gtk+.xml.in
(1 / 0)
|   | |||
| 3280 | 3280 | ||
| 3281 | 3281 | <glade-widget-class name="GtkTextBuffer" generic-name="textbuffer" _title="Text Buffer" | |
| 3282 | 3282 | libglade-unsupported="True" toplevel="True"> | |
| 3283 | <post-create-function>glade_gtk_text_buffer_post_create</post-create-function> | ||
| 3283 | 3284 | <signals> | |
| 3284 | 3285 | <signal id="paste-done" since="2.16"/> | |
| 3285 | 3286 | </signals> |

