diff --git a/src/gtk/common/config.c b/src/gtk/common/config.c
index a4ae1d1..ec3b34b 100644
--- a/src/gtk/common/config.c
+++ b/src/gtk/common/config.c
@@ -353,13 +353,13 @@ void set_boolean_to_config(const gchar *group, const gchar *key, gboolean val)
HKEY hKey;
DWORD disp;
- gchar * path = g_strdup_printf("%s\\%s",registry_path,group);
+ gchar * path = g_strdup_printf("%s\\%s\\%s",registry_path,group,key);
-// trace("Creating key %s",path);
+ trace("Creating key %s",path);
if(RegCreateKeyEx(HKEY_CURRENT_USER,path,0,NULL,REG_OPTION_NON_VOLATILE,KEY_SET_VALUE,NULL,&hKey,&disp) == ERROR_SUCCESS)
{
DWORD value = val ? 1 : 0;
- LONG rc = RegSetValueEx(hKey, key, 0, REG_DWORD,(const BYTE *) &value,sizeof(value));
+ LONG rc = RegSetValueEx(hKey, NULL, 0, REG_DWORD,(const BYTE *) &value,sizeof(value));
SetLastError(rc);
diff --git a/src/gtk/mainwindow.c b/src/gtk/mainwindow.c
index d40eedc..f5ea04c 100644
--- a/src/gtk/mainwindow.c
+++ b/src/gtk/mainwindow.c
@@ -119,7 +119,7 @@
GtkWidget *menu = NULL;
if(!online)
- menu = popup[POPUP_OFFLINE] ? popup[POPUP_OFFLINE] : popup[POPUP_DEFAULT];
+ menu = popup[POPUP_OFFLINE];
else if(selected && popup[POPUP_SELECTION])
menu = popup[POPUP_SELECTION];
else if(popup[POPUP_ONLINE])
@@ -203,7 +203,7 @@
GtkWidget * create_main_window(void)
{
- static const SETUP_ITEM widget_setup[] =
+ static const UI_WIDGET_SETUP widget_setup[] =
{
{ "inputmethod", setup_input_method },
{ "screensizes", setup_screen_sizes },
diff --git a/src/gtk/pw3270-GTK.cbp b/src/gtk/pw3270-GTK.cbp
index 0f56cc7..bc3bfe7 100644
--- a/src/gtk/pw3270-GTK.cbp
+++ b/src/gtk/pw3270-GTK.cbp
@@ -31,11 +31,11 @@
-
+
-
+
diff --git a/src/gtk/uiparser/accelerator.c b/src/gtk/uiparser/accelerator.c
index 438f89d..f07fb67 100644
--- a/src/gtk/uiparser/accelerator.c
+++ b/src/gtk/uiparser/accelerator.c
@@ -29,6 +29,7 @@
*
*/
+ #include
#include "private.h"
/*--[ Implement ]------------------------------------------------------------------------------------*/
diff --git a/src/gtk/uiparser/menuitem.c b/src/gtk/uiparser/menuitem.c
index b839af4..e3e9663 100644
--- a/src/gtk/uiparser/menuitem.c
+++ b/src/gtk/uiparser/menuitem.c
@@ -89,6 +89,26 @@
gtk_menu_shell_append((GtkMenuShell *) menu, widget);
+ // Setup menuitem
+ if(info->setup)
+ {
+ const gchar *name = ui_get_attribute("name",names,values);
+
+ if(name)
+ {
+ int f;
+ for(f=0;info->setup[f].name;f++)
+ {
+ if(!g_strcasecmp(name,info->setup[f].name))
+ {
+ info->setup[f].setup(widget,info->center_widget);
+ break;
+ }
+ }
+ }
+ }
+
+
return G_OBJECT(widget);
}
diff --git a/src/gtk/uiparser/parser.c b/src/gtk/uiparser/parser.c
index 16dca4b..063e11c 100644
--- a/src/gtk/uiparser/parser.c
+++ b/src/gtk/uiparser/parser.c
@@ -206,7 +206,7 @@ void parser_build(struct parser *p, GtkWidget *widget)
}
-GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, const gchar **popupname, GtkWidget *widget, const SETUP_ITEM *setup)
+GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, const gchar **popupname, GtkWidget *widget, const UI_WIDGET_SETUP *setup)
{
struct parser p;
GDir * dir;
@@ -258,6 +258,7 @@ GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, con
p.popupname = popupname;
p.strings = g_string_chunk_new(0);
p.popup = g_new0(GtkWidget *,(g_strv_length((gchar **) p.popupname)+1));
+ p.setup = setup;
g_object_set_data_full(G_OBJECT(p.toplevel),"popup_menus",(gpointer) p.popup, g_free);
diff --git a/src/gtk/uiparser/parser.h b/src/gtk/uiparser/parser.h
index 7cda1e9..fb92ef5 100644
--- a/src/gtk/uiparser/parser.h
+++ b/src/gtk/uiparser/parser.h
@@ -29,14 +29,32 @@
*
*/
- typedef struct _setup_item
- {
- const gchar * name;
- void (*setup)(GtkWidget *widget, GtkWidget *obj);
- } SETUP_ITEM;
+#ifndef UI_PARSER_H_INCLUDED
- GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, const gchar **popupname, GtkWidget *widget, const SETUP_ITEM *itn);
- void ui_connect_action(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id);
- void ui_connect_toggle(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id);
- void ui_connect_pfkey(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id);
- void ui_connect_pakey(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id);
+ #define UI_PARSER_H_INCLUDED 1
+
+ /**
+ * Callback list for specil widget.
+ *
+ * Struct used to define a list of calls to setup some specialized widgets.
+ *
+ */
+ typedef struct _ui_widget_setup
+ {
+ const gchar * name; /**< Widget name */
+ /**
+ * Widget setup call.
+ *
+ * @param widget Widget to setup.
+ * @param obj UI´s center widget.
+ */
+ void (*setup)(GtkWidget *widget, GtkWidget *obj);
+ } UI_WIDGET_SETUP;
+
+ GtkWidget * ui_parse_xml_folder(const gchar *path, const gchar ** groupname, const gchar **popupname, GtkWidget *widget, const UI_WIDGET_SETUP *itn);
+ void ui_connect_action(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id);
+ void ui_connect_toggle(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id);
+ void ui_connect_pfkey(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id);
+ void ui_connect_pakey(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id);
+
+#endif // UI_PARSER_H_INCLUDED
diff --git a/src/gtk/uiparser/private.h b/src/gtk/uiparser/private.h
index cb4a7f5..e0a1d80 100644
--- a/src/gtk/uiparser/private.h
+++ b/src/gtk/uiparser/private.h
@@ -29,8 +29,10 @@
*
*/
+ #include
#include
#include "../common/common.h"
+ #include "parser.h"
#define ERROR_DOMAIN g_quark_from_static_string("uiparser")
@@ -52,16 +54,17 @@
struct parser
{
- int disabled;
- GtkWidget * toplevel;
- GObject * element;
- GtkWidget * center_widget;
- GtkWidget ** popup; /**< Popup widgets */
- GStringChunk * strings;
- const gchar ** group; /**< Action group list */
- const gchar ** popupname; /**< Popup names */
- GHashTable * actions; /**< List of actions */
- GHashTable * element_list[UI_ELEMENT_COUNT];
+ int disabled;
+ GtkWidget * toplevel;
+ GObject * element;
+ GtkWidget * center_widget;
+ GtkWidget ** popup; /**< Popup widgets */
+ GStringChunk * strings;
+ const gchar ** group; /**< Action group list */
+ const gchar ** popupname; /**< Popup names */
+ GHashTable * actions; /**< List of actions */
+ GHashTable * element_list[UI_ELEMENT_COUNT];
+ const UI_WIDGET_SETUP * setup;
};
const gchar * ui_get_attribute(const gchar *key, const gchar **name, const gchar **value);
diff --git a/src/gtk/v3270/genmarshal b/src/gtk/v3270/genmarshal
index a43bd27..c9ce916 100644
--- a/src/gtk/v3270/genmarshal
+++ b/src/gtk/v3270/genmarshal
@@ -6,4 +6,4 @@ VOID:VOID,POINTER,POINTER
VOID:VOID,UINT,POINTER
BOOL:VOID,UINT,ENUM
VOID:VOID,BOOL
-VOID:VOID,BOOL,BOOL,POINTER
+BOOL:VOID,BOOL,BOOL,POINTER
diff --git a/src/gtk/v3270/iocallback.c b/src/gtk/v3270/iocallback.c
index d94d165..2d64180 100644
--- a/src/gtk/v3270/iocallback.c
+++ b/src/gtk/v3270/iocallback.c
@@ -312,6 +312,11 @@ static int static_RunPendingEvents(int wait)
return rc;
}
+static void beep(H3270 *session)
+{
+ gdk_beep();
+}
+
void v3270_register_io_handlers(v3270Class *cls)
{
static const struct lib3270_callbacks hdl =
@@ -338,7 +343,7 @@ void v3270_register_io_handlers(v3270Class *cls)
static_Sleep,
static_RunPendingEvents,
- gdk_beep
+ beep
};
diff --git a/src/gtk/v3270/widget.c b/src/gtk/v3270/widget.c
index f2d62b8..e5c64ca 100644
--- a/src/gtk/v3270/widget.c
+++ b/src/gtk/v3270/widget.c
@@ -31,6 +31,8 @@
#include
#include
#include
+ #include
+ #include
#include "v3270.h"
#include "private.h"
#include "marshal.h"
@@ -284,11 +286,11 @@ static void v3270_class_init(v3270Class *klass)
v3270_widget_signal[SIGNAL_POPUP] =
g_signal_new( "popup",
G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_FIRST,
+ G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- pw3270_VOID__VOID_BOOL_BOOL_POINTER,
- G_TYPE_NONE, 3, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_POINTER);
+ pw3270_BOOL__VOID_BOOL_BOOL_POINTER,
+ G_TYPE_BOOLEAN, 3, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_POINTER);
}
void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int height)
@@ -852,7 +854,7 @@ int v3270_connect(GtkWidget *widget, const gchar *host)
trace("%s widget=%p host=%p",__FUNCTION__,widget,host);
- g_return_if_fail(GTK_IS_V3270(widget));
+ g_return_val_if_fail(GTK_IS_V3270(widget),EINVAL);
terminal = GTK_V3270(widget);
diff --git a/src/include/lib3270.h b/src/include/lib3270.h
index b1d87fb..3e3bb17 100644
--- a/src/include/lib3270.h
+++ b/src/include/lib3270.h
@@ -495,7 +495,7 @@
int (*Wait)(int seconds);
int (*RunPendingEvents)(int wait);
- void (*ring_bell)(void);
+ void (*ring_bell)(H3270 *);
};
@@ -596,6 +596,16 @@
*/
LIB3270_EXPORT void * lib3270_get_widget(H3270 *h);
+ /**
+ * "beep" to notify user.
+ *
+ * If available play a sound signal do alert user.
+ *
+ * @param h Session handle
+ *
+ */
+ LIB3270_EXPORT void lib3270_ring_bell(H3270 *session);
+
LIB3270_EXPORT int lib3270_set_model(H3270 *session, int model);
LIB3270_EXPORT int lib3270_get_model(H3270 *session);
diff --git a/src/lib3270/XtGlue.c b/src/lib3270/XtGlue.c
index 4bf9bd5..e6c1d6c 100644
--- a/src/lib3270/XtGlue.c
+++ b/src/lib3270/XtGlue.c
@@ -94,7 +94,7 @@ static void DefaultRemoveInput(unsigned long id);
static int DefaultProcessEvents(int block);
-static void dunno(void)
+static void dunno(H3270 *session)
{
}
@@ -999,9 +999,10 @@ LIB3270_EXPORT int lib3270_wait(seconds)
return 0;
}
-LIB3270_EXPORT void lib3270_ring_bell(void)
+LIB3270_EXPORT void lib3270_ring_bell(H3270 *session)
{
- callbacks->ring_bell();
+ CHECK_SESSION_HANDLE(session);
+ callbacks->ring_bell(session);
}
diff --git a/src/lib3270/ansi.c b/src/lib3270/ansi.c
index 1d500ac..afb7a5d 100644
--- a/src/lib3270/ansi.c
+++ b/src/lib3270/ansi.c
@@ -917,7 +917,7 @@ ansi_sgr(int ig1 unused, int ig2 unused)
static enum state
ansi_bell(int ig1 unused, int ig2 unused)
{
- lib3270_ring_bell();
+ lib3270_ring_bell(NULL);
return DATA;
}
diff --git a/src/lib3270/api.h b/src/lib3270/api.h
index 851ace4..f4ebd91 100644
--- a/src/lib3270/api.h
+++ b/src/lib3270/api.h
@@ -383,8 +383,6 @@
const char *description;
};
- LIB3270_EXPORT void lib3270_ring_bell(void);
-
#define new_3270_session(m) lib3270_session_new(m)
LOCAL_EXTERN const struct lib3270_option * get_3270_option_table(int sz);
diff --git a/src/lib3270/ctlr.c b/src/lib3270/ctlr.c
index 9552ecc..059584c 100644
--- a/src/lib3270/ctlr.c
+++ b/src/lib3270/ctlr.c
@@ -1871,7 +1871,7 @@ ctlr_write(unsigned char buf[], int buflen, Boolean erase)
status_syswait();
}
if (wcc_sound_alarm)
- lib3270_ring_bell();
+ lib3270_ring_bell(NULL);
/* Set up the DBCS state. */
if (ctlr_dbcs_postprocess() < 0 && rv == PDS_OKAY_NO_OUTPUT)
diff --git a/src/lib3270/kybd.c b/src/lib3270/kybd.c
index f151538..c26f1e8 100644
--- a/src/lib3270/kybd.c
+++ b/src/lib3270/kybd.c
@@ -182,7 +182,7 @@ static int enq_chk(void)
/* If operator error, complain and drop it. */
if (kybdlock & KL_OERR_MASK)
{
- lib3270_ring_bell();
+ lib3270_ring_bell(NULL);
trace_event(" dropped (operator error)\n");
return -1;
}
@@ -190,7 +190,7 @@ static int enq_chk(void)
/* If scroll lock, complain and drop it. */
if (kybdlock & KL_SCROLLED)
{
- lib3270_ring_bell();
+ lib3270_ring_bell(NULL);
trace_event(" dropped (scrolled)\n");
return -1;
}
@@ -471,7 +471,7 @@ operator_error(int error_type)
kybdlock_set((unsigned int)error_type, "operator_error");
(void) flush_ta();
} else {
- lib3270_ring_bell();
+ lib3270_ring_bell(NULL);
}
}
diff --git a/src/lib3270/lib3270.cbp b/src/lib3270/lib3270.cbp
index 3875529..492c3f5 100644
--- a/src/lib3270/lib3270.cbp
+++ b/src/lib3270/lib3270.cbp
@@ -57,8 +57,14 @@
+
+
+
+
+
+
diff --git a/src/lib3270/selection.c b/src/lib3270/selection.c
index 5b44c72..abf30d0 100644
--- a/src/lib3270/selection.c
+++ b/src/lib3270/selection.c
@@ -205,7 +205,7 @@ LIB3270_EXPORT void lib3270_select_word(H3270 *session, int baddr)
if(!lib3270_connected(session) || isspace(ea_buf[baddr].chr))
{
- lib3270_ring_bell();
+ lib3270_ring_bell(session);
return;
}
@@ -227,15 +227,15 @@ LIB3270_EXPORT int lib3270_select_field(H3270 *session, int baddr)
if(!lib3270_connected(session))
{
- lib3270_ring_bell();
- return;
+ lib3270_ring_bell(session);
+ return -1;
}
start = lib3270_field_addr(session,baddr);
if(start < 0)
{
- lib3270_ring_bell();
+ lib3270_ring_bell(session);
return -1;
}
--
libgit2 0.21.2