Skip to content

Commit

Permalink
Final touches related to UI driver modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
L1L1 committed Nov 8, 2014
1 parent b103044 commit d07f18f
Show file tree
Hide file tree
Showing 35 changed files with 300 additions and 3,755 deletions.
1 change: 0 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ Kind contributors:
- and a few anonymous contributors...

This software uses the smartcard_list.txt (c) from Ludovic Rousseau.

43 changes: 41 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,10 +1,49 @@
AUTOMAKE_OPTIONS = gnu
AUTOMAKE_OPTIONS = gnu subdir-objects

AM_CFLAGS=-Wall -pedantic -Wno-overlength-strings @LUA_CFLAGS@ @PCSC_CFLAGS@ @GLIB_CFLAGS@ @GTK_CFLAGS@ @CURL_CFLAGS@

bin_PROGRAMS= cardpeek

cardpeek_SOURCES = asn1.c asn1.h bytestring.c bytestring.h gui_flexi_cell_renderer.c gui_flexi_cell_renderer.h dyntree_model.c dyntree_model.h crypto.c crypto.h replay.c replay.h gui.c gui.h iso7816.c iso7816.h lua_nodes.c lua_nodes.h lua_asn1.c lua_asn1.h lua_bit.c lua_bit.h lua_bytes.c lua_bytes.h lua_card.c lua_card.h lua_crypto.c lua_crypto.h lua_ext.c lua_ext.h lua_log.c lua_log.h lua_ui.c lua_ui.h main.c misc.c misc.h pathconfig.c pathconfig.h smartcard.c smartcard.h system_info.c system_info.h a_string.c a_string.h gui_about.c gui_about.h gui_toolbar.c gui_toolbar.h gui_logview.c gui_logview.h gui_cardview.c gui_cardview.h gui_readerview.c gui_readerview.h gui_scratchpad.c gui_scratchpad.h gui_inprogress.c gui_inprogress.h http_download.c http_download.h lua_iconv.c lua_iconv.h cardpeek_update.c cardpeek_update.h cardpeek_public_key.h win32/config.h
cardpeek_SOURCES = asn1.c asn1.h \
bytestring.c bytestring.h \
ui/gtk/gui_flexi_cell_renderer.c \
ui/gtk/gui_flexi_cell_renderer.h \
dyntree_model.c dyntree_model.h \
crypto.c crypto.h \
replay.c replay.h \
ui.c ui.h \
iso7816.c iso7816.h \
lua_nodes.c lua_nodes.h \
lua_asn1.c lua_asn1.h \
lua_bit.c lua_bit.h \
lua_bytes.c lua_bytes.h \
lua_card.c lua_card.h \
lua_crypto.c lua_crypto.h \
lua_ext.c lua_ext.h \
lua_log.c lua_log.h \
lua_ui.c lua_ui.h \
main.c \
misc.c misc.h \
pathconfig.c pathconfig.h \
smartcard.c smartcard.h \
system_info.c system_info.h \
a_string.c a_string.h \
ui/gtk/gui_core.c ui/gtk/gui_core.h \
ui/gtk/gui_about.c ui/gtk/gui_about.h \
ui/gtk/gui_toolbar.c ui/gtk/gui_toolbar.h \
ui/gtk/gui_logview.c ui/gtk/gui_logview.h \
ui/gtk/gui_cardview.c ui/gtk/gui_cardview.h \
ui/gtk/gui_readerview.c ui/gtk/gui_readerview.h \
ui/gtk/gui_scratchpad.c ui/gtk/gui_scratchpad.h \
ui/gtk/gui_inprogress.c ui/gtk/gui_inprogress.h \
ui/console/console_core.c ui/console/console_core.h \
ui/console/console_inprogress.c ui/console/console_inprogress.h \
ui/console/console_about.c ui/console/console_about.h \
http_download.c http_download.h \
lua_iconv.c lua_iconv.h \
cardpeek_update.c cardpeek_update.h \
cardpeek_public_key.h \
win32/config.h

doc_DATA=doc/cardpeek_ref.en.pdf

Expand Down
8 changes: 4 additions & 4 deletions cardpeek_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "cardpeek_public_key.h"
#include "pathconfig.h"
#include "lua_ext.h"
#include "gui.h"
#include "ui.h"
#include "http_download.h"
#include <glib.h>
#include <glib/gstdio.h>
Expand Down Expand Up @@ -563,9 +563,9 @@ int cardpeek_update_check(void)
return 0;
}

