This is an automated email from the git hooks/post-receive script. hmmr-guest pushed a commit to branch master in repository aghermann.
commit 58335bb7928e829039682bafb1c9c898fce18e7f Author: Andrei Zavada <[email protected]> Date: Sat Sep 21 02:35:45 2013 +0300 include edfhed.glade into aghermann.gresource, have edfhef-gtk make use of common aghermann/ui code --- upstream/data/Makefile.am | 4 +- upstream/data/aghermann.gresource.xml | 1 + upstream/src/tools/Makefile.am | 3 +- upstream/src/tools/edfhed-gtk.cc | 116 ++++++++++++++------------------- 4 files changed, 55 insertions(+), 69 deletions(-) diff --git a/upstream/data/Makefile.am b/upstream/data/Makefile.am index ea76bd8..e82955e 100644 --- a/upstream/data/Makefile.am +++ b/upstream/data/Makefile.am @@ -6,7 +6,6 @@ uidir := $(datadir)/${PACKAGE} ui_DATA := \ aghermann.png \ - edfhed.glade \ aghermann.gresource \ idle-bg.svg \ experiment-dl.sh @@ -33,7 +32,8 @@ GRESOURCES := \ mw.glade mw-dialogs.glade \ sf.glade sf-artifacts.glade sf-artifacts-simple.glade sf-filters.glade sf-patterns.glade sf-phasediff.glade sf-rk1968.glade \ mf.glade edfhed.glade \ - aghermann.png equations1.png equation-uc.png + aghermann.png equations1.png equation-uc.png \ + edfhed.glade aghermann.gresource: aghermann.gresource.xml $(GRESOURCES) $(glib_compile_resources) aghermann.gresource.xml diff --git a/upstream/data/aghermann.gresource.xml b/upstream/data/aghermann.gresource.xml index 222a536..d32b750 100644 --- a/upstream/data/aghermann.gresource.xml +++ b/upstream/data/aghermann.gresource.xml @@ -16,5 +16,6 @@ <file compressed="true">sf-phasediff.glade</file> <file compressed="true">sf-rk1968.glade</file> <file compressed="true">mf.glade</file> + <file compressed="true">edfhed.glade</file> </gresource> </gresources> diff --git a/upstream/src/tools/Makefile.am b/upstream/src/tools/Makefile.am index 5e1591c..20abea4 100644 --- a/upstream/src/tools/Makefile.am +++ b/upstream/src/tools/Makefile.am @@ -30,11 +30,12 @@ edfhed_LDADD := \ edfhed_gtk_SOURCES := \ edfhed-gtk.cc edfhed_gtk_CXXFLAGS := \ - $(AM_CXXFLAGS) $(GTK_CFLAGS) -DPACKAGE_DATADIR=\"$(datadir)\" + $(AM_CXXFLAGS) $(UNIQUE_CFLAGS) $(GTK_CFLAGS) -DPACKAGE_DATADIR=\"$(datadir)\" edfhed_gtk_LDADD := \ ../libsigfile/libsigfile.la \ ../common/liba.a \ ../libsigproc/libsigproc.la \ + ../aghermann/ui/liba.a \ $(FFTW3_LIBS) $(ITPP_LIBS) $(SAMPLERATE_LIBS) $(GSL_LIBS) \ $(GTK_LIBS) \ $(OPENMP_LDADD) $(LIBFFTW3_LDADD) diff --git a/upstream/src/tools/edfhed-gtk.cc b/upstream/src/tools/edfhed-gtk.cc index ddf52e4..b2be58a 100644 --- a/upstream/src/tools/edfhed-gtk.cc +++ b/upstream/src/tools/edfhed-gtk.cc @@ -15,44 +15,12 @@ #include "libsigfile/edf.hh" #include "libsigfile/typed-source.hh" - -void -pop_ok_message( GtkWindow *parent, const char *str, ...) -{ - va_list ap; - va_start (ap, str); - - static GString *buf = NULL; - if ( buf == NULL ) - buf = g_string_new(""); - - g_string_vprintf( buf, str, ap); - va_end (ap); - - GtkWidget *msg = - gtk_message_dialog_new_with_markup( - parent, - (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), - GTK_MESSAGE_INFO, - GTK_BUTTONS_OK, - buf->str, NULL); - gtk_dialog_run( (GtkDialog*)msg); - gtk_widget_destroy( msg); -} - - -#define AGH_GBGETOBJ(Type, A) \ - (A = (Type*)(gtk_builder_get_object( __builder, #A))) - -#define AGH_GBGETOBJ3(B, Type, A) \ - (A = (Type*)(gtk_builder_get_object( B, #A))) - -//#include "../ui/globals.hh" - +#include "aghermann/ui/ui.hh" +using agh::ui::pop_ok_message; GtkBuilder - *__builder; + *builder; GtkDialog *wMain; @@ -169,7 +137,7 @@ main( int argc, char **argv) } if ( ui_init() ) { - pop_ok_message( NULL, "UI failed to initialise\n"); + pop_ok_message( NULL, "UI failed to initialise", "Your install is broken."); return 2; } @@ -193,7 +161,7 @@ main( int argc, char **argv) widgets_to_edf_data( F); } } catch (invalid_argument ex) { - pop_ok_message( NULL, ex.what()); + pop_ok_message( NULL, "Heh", "%s", ex.what()); } ui_fini(); @@ -203,7 +171,9 @@ main( int argc, char **argv) -static void + + +void edf_data_to_widgets( const sigfile::CEDFFile& F) { gtk_label_set_markup( lLabel, (string ("<b>File:</b> <i>") + F.filename() + "</i>").c_str()); @@ -391,37 +361,51 @@ sensitize_channel_nav_buttons() int ui_init() { - // load glade - __builder = gtk_builder_new(); - if ( !gtk_builder_add_from_file( __builder, PACKAGE_DATADIR "/edfhed.glade", NULL) ) { - pop_ok_message( NULL, "Failed to load UI description file."); + GResource + *gresource + = g_resource_load( + PACKAGE_DATADIR "/" PACKAGE "/" AGH_UI_GRESOURCE_FILE, + NULL); + if ( !gresource ) { + fprintf( stderr, "Bad or missing " PACKAGE_DATADIR "/" PACKAGE "/" AGH_UI_GRESOURCE_FILE); return -1; } + g_resources_register( gresource); - if ( !AGH_GBGETOBJ (GtkDialog, wMain) || - !AGH_GBGETOBJ (GtkLabel, lLabel) || - !AGH_GBGETOBJ (GtkEntry, e[PatientID]) || - !AGH_GBGETOBJ (GtkEntry, e[RecordingID]) || - !AGH_GBGETOBJ (GtkEntry, e[RecordingDate]) || - !AGH_GBGETOBJ (GtkEntry, e[RecordingTime]) || - !AGH_GBGETOBJ (GtkEntry, e[Reserved]) || - !AGH_GBGETOBJ (GtkLabel, lChannelsNum) || - !AGH_GBGETOBJ (GtkEntry, e[ChannelLabel]) || - !AGH_GBGETOBJ (GtkEntry, e[ChannelPhysicalDim]) || - !AGH_GBGETOBJ (GtkEntry, e[ChannelPhysicalMin]) || - !AGH_GBGETOBJ (GtkEntry, e[ChannelPhysicalMax]) || - !AGH_GBGETOBJ (GtkEntry, e[ChannelDigitalMin]) || - !AGH_GBGETOBJ (GtkEntry, e[ChannelDigitalMax]) || - !AGH_GBGETOBJ (GtkEntry, e[ChannelTransducerType]) || - !AGH_GBGETOBJ (GtkEntry, e[ChannelFilteringInfo]) || - !AGH_GBGETOBJ (GtkEntry, e[ChannelReserved]) || - !AGH_GBGETOBJ (GtkEntry, e[ChannelSamplesPerRecord]) || - !AGH_GBGETOBJ (GtkButton, bNext) || - !AGH_GBGETOBJ (GtkButton, bPrevious) || - !AGH_GBGETOBJ (GtkButton, bWrite) ) + // load glade + builder = gtk_builder_new(); + if ( !gtk_builder_add_from_resource( builder, "/org/gtk/aghermann/edfhed.glade", NULL) ) { + pop_ok_message( NULL, "Failed to load UI description file", "Your install is broken"); + return -1; + } + gtk_builder_connect_signals( builder, NULL); + +#define AGH_GBGETTRY(A) \ + (A = (GtkEntry*)(gtk_builder_get_object( builder, #A))) + + if ( !AGH_GBGETOBJ (wMain) || + !AGH_GBGETOBJ (lLabel) || + // begad, glade indeed has these widgets named like so: "e[PatientID]"! + !AGH_GBGETTRY (e[PatientID]) || + !AGH_GBGETTRY (e[RecordingID]) || + !AGH_GBGETTRY (e[RecordingDate]) || + !AGH_GBGETTRY (e[RecordingTime]) || + !AGH_GBGETTRY (e[Reserved]) || + !AGH_GBGETTRY (e[ChannelLabel]) || + !AGH_GBGETTRY (e[ChannelPhysicalDim]) || + !AGH_GBGETTRY (e[ChannelPhysicalMin]) || + !AGH_GBGETTRY (e[ChannelPhysicalMax]) || + !AGH_GBGETTRY (e[ChannelDigitalMin]) || + !AGH_GBGETTRY (e[ChannelDigitalMax]) || + !AGH_GBGETTRY (e[ChannelTransducerType]) || + !AGH_GBGETTRY (e[ChannelFilteringInfo]) || + !AGH_GBGETTRY (e[ChannelReserved]) || + !AGH_GBGETTRY (e[ChannelSamplesPerRecord]) || + !AGH_GBGETOBJ (lChannelsNum) || + !AGH_GBGETOBJ (bNext) || + !AGH_GBGETOBJ (bPrevious) || + !AGH_GBGETOBJ (bWrite) ) return -1; - - gtk_builder_connect_signals( __builder, NULL); for ( int i = 0; i < _n_entries; ++i ) { #pragma GCC diagnostic ignored "-Wint-to-pointer-cast" @@ -442,7 +426,7 @@ void ui_fini() { // gtk_widget_destroy - g_object_unref( __builder); + g_object_unref( builder); } -- Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
