parent
ef61d27e19
commit
df5243869d
@ -0,0 +1,34 @@
|
||||
From 1ed0116488c53f93fe4b8e9d607972dacc9b2146 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Wed, 20 Aug 2014 13:10:31 +0200
|
||||
Subject: [PATCH 21/33] Get rid of deprecation warnings introduced with
|
||||
gtk-3.13.6
|
||||
|
||||
Fixes #271
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/gtk-helpers/config_dialog.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/gtk-helpers/config_dialog.c b/src/gtk-helpers/config_dialog.c
|
||||
index 5370fcb..b65c217 100644
|
||||
--- a/src/gtk-helpers/config_dialog.c
|
||||
+++ b/src/gtk-helpers/config_dialog.c
|
||||
@@ -270,8 +270,13 @@ GtkWidget *create_config_tab_content(const char *column_label,
|
||||
g_object_set(G_OBJECT(renderer), "wrap-width", 440, NULL);
|
||||
gtk_tree_view_column_set_sort_column_id(column, COLUMN_NAME);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(tv), column);
|
||||
+
|
||||
+#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 13) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 13 && GTK_MICRO_VERSION < 6))
|
||||
+ /* https://bugzilla.gnome.org/show_bug.cgi?id=733312 */
|
||||
/* "Please draw rows in alternating colors": */
|
||||
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tv), TRUE);
|
||||
+#endif
|
||||
+
|
||||
// TODO: gtk_tree_view_set_headers_visible(FALSE)? We have only one column anyway...
|
||||
GtkTreeModel *model = gtk_tree_model_filter_new(GTK_TREE_MODEL(store), NULL);
|
||||
gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(model), config_filter_func, NULL, NULL);
|
||||
--
|
||||
2.1.0
|
||||
|
@ -0,0 +1,38 @@
|
||||
From 8bea4c9b68fcdb62879b603ba5c2914b6cd8c33a Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Tue, 26 Aug 2014 12:51:19 +0200
|
||||
Subject: [PATCH 22/33] wizard: terminate event chain after the emergency
|
||||
analysis
|
||||
|
||||
Resolves rhbz#1133549
|
||||
Related to rhbz#1069917
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/gui-wizard-gtk/wizard.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
|
||||
index e4718bf..5779052 100644
|
||||
--- a/src/gui-wizard-gtk/wizard.c
|
||||
+++ b/src/gui-wizard-gtk/wizard.c
|
||||
@@ -1752,6 +1752,16 @@ static bool event_need_review(const char *event_name)
|
||||
|
||||
static void on_btn_failed_cb(GtkButton *button)
|
||||
{
|
||||
+ /* Since the Repeat button has been introduced, the event chain isn't
|
||||
+ * terminated upon a failure in order to be able to continue in processing
|
||||
+ * in the retry action.
|
||||
+ *
|
||||
+ * Now, user decided to run the emergency analysis instead of trying to
|
||||
+ * reconfigure libreport, so we have to terminate the event chain.
|
||||
+ */
|
||||
+ gtk_widget_hide(g_btn_repeat);
|
||||
+ terminate_event_chain(TERMINATE_NOFLAGS);
|
||||
+
|
||||
/* Show detailed log */
|
||||
gtk_expander_set_expanded(g_exp_report_log, TRUE);
|
||||
|
||||
--
|
||||
2.1.0
|
||||
|
46
0023-lib-don-t-spit-unnecessary-debug-messages.patch
Normal file
46
0023-lib-don-t-spit-unnecessary-debug-messages.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From 9bfb39ab7a7a1aa71726bcae242d483b003869dc Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Tue, 26 Aug 2014 22:13:02 +0200
|
||||
Subject: [PATCH 23/33] lib: don't spit unnecessary debug messages
|
||||
|
||||
Related to rhbz#1133674
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/lib/dump_dir.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c
|
||||
index 28439af..045a45b 100644
|
||||
--- a/src/lib/dump_dir.c
|
||||
+++ b/src/lib/dump_dir.c
|
||||
@@ -251,7 +251,7 @@ static const char *dd_check(struct dump_dir *dd)
|
||||
dd->dd_time = parse_time_file(filename_buf);
|
||||
if (dd->dd_time < 0)
|
||||
{
|
||||
- log_warning("Missing file: "FILENAME_TIME);
|
||||
+ log_debug("Missing file: "FILENAME_TIME);
|
||||
return FILENAME_TIME;
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ static const char *dd_check(struct dump_dir *dd)
|
||||
dd->dd_type = load_text_file(filename_buf, DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
|
||||
if (!dd->dd_type || (strlen(dd->dd_type) == 0))
|
||||
{
|
||||
- log_warning("Missing or empty file: "FILENAME_TYPE);
|
||||
+ log_debug("Missing or empty file: "FILENAME_TYPE);
|
||||
return FILENAME_TYPE;
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ static int dd_lock(struct dump_dir *dd, unsigned sleep_usec, int flags)
|
||||
if (missing_file)
|
||||
{
|
||||
xunlink(lock_buf);
|
||||
- log_warning("Unlocked '%s' (no or corrupted '%s' file)", lock_buf, missing_file);
|
||||
+ log_notice("Unlocked '%s' (no or corrupted '%s' file)", lock_buf, missing_file);
|
||||
if (--count == 0 || flags & DD_DONT_WAIT_FOR_LOCK)
|
||||
{
|
||||
errno = EISDIR; /* "this is an ordinary dir, not dump dir" */
|
||||
--
|
||||
2.1.0
|
||||
|
@ -0,0 +1,43 @@
|
||||
From 8cc3a91e7f07365d760d8716067ba03bb0d53aa7 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Wed, 27 Aug 2014 09:07:54 +0200
|
||||
Subject: [PATCH 24/33] mailx: print only one log message in notify_only mode
|
||||
|
||||
Related to rhbz#1133674
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/plugins/reporter-mailx.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/plugins/reporter-mailx.c b/src/plugins/reporter-mailx.c
|
||||
index 92e78a4..caacbe8 100644
|
||||
--- a/src/plugins/reporter-mailx.c
|
||||
+++ b/src/plugins/reporter-mailx.c
|
||||
@@ -132,7 +132,11 @@ static void create_and_send_email(
|
||||
*/
|
||||
putenv((char*)"sendwait=1");
|
||||
|
||||
- log(_("Sending an email..."));
|
||||
+ if (notify_only)
|
||||
+ log(_("Sending a notification email to: %s"), email_to);
|
||||
+ else
|
||||
+ log(_("Sending an email..."));
|
||||
+
|
||||
exec_and_feed_input(dsc, args);
|
||||
|
||||
free(dsc);
|
||||
@@ -154,8 +158,9 @@ static void create_and_send_email(
|
||||
free(msg);
|
||||
dd_close(dd);
|
||||
}
|
||||
+ log(_("Email was sent to: %s"), email_to);
|
||||
}
|
||||
- log(_("Email was sent to: %s"), email_to);
|
||||
+
|
||||
free(email_to);
|
||||
}
|
||||
|
||||
--
|
||||
2.1.0
|
||||
|
91
0025-gui-use-symbolic-icons.patch
Normal file
91
0025-gui-use-symbolic-icons.patch
Normal file
@ -0,0 +1,91 @@
|
||||
From 0deb730abc45a4cfa13d93fc07d5b609fb4f0043 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Tue, 26 Aug 2014 22:36:30 +0200
|
||||
Subject: [PATCH 25/33] gui: use -symbolic icons
|
||||
|
||||
Related to abrt/gnome-abrt#72
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/gui-wizard-gtk/wizard.c | 10 +++++-----
|
||||
src/gui-wizard-gtk/wizard.glade | 8 ++++----
|
||||
2 files changed, 9 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
|
||||
index 5779052..525d275 100644
|
||||
--- a/src/gui-wizard-gtk/wizard.c
|
||||
+++ b/src/gui-wizard-gtk/wizard.c
|
||||
@@ -3494,17 +3494,17 @@ void create_assistant(GtkApplication *app, bool expert_mode)
|
||||
gtk_notebook_set_show_tabs(g_assistant, (g_verbose != 0 && g_expert_mode));
|
||||
|
||||
g_btn_close = gtk_button_new_with_mnemonic(_("_Close"));
|
||||
- gtk_button_set_image(GTK_BUTTON(g_btn_close), gtk_image_new_from_icon_name("window-close", GTK_ICON_SIZE_BUTTON));
|
||||
+ gtk_button_set_image(GTK_BUTTON(g_btn_close), gtk_image_new_from_icon_name("window-close-symbolic", GTK_ICON_SIZE_BUTTON));
|
||||
g_btn_stop = gtk_button_new_with_mnemonic(_("_Stop"));
|
||||
- gtk_button_set_image(GTK_BUTTON(g_btn_stop), gtk_image_new_from_icon_name("process-close", GTK_ICON_SIZE_BUTTON));
|
||||
+ gtk_button_set_image(GTK_BUTTON(g_btn_stop), gtk_image_new_from_icon_name("process-close-symbolic", GTK_ICON_SIZE_BUTTON));
|
||||
gtk_widget_set_no_show_all(g_btn_stop, true); /* else gtk_widget_hide won't work */
|
||||
g_btn_onfail = gtk_button_new_with_label(_("Upload for analysis"));
|
||||
- gtk_button_set_image(GTK_BUTTON(g_btn_onfail), gtk_image_new_from_icon_name("go-up", GTK_ICON_SIZE_BUTTON));
|
||||
+ gtk_button_set_image(GTK_BUTTON(g_btn_onfail), gtk_image_new_from_icon_name("go-up-symbolic", GTK_ICON_SIZE_BUTTON));
|
||||
gtk_widget_set_no_show_all(g_btn_onfail, true); /* else gtk_widget_hide won't work */
|
||||
g_btn_repeat = gtk_button_new_with_label(_("Repeat"));
|
||||
gtk_widget_set_no_show_all(g_btn_repeat, true); /* else gtk_widget_hide won't work */
|
||||
g_btn_next = gtk_button_new_with_mnemonic(_("_Forward"));
|
||||
- gtk_button_set_image(GTK_BUTTON(g_btn_next), gtk_image_new_from_icon_name("go-next", GTK_ICON_SIZE_BUTTON));
|
||||
+ gtk_button_set_image(GTK_BUTTON(g_btn_next), gtk_image_new_from_icon_name("go-next-symbolic", GTK_ICON_SIZE_BUTTON));
|
||||
gtk_widget_set_no_show_all(g_btn_next, true); /* else gtk_widget_hide won't work */
|
||||
|
||||
g_box_buttons = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
|
||||
@@ -3530,7 +3530,7 @@ void create_assistant(GtkApplication *app, bool expert_mode)
|
||||
gtk_widget_set_visible(GTK_WIDGET(vbox), TRUE);
|
||||
gtk_box_pack_start(vbox, GTK_WIDGET(g_box_warning_labels), false, false, 5);
|
||||
|
||||
- GtkWidget *image = gtk_image_new_from_icon_name("dialog-warning", GTK_ICON_SIZE_DIALOG);
|
||||
+ GtkWidget *image = gtk_image_new_from_icon_name("dialog-warning-symbolic", GTK_ICON_SIZE_DIALOG);
|
||||
gtk_widget_set_visible(image, TRUE);
|
||||
|
||||
g_widget_warnings_area = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
|
||||
diff --git a/src/gui-wizard-gtk/wizard.glade b/src/gui-wizard-gtk/wizard.glade
|
||||
index 854a402..b0953db 100644
|
||||
--- a/src/gui-wizard-gtk/wizard.glade
|
||||
+++ b/src/gui-wizard-gtk/wizard.glade
|
||||
@@ -5,7 +5,7 @@
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
- <property name="icon_name">media-record</property>
|
||||
+ <property name="icon_name">media-record-symbolic</property>
|
||||
</object>
|
||||
<object class="GtkListStore" id="ls_sensitive_words">
|
||||
<columns>
|
||||
@@ -133,7 +133,7 @@
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
- <property name="secondary_icon_name">edit-find</property>
|
||||
+ <property name="secondary_icon_name">edit-find-symbolic</property>
|
||||
<property name="primary_icon_activatable">False</property>
|
||||
<property name="secondary_icon_tooltip_text" translatable="yes">Clear the search bar to see the list of security sensitive words.</property>
|
||||
<property name="secondary_icon_tooltip_markup" translatable="yes">Clear the search bar to see the list of security sensitive words.</property>
|
||||
@@ -244,7 +244,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_start">4</property>
|
||||
- <property name="icon_name">media-record</property>
|
||||
+ <property name="icon_name">media-record-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
@@ -761,7 +761,7 @@
|
||||
<object class="GtkImage" id="img_process_fail">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="no_show_all">True</property>
|
||||
- <property name="icon_name">dialog-error</property>
|
||||
+ <property name="icon_name">dialog-error-symbolic</property>
|
||||
<property name="icon_size">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
--
|
||||
2.1.0
|
||||
|
751
0026-gui-Problem-Details-suite.patch
Normal file
751
0026-gui-Problem-Details-suite.patch
Normal file
@ -0,0 +1,751 @@
|
||||
From 6043bf96131374c9af27f0d7e1200901ab6f8e5d Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Mon, 25 Aug 2014 17:18:02 +0200
|
||||
Subject: [PATCH 26/33] gui: Problem Details suite
|
||||
|
||||
+ ProblemDetailsWidget
|
||||
+ ProblemDetailsDialog
|
||||
|
||||
Related to abrt/gnome-abrt#64
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
po/POTFILES.in | 2 +
|
||||
src/gtk-helpers/Makefile.am | 10 +-
|
||||
src/gtk-helpers/internal_libreport_gtk.h | 6 +
|
||||
src/gtk-helpers/problem_details_dialog.c | 80 +++++++
|
||||
src/gtk-helpers/problem_details_dialog.h | 37 +++
|
||||
src/gtk-helpers/problem_details_widget.c | 375 +++++++++++++++++++++++++++++++
|
||||
src/gtk-helpers/problem_details_widget.h | 62 +++++
|
||||
src/gtk-helpers/utils.c | 25 +++
|
||||
src/gui-wizard-gtk/wizard.c | 21 +-
|
||||
9 files changed, 596 insertions(+), 22 deletions(-)
|
||||
create mode 100644 src/gtk-helpers/problem_details_dialog.c
|
||||
create mode 100644 src/gtk-helpers/problem_details_dialog.h
|
||||
create mode 100644 src/gtk-helpers/problem_details_widget.c
|
||||
create mode 100644 src/gtk-helpers/problem_details_widget.h
|
||||
create mode 100644 src/gtk-helpers/utils.c
|
||||
|
||||
diff --git a/po/POTFILES.in b/po/POTFILES.in
|
||||
index 4a0b565..c599dab 100644
|
||||
--- a/po/POTFILES.in
|
||||
+++ b/po/POTFILES.in
|
||||
@@ -10,6 +10,8 @@ src/gtk-helpers/config_dialog.c
|
||||
src/gtk-helpers/event_config_dialog.c
|
||||
src/gtk-helpers/secrets.c
|
||||
src/gtk-helpers/workflow_config_dialog.c
|
||||
+src/gtk-helpers/problem_details_widget.c
|
||||
+src/gtk-helpers/problem_details_dialog.c
|
||||
src/gui-wizard-gtk/main.c
|
||||
src/gui-wizard-gtk/wizard.c
|
||||
src/gui-wizard-gtk/wizard.glade
|
||||
diff --git a/src/gtk-helpers/Makefile.am b/src/gtk-helpers/Makefile.am
|
||||
index 13b9072..a7cc554 100644
|
||||
--- a/src/gtk-helpers/Makefile.am
|
||||
+++ b/src/gtk-helpers/Makefile.am
|
||||
@@ -3,12 +3,15 @@ libreport_gtk_includedir = \
|
||||
$(includedir)/libreport
|
||||
|
||||
libreport_gtk_include_HEADERS = \
|
||||
- internal_libreport_gtk.h
|
||||
+ internal_libreport_gtk.h \
|
||||
+ problem_details_widget.h \
|
||||
+ problem_details_dialog.h
|
||||
|
||||
lib_LTLIBRARIES = \
|
||||
libreport-gtk.la
|
||||
|
||||
libreport_gtk_la_SOURCES = \
|
||||
+ utils.c \
|
||||
event_config_dialog.c \
|
||||
secrets.c \
|
||||
hyperlinks.c \
|
||||
@@ -16,11 +19,14 @@ libreport_gtk_la_SOURCES = \
|
||||
workflow_config_dialog.c \
|
||||
config_dialog.c \
|
||||
ask_dialogs.c \
|
||||
- search_item.c search_item.h
|
||||
+ search_item.c search_item.h \
|
||||
+ problem_details_widget.c problem_details_widget.h \
|
||||
+ problem_details_dialog.c problem_details_dialog.h
|
||||
|
||||
libreport_gtk_la_CPPFLAGS = \
|
||||
-I$(srcdir)/../include \
|
||||
-I$(srcdir)/../lib \
|
||||
+ -Wno-error=unused-local-typedefs \
|
||||
$(GTK_CFLAGS) \
|
||||
$(GLIB_CFLAGS) \
|
||||
$(GIO_CFLAGS) \
|
||||
diff --git a/src/gtk-helpers/internal_libreport_gtk.h b/src/gtk-helpers/internal_libreport_gtk.h
|
||||
index f8f1c13..57f5889 100644
|
||||
--- a/src/gtk-helpers/internal_libreport_gtk.h
|
||||
+++ b/src/gtk-helpers/internal_libreport_gtk.h
|
||||
@@ -20,6 +20,8 @@
|
||||
#define INTERNAL_LIBREPORT_GTK_H_
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
+#include "problem_details_dialog.h"
|
||||
+#include "problem_details_widget.h"
|
||||
#include "report.h"
|
||||
#include "internal_libreport.h"
|
||||
|
||||
@@ -96,6 +98,10 @@ struct url_token
|
||||
#define find_url_tokens libreport_find_url_tokens
|
||||
GList *find_url_tokens(const char *line);
|
||||
|
||||
+
|
||||
+#define reload_text_to_text_view libreport_reload_text_to_text_view
|
||||
+void reload_text_to_text_view(GtkTextView *tv, const char *text);
|
||||
+
|
||||
/* Ask dialogs */
|
||||
|
||||
/*
|
||||
diff --git a/src/gtk-helpers/problem_details_dialog.c b/src/gtk-helpers/problem_details_dialog.c
|
||||
new file mode 100644
|
||||
index 0000000..dc2362e
|
||||
--- /dev/null
|
||||
+++ b/src/gtk-helpers/problem_details_dialog.c
|
||||
@@ -0,0 +1,80 @@
|
||||
+/*
|
||||
+ Copyright (C) 2014 ABRT Team
|
||||
+ Copyright (C) 2014 RedHat inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License along
|
||||
+ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+*/
|
||||
+
|
||||
+#include "problem_details_dialog.h"
|
||||
+#include "internal_libreport_gtk.h"
|
||||
+#include "internal_libreport.h"
|
||||
+
|
||||
+GtkWidget *
|
||||
+problem_details_dialog_new(problem_data_t *problem, GtkWindow *parent)
|
||||
+{
|
||||
+ INITIALIZE_LIBREPORT();
|
||||
+
|
||||
+ GtkWidget *dialog = gtk_dialog_new_with_buttons(
|
||||
+ _("Problem details"),
|
||||
+ parent,
|
||||
+ GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
+ _("OK"),
|
||||
+ GTK_RESPONSE_NONE,
|
||||
+ NULL
|
||||
+ );
|
||||
+
|
||||
+ gtk_window_set_default_size(GTK_WINDOW(dialog), 800, 600);
|
||||
+
|
||||
+ g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), dialog);
|
||||
+
|
||||
+ ProblemDetailsWidget *details = problem_details_widget_new(problem);
|
||||
+
|
||||
+ GtkWidget *scrolled = gtk_scrolled_window_new(NULL, NULL);
|
||||
+ gtk_widget_set_halign(scrolled, GTK_ALIGN_FILL);
|
||||
+ gtk_widget_set_valign(scrolled, GTK_ALIGN_FILL);
|
||||
+ gtk_widget_set_hexpand(scrolled, TRUE);
|
||||
+ gtk_widget_set_vexpand(scrolled, TRUE);
|
||||
+
|
||||
+ gtk_container_add(GTK_CONTAINER(scrolled), GTK_WIDGET(details));
|
||||
+
|
||||
+ GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
|
||||
+ gtk_container_add(GTK_CONTAINER(content_area), GTK_WIDGET(scrolled));
|
||||
+
|
||||
+ gtk_widget_show_all(dialog);
|
||||
+
|
||||
+ return dialog;
|
||||
+}
|
||||
+
|
||||
+GtkWidget *
|
||||
+problem_details_dialog_new_for_dir(const char *dir, GtkWindow *parent)
|
||||
+{
|
||||
+ INITIALIZE_LIBREPORT();
|
||||
+
|
||||
+ struct dump_dir *dd = dd_opendir(dir, DD_OPEN_READONLY);
|
||||
+ if (!dd)
|
||||
+ return NULL;
|
||||
+
|
||||
+ problem_data_t *problem = create_problem_data_from_dump_dir(dd);
|
||||
+ problem_data_add_text_noteditable(problem, CD_DUMPDIR, dir);
|
||||
+
|
||||
+ dd_close(dd);
|
||||
+
|
||||
+ GtkWidget *dialog = problem_details_dialog_new(problem, parent);
|
||||
+
|
||||
+ g_signal_connect_swapped(dialog, "destroy", G_CALLBACK(problem_data_free), problem);
|
||||
+
|
||||
+ return dialog;
|
||||
+}
|
||||
+
|
||||
diff --git a/src/gtk-helpers/problem_details_dialog.h b/src/gtk-helpers/problem_details_dialog.h
|
||||
new file mode 100644
|
||||
index 0000000..e8ba8ad
|
||||
--- /dev/null
|
||||
+++ b/src/gtk-helpers/problem_details_dialog.h
|
||||
@@ -0,0 +1,37 @@
|
||||
+/*
|
||||
+ Copyright (C) 2014 ABRT Team
|
||||
+ Copyright (C) 2014 RedHat inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License along
|
||||
+ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+*/
|
||||
+#ifndef _PROBLEM_DETAILS_DIALOG_H
|
||||
+#define _PROBLEM_DETAILS_DIALOG_H
|
||||
+
|
||||
+#include <gtk/gtk.h>
|
||||
+#include "problem_data.h"
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif /* __cplusplus */
|
||||
+
|
||||
+GtkWidget *problem_details_dialog_new(problem_data_t *problem, GtkWindow *parent);
|
||||
+GtkWidget *problem_details_dialog_new_for_dir(const char *dir, GtkWindow *parent);
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif /* __cplusplus */
|
||||
+
|
||||
+#endif /* _PROBLEM_DETAILS_DIALOG_H */
|
||||
+
|
||||
diff --git a/src/gtk-helpers/problem_details_widget.c b/src/gtk-helpers/problem_details_widget.c
|
||||
new file mode 100644
|
||||
index 0000000..2cb3206
|
||||
--- /dev/null
|
||||
+++ b/src/gtk-helpers/problem_details_widget.c
|
||||
@@ -0,0 +1,375 @@
|
||||
+/*
|
||||
+ Copyright (C) 2014 ABRT Team
|
||||
+ Copyright (C) 2014 RedHat inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License along
|
||||
+ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+*/
|
||||
+
|
||||
+#include "problem_details_widget.h"
|
||||
+#include "internal_libreport_gtk.h"
|
||||
+#include "internal_libreport.h"
|
||||
+
|
||||
+#define PROBLEM_DETAILS_WIDGET_GET_PRIVATE(o) \
|
||||
+ (G_TYPE_INSTANCE_GET_PRIVATE((o), TYPE_PROBLEM_DETAILS_WIDGET, ProblemDetailsWidgetPrivate))
|
||||
+
|
||||
+#define EXPLICIT_ITEMS \
|
||||
+ CD_DUMPDIR, \
|
||||
+ FILENAME_TIME, \
|
||||
+ FILENAME_LAST_OCCURRENCE, \
|
||||
+ FILENAME_UID, \
|
||||
+ FILENAME_USERNAME, \
|
||||
+ FILENAME_TYPE, \
|
||||
+ FILENAME_COMMENT, \
|
||||
+ FILENAME_ANALYZER
|
||||
+
|
||||
+#define ORDERED_ITEMS \
|
||||
+ FILENAME_EXPLOITABLE, \
|
||||
+ FILENAME_NOT_REPORTABLE, \
|
||||
+ FILENAME_REASON, \
|
||||
+ FILENAME_BACKTRACE, \
|
||||
+ FILENAME_CRASH_FUNCTION, \
|
||||
+ FILENAME_CMDLINE, \
|
||||
+ FILENAME_EXECUTABLE, \
|
||||
+ FILENAME_PACKAGE, \
|
||||
+ FILENAME_COMPONENT, \
|
||||
+ FILENAME_PID, \
|
||||
+ FILENAME_PWD, \
|
||||
+ FILENAME_HOSTNAME, \
|
||||
+ FILENAME_COUNT
|
||||
+
|
||||
+static const char *items_orderlist[] = {
|
||||
+ ORDERED_ITEMS,
|
||||
+ NULL,
|
||||
+};
|
||||
+
|
||||
+static const char *items_auto_blacklist[] = {
|
||||
+ EXPLICIT_ITEMS,
|
||||
+ ORDERED_ITEMS,
|
||||
+ FILENAME_PKG_NAME,
|
||||
+ FILENAME_PKG_VERSION,
|
||||
+ FILENAME_PKG_RELEASE,
|
||||
+ FILENAME_PKG_ARCH,
|
||||
+ FILENAME_PKG_EPOCH,
|
||||
+ NULL,
|
||||
+};
|
||||
+
|
||||
+struct ProblemDetailsWidgetPrivate {
|
||||
+ PangoFontDescription *font;
|
||||
+ gulong rows;
|
||||
+ problem_data_t *problem_data;
|
||||
+};
|
||||
+
|
||||
+G_DEFINE_TYPE(ProblemDetailsWidget, problem_details_widget, GTK_TYPE_GRID)
|
||||
+
|
||||
+static void problem_details_widget_finalize(GObject *object);
|
||||
+
|
||||
+static void
|
||||
+problem_details_widget_class_init(ProblemDetailsWidgetClass *klass)
|
||||
+{
|
||||
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||
+
|
||||
+ object_class->finalize = problem_details_widget_finalize;
|
||||
+
|
||||
+ g_type_class_add_private(klass, sizeof(ProblemDetailsWidgetPrivate));
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+problem_details_widget_finalize(GObject *object)
|
||||
+{
|
||||
+ ProblemDetailsWidget *self;
|
||||
+
|
||||
+ self = PROBLEM_DETAILS_WIDGET(object);
|
||||
+
|
||||
+ self->priv->problem_data = (void *)0xdeadbeaf;
|
||||
+
|
||||
+ G_OBJECT_CLASS(problem_details_widget_parent_class)->finalize(object);
|
||||
+}
|
||||
+
|
||||
+static gulong
|
||||
+problem_details_widget_append_row(ProblemDetailsWidget *self)
|
||||
+{
|
||||
+ gtk_grid_insert_row(GTK_GRID(self), self->priv->rows);
|
||||
+ return self->priv->rows++;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+problem_details_widget_add_single_line(ProblemDetailsWidget *self, const char *name, const char *content)
|
||||
+{
|
||||
+ GtkWidget *label = gtk_label_new(name);
|
||||
+ gtk_widget_set_halign(label, GTK_ALIGN_START);
|
||||
+ gtk_widget_set_valign(label, GTK_ALIGN_START);
|
||||
+ gtk_widget_set_margin_start(label, 20);
|
||||
+ gtk_widget_set_margin_end(label, 20);
|
||||
+
|
||||
+ GtkWidget *value = gtk_label_new(content);
|
||||
+ gtk_label_set_selectable(GTK_LABEL(value), TRUE);
|
||||
+ gtk_label_set_line_wrap(GTK_LABEL(value), TRUE);
|
||||
+ gtk_label_set_line_wrap_mode(GTK_LABEL(value), GTK_WRAP_WORD);
|
||||
+ gtk_widget_set_halign(value, GTK_ALIGN_START);
|
||||
+ gtk_widget_set_hexpand(value, TRUE);
|
||||
+ gtk_widget_set_margin_start(value, 5);
|
||||
+ gtk_widget_override_font(GTK_WIDGET(value), self->priv->font);
|
||||
+
|
||||
+ const gulong row = problem_details_widget_append_row(self);
|
||||
+
|
||||
+ gtk_grid_attach(GTK_GRID(self), label, 0, row, 1, 1);
|
||||
+ gtk_grid_attach(GTK_GRID(self), value, 1, row, 1, 1);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+problem_details_widget_add_multi_line(ProblemDetailsWidget *self, const char *name, const char *content)
|
||||
+{
|
||||
+#if 0
|
||||
+ GtkWidget *value = gtk_text_view_new();
|
||||
+ gtk_text_view_set_editable(GTK_TEXT_VIEW(value), FALSE);
|
||||
+
|
||||
+ if (strcmp(name, FILENAME_COMMENT) == 0
|
||||
+ || strcmp(name, FILENAME_REASON) == 0)
|
||||
+ gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(value), GTK_WRAP_WORD);
|
||||
+
|
||||
+ reload_text_to_text_view(GTK_TEXT_VIEW(value), content);
|
||||
+#else
|
||||
+ GtkWidget *value = gtk_label_new(content);
|
||||
+ gtk_widget_set_halign(value, GTK_ALIGN_START);
|
||||
+
|
||||
+ if (strcmp(name, FILENAME_COMMENT) == 0
|
||||
+ || strcmp(name, FILENAME_REASON) == 0)
|
||||
+ {
|
||||
+ gtk_label_set_line_wrap(GTK_LABEL(value), TRUE);
|
||||
+ gtk_label_set_line_wrap_mode(GTK_LABEL(value), GTK_WRAP_WORD);
|
||||
+ gtk_widget_set_margin_bottom(value, 12);
|
||||
+ }
|
||||
+
|
||||
+ gtk_label_set_selectable(GTK_LABEL(value), TRUE);
|
||||
+#endif
|
||||
+
|
||||
+ gtk_widget_override_font(GTK_WIDGET(value), self->priv->font);
|
||||
+
|
||||
+ GtkWidget *expander = gtk_expander_new(name);
|
||||
+ gtk_widget_set_hexpand(expander, TRUE);
|
||||
+ gtk_container_add(GTK_CONTAINER(expander), value);
|
||||
+
|
||||
+ const gulong row = problem_details_widget_append_row(self);
|
||||
+
|
||||
+ gtk_grid_attach(GTK_GRID(self), expander, 0, row, 2, 1);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+problem_details_widget_add_binary(ProblemDetailsWidget *self, const char *label, const char *path)
|
||||
+{
|
||||
+ struct stat statbuf;
|
||||
+ statbuf.st_size = 0;
|
||||
+
|
||||
+ if (stat(path, &statbuf) != 0)
|
||||
+ {
|
||||
+ log("File '%s' does not exist", path);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ gchar *size = g_format_size_full((long long)statbuf.st_size, G_FORMAT_SIZE_IEC_UNITS);
|
||||
+ char *msg = xasprintf(_("$DATA_DIRECTORY/%s (binary file, %s)"), label, size);
|
||||
+ problem_details_widget_add_single_line(self, label, msg);
|
||||
+ free(msg);
|
||||
+ g_free(size);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+problem_details_widget_add_time_stamp(ProblemDetailsWidget *self, const char *label, const char *stamp)
|
||||
+{
|
||||
+ struct tm tm;
|
||||
+ memset(&tm, 0, sizeof(struct tm));
|
||||
+
|
||||
+ const char *ret = strptime(stamp, "%s", &tm);
|
||||
+
|
||||
+ if (ret == NULL || ret[0] != '\0')
|
||||
+ return;
|
||||
+
|
||||
+ char buf[255];
|
||||
+ strftime(buf, sizeof(buf), "%F %T", &tm);
|
||||
+
|
||||
+ problem_details_widget_add_single_line(self, label, buf);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+problem_details_widget_add_problem_item(ProblemDetailsWidget *self, const char *name, problem_item *item)
|
||||
+{
|
||||
+ if (item->flags & CD_FLAG_TXT)
|
||||
+ {
|
||||
+ if (strchr(item->content, '\n') == NULL)
|
||||
+ problem_details_widget_add_single_line(self, name, item->content);
|
||||
+ else
|
||||
+ problem_details_widget_add_multi_line(self, name, item->content);
|
||||
+ }
|
||||
+ else if (item->flags & CD_FLAG_BIN)
|
||||
+ problem_details_widget_add_binary(self, name, item->content);
|
||||
+ else
|
||||
+ log("Unsupported file type");
|
||||
+}
|
||||
+
|
||||
+/* Callback for GHashTable */
|
||||
+static void
|
||||
+problem_data_entry_to_grid_row_one_line(const char *item_name, problem_item *item, ProblemDetailsWidget *self)
|
||||
+{
|
||||
+ if (((item->flags & CD_FLAG_TXT) && (strchr(item->content, '\n') == NULL))
|
||||
+ && !is_in_string_list(item_name, (char **)items_auto_blacklist))
|
||||
+ problem_details_widget_add_single_line(self, item_name, item->content);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+problem_data_entry_to_grid_row_multi_line(const char *item_name, problem_item *item, ProblemDetailsWidget *self)
|
||||
+{
|
||||
+ if (((item->flags & CD_FLAG_TXT) && (strchr(item->content, '\n') != NULL))
|
||||
+ && !is_in_string_list(item_name, (char **)items_auto_blacklist))
|
||||
+ problem_details_widget_add_multi_line(self, item_name, item->content);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+problem_data_entry_to_grid_row_binary(const char *item_name, problem_item *item, ProblemDetailsWidget *self)
|
||||
+{
|
||||
+ if ((item->flags & CD_FLAG_BIN)
|
||||
+ && !is_in_string_list(item_name, (char **)items_auto_blacklist))
|
||||
+ problem_details_widget_add_binary(self, item_name, item->content);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+problem_details_widget_populate(ProblemDetailsWidget *self)
|
||||
+{
|
||||
+ { /* Explicit order */
|
||||
+ for (const char **iter = items_orderlist; *iter; ++iter)
|
||||
+ {
|
||||
+ struct problem_item *item = problem_data_get_item_or_NULL(
|
||||
+ self->priv->problem_data, *iter);
|
||||
+
|
||||
+ if (item == NULL)
|
||||
+ continue;
|
||||
+
|
||||
+ problem_details_widget_add_problem_item(self, *iter, item);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ { /* comment: */
|
||||
+ const char *dd = problem_data_get_content_or_NULL(
|
||||
+ self->priv->problem_data, FILENAME_COMMENT);
|
||||
+ if (dd)
|
||||
+ problem_details_widget_add_multi_line(self, FILENAME_COMMENT, dd);
|
||||
+ }
|
||||
+
|
||||
+ { /* First occurence: 2014-08-26 11:08 */
|
||||
+ const char *ts = problem_data_get_content_or_NULL(
|
||||
+ self->priv->problem_data, FILENAME_TIME);
|
||||
+ if (ts)
|
||||
+ problem_details_widget_add_time_stamp(self, "first_occurence", ts);
|
||||
+ }
|
||||
+
|
||||
+ { /* Last occurence: 2014-08-27 11:08 */
|
||||
+ const char *ts = problem_data_get_content_or_NULL(
|
||||
+ self->priv->problem_data, FILENAME_LAST_OCCURRENCE);
|
||||
+ if (ts)
|
||||
+ problem_details_widget_add_time_stamp(self, "last_occurence", ts);
|
||||
+ }
|
||||
+
|
||||
+ { /* User: login(UID) */
|
||||
+ const char *uid = problem_data_get_content_or_NULL(
|
||||
+ self->priv->problem_data, FILENAME_UID);
|
||||
+
|
||||
+ const char *username = problem_data_get_content_or_NULL(
|
||||
+ self->priv->problem_data, "username");
|
||||
+
|
||||
+ char *line = NULL;
|
||||
+ if (uid && username)
|
||||
+ line = xasprintf("%s (%s)", username, uid);
|
||||
+ else if (!uid && !username)
|
||||
+ line = xstrdup("unknown user");
|
||||
+ else
|
||||
+ line = xasprintf("%s", uid ? uid : username);
|
||||
+
|
||||
+ problem_details_widget_add_single_line(self, "user", line);
|
||||
+ }
|
||||
+
|
||||
+ { /* Type/Analyzer: CCpp */
|
||||
+ const char *type = problem_data_get_content_or_NULL(
|
||||
+ self->priv->problem_data, FILENAME_TYPE);
|
||||
+ const char *analyzer = problem_data_get_content_or_NULL(
|
||||
+ self->priv->problem_data, FILENAME_ANALYZER);
|
||||
+
|
||||
+ char *label = NULL;
|
||||
+ char *line = NULL;
|
||||
+ if (type != NULL && analyzer != NULL)
|
||||
+ {
|
||||
+ if (strcmp(type, analyzer) != 0)
|
||||
+ {
|
||||
+ label = xstrdup("type/analyzer");
|
||||
+ line = xasprintf("%s/%s", type, analyzer);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ label = xstrdup("type");
|
||||
+ line = xstrdup(type);
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ label = xstrdup(type ? "type" : "anlyzer");
|
||||
+ line = xstrdup(type ? type : analyzer);
|
||||
+ }
|
||||
+
|
||||
+ problem_details_widget_add_single_line(self, label, line);
|
||||
+
|
||||
+ free(line);
|
||||
+ free(label);
|
||||
+ }
|
||||
+
|
||||
+ g_hash_table_foreach(self->priv->problem_data,
|
||||
+ (GHFunc)problem_data_entry_to_grid_row_one_line, self);
|
||||
+
|
||||
+ { /* data directory: */
|
||||
+ const char *dd = problem_data_get_content_or_NULL(
|
||||
+ self->priv->problem_data, CD_DUMPDIR);
|
||||
+ if (dd)
|
||||
+ problem_details_widget_add_single_line(self, "data_directory", dd);
|
||||
+
|
||||
+ /* show binaries below the data_directory entry */
|
||||
+ g_hash_table_foreach(self->priv->problem_data,
|
||||
+ (GHFunc)problem_data_entry_to_grid_row_binary, self);
|
||||
+ }
|
||||
+
|
||||
+ g_hash_table_foreach(self->priv->problem_data,
|
||||
+ (GHFunc)problem_data_entry_to_grid_row_multi_line, self);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+problem_details_widget_init(ProblemDetailsWidget *self)
|
||||
+{
|
||||
+ self->priv = PROBLEM_DETAILS_WIDGET_GET_PRIVATE(self);
|
||||
+ self->priv->font = pango_font_description_from_string("monospace");
|
||||
+ self->priv->rows = 0;
|
||||
+ self->priv->problem_data = NULL;
|
||||
+}
|
||||
+
|
||||
+ProblemDetailsWidget *
|
||||
+problem_details_widget_new(problem_data_t *problem)
|
||||
+{
|
||||
+ INITIALIZE_LIBREPORT();
|
||||
+
|
||||
+ GObject *object = g_object_new(TYPE_PROBLEM_DETAILS_WIDGET, NULL);
|
||||
+ ProblemDetailsWidget *self = PROBLEM_DETAILS_WIDGET(object);
|
||||
+ self->priv->problem_data = problem;
|
||||
+
|
||||
+ problem_details_widget_populate(self);
|
||||
+ gtk_widget_show_all(GTK_WIDGET(self));
|
||||
+
|
||||
+ return self;
|
||||
+}
|
||||
+
|
||||
diff --git a/src/gtk-helpers/problem_details_widget.h b/src/gtk-helpers/problem_details_widget.h
|
||||
new file mode 100644
|
||||
index 0000000..c736a5d
|
||||
--- /dev/null
|
||||
+++ b/src/gtk-helpers/problem_details_widget.h
|
||||
@@ -0,0 +1,62 @@
|
||||
+/*
|
||||
+ Copyright (C) 2014 ABRT Team
|
||||
+ Copyright (C) 2014 RedHat inc.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License along
|
||||
+ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
+*/
|
||||
+#ifndef _PROBLEM_DETAILS_WIDGET_H
|
||||
+#define _PROBLEM_DETAILS_WIDGET_H
|
||||
+
|
||||
+#include <gtk/gtk.h>
|
||||
+#include "problem_data.h"
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+extern "C" {
|
||||
+#endif /* __cplusplus */
|
||||
+
|
||||
+G_BEGIN_DECLS
|
||||
+
|
||||
+#define TYPE_PROBLEM_DETAILS_WIDGET (problem_details_widget_get_type())
|
||||
+#define PROBLEM_DETAILS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PROBLEM_DETAILS_WIDGET, ProblemDetailsWidget))
|
||||
+#define PROBLEM_DETAILS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PROBLEM_DETAILS_WIDGET, ProblemDetailsWidgetClass))
|
||||
+#define IS_PROBLEM_DETAILS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PROBLEM_DETAILS_WIDGET))
|
||||
+#define IS_PROBLEM_DETAILS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PROBLEM_DETAILS_WIDGET))
|
||||
+#define PROBLEM_DETAILS_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PROBLEM_DETAILS_WIDGET, ProblemDetailsWidgetClass))
|
||||
+
|
||||
+typedef struct _ProblemDetailsWidget ProblemDetailsWidget;
|
||||
+typedef struct _ProblemDetailsWidgetClass ProblemDetailsWidgetClass;
|
||||
+typedef struct ProblemDetailsWidgetPrivate ProblemDetailsWidgetPrivate;
|
||||
+
|
||||
+struct _ProblemDetailsWidget {
|
||||
+ GtkGrid parent_instance;
|
||||
+ ProblemDetailsWidgetPrivate *priv;
|
||||
+};
|
||||
+
|
||||
+struct _ProblemDetailsWidgetClass {
|
||||
+ GtkGridClass parent_class;
|
||||
+};
|
||||
+
|
||||
+GType problem_details_widget_get_type (void) G_GNUC_CONST;
|
||||
+
|
||||
+ProblemDetailsWidget *problem_details_widget_new(problem_data_t *problem);
|
||||
+
|
||||
+G_END_DECLS
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif /* __cplusplus */
|
||||
+
|
||||
+#endif /* _PROBLEM_DETAILS_WIDGET_H */
|
||||
+
|
||||
diff --git a/src/gtk-helpers/utils.c b/src/gtk-helpers/utils.c
|
||||
new file mode 100644
|
||||
index 0000000..4ba2c0e
|
||||
--- /dev/null
|
||||
+++ b/src/gtk-helpers/utils.c
|
||||
@@ -0,0 +1,25 @@
|
||||
+#include "internal_libreport_gtk.h"
|
||||
+
|
||||
+void reload_text_to_text_view(GtkTextView *tv, const char *text)
|
||||
+{
|
||||
+ GtkTextBuffer *tb = gtk_text_view_get_buffer(tv);
|
||||
+ GtkTextIter beg_iter, end_iter;
|
||||
+ gtk_text_buffer_get_iter_at_offset(tb, &beg_iter, 0);
|
||||
+ gtk_text_buffer_get_iter_at_offset(tb, &end_iter, -1);
|
||||
+ gtk_text_buffer_delete(tb, &beg_iter, &end_iter);
|
||||
+
|
||||
+ if (!text)
|
||||
+ return;
|
||||
+
|
||||
+ const gchar *end;
|
||||
+ while (!g_utf8_validate(text, -1, &end))
|
||||
+ {
|
||||
+ gtk_text_buffer_insert_at_cursor(tb, text, end - text);
|
||||
+ char buf[8];
|
||||
+ unsigned len = snprintf(buf, sizeof(buf), "<%02X>", (unsigned char)*end);
|
||||
+ gtk_text_buffer_insert_at_cursor(tb, buf, len);
|
||||
+ text = end + 1;
|
||||
+ }
|
||||
+
|
||||
+ gtk_text_buffer_insert_at_cursor(tb, text, strlen(text));
|
||||
+}
|
||||
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
|
||||
index 5779052..a5f6119 100644
|
||||
--- a/src/gui-wizard-gtk/wizard.c
|
||||
+++ b/src/gui-wizard-gtk/wizard.c
|
||||
@@ -393,31 +393,12 @@ static void load_text_to_text_view(GtkTextView *tv, const char *name)
|
||||
/* a result of xstrdup() is freed */
|
||||
g_hash_table_insert(g_loaded_texts, (gpointer)xstrdup(name), (gpointer)1);
|
||||
|
||||
- GtkTextBuffer *tb = gtk_text_view_get_buffer(tv);
|
||||
-
|
||||
const char *str = g_cd ? problem_data_get_content_or_NULL(g_cd, name) : NULL;
|
||||
/* Bad: will choke at any text with non-Unicode parts: */
|
||||
/* gtk_text_buffer_set_text(tb, (str ? str : ""), -1);*/
|
||||
/* Start torturing ourself instead: */
|
||||
|
||||
- GtkTextIter beg_iter, end_iter;
|
||||
- gtk_text_buffer_get_iter_at_offset(tb, &beg_iter, 0);
|
||||
- gtk_text_buffer_get_iter_at_offset(tb, &end_iter, -1);
|
||||
- gtk_text_buffer_delete(tb, &beg_iter, &end_iter);
|
||||
-
|
||||
- if (!str)
|
||||
- return;
|
||||
-
|
||||
- const gchar *end;
|
||||
- while (!g_utf8_validate(str, -1, &end))
|
||||
- {
|
||||
- gtk_text_buffer_insert_at_cursor(tb, str, end - str);
|
||||
- char buf[8];
|
||||
- unsigned len = snprintf(buf, sizeof(buf), "<%02X>", (unsigned char)*end);
|
||||
- gtk_text_buffer_insert_at_cursor(tb, buf, len);
|
||||
- str = end + 1;
|
||||
- }
|
||||
- gtk_text_buffer_insert_at_cursor(tb, str, strlen(str));
|
||||
+ reload_text_to_text_view(tv, str);
|
||||
}
|
||||
|
||||
static gchar *get_malloced_string_from_text_view(GtkTextView *tv)
|
||||
--
|
||||
2.1.0
|
||||
|
168
0027-gui-port-to-Problem-Details-suite.patch
Normal file
168
0027-gui-port-to-Problem-Details-suite.patch
Normal file
@ -0,0 +1,168 @@
|
||||
From b4044bad5c86b552e252376f1b520afa28c8c63e Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Mon, 25 Aug 2014 17:20:16 +0200
|
||||
Subject: [PATCH 27/34] gui: port to Problem Details suite
|
||||
|
||||
- show the "Details" button on the comment page
|
||||
- use the problem details widget on the summary page
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/gui-wizard-gtk/wizard.c | 43 ++++++++++++++++++++---------------------
|
||||
src/gui-wizard-gtk/wizard.glade | 16 +++++++--------
|
||||
2 files changed, 29 insertions(+), 30 deletions(-)
|
||||
|
||||
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
|
||||
index a5f6119..b6629ba 100644
|
||||
--- a/src/gui-wizard-gtk/wizard.c
|
||||
+++ b/src/gui-wizard-gtk/wizard.c
|
||||
@@ -69,6 +69,7 @@ static GtkWidget *g_btn_close;
|
||||
static GtkWidget *g_btn_next;
|
||||
static GtkWidget *g_btn_onfail;
|
||||
static GtkWidget *g_btn_repeat;
|
||||
+static GtkWidget *g_btn_detail;
|
||||
|
||||
static GtkBox *g_box_events;
|
||||
static GtkBox *g_box_workflows;
|
||||
@@ -2673,6 +2674,7 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us
|
||||
clear_warnings();
|
||||
}
|
||||
|
||||
+ gtk_widget_hide(g_btn_detail);
|
||||
gtk_widget_hide(g_btn_onfail);
|
||||
if (!g_expert_mode)
|
||||
gtk_widget_hide(g_btn_repeat);
|
||||
@@ -2710,31 +2712,12 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us
|
||||
show_warnings();
|
||||
}
|
||||
|
||||
- if (pages[PAGENO_SUMMARY].page_widget == page
|
||||
- || pages[PAGENO_REVIEW_DATA].page_widget == page
|
||||
- ) {
|
||||
- GtkWidget *w = GTK_WIDGET(g_tv_details);
|
||||
- GtkContainer *c = GTK_CONTAINER(gtk_widget_get_parent(w));
|
||||
- if (c)
|
||||
- gtk_container_remove(c, w);
|
||||
- gtk_container_add(pages[PAGENO_SUMMARY].page_widget == page ?
|
||||
- g_container_details1 : g_container_details2,
|
||||
- w
|
||||
- );
|
||||
- /* Make checkbox column visible only on the last page */
|
||||
- gtk_tree_view_column_set_visible(g_tv_details_col_checkbox,
|
||||
- (pages[PAGENO_REVIEW_DATA].page_widget == page)
|
||||
- );
|
||||
-
|
||||
- if (pages[PAGENO_REVIEW_DATA].page_widget == page)
|
||||
- {
|
||||
- gtk_widget_set_sensitive(g_btn_next, gtk_toggle_button_get_active(g_tb_approve_bt));
|
||||
- update_ls_details_checkboxes(g_event_selected);
|
||||
- }
|
||||
- }
|
||||
+ if (pages[PAGENO_REVIEW_DATA].page_widget == page)
|
||||
+ update_ls_details_checkboxes(g_event_selected);
|
||||
|
||||
if (pages[PAGENO_EDIT_COMMENT].page_widget == page)
|
||||
{
|
||||
+ gtk_widget_show(g_btn_detail);
|
||||
gtk_widget_set_sensitive(g_btn_next, false);
|
||||
on_comment_changed(gtk_text_view_get_buffer(g_tv_comment), NULL);
|
||||
}
|
||||
@@ -3192,6 +3175,12 @@ static void on_btn_add_file(GtkButton *button)
|
||||
}
|
||||
}
|
||||
|
||||
+static void on_btn_detail(GtkButton *button)
|
||||
+{
|
||||
+ GtkWidget *pdd = problem_details_dialog_new(g_cd, g_wnd_assistant);
|
||||
+ gtk_dialog_run(GTK_DIALOG(pdd));
|
||||
+}
|
||||
+
|
||||
/* [Del] key handling in item list */
|
||||
static void delete_item(GtkTreeView *treeview)
|
||||
{
|
||||
@@ -3317,6 +3306,8 @@ static void add_pages(void)
|
||||
|
||||
g_signal_connect(g_tv_details, "key-press-event", G_CALLBACK(on_key_press_event_in_item_list), NULL);
|
||||
g_tv_sensitive_sel_hndlr = g_signal_connect(g_tv_sensitive_sel, "changed", G_CALLBACK(on_sensitive_word_selection_changed), NULL);
|
||||
+
|
||||
+
|
||||
}
|
||||
|
||||
static void create_details_treeview(void)
|
||||
@@ -3487,6 +3478,8 @@ void create_assistant(GtkApplication *app, bool expert_mode)
|
||||
g_btn_next = gtk_button_new_with_mnemonic(_("_Forward"));
|
||||
gtk_button_set_image(GTK_BUTTON(g_btn_next), gtk_image_new_from_icon_name("go-next-symbolic", GTK_ICON_SIZE_BUTTON));
|
||||
gtk_widget_set_no_show_all(g_btn_next, true); /* else gtk_widget_hide won't work */
|
||||
+ g_btn_detail = gtk_button_new_with_mnemonic(_("Details"));
|
||||
+ gtk_widget_set_no_show_all(g_btn_detail, true); /* else gtk_widget_hide won't work */
|
||||
|
||||
g_box_buttons = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0));
|
||||
gtk_box_pack_start(g_box_buttons, g_btn_close, false, false, 5);
|
||||
@@ -3497,10 +3490,12 @@ void create_assistant(GtkApplication *app, bool expert_mode)
|
||||
#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 13) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 13 && GTK_MICRO_VERSION < 5))
|
||||
GtkWidget *w = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
|
||||
gtk_box_pack_start(g_box_buttons, w, true, true, 5);
|
||||
+ gtk_box_pack_start(g_box_buttons, g_btn_detail, false, false, 5);
|
||||
gtk_box_pack_start(g_box_buttons, g_btn_next, false, false, 5);
|
||||
#else
|
||||
gtk_widget_set_valign(GTK_WIDGET(g_btn_next), GTK_ALIGN_END);
|
||||
gtk_box_pack_end(g_box_buttons, g_btn_next, false, false, 5);
|
||||
+ gtk_box_pack_end(g_box_buttons, g_btn_detail, false, false, 5);
|
||||
#endif
|
||||
|
||||
{ /* Warnings area widget definition start */
|
||||
@@ -3564,6 +3559,9 @@ void create_assistant(GtkApplication *app, bool expert_mode)
|
||||
|
||||
create_details_treeview();
|
||||
|
||||
+ ProblemDetailsWidget *details = problem_details_widget_new(g_cd);
|
||||
+ gtk_container_add(GTK_CONTAINER(g_container_details1), GTK_WIDGET(details));
|
||||
+
|
||||
g_signal_connect(g_btn_close, "clicked", G_CALLBACK(assistant_quit_cb), g_wnd_assistant);
|
||||
g_signal_connect(g_btn_stop, "clicked", G_CALLBACK(on_btn_cancel_event), NULL);
|
||||
g_signal_connect(g_btn_onfail, "clicked", G_CALLBACK(on_btn_failed_cb), NULL);
|
||||
@@ -3577,6 +3575,7 @@ void create_assistant(GtkApplication *app, bool expert_mode)
|
||||
g_signal_connect(gtk_text_view_get_buffer(g_tv_comment), "changed", G_CALLBACK(on_comment_changed), NULL);
|
||||
|
||||
g_signal_connect(g_btn_add_file, "clicked", G_CALLBACK(on_btn_add_file), NULL);
|
||||
+ g_signal_connect(g_btn_detail, "clicked", G_CALLBACK(on_btn_detail), NULL);
|
||||
|
||||
if (is_screencast_available()) {
|
||||
/* we need to override the activate-link handler, because we use
|
||||
diff --git a/src/gui-wizard-gtk/wizard.glade b/src/gui-wizard-gtk/wizard.glade
|
||||
index 854a402..e6c0fc1 100644
|
||||
--- a/src/gui-wizard-gtk/wizard.glade
|
||||
+++ b/src/gui-wizard-gtk/wizard.glade
|
||||
@@ -405,13 +405,7 @@
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">out</property>
|
||||
<child>
|
||||
- <object class="GtkTreeView" id="tv_details">
|
||||
- <property name="visible">True</property>
|
||||
- <property name="can_focus">True</property>
|
||||
- <child internal-child="selection">
|
||||
- <object class="GtkTreeSelection" id="treeview-selection1"/>
|
||||
- </child>
|
||||
- </object>
|
||||
+ <placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -676,7 +670,13 @@
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">out</property>
|
||||
<child>
|
||||
- <placeholder/>
|
||||
+ <object class="GtkTreeView" id="tv_details">
|
||||
+ <property name="visible">True</property>
|
||||
+ <property name="can_focus">True</property>
|
||||
+ <child internal-child="selection">
|
||||
+ <object class="GtkTreeSelection" id="treeview-selection"/>
|
||||
+ </child>
|
||||
+ </object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
--
|
||||
2.1.0
|
||||
|
48
0029-gui-fix-build-with-older-gtk.patch
Normal file
48
0029-gui-fix-build-with-older-gtk.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From fbd0a76180633c7d50be01ea69ad734749db18a8 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Thu, 28 Aug 2014 09:38:16 +0200
|
||||
Subject: [PATCH 29/33] gui: fix build with older gtk
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/gtk-helpers/problem_details_widget.c | 15 ++++++++++++---
|
||||
1 file changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/gtk-helpers/problem_details_widget.c b/src/gtk-helpers/problem_details_widget.c
|
||||
index 2cb3206..c314d4d 100644
|
||||
--- a/src/gtk-helpers/problem_details_widget.c
|
||||
+++ b/src/gtk-helpers/problem_details_widget.c
|
||||
@@ -110,8 +110,6 @@ problem_details_widget_add_single_line(ProblemDetailsWidget *self, const char *n
|
||||
GtkWidget *label = gtk_label_new(name);
|
||||
gtk_widget_set_halign(label, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign(label, GTK_ALIGN_START);
|
||||
- gtk_widget_set_margin_start(label, 20);
|
||||
- gtk_widget_set_margin_end(label, 20);
|
||||
|
||||
GtkWidget *value = gtk_label_new(content);
|
||||
gtk_label_set_selectable(GTK_LABEL(value), TRUE);
|
||||
@@ -119,9 +117,20 @@ problem_details_widget_add_single_line(ProblemDetailsWidget *self, const char *n
|
||||
gtk_label_set_line_wrap_mode(GTK_LABEL(value), GTK_WRAP_WORD);
|
||||
gtk_widget_set_halign(value, GTK_ALIGN_START);
|
||||
gtk_widget_set_hexpand(value, TRUE);
|
||||
- gtk_widget_set_margin_start(value, 5);
|
||||
gtk_widget_override_font(GTK_WIDGET(value), self->priv->font);
|
||||
|
||||
+#if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 11) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 11 && GTK_MICRO_VERSION < 2))
|
||||
+ gtk_widget_set_margin_left(label, 20);
|
||||
+ gtk_widget_set_margin_right(label, 20);
|
||||
+
|
||||
+ gtk_widget_set_margin_left(value, 5);
|
||||
+#else
|
||||
+ gtk_widget_set_margin_start(label, 20);
|
||||
+ gtk_widget_set_margin_end(label, 20);
|
||||
+
|
||||
+ gtk_widget_set_margin_start(value, 5);
|
||||
+#endif
|
||||
+
|
||||
const gulong row = problem_details_widget_append_row(self);
|
||||
|
||||
gtk_grid_attach(GTK_GRID(self), label, 0, row, 1, 1);
|
||||
--
|
||||
2.1.0
|
||||
|
111
0030-wizard-don-t-work-with-destroyed-widgets.patch
Normal file
111
0030-wizard-don-t-work-with-destroyed-widgets.patch
Normal file
@ -0,0 +1,111 @@
|
||||
From c781531f2c04be3d99830a28997e7b1fb2132dba Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Thu, 28 Aug 2014 12:22:39 +0200
|
||||
Subject: [PATCH 30/33] wizard: don't work with destroyed widgets
|
||||
|
||||
Resolves rhbz#1133055
|
||||
Related to rhbz#1069917
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/gui-wizard-gtk/wizard.c | 35 ++++++++++++++++++++++++++++-------
|
||||
1 file changed, 28 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
|
||||
index f0445eb..8620823 100644
|
||||
--- a/src/gui-wizard-gtk/wizard.c
|
||||
+++ b/src/gui-wizard-gtk/wizard.c
|
||||
@@ -57,6 +57,7 @@ static char *g_event_selected;
|
||||
static unsigned g_black_event_count = 0;
|
||||
|
||||
static pid_t g_event_child_pid = 0;
|
||||
+static guint g_event_source_id = 0;
|
||||
|
||||
static bool g_expert_mode;
|
||||
|
||||
@@ -1529,10 +1530,18 @@ static void update_event_log_on_disk(const char *str)
|
||||
dd_close(dd);
|
||||
}
|
||||
|
||||
+static bool cancel_event_run()
|
||||
+{
|
||||
+ if (g_event_child_pid <= 0)
|
||||
+ return false;
|
||||
+
|
||||
+ kill(- g_event_child_pid, SIGTERM);
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
static void on_btn_cancel_event(GtkButton *button)
|
||||
{
|
||||
- if (g_event_child_pid > 0)
|
||||
- kill(- g_event_child_pid, SIGTERM);
|
||||
+ cancel_event_run();
|
||||
}
|
||||
|
||||
static bool is_processing_finished()
|
||||
@@ -1938,8 +1947,10 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
|
||||
: _("Processing finished, please proceed to the next step."));
|
||||
}
|
||||
|
||||
- /*g_source_remove(evd->event_source_id);*/
|
||||
+ g_source_remove(g_event_source_id);
|
||||
+ g_event_source_id = 0;
|
||||
close(evd->fd);
|
||||
+ g_io_channel_unref(evd->channel);
|
||||
free_run_event_state(evd->run_state);
|
||||
strbuf_free(evd->event_log);
|
||||
free(evd->event_name);
|
||||
@@ -2108,7 +2119,7 @@ static void start_event_run(const char *event_name)
|
||||
|
||||
ndelay_on(evd->fd);
|
||||
evd->channel = g_io_channel_unix_new(evd->fd);
|
||||
- /*evd->event_source_id = */ g_io_add_watch(evd->channel,
|
||||
+ g_event_source_id = g_io_add_watch(evd->channel,
|
||||
G_IO_IN | G_IO_ERR | G_IO_HUP, /* need HUP to detect EOF w/o any data */
|
||||
consume_cmd_output,
|
||||
evd
|
||||
@@ -3385,13 +3396,23 @@ static void init_pages(void)
|
||||
|
||||
static void assistant_quit_cb(void *obj, void *data)
|
||||
{
|
||||
+ /* Suppress execution of consume_cmd_output() */
|
||||
+ if (g_event_source_id != 0)
|
||||
+ {
|
||||
+ g_source_remove(g_event_source_id);
|
||||
+ g_event_source_id = 0;
|
||||
+ }
|
||||
+
|
||||
+ cancel_event_run();
|
||||
+
|
||||
if (g_loaded_texts)
|
||||
{
|
||||
g_hash_table_destroy(g_loaded_texts);
|
||||
g_loaded_texts = NULL;
|
||||
}
|
||||
|
||||
- gtk_widget_destroy(GTK_WIDGET(data));
|
||||
+ gtk_widget_destroy(GTK_WIDGET(g_wnd_assistant));
|
||||
+ g_wnd_assistant = (void *)0xdeadbeaf;
|
||||
}
|
||||
|
||||
static void on_btn_startcast(GtkWidget *btn, gpointer user_data)
|
||||
@@ -3562,13 +3583,13 @@ void create_assistant(GtkApplication *app, bool expert_mode)
|
||||
ProblemDetailsWidget *details = problem_details_widget_new(g_cd);
|
||||
gtk_container_add(GTK_CONTAINER(g_container_details1), GTK_WIDGET(details));
|
||||
|
||||
- g_signal_connect(g_btn_close, "clicked", G_CALLBACK(assistant_quit_cb), g_wnd_assistant);
|
||||
+ g_signal_connect(g_btn_close, "clicked", G_CALLBACK(assistant_quit_cb), NULL);
|
||||
g_signal_connect(g_btn_stop, "clicked", G_CALLBACK(on_btn_cancel_event), NULL);
|
||||
g_signal_connect(g_btn_onfail, "clicked", G_CALLBACK(on_btn_failed_cb), NULL);
|
||||
g_signal_connect(g_btn_repeat, "clicked", G_CALLBACK(on_btn_repeat_cb), NULL);
|
||||
g_signal_connect(g_btn_next, "clicked", G_CALLBACK(on_next_btn_cb), NULL);
|
||||
|
||||
- g_signal_connect(g_wnd_assistant, "destroy", G_CALLBACK(assistant_quit_cb), g_wnd_assistant);
|
||||
+ g_signal_connect(g_wnd_assistant, "destroy", G_CALLBACK(assistant_quit_cb), NULL);
|
||||
g_signal_connect(g_assistant, "switch-page", G_CALLBACK(on_page_prepare), NULL);
|
||||
|
||||
g_signal_connect(g_tb_approve_bt, "toggled", G_CALLBACK(on_bt_approve_toggle), NULL);
|
||||
--
|
||||
2.1.0
|
||||
|
@ -0,0 +1,32 @@
|
||||
From 8fc56865d8945e2923fec7c95d025f12d45693ae Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Thu, 28 Aug 2014 15:17:30 +0200
|
||||
Subject: [PATCH 31/33] wizard: "Next" button insensitive on the review page by
|
||||
default
|
||||
|
||||
This feature was accidentally removed in commit
|
||||
b4044bad5c86b552e252376f1b520afa28c8c63e
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/gui-wizard-gtk/wizard.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
|
||||
index 8620823..8d0429e 100644
|
||||
--- a/src/gui-wizard-gtk/wizard.c
|
||||
+++ b/src/gui-wizard-gtk/wizard.c
|
||||
@@ -2724,7 +2724,10 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us
|
||||
}
|
||||
|
||||
if (pages[PAGENO_REVIEW_DATA].page_widget == page)
|
||||
+ {
|
||||
update_ls_details_checkboxes(g_event_selected);
|
||||
+ gtk_widget_set_sensitive(g_btn_next, gtk_toggle_button_get_active(g_tb_approve_bt));
|
||||
+ }
|
||||
|
||||
if (pages[PAGENO_EDIT_COMMENT].page_widget == page)
|
||||
{
|
||||
--
|
||||
2.1.0
|
||||
|
130
0032-report-parse-release-version-from-os-release.patch
Normal file
130
0032-report-parse-release-version-from-os-release.patch
Normal file
@ -0,0 +1,130 @@
|
||||
From 4e4bd7c0011f3ea4565fb9488cedec4fee935d35 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Wed, 23 Jul 2014 10:59:55 +0200
|
||||
Subject: [PATCH 32/33] report: parse release/version from os-release
|
||||
|
||||
Related to rhbz#1101240
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/report-python/__init__.py | 69 ++++++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 61 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/report-python/__init__.py b/src/report-python/__init__.py
|
||||
index 3d2595f..ce7ea06 100644
|
||||
--- a/src/report-python/__init__.py
|
||||
+++ b/src/report-python/__init__.py
|
||||
@@ -27,6 +27,9 @@ import os
|
||||
|
||||
SYSTEM_RELEASE_PATHS = ["/etc/system-release","/etc/redhat-release"]
|
||||
SYSTEM_RELEASE_DEPS = ["system-release", "redhat-release"]
|
||||
+SYSTEM_OS_RELEASE_FILE = "/etc/os-release"
|
||||
+OS_RELEASE_PRODUCT_FIELDS = ["REDHAT_BUGZILLA_PRODUCT", "REDHAT_SUPPORT_PRODUCT", "NAME"]
|
||||
+OS_RELEASE_VERSION_FIELDS = ["REDHAT_BUGZILLA_VERSION", "REDHAT_SUPPORT_VERSION", "NAME"]
|
||||
|
||||
_hardcoded_default_product = ""
|
||||
_hardcoded_default_version = ""
|
||||
@@ -61,6 +64,57 @@ def getVersion_fromRPM():
|
||||
return ""
|
||||
"""
|
||||
|
||||
+def parse_os_release_lines(osreleaselines):
|
||||
+ osrel = {}
|
||||
+
|
||||
+ for line in osreleaselines:
|
||||
+ kvp = line.split('=')
|
||||
+ if len(kvp) < 2:
|
||||
+ continue
|
||||
+
|
||||
+ key = kvp[0]
|
||||
+ value = kvp[1]
|
||||
+ if len(kvp) > 2:
|
||||
+ value = "=".join(kvp[1:])
|
||||
+
|
||||
+ if value:
|
||||
+ osrel[key] = value.strip('"')
|
||||
+ else:
|
||||
+ osrel[key] = value
|
||||
+
|
||||
+ return osrel
|
||||
+
|
||||
+# /etc/os-release file parser
|
||||
+# see man os-release
|
||||
+def parse_os_release_file(filepath):
|
||||
+ osrel = {}
|
||||
+ try:
|
||||
+ with open(filepath) as osrelfil:
|
||||
+ osrel = parse_os_release_lines(osrelfil)
|
||||
+ except IOError as ex:
|
||||
+ # I am sorry, but we do not support logging here :(
|
||||
+ pass
|
||||
+
|
||||
+ return osrel
|
||||
+
|
||||
+def getProduct_fromOSRELEASE(file_path=SYSTEM_OS_RELEASE_FILE):
|
||||
+ osrel = parse_os_release_file(file_path)
|
||||
+
|
||||
+ for pf in OS_RELEASE_PRODUCT_FIELDS:
|
||||
+ if pf in osrel:
|
||||
+ return osrel[pf]
|
||||
+
|
||||
+ return None
|
||||
+
|
||||
+def getVersion_fromOSRELEASE(file_path=SYSTEM_OS_RELEASE_FILE):
|
||||
+ osrel = parse_os_release_file(file_path)
|
||||
+
|
||||
+ for vf in OS_RELEASE_VERSION_FIELDS:
|
||||
+ if vf in osrel:
|
||||
+ return osrel[vf]
|
||||
+
|
||||
+ return None
|
||||
+
|
||||
def getProduct_fromFILE():
|
||||
for each_path in SYSTEM_RELEASE_PATHS:
|
||||
if os.path.exists(each_path):
|
||||
@@ -73,7 +127,6 @@ def getProduct_fromFILE():
|
||||
content = file.read()
|
||||
if content.startswith("Red Hat Enterprise Linux"):
|
||||
return "Red Hat Enterprise Linux"
|
||||
-
|
||||
if content.startswith("Fedora"):
|
||||
return "Fedora"
|
||||
|
||||
@@ -96,11 +149,11 @@ def getVersion_fromFILE():
|
||||
if content.find("Rawhide") > -1:
|
||||
return "rawhide"
|
||||
|
||||
- clist = content.split(" ")
|
||||
- i = clist.index("release")
|
||||
- return clist[i+1]
|
||||
- else:
|
||||
- return ""
|
||||
+ i = content.find(" release")
|
||||
+ if i > -1:
|
||||
+ return content[i + len(" release"):]
|
||||
+
|
||||
+ return ""
|
||||
|
||||
def getProduct_fromPRODUCT():
|
||||
try:
|
||||
@@ -131,7 +184,7 @@ def getProduct():
|
||||
asking anaconda
|
||||
Always return as a string.
|
||||
"""
|
||||
- for getter in (getProduct_fromFILE, getProduct_fromPRODUCT):
|
||||
+ for getter in (getProduct_fromOSRELEASE, getProduct_fromFILE, getProduct_fromPRODUCT):
|
||||
product = getter()
|
||||
if product:
|
||||
return product
|
||||
@@ -144,7 +197,7 @@ def getVersion():
|
||||
asking anaconda
|
||||
Always return as a string.
|
||||
"""
|
||||
- for getter in (getVersion_fromFILE, getVersion_fromPRODUCT):
|
||||
+ for getter in (getVersion_fromOSRELEASE, getVersion_fromFILE, getVersion_fromPRODUCT):
|
||||
version = getter()
|
||||
if version:
|
||||
return version
|
||||
--
|
||||
2.1.0
|
||||
|
162
0033-testsuite-report-python-sanity-tests.patch
Normal file
162
0033-testsuite-report-python-sanity-tests.patch
Normal file
@ -0,0 +1,162 @@
|
||||
From 00312a80f569f149aa888fcc17765378cd7f799f Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Wed, 23 Jul 2014 11:00:28 +0200
|
||||
Subject: [PATCH 33/33] testsuite: report python sanity tests
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
tests/Makefile.am | 3 ++-
|
||||
tests/local.at | 13 +++++++++++++
|
||||
tests/osinfo.at | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
tests/report_python.at | 33 ++++++++++++++++++++++++++++++++
|
||||
tests/testsuite.at | 1 +
|
||||
5 files changed, 101 insertions(+), 1 deletion(-)
|
||||
create mode 100644 tests/report_python.at
|
||||
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index 8ec40e1..750fa16 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -38,7 +38,8 @@ TESTSUITE_AT = \
|
||||
reported_to.at \
|
||||
make_description.at \
|
||||
libreport_types.at \
|
||||
- xml_definition.at
|
||||
+ xml_definition.at \
|
||||
+ report_python.at
|
||||
|
||||
EXTRA_DIST += $(TESTSUITE_AT)
|
||||
TESTSUITE = $(srcdir)/testsuite
|
||||
diff --git a/tests/local.at b/tests/local.at
|
||||
index 758906d..b5fae97 100644
|
||||
--- a/tests/local.at
|
||||
+++ b/tests/local.at
|
||||
@@ -24,4 +24,17 @@ AT_COMPILE([$1])
|
||||
AT_CHECK([./$1], 0, [ignore], [ignore])
|
||||
AT_CLEANUP])
|
||||
|
||||
+# ------------------------
|
||||
+# AT_PYTESTFUN(NAME, SOURCE)
|
||||
+# ------------------------
|
||||
+
|
||||
+# Create a test named NAME by running Python file with contents SOURCE. The
|
||||
+# stdout and stderr output of the Python program is ignored by Autotest.
|
||||
+
|
||||
+m4_define([AT_PYTESTFUN],
|
||||
+[AT_SETUP([$1])
|
||||
+AT_DATA([$1], [$2])
|
||||
+AT_CHECK([PYTHONPATH=../../../src python ./$1], 0, [ignore], [ignore])
|
||||
+AT_CLEANUP])
|
||||
+
|
||||
AT_INIT
|
||||
diff --git a/tests/osinfo.at b/tests/osinfo.at
|
||||
index 529ca13..b57452d 100644
|
||||
--- a/tests/osinfo.at
|
||||
+++ b/tests/osinfo.at
|
||||
@@ -393,3 +393,55 @@ int main(void)
|
||||
return 0;
|
||||
}
|
||||
]])
|
||||
+
|
||||
+## ------------------- ##
|
||||
+## parse_osinfo_python ##
|
||||
+## ------------------- ##
|
||||
+
|
||||
+AT_PYTESTFUN([parse_osinfo_python],
|
||||
+[[import sys
|
||||
+
|
||||
+sys.path.insert(0, "../../../src/report-python/.libs")
|
||||
+
|
||||
+report = __import__("report-python", globals(), locals(), [], -1)
|
||||
+sys.modules["report"] = report
|
||||
+
|
||||
+lines = [
|
||||
+ 'NAME=fedora',
|
||||
+ 'VERSION="20 (Heisenbug)"',
|
||||
+ 'ID=fedora',
|
||||
+ 'VERSION_ID=20',
|
||||
+ 'PRETTY_NAME="Fedora 20 (Heisenbug)"',
|
||||
+ 'ANSI_COLOR="0;34"',
|
||||
+ 'CPE_NAME="cpe:/o:fedoraproject:fedora:20"',
|
||||
+ 'HOME_URL="https://fedoraproject.org/"',
|
||||
+ 'BUG_REPORT_URL="https://bugzilla.redhat.com/"',
|
||||
+ 'REDHAT_BUGZILLA_PRODUCT="Fedora"',
|
||||
+ 'REDHAT_BUGZILLA_PRODUCT_VERSION=20',
|
||||
+ 'REDHAT_SUPPORT_PRODUCT="Fedora"',
|
||||
+ 'REDHAT_SUPPORT_PRODUCT_VERSION=20',
|
||||
+]
|
||||
+
|
||||
+expected = {
|
||||
+ 'NAME':'fedora',
|
||||
+ 'VERSION':'20 (Heisenbug)',
|
||||
+ 'ID':'fedora',
|
||||
+ 'VERSION_ID':'20',
|
||||
+ 'PRETTY_NAME':'Fedora 20 (Heisenbug)',
|
||||
+ 'ANSI_COLOR':'0;34',
|
||||
+ 'CPE_NAME':'cpe:/o:fedoraproject:fedora:20',
|
||||
+ 'HOME_URL':'https://fedoraproject.org/',
|
||||
+ 'BUG_REPORT_URL':'https://bugzilla.redhat.com/',
|
||||
+ 'REDHAT_BUGZILLA_PRODUCT':'Fedora',
|
||||
+ 'REDHAT_BUGZILLA_PRODUCT_VERSION':'20',
|
||||
+ 'REDHAT_SUPPORT_PRODUCT':'Fedora',
|
||||
+ 'REDHAT_SUPPORT_PRODUCT_VERSION':'20'
|
||||
+}
|
||||
+
|
||||
+osrel = report.parse_os_release_lines(lines)
|
||||
+
|
||||
+print sorted(expected.items())
|
||||
+print sorted(osrel.items())
|
||||
+
|
||||
+sys.exit(not bool(osrel == expected))
|
||||
+]])
|
||||
diff --git a/tests/report_python.at b/tests/report_python.at
|
||||
new file mode 100644
|
||||
index 0000000..17e4fb3
|
||||
--- /dev/null
|
||||
+++ b/tests/report_python.at
|
||||
@@ -0,0 +1,33 @@
|
||||
+# -*- Autotest -*-
|
||||
+
|
||||
+AT_BANNER([report_python])
|
||||
+
|
||||
+## ----------------------- ##
|
||||
+## get_from_etc_os_release ##
|
||||
+## ----------------------- ##
|
||||
+
|
||||
+AT_PYTESTFUN([get_from_etc_os_release],
|
||||
+[[import sys
|
||||
+
|
||||
+sys.path.insert(0, "../../../src/report-python/.libs")
|
||||
+
|
||||
+report = __import__("report-python", globals(), locals(), [], -1)
|
||||
+sys.modules["report"] = report
|
||||
+
|
||||
+import os
|
||||
+
|
||||
+if not os.path.exists("/etc/os-release"):
|
||||
+ print "Cannot run the test: '/etc/os-release' does not exist"
|
||||
+ sys.exit(1)
|
||||
+
|
||||
+exit_code = 0
|
||||
+if report.getProduct_fromOSRELEASE() != report.getProduct():
|
||||
+ print "getProduct() did not return PRODUCT from /etc/os-release"
|
||||
+ exit_code += 1
|
||||
+
|
||||
+if report.getVersion_fromOSRELEASE() != report.getVersion():
|
||||
+ print "getVersion() did not return PRODUCT from /etc/os-release"
|
||||
+ exit_code += 1
|
||||
+
|
||||
+sys.exit(exit_code)
|
||||
+]])
|
||||
diff --git a/tests/testsuite.at b/tests/testsuite.at
|
||||
index 97b2442..a569457 100644
|
||||
--- a/tests/testsuite.at
|
||||
+++ b/tests/testsuite.at
|
||||
@@ -13,3 +13,4 @@ m4_include([reported_to.at])
|
||||
m4_include([make_description.at])
|
||||
m4_include([libreport_types.at])
|
||||
m4_include([xml_definition.at])
|
||||
+m4_include([report_python.at])
|
||||
--
|
||||
2.1.0
|
||||
|
@ -0,0 +1,59 @@
|
||||
From 084de59a8ed21e9feb50b49ccbba6b472641c284 Mon Sep 17 00:00:00 2001
|
||||
From: Jakub Filak <jfilak@redhat.com>
|
||||
Date: Wed, 3 Sep 2014 13:38:46 +0200
|
||||
Subject: [PATCH 34/34] testsuite: work around the issue with 'report-python'
|
||||
|
||||
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
||||
---
|
||||
src/report-python/__init__.py | 9 ++++++++-
|
||||
tests/osinfo.at | 1 +
|
||||
tests/report_python.at | 1 +
|
||||
3 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/report-python/__init__.py b/src/report-python/__init__.py
|
||||
index ce7ea06..71e2d62 100644
|
||||
--- a/src/report-python/__init__.py
|
||||
+++ b/src/report-python/__init__.py
|
||||
@@ -17,7 +17,14 @@ try:
|
||||
except ImportError:
|
||||
from report._py3report import *
|
||||
|
||||
-from report.io import TextIO, GTKIO, NewtIO
|
||||
+try:
|
||||
+ from report.io import TextIO, GTKIO, NewtIO
|
||||
+except ImportError:
|
||||
+ # Support testing
|
||||
+ _temp = __import__("io", globals(), locals(), ["TextIO", "GTKIO", "NewtIO"], -1)
|
||||
+ TextIO = _temp.TextIO
|
||||
+ GTKIO = _temp.GTKIO
|
||||
+ NewtIO = _temp.NewtIO
|
||||
|
||||
#Compatibility with report package:
|
||||
# Author(s): Gavin Romig-Koch <gavin@redhat.com>
|
||||
diff --git a/tests/osinfo.at b/tests/osinfo.at
|
||||
index b57452d..868a9a2 100644
|
||||
--- a/tests/osinfo.at
|
||||
+++ b/tests/osinfo.at
|
||||
@@ -401,6 +401,7 @@ int main(void)
|
||||
AT_PYTESTFUN([parse_osinfo_python],
|
||||
[[import sys
|
||||
|
||||
+sys.path.insert(0, "../../../src/report-python")
|
||||
sys.path.insert(0, "../../../src/report-python/.libs")
|
||||
|
||||
report = __import__("report-python", globals(), locals(), [], -1)
|
||||
diff --git a/tests/report_python.at b/tests/report_python.at
|
||||
index 17e4fb3..5569b1f 100644
|
||||
--- a/tests/report_python.at
|
||||
+++ b/tests/report_python.at
|
||||
@@ -9,6 +9,7 @@ AT_BANNER([report_python])
|
||||
AT_PYTESTFUN([get_from_etc_os_release],
|
||||
[[import sys
|
||||
|
||||
+sys.path.insert(0, "../../../src/report-python")
|
||||
sys.path.insert(0, "../../../src/report-python/.libs")
|
||||
|
||||
report = __import__("report-python", globals(), locals(), [], -1)
|
||||
--
|
||||
2.1.0
|
||||
|
@ -34,6 +34,20 @@ Patch17: 0017-gui-clear-the-sensitive-cache-between-two-event-runs.patch
|
||||
Patch18: 0018-gui-don-t-remove-already-removed-GTimeoutSource.patch
|
||||
Patch19: 0019-gui-reload-destroyed-sensitive-data-warn-widgets-fro.patch
|
||||
Patch20: 0020-gui-add-Repeat-button.patch
|
||||
Patch21: 0021-Get-rid-of-deprecation-warnings-introduced-with-gtk-.patch
|
||||
Patch22: 0022-wizard-terminate-event-chain-after-the-emergency-ana.patch
|
||||
Patch23: 0023-lib-don-t-spit-unnecessary-debug-messages.patch
|
||||
Patch24: 0024-mailx-print-only-one-log-message-in-notify_only-mode.patch
|
||||
Patch25: 0025-gui-use-symbolic-icons.patch
|
||||
Patch26: 0026-gui-Problem-Details-suite.patch
|
||||
Patch27: 0027-gui-port-to-Problem-Details-suite.patch
|
||||
#Patch28: 0028-spec-install-Problem-Details-stuff.patch
|
||||
Patch29: 0029-gui-fix-build-with-older-gtk.patch
|
||||
Patch30: 0030-wizard-don-t-work-with-destroyed-widgets.patch
|
||||
Patch31: 0031-wizard-Next-button-insensitive-on-the-review-page-by.patch
|
||||
Patch32: 0032-report-parse-release-version-from-os-release.patch
|
||||
Patch33: 0033-testsuite-report-python-sanity-tests.patch
|
||||
Patch34: 0034-testsuite-work-around-the-issue-with-report-python.patch
|
||||
|
||||
# git is need for '%%autosetup -S git' which automatically applies all the
|
||||
# patches above. Please, be aware that the patches must be generated
|
||||
@ -399,7 +413,10 @@ rm -f $RPM_BUILD_ROOT%{_mandir}/man5/report_rhel_bugzilla.conf.5
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%check
|
||||
make check
|
||||
make check || {
|
||||
cat tests/testsuite.log
|
||||
exit 1
|
||||
}
|
||||
|
||||
%post gtk
|
||||
/sbin/ldconfig
|
||||
@ -464,6 +481,8 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
||||
%{_includedir}/libreport/file_obj.h
|
||||
%{_includedir}/libreport/config_item_info.h
|
||||
%{_includedir}/libreport/workflow.h
|
||||
%{_includedir}/libreport/problem_details_widget.h
|
||||
%{_includedir}/libreport/problem_details_dialog.h
|
||||
# Private api headers:
|
||||
%{_includedir}/libreport/internal_abrt_dbus.h
|
||||
%{_includedir}/libreport/internal_libreport.h
|
||||
@ -672,6 +691,14 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Sep 01 2014 Jakub Filak <jfilak@redhat.com> 2.2.3-6
|
||||
- add "Details" button on the screen with comment
|
||||
- terminate reporting after the emergency analysis
|
||||
- reduce the amount of log messages
|
||||
- use symbolic icons
|
||||
- parse release version from os-release (Python)
|
||||
- Resolves: #1133549
|
||||
|
||||
* Tue Aug 19 2014 Jakub Filak <jfilak@redhat.com> 2.2.3-5
|
||||
- add the "Repeat" button to the reporting wizard
|
||||
- a bunch of GUI improvements
|
||||
|
Loading…
Reference in New Issue
Block a user