switch (gui_question("Cardpeek is configured to check for script updates periodically.\n"
"Do you whish to perform this check now?",
"Yes","No, ask me again later","No, always use the local copy",NULL))
switch (ui_question("Cardpeek is configured to check for script updates periodically.\n"
"Do you whish to perform this check now?",
"Yes","No, ask me again later","No, always use the local copy",NULL))
{
case 0:
retval = 1;
Expand Down
18 changes: 18 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
/* Define to 1 if the system has the type `GStatBuf'. */
#undef HAVE_GSTATBUF

/* Define to 1 if you have the <history.h> header file. */
#undef HAVE_HISTORY_H

/* Define if you have the iconv() function and it works. */
#undef HAVE_ICONV

Expand All @@ -35,6 +38,9 @@
/* Define to 1 if you have the `execinfo' library (-lexecinfo). */
#undef HAVE_LIBEXECINFO

/* Define if you have a readline compatible library */
#undef HAVE_LIBREADLINE

/* Define to 1 if you have the `ssl' library (-lssl). */
#undef HAVE_LIBSSL

Expand All @@ -57,6 +63,18 @@
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H

/* Define to 1 if you have the <readline.h> header file. */
#undef HAVE_READLINE_H

/* Define if your readline library has \`add_history' */
#undef HAVE_READLINE_HISTORY

/* Define to 1 if you have the <readline/history.h> header file. */
#undef HAVE_READLINE_HISTORY_H

/* Define to 1 if you have the <readline/readline.h> header file. */
#undef HAVE_READLINE_READLINE_H

/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#undef HAVE_REALLOC
Expand Down
2 changes: 1 addition & 1 deletion drivers/null_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static int null_fail(cardreader_t* cr)

static void null_finalize(cardreader_t* cr)
{
null_error(cr);
/* null_error(cr); */
}

static int null_initialize(cardreader_t *reader)
Expand Down
10 changes: 5 additions & 5 deletions drivers/pcsc_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ static int pcsc_connect(cardreader_t *cr, unsigned prefered_protocol)
SCARD_READERSTATE reader_state;
pcsc_data_t* pcsc = cr->extra_data;
int counter = 0;
GtkWidget *progress;
void *progress;

memset(&reader_state,0,sizeof(reader_state));
reader_state.szReader = cr->name+7;
Expand All @@ -151,7 +151,7 @@ static int pcsc_connect(cardreader_t *cr, unsigned prefered_protocol)
return 0;
}

progress = gui_inprogress_new("Connection","Waiting for the reader to connect to a card.");
progress = ui_inprogress_new("Connection","Waiting for the reader to connect to a card.");
while ((reader_state.dwEventState & SCARD_STATE_PRESENT)==0)
{
reader_state.dwCurrentState = reader_state.dwEventState;
Expand All @@ -161,10 +161,10 @@ static int pcsc_connect(cardreader_t *cr, unsigned prefered_protocol)
pcsc_stringify_state(reader_state.dwEventState));
}

if (!gui_inprogress_pulse(progress))
if (!ui_inprogress_pulse(progress))
{
log_printf(LOG_ERROR,"Connection aborted by user");
gui_inprogress_free(progress);
ui_inprogress_free(progress);
pcsc->status = 0x6FFF;
return 0;
}
Expand All @@ -179,7 +179,7 @@ static int pcsc_connect(cardreader_t *cr, unsigned prefered_protocol)
return 0;
}
}
gui_inprogress_free(progress);
ui_inprogress_free(progress);

log_printf(LOG_DEBUG,"Attempting to connect to '%s'",cr->name);
pcsc->status = SCardConnect(pcsc->hcontext,
Expand Down
29 changes: 15 additions & 14 deletions dyntree_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <string.h>
#include <fcntl.h>

DyntreeModel *CARD_DATA_STORE = NULL;

/*
* NOTE: Integration of the data model in GTK+ is based on the GtkTreeView
* tutorial by Tim-Philipp Müller (thanks!).
Expand Down Expand Up @@ -530,20 +532,19 @@ static gboolean dyntree_model_iter_parent (GtkTreeModel *tree_model,
*****************************************************************************/
DyntreeModel *dyntree_model_new (void)
{
DyntreeModel *newctm;
newctm = (DyntreeModel *) g_object_new (DYNTREE_MODEL_TYPE, NULL);
g_assert( newctm != NULL );

dyntree_model_column_register(newctm,"classname");
dyntree_model_column_register(newctm,"label");
dyntree_model_column_register(newctm,"id");
dyntree_model_column_register(newctm,"size");
dyntree_model_column_register(newctm,"val");
dyntree_model_column_register(newctm,"alt");
dyntree_model_column_register(newctm,"mime-type");
g_assert(newctm->n_columns == CC_INITIAL_COUNT);

return newctm;
CARD_DATA_STORE = (DyntreeModel *) g_object_new (DYNTREE_MODEL_TYPE, NULL);
g_assert( CARD_DATA_STORE != NULL );

dyntree_model_column_register(CARD_DATA_STORE,"classname");
dyntree_model_column_register(CARD_DATA_STORE,"label");
dyntree_model_column_register(CARD_DATA_STORE,"id");
dyntree_model_column_register(CARD_DATA_STORE,"size");
dyntree_model_column_register(CARD_DATA_STORE,"val");
dyntree_model_column_register(CARD_DATA_STORE,"alt");
dyntree_model_column_register(CARD_DATA_STORE,"mime-type");
g_assert(CARD_DATA_STORE->n_columns == CC_INITIAL_COUNT);

return CARD_DATA_STORE;
}

/*****************************************************************************
Expand Down
2 changes: 2 additions & 0 deletions dyntree_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ GType dyntree_model_get_type(void);

/***** USER FUNCS *****/

extern DyntreeModel *CARD_DATA_STORE;

/* Creating our model */

DyntreeModel *dyntree_model_new (void);
Expand Down
Loading

0 comments on commit d07f18f

Please sign in to comment.