116 lines
5.0 KiB
Diff
116 lines
5.0 KiB
Diff
# HG changeset patch
|
|
# Parent 8cba870a352ca71b53cebee7688847756eb3f5f7
|
|
# User Petr Jasicek <pjasicek@redhat.com>
|
|
Bug 1192243 - Fix Gtk3 crash reporter's ScrolledWindow and width. r=karlt
|
|
|
|
diff --git a/toolkit/crashreporter/client/crashreporter_linux.cpp b/toolkit/crashreporter/client/crashreporter_linux.cpp
|
|
--- a/toolkit/crashreporter/client/crashreporter_linux.cpp
|
|
+++ b/toolkit/crashreporter/client/crashreporter_linux.cpp
|
|
@@ -9,16 +9,18 @@
|
|
#include <gtk/gtk.h>
|
|
#include <string.h>
|
|
|
|
#include <cctype>
|
|
|
|
#include "crashreporter.h"
|
|
#include "crashreporter_gtk_common.h"
|
|
|
|
+#define LABEL_MAX_CHAR_WIDTH 48
|
|
+
|
|
using std::string;
|
|
using std::vector;
|
|
|
|
using namespace CrashReporter;
|
|
|
|
static GtkWidget* gViewReportButton = 0;
|
|
static GtkWidget* gCommentTextLabel = 0;
|
|
static GtkWidget* gCommentText = 0;
|
|
@@ -178,19 +180,22 @@ static void ViewReportClicked(GtkButton*
|
|
GTK_DIALOG_MODAL,
|
|
GTK_STOCK_OK,
|
|
GTK_RESPONSE_OK,
|
|
nullptr));
|
|
|
|
GtkWidget* scrolled = gtk_scrolled_window_new(0, 0);
|
|
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(dialog)), scrolled);
|
|
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
|
|
- GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
|
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
|
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled),
|
|
GTK_SHADOW_IN);
|
|
+#if (MOZ_WIDGET_GTK >= 3)
|
|
+ gtk_widget_set_vexpand(scrolled, TRUE);
|
|
+#endif
|
|
|
|
GtkWidget* viewReportTextView = gtk_text_view_new();
|
|
gtk_container_add(GTK_CONTAINER(scrolled), viewReportTextView);
|
|
gtk_text_view_set_editable(GTK_TEXT_VIEW(viewReportTextView), FALSE);
|
|
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(viewReportTextView),
|
|
GTK_WRAP_WORD);
|
|
gtk_widget_set_size_request(GTK_WIDGET(viewReportTextView), -1, 100);
|
|
|
|
@@ -407,17 +412,21 @@ bool UIShowCrashUI(const StringTable& fi
|
|
gStrings[ST_CRASHREPORTERHEADER].c_str());
|
|
gtk_label_set_markup(GTK_LABEL(titleLabel), markup);
|
|
g_free(markup);
|
|
|
|
GtkWidget* descriptionLabel =
|
|
gtk_label_new(gStrings[ST_CRASHREPORTERDESCRIPTION].c_str());
|
|
gtk_box_pack_start(GTK_BOX(vbox), descriptionLabel, TRUE, TRUE, 0);
|
|
// force the label to line wrap
|
|
+#if (MOZ_WIDGET_GTK == 2)
|
|
gtk_widget_set_size_request(descriptionLabel, 400, -1);
|
|
+#else
|
|
+ gtk_label_set_max_width_chars(GTK_LABEL(descriptionLabel), LABEL_MAX_CHAR_WIDTH);
|
|
+#endif
|
|
gtk_label_set_line_wrap(GTK_LABEL(descriptionLabel), TRUE);
|
|
gtk_label_set_selectable(GTK_LABEL(descriptionLabel), TRUE);
|
|
gtk_misc_set_alignment(GTK_MISC(descriptionLabel), 0, 0.5);
|
|
|
|
// this is honestly how they suggest you indent a section
|
|
GtkWidget* indentBox = gtk_hbox_new(FALSE, 0);
|
|
gtk_box_pack_start(GTK_BOX(vbox), indentBox, FALSE, FALSE, 0);
|
|
gtk_box_pack_start(GTK_BOX(indentBox), gtk_label_new(""), FALSE, FALSE, 6);
|
|
@@ -451,16 +460,19 @@ bool UIShowCrashUI(const StringTable& fi
|
|
g_signal_connect(gViewReportButton, "clicked", G_CALLBACK(ViewReportClicked), 0);
|
|
|
|
GtkWidget* scrolled = gtk_scrolled_window_new(0, 0);
|
|
gtk_container_add(GTK_CONTAINER(innerVBox), scrolled);
|
|
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
|
|
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
|
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled),
|
|
GTK_SHADOW_IN);
|
|
+#if (MOZ_WIDGET_GTK >= 3)
|
|
+ gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled), 100);
|
|
+#endif
|
|
|
|
gCommentTextLabel = gtk_label_new(gStrings[ST_COMMENTGRAYTEXT].c_str());
|
|
gCommentText = gtk_text_view_new();
|
|
gtk_label_set_mnemonic_widget(GTK_LABEL(gCommentTextLabel), gCommentText);
|
|
gtk_text_view_set_accepts_tab(GTK_TEXT_VIEW(gCommentText), FALSE);
|
|
g_signal_connect(gCommentText, "focus-in-event", G_CALLBACK(CommentFocusChange), 0);
|
|
g_signal_connect(gCommentText, "focus-out-event", G_CALLBACK(CommentFocusChange), 0);
|
|
|
|
@@ -509,17 +521,21 @@ bool UIShowCrashUI(const StringTable& fi
|
|
g_free(dir);
|
|
gThrobber = gtk_image_new_from_file(path);
|
|
gtk_box_pack_start(GTK_BOX(progressBox), gThrobber, FALSE, FALSE, 0);
|
|
|
|
gProgressLabel =
|
|
gtk_label_new(gStrings[ST_REPORTPRESUBMIT].c_str());
|
|
gtk_box_pack_start(GTK_BOX(progressBox), gProgressLabel, TRUE, TRUE, 0);
|
|
// force the label to line wrap
|
|
+#if (MOZ_WIDGET_GTK == 2)
|
|
gtk_widget_set_size_request(gProgressLabel, 400, -1);
|
|
+#else
|
|
+ gtk_label_set_max_width_chars(GTK_LABEL(gProgressLabel), LABEL_MAX_CHAR_WIDTH);
|
|
+#endif
|
|
gtk_label_set_line_wrap(GTK_LABEL(gProgressLabel), TRUE);
|
|
|
|
GtkWidget* buttonBox = gtk_hbutton_box_new();
|
|
gtk_box_pack_end(GTK_BOX(vbox), buttonBox, FALSE, FALSE, 0);
|
|
gtk_box_set_spacing(GTK_BOX(buttonBox), 6);
|
|
gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END);
|
|
|
|
gCloseButton =
|