123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325 |
- #include <vte/vte.h>
- #include <gdk/gdkkeysyms.h>
- #include "mssh-gconf.h"
- #include "mssh-window.h"
- #include "mssh-terminal.h"
- void mssh_gconf_notify_font(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- const gchar *font;
- int i;
- MSSHWindow *window = MSSH_WINDOW(data);
- value = gconf_entry_get_value(entry);
- font = gconf_value_get_string(value);
- for(i = 0; i < window->terminals->len; i++)
- {
- vte_terminal_set_font_from_string(VTE_TERMINAL(g_array_index(
- window->terminals, MSSHTerminal*, i)), font);
- }
- }
- void mssh_gconf_notify_fg_colour(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- const gchar *colour_s;
- GdkRGBA colour;
- int i;
- MSSHWindow *window = MSSH_WINDOW(data);
- value = gconf_entry_get_value(entry);
- colour_s = gconf_value_get_string(value);
- gdk_rgba_parse(&colour, colour_s);
- for(i = 0; i < window->terminals->len; i++)
- {
- vte_terminal_set_color_foreground_rgba(VTE_TERMINAL(g_array_index(
- window->terminals, MSSHTerminal*, i)), &colour);
- }
- }
- void mssh_gconf_notify_bg_colour(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- const gchar *colour_s;
- GdkRGBA colour;
- int i;
- MSSHWindow *window = MSSH_WINDOW(data);
- value = gconf_entry_get_value(entry);
- colour_s = gconf_value_get_string(value);
- gdk_rgba_parse(&colour, colour_s);
- for(i = 0; i < window->terminals->len; i++)
- {
- vte_terminal_set_color_background_rgba(VTE_TERMINAL(g_array_index(
- window->terminals, MSSHTerminal*, i)), &colour);
- }
- }
- void mssh_gconf_notify_fg_colour_focus(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- const gchar *colour_s;
- GdkRGBA colour;
- int i;
- int idx = -1;
- GtkWidget *focus;
- MSSHWindow *window = MSSH_WINDOW(data);
- value = gconf_entry_get_value(entry);
- colour_s = gconf_value_get_string(value);
- gdk_rgba_parse(&colour, colour_s);
- /* get the currently focused window */
- focus = gtk_window_get_focus(GTK_WINDOW(window));
- /* find the focused window in the terminal list */
- for(i = 0; i < window->terminals->len; i++)
- {
- if(focus == GTK_WIDGET(g_array_index(window->terminals,
- MSSHTerminal*, i)))
- {
- idx = i;
- break;
- }
- }
- if (idx != -1) {
- /* found the currently focused terminal, update the color */
- vte_terminal_set_color_foreground_rgba(VTE_TERMINAL(g_array_index(
- window->terminals, MSSHTerminal*, idx)), &colour);
- }
- }
- void mssh_gconf_notify_bg_colour_focus(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- const gchar *colour_s;
- GdkRGBA colour;
- int i;
- int idx = -1;
- GtkWidget *focus;
- MSSHWindow *window = MSSH_WINDOW(data);
- value = gconf_entry_get_value(entry);
- colour_s = gconf_value_get_string(value);
- gdk_rgba_parse(&colour, colour_s);
- /* get the currently focused window */
- focus = gtk_window_get_focus(GTK_WINDOW(window));
- /* find the focused window in the terminal list */
- for(i = 0; i < window->terminals->len; i++)
- {
- if(focus == GTK_WIDGET(g_array_index(window->terminals,
- MSSHTerminal*, i)))
- {
- idx = i;
- break;
- }
- }
- if (idx != -1) {
- /* found the currently focused terminal, update the color */
- vte_terminal_set_color_background_rgba(VTE_TERMINAL(g_array_index(
- window->terminals, MSSHTerminal*, idx)), &colour);
- }
- }
- void mssh_gconf_notify_columns(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- int columns;
- MSSHWindow *window = MSSH_WINDOW(data);
- value = gconf_entry_get_value(entry);
- columns = gconf_value_get_int(value);
- if(columns <= 0)
- {
- columns = 1;
- gconf_client_set_int(client, MSSH_GCONF_KEY_COLUMNS, columns,
- NULL);
- }
- window->columns = columns;
- mssh_window_relayout(window);
- }
- void mssh_gconf_notify_timeout(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- int timeout;
- MSSHWindow *window = MSSH_WINDOW(data);
- value = gconf_entry_get_value(entry);
- timeout = gconf_value_get_int(value);
- if(timeout < 0)
- {
- timeout = 0;
- gconf_client_set_int(client, MSSH_GCONF_KEY_TIMEOUT, timeout,
- NULL);
- }
- window->timeout = timeout;
- mssh_window_relayout(window);
- }
- void mssh_gconf_notify_close_ended(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- gboolean close_ended;
- int i;
- MSSHWindow *window = MSSH_WINDOW(data);
- value = gconf_entry_get_value(entry);
- close_ended = gconf_value_get_bool(value);
- window->close_ended_sessions = close_ended;
- if(close_ended)
- {
- for(i = 0; i < window->terminals->len; i++)
- {
- MSSHTerminal *terminal = g_array_index(window->terminals,
- MSSHTerminal*, i);
- if(terminal->ended)
- {
- mssh_window_session_closed(terminal, window);
- }
- }
- }
- }
- void mssh_gconf_notify_recolor_focused(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- gboolean recolor_focused;
- MSSHWindow *window = MSSH_WINDOW(data);
- value = gconf_entry_get_value(entry);
- recolor_focused = gconf_value_get_bool(value);
- window->recolor_focused = recolor_focused;
- }
- void mssh_gconf_notify_quit_all_ended(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- MSSHWindow *window = MSSH_WINDOW(data);
- value = gconf_entry_get_value(entry);
- window->exit_on_all_closed = gconf_value_get_bool(value);
- }
- void mssh_gconf_notify_dir_focus(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- MSSHWindow *window = MSSH_WINDOW(data);
- value = gconf_entry_get_value(entry);
- window->dir_focus = gconf_value_get_bool(value);
- }
- void mssh_gconf_notify_modifier(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- MSSHWindow *window = MSSH_WINDOW(data);
- value = gconf_entry_get_value(entry);
- if(window->accel)
- {
- gtk_accel_group_disconnect_key(window->accel, GDK_KEY_Up,
- window->modifier);
- gtk_accel_group_disconnect_key(window->accel, GDK_KEY_Down,
- window->modifier);
- gtk_accel_group_disconnect_key(window->accel, GDK_KEY_Left,
- window->modifier);
- gtk_accel_group_disconnect_key(window->accel, GDK_KEY_Right,
- window->modifier);
- }
- window->modifier = gconf_value_get_int(value);
- if(window->accel)
- {
- gtk_accel_group_connect(window->accel, GDK_KEY_Up, window->modifier,
- GTK_ACCEL_VISIBLE, g_cclosure_new(
- G_CALLBACK(mssh_window_focus), window, NULL));
- gtk_accel_group_connect(window->accel, GDK_KEY_Down, window->modifier,
- GTK_ACCEL_VISIBLE, g_cclosure_new(
- G_CALLBACK(mssh_window_focus), window, NULL));
- gtk_accel_group_connect(window->accel, GDK_KEY_Left, window->modifier,
- GTK_ACCEL_VISIBLE, g_cclosure_new(
- G_CALLBACK(mssh_window_focus), window, NULL));
- gtk_accel_group_connect(window->accel, GDK_KEY_Right, window->modifier,
- GTK_ACCEL_VISIBLE, g_cclosure_new(
- G_CALLBACK(mssh_window_focus), window, NULL));
- }
- }
- void mssh_gconf_backscroll_buffer_size(GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer data)
- {
- GConfValue *value;
- gint backscroll_buffer_size;
- MSSHWindow *window = MSSH_WINDOW(data);
- int i;
- int len = window->terminals->len;
- value = gconf_entry_get_value(entry);
- backscroll_buffer_size = gconf_value_get_int(value);
- if (backscroll_buffer_size < -1)
- {
- backscroll_buffer_size = 5000;
- gconf_client_set_int(client, MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE, backscroll_buffer_size,
- NULL);
- }
- window->backscroll_buffer_size = backscroll_buffer_size;
- /* reconfigure all terminals with the new size*/
- for(i = 0; i < len; i++)
- {
- mssh_terminal_set_backscroll_size(g_array_index(window->terminals,
- MSSHTerminal*, i), &backscroll_buffer_size);
- }
- }
|