[LIBREPORT PATCH] replace functions deprecated in Gtk-3.10 with their substitutes
by Jakub Filak
The deprecated functions are helpers and all the substitutes are in Gtk
since version 3.0
Related to abrt/abrt#673
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gtk-helpers/ask_dialogs.c | 4 +--
src/gtk-helpers/config_dialog.c | 2 +-
src/gtk-helpers/event_config_dialog.c | 17 +++++----
src/gtk-helpers/workflow_config_dialog.c | 4 +--
src/gui-wizard-gtk/wizard.c | 61 +++++++++++++++++++-------------
src/gui-wizard-gtk/wizard.glade | 24 +++----------
6 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/src/gtk-helpers/ask_dialogs.c b/src/gtk-helpers/ask_dialogs.c
index 07e6c67..19fed1f 100644
--- a/src/gtk-helpers/ask_dialogs.c
+++ b/src/gtk-helpers/ask_dialogs.c
@@ -76,8 +76,8 @@ static int run_ask_yes_no_save_generic_result_dialog(ask_yes_no_dialog_flags fla
GTK_BUTTONS_NONE,
"%s", message);
- gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_YES, GTK_RESPONSE_YES);
- GtkWidget *no_button = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_NO, GTK_RESPONSE_NO);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Yes"), GTK_RESPONSE_YES);
+ GtkWidget *no_button = gtk_dialog_add_button(GTK_DIALOG(dialog), _("_No"), GTK_RESPONSE_NO);
gint response = GTK_RESPONSE_NO;
g_signal_connect(G_OBJECT(dialog), "response",
diff --git a/src/gtk-helpers/config_dialog.c b/src/gtk-helpers/config_dialog.c
index 75e26a9..cfa70da 100644
--- a/src/gtk-helpers/config_dialog.c
+++ b/src/gtk-helpers/config_dialog.c
@@ -306,7 +306,7 @@ GtkWindow *create_config_list_window(GHashTable *configs, GtkWindow *parent)
GtkWidget *btn_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
GtkWidget *configure_btn = gtk_button_new_with_mnemonic(_("C_onfigure"));
GtkWidget *align = gtk_alignment_new(0, 0, 0, 0);
- GtkWidget *close_btn = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
+ GtkWidget *close_btn = gtk_button_new_with_mnemonic(_("_Close"));
GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
//force apply and close to have the same size
gtk_size_group_add_widget(sg, close_btn);
diff --git a/src/gtk-helpers/event_config_dialog.c b/src/gtk-helpers/event_config_dialog.c
index 7ea5b29..c8a251c 100644
--- a/src/gtk-helpers/event_config_dialog.c
+++ b/src/gtk-helpers/event_config_dialog.c
@@ -262,8 +262,13 @@ config_dialog_t *create_event_config_dialog_content(event_config_t *event, GtkWi
GtkWidget *keyring_warn_lbl =
gtk_label_new(
_("Secret Service is not available, your settings won't be saved!"));
- static const GdkColor red = { .red = 0xffff };
- gtk_widget_modify_fg(keyring_warn_lbl, GTK_STATE_NORMAL, &red);
+ static const GdkRGBA red = {
+ .red = 1.0,
+ .green = 0.0,
+ .blue = 0.0,
+ .alpha = 1.0,
+ };
+ gtk_widget_override_color(keyring_warn_lbl, GTK_STATE_FLAG_NORMAL, &red);
gtk_box_pack_start(GTK_BOX(content), keyring_warn_lbl, false, false, 0);
}
@@ -291,9 +296,9 @@ config_dialog_t *create_event_config_dialog(const char *event_name, GtkWindow *p
/*title:*/ec_get_screen_name(event) ? ec_get_screen_name(event) : event_name,
parent_window,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL,
+ _("_Cancel"),
GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK,
+ _("_OK"),
GTK_RESPONSE_APPLY,
NULL);
@@ -343,9 +348,9 @@ int show_event_config_dialog(const char *event_name, GtkWindow *parent)
/*title:*/ec_get_screen_name(event) ? ec_get_screen_name(event) : event_name,
parent_window,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL,
+ _("_Cancel"),
GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK,
+ _("_OK"),
GTK_RESPONSE_APPLY,
NULL);
diff --git a/src/gtk-helpers/workflow_config_dialog.c b/src/gtk-helpers/workflow_config_dialog.c
index decdb37..fb312e3 100644
--- a/src/gtk-helpers/workflow_config_dialog.c
+++ b/src/gtk-helpers/workflow_config_dialog.c
@@ -73,9 +73,9 @@ config_dialog_t *create_workflow_config_dialog(const char *workflow_name, GtkWin
/*title:*/ wf_get_screen_name(workflow) ? wf_get_screen_name(workflow) : workflow_name,
parent_window,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL,
+ _("_Cancel"),
GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK,
+ _("_OK"),
GTK_RESPONSE_APPLY,
NULL);
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 1c7d75d..9ddf076 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -104,7 +104,6 @@ static GtkEventBox *g_ev_search_up;
static GtkEventBox *g_ev_search_down;
static GtkSpinner *g_spinner_event_log;
static GtkImage *g_img_process_fail;
-static GtkImage *g_img_process_ok;
static GtkButton *g_btn_startcast;
static GtkExpander *g_exp_report_log;
@@ -749,8 +748,8 @@ static void tv_details_row_activated(
GtkWidget *scrolled = gtk_scrolled_window_new(NULL, NULL);
GtkWidget *textview = gtk_text_view_new();
- gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_SAVE, GTK_RESPONSE_OK);
- gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Save"), GTK_RESPONSE_OK);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Cancel"), GTK_RESPONSE_CANCEL);
gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0);
gtk_widget_set_size_request(scrolled, 640, 480);
@@ -1046,13 +1045,21 @@ static event_gui_data_t *add_event_buttons(GtkBox *box,
GtkWidget *child = gtk_bin_get_child(GTK_BIN(button));
if (child)
{
- static const GdkColor red = { .red = 0xffff };
- static const GdkColor green = { .green = 0x7fff };
- const GdkColor *color = (green_choice ? &green : &red);
+ static const GdkRGBA red = {
+ .red = 1.0,
+ .green = 0.0,
+ .blue = 0.0,
+ .alpha = 1.0,
+ };
+ static const GdkRGBA green = {
+ .red = 0.0,
+ .green = 0.5,
+ .blue = 0.0,
+ .alpha = 1.0,
+ };
+ const GdkRGBA *color = (green_choice ? &green : &red);
//gtk_widget_modify_text(button, GTK_STATE_NORMAL, color);
- gtk_widget_modify_fg(child, GTK_STATE_NORMAL, color);
- gtk_widget_modify_fg(child, GTK_STATE_ACTIVE, color);
- gtk_widget_modify_fg(child, GTK_STATE_PRELIGHT, color);
+ gtk_widget_override_color(child, GTK_STATE_FLAG_NORMAL, color);
}
}
@@ -1148,7 +1155,7 @@ static void append_item_to_ls_details(gpointer name, gpointer value, gpointer da
{
GtkWidget *tab_lbl = gtk_label_new((char *)name);
GtkWidget *tev = gtk_text_view_new();
- gtk_widget_modify_font(GTK_WIDGET(tev), g_monospace_font);
+ gtk_widget_override_font(GTK_WIDGET(tev), g_monospace_font);
load_text_to_text_view(GTK_TEXT_VIEW(tev), (char *)name);
/* init searching */
GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(tev));
@@ -1831,7 +1838,6 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
}
else
{
- gtk_widget_show(GTK_WIDGET(g_img_process_ok));
gtk_label_set_text(g_lbl_event_log, is_processing_finished() ? _("Processing finished.")
: _("Processing finished, please proceed to the next step."));
}
@@ -1948,7 +1954,6 @@ static void start_event_run(const char *event_name)
/* don't bother testing if they are visible, this is faster */
gtk_widget_hide(GTK_WIDGET(g_img_process_fail));
- gtk_widget_hide(GTK_WIDGET(g_img_process_ok));
gtk_widget_show(GTK_WIDGET(g_spinner_event_log));
gtk_widget_show(g_btn_stop);
@@ -2809,8 +2814,8 @@ static void on_btn_add_file(GtkButton *button)
"Attach File",
GTK_WINDOW(g_wnd_assistant),
GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ _("_Cancel"), GTK_RESPONSE_CANCEL,
+ _("_Open"), GTK_RESPONSE_ACCEPT,
NULL
);
char *filename = NULL;
@@ -3009,20 +3014,24 @@ static void add_pages(void)
g_ev_search_up = GTK_EVENT_BOX( gtk_builder_get_object(g_builder, "ev_search_up"));
g_ev_search_down = GTK_EVENT_BOX( gtk_builder_get_object(g_builder, "ev_search_down"));
g_spinner_event_log = GTK_SPINNER( gtk_builder_get_object(g_builder, "spinner_event_log"));
- g_img_process_ok = GTK_IMAGE( gtk_builder_get_object(g_builder, "img_process_ok"));
g_img_process_fail = GTK_IMAGE( gtk_builder_get_object(g_builder, "img_process_fail"));
g_btn_startcast = GTK_BUTTON( gtk_builder_get_object(g_builder, "btn_startcast"));
g_exp_report_log = GTK_EXPANDER( gtk_builder_get_object(g_builder, "expand_report"));
gtk_widget_set_no_show_all(GTK_WIDGET(g_spinner_event_log), true);
- gtk_widget_modify_font(GTK_WIDGET(g_tv_event_log), g_monospace_font);
+ gtk_widget_override_font(GTK_WIDGET(g_tv_event_log), g_monospace_font);
fix_all_wrapped_labels(GTK_WIDGET(g_assistant));
/* Configure btn on select analyzers page */
+ GtkWidget *img_config_btn = gtk_image_new_from_icon_name("preferences-system", GTK_ICON_SIZE_BUTTON);
GtkWidget *config_btn = GTK_WIDGET(gtk_builder_get_object(g_builder, "button_cfg1"));
if (config_btn)
+ {
g_signal_connect(G_OBJECT(config_btn), "clicked", G_CALLBACK(on_show_event_list_cb), NULL);
+ gtk_button_set_image(GTK_BUTTON(config_btn), img_config_btn);
+ gtk_button_set_image_position(GTK_BUTTON(config_btn), GTK_POS_RIGHT);
+ }
g_signal_connect(g_cb_no_comment, "toggled", G_CALLBACK(on_no_comment_toggled), NULL);
@@ -3036,9 +3045,9 @@ static void add_pages(void)
g_signal_connect(G_OBJECT(g_ev_search_down), "button-press-event", G_CALLBACK(search_down), NULL);
/* Set color of the comment evenbox */
- GdkColor color;
- gdk_color_parse("#CC3333", &color);
- gtk_widget_modify_bg(GTK_WIDGET(g_eb_comment), GTK_STATE_NORMAL, &color);
+ GdkRGBA color;
+ gdk_rgba_parse(&color, "#CC3333");
+ gtk_widget_override_color(GTK_WIDGET(g_eb_comment), GTK_STATE_FLAG_NORMAL, &color);
g_signal_connect(g_tv_details, "key-press-event", G_CALLBACK(on_key_press_event_in_item_list), NULL);
}
@@ -3199,14 +3208,16 @@ void create_assistant(bool expert_mode)
*/
gtk_notebook_set_show_tabs(g_assistant, (g_verbose != 0 && g_expert_mode));
- g_btn_close = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
- g_btn_stop = gtk_button_new_from_stock(GTK_STOCK_STOP);
+ 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));
+ 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_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_stock(GTK_STOCK_GO_UP, GTK_ICON_SIZE_BUTTON));
- gtk_button_set_image_position(GTK_BUTTON(g_btn_onfail), GTK_POS_LEFT);
+ gtk_button_set_image(GTK_BUTTON(g_btn_onfail), gtk_image_new_from_icon_name("go-up", GTK_ICON_SIZE_BUTTON));
gtk_widget_set_no_show_all(g_btn_onfail, true); /* else gtk_widget_hide won't work */
- g_btn_next = gtk_button_new_from_stock(GTK_STOCK_GO_FORWARD);
+ 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_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));
@@ -3232,7 +3243,7 @@ void create_assistant(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_stock(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
+ GtkWidget *image = gtk_image_new_from_icon_name("dialog-warning", 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 619b19a..800eae0 100644
--- a/src/gui-wizard-gtk/wizard.glade
+++ b/src/gui-wizard-gtk/wizard.glade
@@ -4,7 +4,7 @@
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="stock">gtk-media-record</property>
+ <property name="icon_name">media-record</property>
</object>
<object class="GtkWindow" id="window0">
<property name="can_focus">False</property>
@@ -303,13 +303,11 @@
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="button_cfg1">
- <property name="label">gtk-preferences</property>
+ <property name="label">_Preferences</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
- <property name="use_stock">True</property>
- <property name="image_position">right</property>
</object>
<packing>
<property name="expand">False</property>
@@ -405,7 +403,7 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="invisible_char_set">True</property>
- <property name="secondary_icon_stock">gtk-find</property>
+ <property name="secondary_icon_name">edit-find</property>
<property name="primary_icon_activatable">False</property>
</object>
<packing>
@@ -607,24 +605,10 @@
</packing>
</child>
<child>
- <object class="GtkImage" id="img_process_ok">
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="stock">gtk-apply</property>
- <property name="icon-size">1</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="padding">5</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
<object class="GtkImage" id="img_process_fail">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
- <property name="stock">gtk-dialog-error</property>
+ <property name="icon_name">dialog-error</property>
<property name="icon-size">1</property>
</object>
<packing>
--
1.8.3.1
10 years, 9 months
[GNOME-ABRT PATCH] Get rid of Stock Items usage
by Jakub Filak
Related to abrt/abrt#673
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gnome_abrt/oops.glade | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/gnome_abrt/oops.glade b/src/gnome_abrt/oops.glade
index 497c386..ceba652 100644
--- a/src/gnome_abrt/oops.glade
+++ b/src/gnome_abrt/oops.glade
@@ -7,9 +7,8 @@
<property name="accel_group">ag_accelerators</property>
<child>
<object class="GtkAction" id="gac_delete">
- <property name="label" translatable="yes">Delete</property>
+ <property name="label" translatable="yes">_Delete</property>
<property name="tooltip" translatable="yes">Delete selected problems</property>
- <property name="stock_id">gtk-delete</property>
<signal name="activate" handler="on_gac_delete_activate" swapped="no"/>
</object>
<accelerator key="Delete"/>
@@ -26,7 +25,6 @@
<object class="GtkAction" id="gac_detail">
<property name="label" translatable="yes">Analy_ze</property>
<property name="tooltip" translatable="yes">Open selected problem for analysis</property>
- <property name="stock_id">gtk-zoom-in</property>
<signal name="activate" handler="on_gac_detail_activate" swapped="no"/>
</object>
<accelerator key="Return" modifiers="GDK_CONTROL_MASK | GDK_MOD1_MASK"/>
@@ -42,7 +40,6 @@
<object class="GtkAction" id="gac_open_directory">
<property name="label" translatable="yes">_Open problem's data directory</property>
<property name="tooltip" translatable="yes">Opens the selected problem's data directory in the default file system browser</property>
- <property name="stock_id">gtk-open</property>
<signal name="activate" handler="on_gac_open_directory_activate" swapped="no"/>
</object>
<accelerator key="o" modifiers="GDK_CONTROL_MASK"/>
@@ -51,7 +48,6 @@
<object class="GtkAction" id="gac_copy_id">
<property name="label" translatable="yes">_Copy problem's ID to Clipboard</property>
<property name="tooltip" translatable="yes">Stores the selected problem's ID in Clibpoard</property>
- <property name="stock_id">gtk-copy</property>
<signal name="activate" handler="on_gac_copy_id_activate" swapped="no"/>
</object>
<accelerator key="c" modifiers="GDK_CONTROL_MASK"/>
@@ -131,7 +127,7 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="caps_lock_warning">False</property>
- <property name="secondary_icon_stock">gtk-find</property>
+ <property name="secondary_icon_name">edit-find</property>
<property name="placeholder_text">Search</property>
<signal name="changed" handler="on_te_search_changed" swapped="no"/>
</object>
@@ -163,7 +159,7 @@
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">start</property>
- <property name="stock">gtk-missing-image</property>
+ <property name="icon_name">image-missing</property>
<property name="icon-size">3</property>
</object>
<packing>
@@ -724,7 +720,6 @@
<property name="receives_default">True</property>
<property name="halign">end</property>
<property name="margin_right">5</property>
- <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
--
1.8.3.1
10 years, 9 months
[SATYR PATCH] Always build GDB-output-based unwinder
by Martin Milata
Previously it was built only when a native unwinding library was
present, which does not make any sense.
Signed-off-by: Martin Milata <mmilata(a)redhat.com>
---
lib/core_unwind.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/lib/core_unwind.c b/lib/core_unwind.c
index f15a0f9..f8ec516 100644
--- a/lib/core_unwind.c
+++ b/lib/core_unwind.c
@@ -49,7 +49,7 @@ sr_parse_coredump(const char *coredump_filename,
return NULL;
}
-#else /* !defined WITH_LIBDWFL && !defined WITH_LIBUNWIND */
+#endif /* !defined WITH_LIBDWFL && !defined WITH_LIBUNWIND */
/* FIXME: is there another way to pass the executable name to the find_elf
* callback? */
@@ -444,5 +444,3 @@ sr_core_stacktrace_from_gdb(const char *gdb_output, const char *core_file,
sr_gdb_stacktrace_free(gdb_stacktrace);
return core_stacktrace;
}
-
-#endif /* !defined WITH_LIBDWFL && !defined WITH_LIBUNWIND */
--
1.8.3.1
10 years, 9 months
[LIBREPORT PATCH] add missing compiler flags for g_type_init()
by Jakub Filak
Related to rhbz#927919
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
configure.ac | 1 +
src/lib/Makefile.am | 2 ++
2 files changed, 3 insertions(+)
diff --git a/configure.ac b/configure.ac
index 5365c2a..5fa76cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,6 +146,7 @@ AC_SUBST(PYTHON_CFLAGS)
AC_SUBST(PYTHON_LIBS)
PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.21])
+PKG_CHECK_MODULES([GOBJECT], [gobject-2.0])
PKG_CHECK_MODULES([DBUS], [dbus-1])
PKG_CHECK_MODULES([LIBXML], [libxml-2.0])
PKG_CHECK_MODULES([NSS], [nss])
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 92287bc..6266f6f 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -118,6 +118,7 @@ libreport_web_la_CPPFLAGS = \
-DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
-DEVENTS_DIR=\"$(EVENTS_DIR)\" \
$(GLIB_CFLAGS) \
+ $(GOBJECT_CFLAGS) \
$(CURL_CFLAGS) \
$(PROXY_CFLAGS) \
$(LIBXML_CFLAGS) \
@@ -129,6 +130,7 @@ libreport_web_la_LDFLAGS = \
-version-info 0:1:0
libreport_web_la_LIBADD = \
$(GLIB_LIBS) \
+ $(GOBJECT_LIBS) \
$(CURL_LIBS) \
$(PROXY_LIBS) \
$(LIBXML_LIBS) \
--
1.8.3.1
10 years, 9 months
[LIBREPORT PATCH] add helper function for GLib initialization
by Jakub Filak
Related to rhbz#927919
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/include/internal_libreport.h | 5 +++++
src/lib/glib_support.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
index 1d1d204..dbac2f7 100644
--- a/src/include/internal_libreport.h
+++ b/src/include/internal_libreport.h
@@ -281,6 +281,11 @@ bool is_in_comma_separated_list(const char *value, const char *list);
#define is_in_comma_separated_list_of_glob_patterns libreport_is_in_comma_separated_list_of_glob_patterns
bool is_in_comma_separated_list_of_glob_patterns(const char *value, const char *list);
+/* Calls GLib version appropriate initialization function.
+ */
+#define glib_init libreport_glib_init
+void glib_init(void);
+
/* Frees every element'd data using free(),
* then frees list itself using g_list_free(list):
*/
diff --git a/src/lib/glib_support.c b/src/lib/glib_support.c
index 1180537..fb97f4c 100644
--- a/src/lib/glib_support.c
+++ b/src/lib/glib_support.c
@@ -17,6 +17,38 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "internal_libreport.h"
+#include <glib-object.h>
+
+void glib_init(void)
+{
+#if (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 35)
+ /* Became deprecated in glib-2.35.1 (branch 2.36 commit df02fa1e4cc61a2c7f3aafdf1a6534a831f1c0d6) */
+ g_type_init();
+#endif
+
+ /* This is not necessary but is IMO is good to know that:
+ *
+ * If want to be defensive and ensure we're linked to GObject
+ * call the following function [1]:
+ *
+ * g_type_ensure(G_TYPE_OBJECT);
+ *
+ *
+ * See glib README -> Notes about GLib 2.36, 1st paragraph
+ *
+ * 1: https://bugzilla.gnome.org/show_bug.cgi?id=691077
+ */
+
+ /* Help with mysterious bug */
+ if (g_verbose > 0)
+ {
+ const gchar *version_mismatch = glib_check_version(GLIB_MAJOR_VERSION,
+ GLIB_MINOR_VERSION,
+ GLIB_MICRO_VERSION);
+ if (version_mismatch != NULL)
+ log("Running GLib incompatible version: %s", version_mismatch);
+ }
+}
void list_free_with_free(GList *list)
{
--
1.8.3.1
10 years, 9 months
[GNOME-ABRT PATCH 1/2] Do not remove invalid problems while sorting the list
by Jakub Filak
Closes rhbz#956912
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gnome_abrt/views.py | 39 +++++++++++++++++++++++++++++++--------
1 file changed, 31 insertions(+), 8 deletions(-)
diff --git a/src/gnome_abrt/views.py b/src/gnome_abrt/views.py
index 34e1fab..73a8fa7 100644
--- a/src/gnome_abrt/views.py
+++ b/src/gnome_abrt/views.py
@@ -88,13 +88,18 @@ def problem_to_storage_values(problem):
problem]
#pylint: disable=W0613
-def time_sort_func(model, first, second, view):
+def time_sort_func(model, first, second, trash):
+ # skip invalid problems which were marked invalid while sorting
+ if (model[first][2].problem_id in trash or
+ model[second][2].problem_id in trash):
+ return 0
+
try:
lhs = model[first][2]['date_last'].timetuple()
rhs = model[second][2]['date_last'].timetuple()
return time.mktime(lhs) - time.mktime(rhs)
except errors.InvalidProblem as ex:
- view._remove_problem_from_storage(ex.problem_id)
+ trash.add(ex.problem_id)
logging.debug(ex)
return 0
@@ -279,7 +284,10 @@ class OopsWindow(Gtk.ApplicationWindow):
self._set_button_toggled(self._source.button, True)
self._builder.ls_problems.set_sort_column_id(0, Gtk.SortType.DESCENDING)
- self._builder.ls_problems.set_sort_func(0, time_sort_func, self)
+ # a set where invalid problems found while sorting of the problem list
+ # are stored
+ self._trash = set()
+ self._builder.ls_problems.set_sort_func(0, time_sort_func, self._trash)
self._filter = ProblemsFilter(self, self._builder.tv_problems)
self._builder.tv_problems.grab_focus()
@@ -405,13 +413,27 @@ class OopsWindow(Gtk.ApplicationWindow):
Returns True if the problem was successfully added to the storage;
otherwise returns False
"""
+ problem_values = None
try:
- self._builder.ls_problems.append(problem_to_storage_values(problem))
- return True
+ problem_values = problem_to_storage_values(problem)
except errors.InvalidProblem as ex:
logging.debug("Exception: {0}".format(traceback.format_exc()))
- self._remove_problem_from_storage(ex.problem_id)
- return False
+ return
+
+ self._append_problem_values_to_storage(problem_values)
+
+ def _append_problem_values_to_storage(self, problem_values):
+ self._builder.ls_problems.append(problem_values)
+ self._clear_invalid_problems_trash()
+
+ def _clear_invalid_problems_trash(self):
+ # GtkListStore.append()/set_value() methods trigger
+ # time_sort_func() where InvalidProblem exception can occur. In that
+ # case time_sort_func() pushes an invalid problem to the trash set
+ # because the invalid problem cannot be removed while executing the
+ # operation
+ while self._trash:
+ self._remove_problem_from_storage(self._trash.pop())
def _remove_problem_from_storage(self, problem):
if problem is None:
@@ -433,6 +455,7 @@ class OopsWindow(Gtk.ApplicationWindow):
for i in xrange(0, len(values)-1):
self._builder.ls_problems.set_value(pit, i, values[i])
+ self._clear_invalid_problems_trash()
if problem in self._get_selected(self._builder.tvs_problems):
self._set_problem(problem)
@@ -461,7 +484,7 @@ class OopsWindow(Gtk.ApplicationWindow):
if storage_problems:
for p in storage_problems:
- self._builder.ls_problems.append(p)
+ self._append_problem_values_to_storage(p)
finally:
self._reloading = False
--
1.8.2.1
10 years, 9 months
[GNOME-ABRT PATCH] Check if X display can be opened
by Jakub Filak
Gtk raise too general exception (RuntimeError) which should not be
caught and considered as evidence that X is accessible.
Closes rhbz#984315
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gnome-abrt | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/gnome-abrt b/src/gnome-abrt
index b9be029..143de33 100755
--- a/src/gnome-abrt
+++ b/src/gnome-abrt
@@ -25,6 +25,21 @@ import signal
import traceback
from argparse import ArgumentParser
+from ctypes import cdll, util
+
+xlib_path = util.find_library('X11')
+if not xlib_path:
+ sys.stderr.write("Could not load X11 library\n")
+ sys.exit(1)
+
+xlib = cdll.LoadLibrary(xlib_path)
+display = xlib.XOpenDisplay(None)
+if display == 0:
+ sys.stderr.write("Cannot connect to X server\n")
+ sys.exit(2)
+
+xlib.XCloseDisplay(display)
+
# pygobject
#pylint: disable=E0611
from gi.repository import Gtk
--
1.8.3.1
10 years, 9 months
[LIBREPORT PATCH] fixed the bugzilla private group names rhbz#985881
by Jiri Moskovcak
- the actual group list can be retrieved here:
https://bugzilla.redhat.com/userprefs.cgi?tab=permissions
---
src/plugins/bugzilla.conf | 2 +-
src/plugins/report_Bugzilla.xml.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/plugins/bugzilla.conf b/src/plugins/bugzilla.conf
index 0fb3794..29c44b3 100644
--- a/src/plugins/bugzilla.conf
+++ b/src/plugins/bugzilla.conf
@@ -18,4 +18,4 @@ DontMatchComponents = selinux-policy
# for more info about these settings see: https://github.com/abrt/abrt/wiki/FAQ#creating-private-bugzilla-tickets
# CreatePrivate = no
-# PrivateGroups = group_218
+# PrivateGroups = private
diff --git a/src/plugins/report_Bugzilla.xml.in b/src/plugins/report_Bugzilla.xml.in
index d1516ba..9ffe90f 100644
--- a/src/plugins/report_Bugzilla.xml.in
+++ b/src/plugins/report_Bugzilla.xml.in
@@ -63,7 +63,7 @@
<option type="text" name="Bugzilla_PrivateGroups">
<_label>Groups</_label>
<allow-empty>yes</allow-empty>
- <default-value>group_218</default-value>
+ <default-value>private</default-value>
<_note-html>Restrict the access to specified groups <a href="https://github.com/abrt/abrt/wiki/FAQ#creating-private-bugzilla-tickets">?</a></_note-html>
</option>
</advanced-options>
--
1.8.3.1
10 years, 9 months
[ABRT PATCH] a-a-g-c-b: Unwind using GDB
by Martin Milata
Related to the fact that some distributions don't have libunwind nor
elfutils unwinder and we have to fall back to GDB.
Signed-off-by: Martin Milata <mmilata(a)redhat.com>
---
configure.ac | 13 +++++++++++
src/plugins/abrt-action-generate-core-backtrace.c | 28 ++++++++++++++++++++---
2 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4e69519..d54c715 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,6 +170,19 @@ fi
AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test "$enable_doxygen_docs" = "yes")
+# Make satyr use GDB or elfutils/libunwind for unwinding?
+
+AC_ARG_ENABLE([native-unwinder],
+ AS_HELP_STRING([--enable-native-unwinder],
+ [use native unwinder (libunwind or elfutils) instead of GDB (default is no)]),
+ [], [enable_native_unwinder=no])
+
+[if test "$enable_native_unwinder" = "yes"]
+[then]
+ AC_DEFINE([ENABLE_NATIVE_UNWINDER], [1], [Use elfutils/libunwind for unwinding instead of GDB.])
+[fi]
+
+
AC_SUBST(CONF_DIR)
AC_SUBST(VAR_RUN)
AC_SUBST(PLUGINS_CONF_DIR)
diff --git a/src/plugins/abrt-action-generate-core-backtrace.c b/src/plugins/abrt-action-generate-core-backtrace.c
index a549a53..c4f384e 100644
--- a/src/plugins/abrt-action-generate-core-backtrace.c
+++ b/src/plugins/abrt-action-generate-core-backtrace.c
@@ -64,9 +64,31 @@ int main(int argc, char **argv)
log(_("Generating core_backtrace"));
char *error_message = NULL;
- bool success = sr_abrt_create_core_stacktrace(dump_dir_name,
- !raw_fingerprints,
- &error_message);
+ bool success;
+
+#ifdef ENABLE_NATIVE_UNWINDER
+
+ success = sr_abrt_create_core_stacktrace(dump_dir_name, !raw_fingerprints,
+ &error_message);
+#else /* ENABLE_NATIVE_UNWINDER */
+
+ /* The value 240 was taken from abrt-action-generate-backtrace.c. */
+ int exec_timeout_sec = 240;
+
+ char *gdb_output = get_backtrace(dump_dir_name, exec_timeout_sec, NULL);
+ if (!gdb_output)
+ {
+ log(_("Error: GDB did not return any data"));
+ return 1;
+ }
+
+ success = sr_abrt_create_core_stacktrace_from_gdb(dump_dir_name,
+ gdb_output,
+ !raw_fingerprints,
+ &error_message);
+ free(gdb_output);
+
+#endif /* ENABLE_NATIVE_UNWINDER */
if (!success)
{
--
1.7.11.7
10 years, 9 months
[SATYR PATCH] Do not include unknown addresses in core stacktraces
by Martin Milata
Closes #96.
Signed-off-by: Martin Milata <mmilata(a)redhat.com>
---
lib/core_frame.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/lib/core_frame.c b/lib/core_frame.c
index a75f859..bb4f576 100644
--- a/lib/core_frame.c
+++ b/lib/core_frame.c
@@ -359,9 +359,13 @@ char *
sr_core_frame_to_json(struct sr_core_frame *frame)
{
struct sr_strbuf *strbuf = sr_strbuf_new();
- sr_strbuf_append_strf(strbuf,
- "{ \"address\": %"PRIu64"\n",
- frame->address);
+
+ if (frame->address != -1)
+ {
+ sr_strbuf_append_strf(strbuf,
+ ", \"address\": %"PRIu64"\n",
+ frame->address);
+ }
if (frame->build_id)
{
@@ -370,9 +374,12 @@ sr_core_frame_to_json(struct sr_core_frame *frame)
sr_strbuf_append_str(strbuf, "\n");
}
- sr_strbuf_append_strf(strbuf,
- ", \"build_id_offset\": %"PRIu64"\n",
- frame->build_id_offset);
+ if (frame->build_id_offset != -1)
+ {
+ sr_strbuf_append_strf(strbuf,
+ ", \"build_id_offset\": %"PRIu64"\n",
+ frame->build_id_offset);
+ }
if (frame->function_name)
{
@@ -395,6 +402,11 @@ sr_core_frame_to_json(struct sr_core_frame *frame)
sr_strbuf_append_str(strbuf, "\n");
}
+ if (strbuf->len > 0)
+ strbuf->buf[0] = '{';
+ else
+ sr_strbuf_append_char(strbuf, '{');
+
sr_strbuf_append_char(strbuf, '}');
return sr_strbuf_free_nobuf(strbuf);
}
--
1.7.11.7
10 years, 9 months