From 7fcb41292307b043a7e8c3ba0377347aaec1eb46 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 24 Nov 2012 21:51:54 +0100 Subject: GTK: display "..." at end of info popup if it wouldn't fit on the screen * this is a simple workaround so that a window too large to fit in memory is not constructed --- gtk-info-popup.gob | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gtk-info-popup.gob b/gtk-info-popup.gob index 54c62fb..914647a 100644 --- a/gtk-info-popup.gob +++ b/gtk-info-popup.gob @@ -102,11 +102,17 @@ class Gtk:Info:Popup from Gtk:Window { }; GtkWidget *vbox = gtk_bin_get_child(GTK_BIN(self)); + GdkScreen *screen = gtk_window_get_screen(GTK_WINDOW(self)); + GtkRequisition req; GtkWidget *hbox; GtkWidget *label; gchar *markup; + gtk_widget_size_request(GTK_WIDGET(self), &req); + if (req.height > gdk_screen_get_height(screen)) + return; + hbox = gtk_hbox_new(FALSE, 5); if (type2stock[type]) { @@ -133,6 +139,14 @@ class Gtk:Info:Popup from Gtk:Window { gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_widget_show_all(hbox); + + gtk_widget_size_request(GTK_WIDGET(self), &req); + if (req.height > gdk_screen_get_height(screen)) { + label = gtk_label_new("..."); + gtk_box_pack_start(GTK_BOX(vbox), label, + FALSE, FALSE, 0); + gtk_widget_show(label); + } } public void -- cgit v1.2.3