gcalctool r2111 - in branches/gnome-2-22: . gcalctool
- From: rancell svn gnome org
- To: svn-commits-list gnome org
- Subject: gcalctool r2111 - in branches/gnome-2-22: . gcalctool
- Date: Sat, 14 Jun 2008 09:22:02 +0000 (UTC)
Author: rancell
Date: Sat Jun 14 09:22:01 2008
New Revision: 2111
URL: http://svn.gnome.org/viewvc/gcalctool?rev=2111&view=rev
Log:
Added workaround to stop display disappearing when editing large displays (Bug #524602)
Modified:
branches/gnome-2-22/ChangeLog
branches/gnome-2-22/gcalctool/gtk.c
Modified: branches/gnome-2-22/gcalctool/gtk.c
==============================================================================
--- branches/gnome-2-22/gcalctool/gtk.c (original)
+++ branches/gnome-2-22/gcalctool/gtk.c Sat Jun 14 09:22:01 2008
@@ -943,6 +943,27 @@
}
}
+static gboolean
+redo_display(gpointer data)
+{
+ gchar *text;
+ GtkTextIter start, end, cursor;
+ gint cursor_position;
+
+ gtk_text_buffer_get_start_iter(X->display_buffer, &start);
+ gtk_text_buffer_get_end_iter(X->display_buffer, &end);
+ text = gtk_text_buffer_get_text(X->display_buffer, &start, &end, FALSE);
+
+ g_object_get(G_OBJECT(X->display_buffer), "cursor-position", &cursor_position, NULL);
+
+ gtk_text_buffer_set_text(X->display_buffer, text, -1);
+ gtk_text_buffer_get_iter_at_offset(X->display_buffer, &cursor, cursor_position);
+ gtk_text_buffer_place_cursor(X->display_buffer, &cursor);
+
+ g_free(text);
+
+ return FALSE;
+}
void
ui_set_display(char *str, int cursor)
@@ -969,6 +990,13 @@
}
gtk_text_buffer_place_cursor(X->display_buffer, &iter);
+ /* This is a workaround for bug #524602.
+ * Basically the above code can cause the display to disappear when going from
+ * a display that is wider than the widget to one that is thinner. The following
+ * causes the display to be set twice which seems to work the second time.
+ */
+ g_idle_add(redo_display, NULL);
+
/* Align to the right */
if (cursor < 0) {
adj = gtk_scrolled_window_get_hadjustment(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]