|
|
4b6aa8 |
From 3abbb4c7324fff37189b632f7522385a001e16a0 Mon Sep 17 00:00:00 2001
|
|
|
4b6aa8 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
4b6aa8 |
Date: Wed, 30 Jul 2014 13:48:59 +0200
|
|
|
4b6aa8 |
Subject: [LIBREPORT PATCH 51/93] gui: reload destroyed sensitive data warn
|
|
|
4b6aa8 |
widgets from the galde
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
clear_warnings() destroys the warning widgets. The sensitive data
|
|
|
4b6aa8 |
widgets needs to be reloaded as GtkBuilder does not return clones of
|
|
|
4b6aa8 |
object but the instances from its cache.
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Related to rhbz#1069917
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
Signed-off-by: Jakub Filak <jfilak@redhat.com>
|
|
|
4b6aa8 |
---
|
|
|
4b6aa8 |
src/gui-wizard-gtk/wizard.c | 75 +++++++++++++++++++++++++++------------------
|
|
|
4b6aa8 |
1 file changed, 46 insertions(+), 29 deletions(-)
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
|
|
|
4b6aa8 |
index 492feed..d7d1a78 100644
|
|
|
4b6aa8 |
--- a/src/gui-wizard-gtk/wizard.c
|
|
|
4b6aa8 |
+++ b/src/gui-wizard-gtk/wizard.c
|
|
|
4b6aa8 |
@@ -229,6 +229,45 @@ static bool check_minimal_bt_rating(const char *event_name);
|
|
|
4b6aa8 |
static char *get_next_processed_event(GList **events_list);
|
|
|
4b6aa8 |
static void on_next_btn_cb(GtkWidget *btn, gpointer user_data);
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
+/* wizard.glade file as a string WIZARD_GLADE_CONTENTS: */
|
|
|
4b6aa8 |
+#include "wizard_glade.c"
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+static GtkBuilder *make_builder()
|
|
|
4b6aa8 |
+{
|
|
|
4b6aa8 |
+ GError *error = NULL;
|
|
|
4b6aa8 |
+ GtkBuilder *builder = gtk_builder_new();
|
|
|
4b6aa8 |
+ if (!g_glade_file)
|
|
|
4b6aa8 |
+ {
|
|
|
4b6aa8 |
+ /* load additional widgets from glade */
|
|
|
4b6aa8 |
+ gtk_builder_add_objects_from_string(builder,
|
|
|
4b6aa8 |
+ WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1,
|
|
|
4b6aa8 |
+ (gchar**)misc_widgets,
|
|
|
4b6aa8 |
+ &error);
|
|
|
4b6aa8 |
+ if (error != NULL)
|
|
|
4b6aa8 |
+ error_msg_and_die("Error loading glade data: %s", error->message);
|
|
|
4b6aa8 |
+ /* Load pages from internal string */
|
|
|
4b6aa8 |
+ gtk_builder_add_objects_from_string(builder,
|
|
|
4b6aa8 |
+ WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1,
|
|
|
4b6aa8 |
+ (gchar**)page_names,
|
|
|
4b6aa8 |
+ &error);
|
|
|
4b6aa8 |
+ if (error != NULL)
|
|
|
4b6aa8 |
+ error_msg_and_die("Error loading glade data: %s", error->message);
|
|
|
4b6aa8 |
+ }
|
|
|
4b6aa8 |
+ else
|
|
|
4b6aa8 |
+ {
|
|
|
4b6aa8 |
+ /* -g FILE: load UI from it */
|
|
|
4b6aa8 |
+ /* load additional widgets from glade */
|
|
|
4b6aa8 |
+ gtk_builder_add_objects_from_file(builder, g_glade_file, (gchar**)misc_widgets, &error);
|
|
|
4b6aa8 |
+ if (error != NULL)
|
|
|
4b6aa8 |
+ error_msg_and_die("Can't load %s: %s", g_glade_file, error->message);
|
|
|
4b6aa8 |
+ gtk_builder_add_objects_from_file(builder, g_glade_file, (gchar**)page_names, &error);
|
|
|
4b6aa8 |
+ if (error != NULL)
|
|
|
4b6aa8 |
+ error_msg_and_die("Can't load %s: %s", g_glade_file, error->message);
|
|
|
4b6aa8 |
+ }
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ return builder;
|
|
|
4b6aa8 |
+}
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
static void label_wrapper(GtkWidget *widget, gpointer data_unused)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
if (GTK_IS_CONTAINER(widget))
|
|
|
4b6aa8 |
@@ -2062,11 +2101,15 @@ static void on_sensitive_ticket_clicked_cb(GtkWidget *button, gpointer user_data
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
static void add_sensitive_data_warning(void)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
- GtkWidget *sens_data_warn = GTK_WIDGET(gtk_builder_get_object(g_builder, SENSITIVE_DATA_WARN));
|
|
|
4b6aa8 |
- GtkButton *sens_ticket_cb = GTK_BUTTON(gtk_builder_get_object(g_builder, PRIVATE_TICKET_CB));
|
|
|
4b6aa8 |
+ GtkBuilder *builder = make_builder();
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ GtkWidget *sens_data_warn = GTK_WIDGET(gtk_builder_get_object(builder, SENSITIVE_DATA_WARN));
|
|
|
4b6aa8 |
+ GtkButton *sens_ticket_cb = GTK_BUTTON(gtk_builder_get_object(builder, PRIVATE_TICKET_CB));
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
g_signal_connect(sens_ticket_cb, "toggled", G_CALLBACK(on_sensitive_ticket_clicked_cb), NULL);
|
|
|
4b6aa8 |
add_widget_to_warning_area(GTK_WIDGET(sens_data_warn));
|
|
|
4b6aa8 |
+
|
|
|
4b6aa8 |
+ g_object_unref(builder);
|
|
|
4b6aa8 |
}
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
static void show_warnings(void)
|
|
|
4b6aa8 |
@@ -3128,9 +3171,6 @@ static gint on_key_press_event_in_item_list(GtkTreeView *treeview, GdkEventKey *
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
/* Initialization */
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
-/* wizard.glade file as a string WIZARD_GLADE_CONTENTS: */
|
|
|
4b6aa8 |
-#include "wizard_glade.c"
|
|
|
4b6aa8 |
-
|
|
|
4b6aa8 |
static void on_next_btn_cb(GtkWidget *btn, gpointer user_data)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
gint current_page_no = gtk_notebook_get_current_page(g_assistant);
|
|
|
4b6aa8 |
@@ -3145,30 +3185,7 @@ static void on_next_btn_cb(GtkWidget *btn, gpointer user_data)
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
static void add_pages(void)
|
|
|
4b6aa8 |
{
|
|
|
4b6aa8 |
- GError *error = NULL;
|
|
|
4b6aa8 |
- g_builder = gtk_builder_new();
|
|
|
4b6aa8 |
- if (!g_glade_file)
|
|
|
4b6aa8 |
- {
|
|
|
4b6aa8 |
- /* load additional widgets from glade */
|
|
|
4b6aa8 |
- gtk_builder_add_objects_from_string(g_builder,
|
|
|
4b6aa8 |
- WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1,
|
|
|
4b6aa8 |
- (gchar**)misc_widgets,
|
|
|
4b6aa8 |
- &error);
|
|
|
4b6aa8 |
- /* Load pages from internal string */
|
|
|
4b6aa8 |
- gtk_builder_add_objects_from_string(g_builder,
|
|
|
4b6aa8 |
- WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1,
|
|
|
4b6aa8 |
- (gchar**)page_names,
|
|
|
4b6aa8 |
- &error);
|
|
|
4b6aa8 |
- if (error != NULL)
|
|
|
4b6aa8 |
- error_msg_and_die("Error loading glade data: %s", error->message);
|
|
|
4b6aa8 |
- }
|
|
|
4b6aa8 |
- else
|
|
|
4b6aa8 |
- {
|
|
|
4b6aa8 |
- /* -g FILE: load IU from it */
|
|
|
4b6aa8 |
- gtk_builder_add_objects_from_file(g_builder, g_glade_file, (gchar**)page_names, &error);
|
|
|
4b6aa8 |
- if (error != NULL)
|
|
|
4b6aa8 |
- error_msg_and_die("Can't load %s: %s", g_glade_file, error->message);
|
|
|
4b6aa8 |
- }
|
|
|
4b6aa8 |
+ g_builder = make_builder();
|
|
|
4b6aa8 |
|
|
|
4b6aa8 |
int i;
|
|
|
4b6aa8 |
int page_no = 0;
|
|
|
4b6aa8 |
--
|
|
|
4b6aa8 |
1.8.3.1
|
|
|
4b6aa8 |
|