diff options
-rw-r--r-- | abrt.spec | 2 | ||||
-rw-r--r-- | src/gui-wizard-gtk/Makefile.am | 21 | ||||
-rw-r--r-- | src/gui-wizard-gtk/main.c | 8 | ||||
-rw-r--r-- | src/gui-wizard-gtk/wizard.c | 13 | ||||
-rw-r--r-- | src/gui-wizard-gtk/wizard.h | 2 |
5 files changed, 37 insertions, 9 deletions
@@ -410,6 +410,8 @@ fi %files -n libreport-gtk %defattr(-,root,root,-) %{_bindir}/bug-reporting-wizard +# If you want to deploy external glade file: +#%{_datadir}/%{name}/wizard.glade %files libs %defattr(-,root,root,-) diff --git a/src/gui-wizard-gtk/Makefile.am b/src/gui-wizard-gtk/Makefile.am index 1c14fa86..1b57d753 100644 --- a/src/gui-wizard-gtk/Makefile.am +++ b/src/gui-wizard-gtk/Makefile.am @@ -1,18 +1,20 @@ +# bug-reporting-wizard binary bin_PROGRAMS = bug-reporting-wizard bug_reporting_wizard_SOURCES = \ - wizard_glade.c \ wizard.h wizard.c \ - main.c + main.c \ + wizard_glade.c -#-Wl,--export-dynamic and lgmodule-2.0 -#is required for gtk_builder_connect_signals() to work correctly +# -Wl,--export-dynamic and lgmodule-2.0 +# is required for gtk_builder_connect_signals() to work correctly bug_reporting_wizard_CFLAGS = \ -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ -DCONF_DIR=\"$(CONF_DIR)\" \ + -DDATA_DIR=\"$(datadir)\" \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ @@ -31,6 +33,16 @@ bug_reporting_wizard_LDADD = \ -lgmodule-2.0 \ $(GTK_LIBS) + +# If you want to deploy external glade file: +#GLADE_FILES = wizard.glade +#pkgdata_DATA = $(GLADE_FILES) +#EXTRA_DIST = $(GLADE_FILES) + + +# For internal glade file storage in the binary: +wizard.c: wizard_glade.c + wizard_glade.c: { \ echo '#define WIZARD_GLADE_CONTENTS "\'; \ @@ -38,6 +50,7 @@ wizard_glade.c: echo '"'; \ } >wizard_glade.c + DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ @INTLTOOL_DESKTOP_RULE@ diff --git a/src/gui-wizard-gtk/main.c b/src/gui-wizard-gtk/main.c index 6be2fee9..0b6b3122 100644 --- a/src/gui-wizard-gtk/main.c +++ b/src/gui-wizard-gtk/main.c @@ -5,6 +5,8 @@ #define PROGNAME "bug-reporting-wizard" +char *g_glade_file = NULL; + static crash_data_t *cd; int main(int argc, char **argv) @@ -13,15 +15,17 @@ int main(int argc, char **argv) /* Can't keep these strings/structs static: _() doesn't support that */ const char *program_usage_string = _( - PROGNAME" [-v] DIR\n\n" - "GUI tool to run analyze and report ABRT crash in specified DIR" + PROGNAME" [-v] [-g GUI_FILE] DIR\n\n" + "GUI tool to analyze and report ABRT crash in specified DIR" ); enum { OPT_v = 1 << 0, + OPT_g = 1 << 1, }; /* Keep enum above and order of options below in sync! */ struct options program_options[] = { OPT__VERBOSE(&g_verbose), + OPT_STRING('g', NULL, &g_glade_file, "FILE" , _("Alternate GUI file")), OPT_END() }; diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index c5c885fc..0fd957a7 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -1,7 +1,6 @@ #include <gtk/gtk.h> #include "abrtlib.h" - -#include "wizard_glade.c" +#include "wizard.h" /* THE PAGE FLOW * page_1: analyze action selection @@ -66,13 +65,21 @@ void on_b_refresh_clicked(GtkButton *button) g_print("Refresh clicked!\n"); } +/* wizard.glade file as a string WIZARD_GLADE_CONTENTS: */ +#include "wizard_glade.c" + static void add_pages() { GError *error = NULL; - gtk_builder_add_objects_from_string(builder, + if (!g_glade_file) + /* Load UI from internal string */ + gtk_builder_add_objects_from_string(builder, WIZARD_GLADE_CONTENTS, sizeof(WIZARD_GLADE_CONTENTS) - 1, (gchar**)page_names, &error); + else + /* -g FILE: load IU from it */ + gtk_builder_add_objects_from_file(builder, g_glade_file, (gchar**)page_names, &error); if (error != NULL) { error_msg_and_die("can't load %s: %s", "wizard.glade", error->message); diff --git a/src/gui-wizard-gtk/wizard.h b/src/gui-wizard-gtk/wizard.h index daa25eeb..888c2df3 100644 --- a/src/gui-wizard-gtk/wizard.h +++ b/src/gui-wizard-gtk/wizard.h @@ -1 +1,3 @@ GtkWidget *create_assistant(void); + +extern char *g_glade_file; |