Commit 60b030af642ac803e52f93a55325110c0fb341cd
1 parent
58012c44
Exists in
master
and in
5 other branches
Implementando actions
Showing
7 changed files
with
40 additions
and
12 deletions
Show diff stats
src/gtk/actions.c
@@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
36 | #include <lib3270/selection.h> | 36 | #include <lib3270/selection.h> |
37 | 37 | ||
38 | #define ERROR_DOMAIN g_quark_from_static_string(PACKAGE_NAME) | 38 | #define ERROR_DOMAIN g_quark_from_static_string(PACKAGE_NAME) |
39 | + #define TOGGLE_GDKDEBUG LIB3270_TOGGLE_COUNT+1 | ||
39 | 40 | ||
40 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 41 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
41 | 42 | ||
@@ -186,7 +187,10 @@ static void lib3270_toggle_action(GtkToggleAction *action,GtkWidget *widget) | @@ -186,7 +187,10 @@ static void lib3270_toggle_action(GtkToggleAction *action,GtkWidget *widget) | ||
186 | 187 | ||
187 | trace("Action %s toggled on widget %p (id=%d)",gtk_action_get_name(GTK_ACTION(action)),widget,(int) toggle); | 188 | trace("Action %s toggled on widget %p (id=%d)",gtk_action_get_name(GTK_ACTION(action)),widget,(int) toggle); |
188 | 189 | ||
189 | - lib3270_set_toggle(GTK_V3270(widget)->host,toggle,gtk_toggle_action_get_active(action)); | 190 | + if(toggle == TOGGLE_GDKDEBUG) |
191 | + gdk_window_set_debug_updates(gtk_toggle_action_get_active(action)); | ||
192 | + else | ||
193 | + lib3270_set_toggle(GTK_V3270(widget)->host,toggle,gtk_toggle_action_get_active(action)); | ||
190 | } | 194 | } |
191 | 195 | ||
192 | static void selection_move_action(GtkAction *action, GtkWidget *widget) | 196 | static void selection_move_action(GtkAction *action, GtkWidget *widget) |
@@ -327,11 +331,18 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash | @@ -327,11 +331,18 @@ GtkAction * ui_get_action(GtkWidget *widget, const gchar *name, GHashTable *hash | ||
327 | if(!attr) | 331 | if(!attr) |
328 | attr = ui_get_attribute("toggle",names,values); | 332 | attr = ui_get_attribute("toggle",names,values); |
329 | 333 | ||
330 | - id = lib3270_get_toggle_id(attr); | ||
331 | - if(id < 0) | 334 | + if(g_strcasecmp(attr,"gdkdebug")) |
332 | { | 335 | { |
333 | - *error = g_error_new(ERROR_DOMAIN,EINVAL,_("%s action needs a valid toggle name" ), name); | ||
334 | - return NULL; | 336 | + id = lib3270_get_toggle_id(attr); |
337 | + if(id < 0) | ||
338 | + { | ||
339 | + *error = g_error_new(ERROR_DOMAIN,EINVAL,_("%s action needs a valid toggle name" ), name); | ||
340 | + return NULL; | ||
341 | + } | ||
342 | + } | ||
343 | + else | ||
344 | + { | ||
345 | + id = TOGGLE_GDKDEBUG; | ||
335 | } | 346 | } |
336 | nm = g_strconcat(name,attr,NULL); | 347 | nm = g_strconcat(name,attr,NULL); |
337 | } | 348 | } |
src/gtk/mainwindow.c
@@ -199,6 +199,11 @@ | @@ -199,6 +199,11 @@ | ||
199 | 199 | ||
200 | } | 200 | } |
201 | 201 | ||
202 | + static void has_text(GtkWidget *widget, gboolean on, GtkActionGroup **group) | ||
203 | + { | ||
204 | + gtk_action_group_set_sensitive(group[ACTION_GROUP_CLIPBOARD],on); | ||
205 | + } | ||
206 | + | ||
202 | static void pastenext(GtkWidget *widget, gboolean on, GtkAction **action) | 207 | static void pastenext(GtkWidget *widget, gboolean on, GtkAction **action) |
203 | { | 208 | { |
204 | gtk_action_set_sensitive(action[ACTION_PASTENEXT],on); | 209 | gtk_action_set_sensitive(action[ACTION_PASTENEXT],on); |
@@ -346,9 +351,10 @@ | @@ -346,9 +351,10 @@ | ||
346 | g_signal_connect(terminal,"model_changed",G_CALLBACK(update_model),0); | 351 | g_signal_connect(terminal,"model_changed",G_CALLBACK(update_model),0); |
347 | g_signal_connect(terminal,"selecting",G_CALLBACK(selecting),group); | 352 | g_signal_connect(terminal,"selecting",G_CALLBACK(selecting),group); |
348 | g_signal_connect(terminal,"popup",G_CALLBACK(popup_menu),popup); | 353 | g_signal_connect(terminal,"popup",G_CALLBACK(popup_menu),popup); |
354 | + g_signal_connect(terminal,"has_text",G_CALLBACK(has_text),group); | ||
349 | 355 | ||
350 | g_free(path); | 356 | g_free(path); |
351 | - gtk_widget_grab_focus(terminal); | 357 | +// gtk_widget_grab_focus(terminal); |
352 | 358 | ||
353 | if(lib3270_get_toggle(host,LIB3270_TOGGLE_FULL_SCREEN)) | 359 | if(lib3270_get_toggle(host,LIB3270_TOGGLE_FULL_SCREEN)) |
354 | gtk_window_fullscreen(GTK_WINDOW(window)); | 360 | gtk_window_fullscreen(GTK_WINDOW(window)); |
@@ -358,6 +364,7 @@ | @@ -358,6 +364,7 @@ | ||
358 | #endif | 364 | #endif |
359 | 365 | ||
360 | trace("%s ends",__FUNCTION__); | 366 | trace("%s ends",__FUNCTION__); |
367 | + gtk_window_set_focus(GTK_WINDOW(window),terminal); | ||
361 | return window; | 368 | return window; |
362 | } | 369 | } |
363 | 370 |
src/gtk/v3270/clipboard.c
@@ -90,6 +90,7 @@ void v3270_copy_clipboard(v3270 *widget) | @@ -90,6 +90,7 @@ void v3270_copy_clipboard(v3270 *widget) | ||
90 | 90 | ||
91 | if(!text) | 91 | if(!text) |
92 | { | 92 | { |
93 | + g_signal_emit(widget,v3270_widget_signal[SIGNAL_CLIPBOARD], 0, FALSE); | ||
93 | lib3270_ring_bell(widget->host); | 94 | lib3270_ring_bell(widget->host); |
94 | return; | 95 | return; |
95 | } | 96 | } |
@@ -108,6 +109,9 @@ void v3270_copy_clipboard(v3270 *widget) | @@ -108,6 +109,9 @@ void v3270_copy_clipboard(v3270 *widget) | ||
108 | { | 109 | { |
109 | gtk_clipboard_set_can_store(clipboard,targets,1); | 110 | gtk_clipboard_set_can_store(clipboard,targets,1); |
110 | } | 111 | } |
112 | + | ||
113 | + g_signal_emit(widget,v3270_widget_signal[SIGNAL_CLIPBOARD], 0, TRUE); | ||
114 | + | ||
111 | } | 115 | } |
112 | 116 | ||
113 | void v3270_paste_string(GtkWidget *widget, const gchar *text, const gchar *encoding) | 117 | void v3270_paste_string(GtkWidget *widget, const gchar *text, const gchar *encoding) |
src/gtk/v3270/private.h
src/gtk/v3270/widget.c
@@ -302,6 +302,14 @@ static void v3270_class_init(v3270Class *klass) | @@ -302,6 +302,14 @@ static void v3270_class_init(v3270Class *klass) | ||
302 | pw3270_VOID__VOID_BOOL, | 302 | pw3270_VOID__VOID_BOOL, |
303 | G_TYPE_NONE, 1, G_TYPE_BOOLEAN); | 303 | G_TYPE_NONE, 1, G_TYPE_BOOLEAN); |
304 | 304 | ||
305 | + v3270_widget_signal[SIGNAL_CLIPBOARD] = | ||
306 | + g_signal_new( "has_text", | ||
307 | + G_OBJECT_CLASS_TYPE (gobject_class), | ||
308 | + G_SIGNAL_RUN_FIRST, | ||
309 | + 0, | ||
310 | + NULL, NULL, | ||
311 | + pw3270_VOID__VOID_BOOL, | ||
312 | + G_TYPE_NONE, 1, G_TYPE_BOOLEAN); | ||
305 | } | 313 | } |
306 | 314 | ||
307 | void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int height) | 315 | void v3270_update_font_metrics(v3270 *terminal, cairo_t *cr, int width, int height) |
@@ -875,12 +883,8 @@ int v3270_connect(GtkWidget *widget, const gchar *host) | @@ -875,12 +883,8 @@ int v3270_connect(GtkWidget *widget, const gchar *host) | ||
875 | g_return_val_if_fail(GTK_IS_V3270(widget),EINVAL); | 883 | g_return_val_if_fail(GTK_IS_V3270(widget),EINVAL); |
876 | 884 | ||
877 | 885 | ||
878 | - | ||
879 | terminal = GTK_V3270(widget); | 886 | terminal = GTK_V3270(widget); |
880 | 887 | ||
881 | - rc = lib3270_connect(terminal->host,host,0); | ||
882 | - | ||
883 | -/* | ||
884 | if(host) | 888 | if(host) |
885 | { | 889 | { |
886 | set_string_to_config("host","uri","%s",host); | 890 | set_string_to_config("host","uri","%s",host); |
@@ -897,7 +901,7 @@ int v3270_connect(GtkWidget *widget, const gchar *host) | @@ -897,7 +901,7 @@ int v3270_connect(GtkWidget *widget, const gchar *host) | ||
897 | 901 | ||
898 | g_free(hs); | 902 | g_free(hs); |
899 | } | 903 | } |
900 | -*/ | 904 | + |
901 | trace("%s exits with rc=%d (%s)",__FUNCTION__,rc,strerror(rc)); | 905 | trace("%s exits with rc=%d (%s)",__FUNCTION__,rc,strerror(rc)); |
902 | 906 | ||
903 | return rc; | 907 | return rc; |
ui/00default.xml
@@ -181,7 +181,7 @@ | @@ -181,7 +181,7 @@ | ||
181 | 181 | ||
182 | </popup> | 182 | </popup> |
183 | 183 | ||
184 | - <accelerator action='Toggle' id='Insert' key='Insert' group='online' /> | 184 | + <accelerator action='toggle' id='insert' key='Insert' group='online' /> |
185 | 185 | ||
186 | <accelerator action='Home' key='Home' group='online' /> | 186 | <accelerator action='Home' key='Home' group='online' /> |
187 | <!-- accelerator action='Reset' key='<Shift><Ctrl>r' group='online' /--> | 187 | <!-- accelerator action='Reset' key='<Shift><Ctrl>r' group='online' /--> |
ui/99debug.xml
@@ -41,6 +41,7 @@ | @@ -41,6 +41,7 @@ | ||
41 | <menu name='debugmenu' label='Debug' > | 41 | <menu name='debugmenu' label='Debug' > |
42 | <menuitem action='testpattern' group='offline' label='Show test pattern' /> | 42 | <menuitem action='testpattern' group='offline' label='Show test pattern' /> |
43 | <menuitem action='reload' label='Reload buffer contents' /> | 43 | <menuitem action='reload' label='Reload buffer contents' /> |
44 | + <menuitem action='toggle' id='gdkdebug' label='Debug window updates' /> | ||
44 | </menu> | 45 | </menu> |
45 | 46 | ||
46 | </menubar> | 47 | </menubar> |