Commit de2f1925660eb9d0a5665e3e7bbd7ff4dc30a431

Authored by Perry Werneck
1 parent d6a8d77c
Exists in v5.2

Changing color selection dialog to the new (and standard) one.

Showing 2 changed files with 60 additions and 10 deletions   Show diff stats
src/pw3270/colors.c
... ... @@ -30,9 +30,10 @@
30 30 #include <gtk/gtk.h>
31 31 #include "private.h"
32 32 #include <lib3270/trace.h>
  33 + #include <v3270/settings.h>
  34 + #include <v3270/colorscheme.h>
33 35  
34   - #define V3270_COLOR_BASE V3270_COLOR_GRAY+1
35   -
  36 + //#define V3270_COLOR_BASE V3270_COLOR_GRAY+1
36 37  
37 38 //#if defined(DEBUG) && GTK_CHECK_VERSION(3,4,0)
38 39 // #define USE_GTK_COLOR_CHOOSER 1
... ... @@ -40,6 +41,7 @@
40 41  
41 42 /*--[ Implement ]------------------------------------------------------------------------------------*/
42 43  
  44 +/*
43 45 static void store_color_scheme(GtkWidget *widget)
44 46 {
45 47 int f;
... ... @@ -283,14 +285,14 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkRGBA *clr)
283 285 return TRUE;
284 286 }
285 287  
286   -/**
287   - * Create a color scheme dropdown button
288   - *
289   - * @param clr Pointer to current color table
290   - *
291   - * @return Combobox widget with colors.conf loaded and set
292   - *
293   - */
  288 + ///
  289 + /// @brief Create a color scheme dropdown button
  290 + ///
  291 + /// @param clr Pointer to current color table
  292 + ///
  293 + /// @return Combobox widget with colors.conf loaded and set
  294 + ///
  295 + ///
294 296 GtkWidget * color_scheme_new(const GdkRGBA *current)
295 297 {
296 298 gchar * filename = build_data_filename("colors.conf",NULL);
... ... @@ -669,4 +671,51 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkRGBA *clr)
669 671  
670 672 }
671 673  
  674 +*/
  675 +
  676 + void editcolors_action(GtkAction *action, GtkWidget *terminal)
  677 + {
  678 + int f;
  679 + GString *str;
  680 +
  681 + g_return_if_fail(GTK_IS_V3270(terminal));
  682 +
  683 + GtkWidget * dialog = v3270_settings_dialog_new();
  684 + GtkWidget * settings = v3270_color_selection_new();
  685 +
  686 + gtk_window_set_title(GTK_WINDOW(dialog), v3270_settings_get_title(settings));
  687 + gtk_container_add(GTK_CONTAINER(dialog), settings);
  688 +
  689 + gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(gtk_widget_get_toplevel(terminal)));
  690 + gtk_window_set_modal(GTK_WINDOW(dialog),TRUE);
  691 +
  692 + v3270_settings_dialog_set_terminal_widget(dialog, terminal);
  693 +
  694 + gtk_widget_show_all(dialog);
  695 +
  696 + switch(gtk_dialog_run(GTK_DIALOG(dialog)))
  697 + {
  698 + case GTK_RESPONSE_APPLY:
  699 +
  700 + v3270_settings_dialog_apply(dialog);
  701 +
  702 + str = g_string_new("");
  703 + for(f=0;f<V3270_COLOR_COUNT;f++)
  704 + {
  705 + if(f)
  706 + g_string_append_c(str,';');
  707 + g_string_append_printf(str,"%s",gdk_rgba_to_string(v3270_get_color(terminal,f)));
  708 + }
  709 + set_string_to_config("terminal","colors","%s",str->str);
  710 + g_string_free(str,TRUE);
  711 +
  712 + break;
  713 +
  714 + case GTK_RESPONSE_CANCEL:
  715 + v3270_settings_dialog_revert(dialog);
  716 + break;
  717 + }
  718 +
  719 + gtk_widget_destroy(dialog);
672 720  
  721 + }
... ...
src/pw3270/hostdialog.c
... ... @@ -50,6 +50,7 @@
50 50 set_integer_to_config("terminal","model_number",lib3270_get_model_number(hSession));
51 51 set_string_to_config("terminal","model_name","%s",lib3270_get_model_name(hSession));
52 52 set_string_to_config("terminal","host_charset",lib3270_get_host_charset(hSession));
  53 + set_string_to_config("terminal","remap_file",v3270_get_remap_filename(widget));
53 54  
54 55 }
55 56  
... ...