mssh-gconf.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #include <vte/vte.h>
  2. #include "mssh-gconf.h"
  3. #include "mssh-window.h"
  4. #include "mssh-terminal.h"
  5. void mssh_gconf_notify_font(GConfClient *client, guint cnxn_id,
  6. GConfEntry *entry, gpointer data)
  7. {
  8. GConfValue *value;
  9. const gchar *font;
  10. int i;
  11. MSSHWindow *window = MSSH_WINDOW(data);
  12. value = gconf_entry_get_value(entry);
  13. font = gconf_value_get_string(value);
  14. for(i = 0; i < window->terminals->len; i++)
  15. {
  16. vte_terminal_set_font_from_string(VTE_TERMINAL(g_array_index(
  17. window->terminals, MSSHTerminal*, i)), font);
  18. }
  19. }
  20. void mssh_gconf_notify_fg_colour(GConfClient *client, guint cnxn_id,
  21. GConfEntry *entry, gpointer data)
  22. {
  23. GConfValue *value;
  24. const gchar *colour_s;
  25. GdkVisual *visual = gdk_visual_get_system();
  26. GdkColormap *colour_map;
  27. GdkColor colour;
  28. int i;
  29. MSSHWindow *window = MSSH_WINDOW(data);
  30. value = gconf_entry_get_value(entry);
  31. colour_s = gconf_value_get_string(value);
  32. colour_map = gdk_colormap_new(visual, TRUE);
  33. gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
  34. gdk_color_parse(colour_s, &colour);
  35. for(i = 0; i < window->terminals->len; i++)
  36. {
  37. vte_terminal_set_color_foreground(VTE_TERMINAL(g_array_index(
  38. window->terminals, MSSHTerminal*, i)), &colour);
  39. }
  40. }
  41. void mssh_gconf_notify_bg_colour(GConfClient *client, guint cnxn_id,
  42. GConfEntry *entry, gpointer data)
  43. {
  44. GConfValue *value;
  45. const gchar *colour_s;
  46. GdkVisual *visual = gdk_visual_get_system();
  47. GdkColormap *colour_map;
  48. GdkColor colour;
  49. int i;
  50. MSSHWindow *window = MSSH_WINDOW(data);
  51. value = gconf_entry_get_value(entry);
  52. colour_s = gconf_value_get_string(value);
  53. colour_map = gdk_colormap_new(visual, TRUE);
  54. gdk_colormap_alloc_color(colour_map, &colour, TRUE, TRUE);
  55. gdk_color_parse(colour_s, &colour);
  56. for(i = 0; i < window->terminals->len; i++)
  57. {
  58. vte_terminal_set_color_background(VTE_TERMINAL(g_array_index(
  59. window->terminals, MSSHTerminal*, i)), &colour);
  60. }
  61. }
  62. void mssh_gconf_notify_columns(GConfClient *client, guint cnxn_id,
  63. GConfEntry *entry, gpointer data)
  64. {
  65. GConfValue *value;
  66. int columns;
  67. MSSHWindow *window = MSSH_WINDOW(data);
  68. value = gconf_entry_get_value(entry);
  69. columns = gconf_value_get_int(value);
  70. if(columns <= 0)
  71. {
  72. columns = 1;
  73. gconf_client_set_int(client, MSSH_GCONF_KEY_COLUMNS, columns,
  74. NULL);
  75. }
  76. window->columns = columns;
  77. mssh_window_relayout(window);
  78. }