[gnome-software/gnome-3-14] offline updates: Scrolled content of the error message dialog
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-14] offline updates: Scrolled content of the error message dialog
- Date: Sat, 18 Apr 2015 14:59:59 +0000 (UTC)
commit 1462c9b860f201a943a672408504c1111a369331
Author: Rafal Luzynski <digitalfreak lingonborough com>
Date: Tue Apr 7 19:52:28 2015 +0200
offline updates: Scrolled content of the error message dialog
The detailed error message text for the offline updates may
contain many lines and must be scrollable. With this fix we
insert GtkScrolledWindow containing the message into the dialog.
https://bugzilla.gnome.org/show_bug.cgi?id=747148
Signed-off-by: Richard Hughes <richard hughsie com>
src/gs-offline-updates.c | 28 +++++++++++++++++++++++++---
1 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-offline-updates.c b/src/gs-offline-updates.c
index 9004327..2187086 100644
--- a/src/gs-offline-updates.c
+++ b/src/gs-offline-updates.c
@@ -27,13 +27,22 @@
#include "gs-offline-updates.h"
#include "gs-utils.h"
+static void
+gs_offline_updates_label_allocate_cb (GtkWidget *label,
+ GdkRectangle *allocation, gpointer data)
+{
+ GtkScrolledWindow *sw = GTK_SCROLLED_WINDOW (data);
+ gtk_scrolled_window_set_min_content_height (
+ sw, MIN (allocation->height, 300));
+}
+
void
gs_offline_updates_show_error (void)
{
const gchar *title;
gboolean show_geeky = FALSE;
GString *msg;
- GtkWidget *dialog;
+ GtkWidget *dialog, *message_area, *sw, *label;
GError *error = NULL;
PkResults *results = NULL;
PkError *pk_error = NULL;
@@ -130,8 +139,21 @@ gs_offline_updates_show_error (void)
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"%s", title);
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- "%s", msg->str);
+
+ message_area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (dialog));
+ g_assert (GTK_IS_BOX (message_area));
+ sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_widget_set_visible (sw, TRUE);
+
+ label = gtk_label_new (msg->str);
+ gtk_widget_set_visible (label, TRUE);
+ g_signal_connect (label, "size-allocate",
+ G_CALLBACK (gs_offline_updates_label_allocate_cb), sw);
+ gtk_container_add (GTK_CONTAINER (sw), label);
+ gtk_container_add (GTK_CONTAINER (message_area), sw);
+
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
dialog);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]