Description: Port to GSettings. Debian-Bug: https://bugs.debian.org/886055 Author: Yavor Doganov Forwarded: no Last-Update: 2018-10-23 --- --- debian-mssh.orig/Makefile.am +++ debian-mssh/Makefile.am @@ -2,15 +2,12 @@ EXTRA_DIST = config.rpath mkinstalldirs m4/Makefile.in mssh.schemas mssh_clusters.conf -SCHEMAS_FILE = mssh.schemas +data_convertdir = $(datadir)/GConf/gsettings +dist_data_convert_DATA = mssh.convert -schemadir = $(GCONF_SCHEMA_FILE_DIR) -schema_DATA = $(SCHEMAS_FILE) - -if GCONF_SCHEMAS_INSTALL -install-data-local: - GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/$(schema_DATA) -endif +gsettings_SCHEMAS = es.hgarcia.mssh.gschema.xml +EXTRA_DIST += $(gsettings_SCHEMAS) +@GSETTINGS_RULES@ man1_MANS = mssh.1 --- debian-mssh.orig/configure.ac +++ debian-mssh/configure.ac @@ -6,7 +6,7 @@ AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The prefix for our gettext translation domains.]) -IT_PROG_INTLTOOL(0.26) +IT_PROG_INTLTOOL([0.50.1]) #AM_GNU_GETTEXT([external]) @@ -16,17 +16,11 @@ AC_PROG_CC -PKG_CHECK_MODULES(MSSH, [gtk+-3.0 vte-2.91 gconf-2.0]) +PKG_CHECK_MODULES(MSSH, [gtk+-3.0 vte-2.91]) AC_SUBST(MSSH_CFLAGS) AC_SUBST(MSSH_LIBS) -AC_PATH_PROG(GCONFTOOL, gconftool-2, no) - -if test x"$GCONFTOOL" = xno; then - AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf]) -fi - -AM_GCONF_SOURCE_2 +GLIB_GSETTINGS AC_OUTPUT( po/Makefile.in Makefile --- /dev/null +++ debian-mssh/es.hgarcia.mssh.gschema.xml @@ -0,0 +1,74 @@ + + + + 'Monospace 10' + Terminal font + Font to use for all MSSH terminals + + + '#ffffffffffff' + Terminal foreground colour + Foreground colour to use for all MSSH terminals + + + '#000000000000' + Terminal background colour + Background colour to use for all MSSH terminals + + + true + Recolor focused window + Use different Back- and Foreground color for focused window + + + '#ffffffffffff' + Terminal foreground colour for the focused window + Foreground colour to use for the currently focused MSSH terminal + + + '#000000000000' + Terminal background colour for the focused window + Background colour to use for the currently focused MSSH terminal + + + 2 + Terminal columns + Number of columns of tiled terminals + + + 2 + Terminal close timeout + Timeout after which to close ended sessions + + + true + Close ended sessions + Close ended ssh sessions + + + false + Quit after all sessions ended + Quit MSSH when all ssh sessions have ended + + + true + Use directional focus + Uses directional focus rather than linear focus + + + true + Allow expansion of curly braces when adding new sessions + Use curly bracket expansion when adding new sessions + + + 8 + Shortcut modifier + Modifier used in focus shortcuts + + + 5000 + Backscroll buffer size + Number of lines to keep for every window as a backscroll buffer. Set to -1 to make it infinite + + + --- /dev/null +++ debian-mssh/mssh.convert @@ -0,0 +1,15 @@ +[es.hgarcia.mssh] +font = /apps/mssh/font +fg-colour = /apps/mssh/fg_colour +bg-colour = /apps/mssh/bg_colour +recolor-focused = /apps/mssh/recolor_focused +fg-colour-focus = /apps/mssh/fg_colour_focus +bg-colour-focus = /apps/mssh/bg_colour_focus +columns = /apps/mssh/columns +timeout = /apps/mssh/timeout +close-ended = /apps/mssh/close_ended +quit-all-ended = /apps/mssh/quit_all_ended +dir-focus = /apps/mssh/dir_focus +use-pattern-expansion = /apps/mssh/use_pattern_expansion +modifier = /apps/mssh/modifier +backscroll-buffer-size = /apps/mssh/backscroll_buffer_size --- debian-mssh.orig/mssh.schemas +++ /dev/null @@ -1,158 +0,0 @@ - - - - /schemas/apps/mssh/font - /apps/mssh/font - mssh - string - Monospace 10 - - Terminal font - Font to use for all MSSH terminals - - - - /schemas/apps/mssh/fg_colour - /apps/mssh/fg_colour - mssh - string - #ffffffffffff - - Terminal foreground colour - Foreground colour to use for all MSSH terminals - - - - /schemas/apps/mssh/bg_colour - /apps/mssh/bg_colour - mssh - string - #000000000000 - - Terminal background colour - Background colour to use for all MSSH terminals - - - - /schemas/apps/mssh/recolor_focused - /apps/mssh/recolor_focused - mssh - bool - true - - Recolor focused window - Use different Back- and Foreground color for focused window - - - - /schemas/apps/mssh/fg_colour_focus - /apps/mssh/fg_colour_focus - mssh - string - #ffffffffffff - - Terminal foreground colour for the focused window - Foreground colour to use for the currently focused MSSH terminal - - - - /schemas/apps/mssh/bg_colour_focus - /apps/mssh/bg_colour_focus - mssh - string - #000000000000 - - Terminal background colour for the focused window - Background colour to use for the currently focused MSSH terminal - - - - /schemas/apps/mssh/coloums - /apps/mssh/columns - mssh - int - 2 - - Terminal columns - Number of columns of tiled terminals - - - - /schemas/apps/mssh/timeout - /apps/mssh/timeout - mssh - int - 2 - - Terminal close timeout - Timeout after which to close ended sessions - - - - /schemas/apps/mssh/close_ended - /apps/mssh/close_ended - mssh - bool - true - - Close ended sessions - Close ended ssh sessions - - - - /schemas/apps/mssh/quit_all_ended - /apps/mssh/quit_all_ended - mssh - bool - false - - Quit after all sessions ended - Quit MSSH when all ssh sessions have ended - - - - /schemas/apps/mssh/dir_focus - /apps/mssh/dir_focus - mssh - bool - true - - Use directional focus - Uses directional focus rather than linear focus - - - - /schemas/apps/mssh/use_pattern_expansion - /apps/mssh/use_pattern_expansion - mssh - bool - true - - Allow expansion of curly braces when adding new sessions - Use curly bracket expansion when adding new sessions - - - - /schemas/apps/mssh/modifier - /apps/mssh/modifier - mssh - int - 8 - - Shortcut modifier - Modifier used in focus shortcuts - - - - /schemas/apps/mssh/backscroll_buffer_size - /apps/mssh/backscroll_buffer_size - mssh - int - 5000 - - Backscroll buffer size - Number of lines to keep for every window as a backscroll buffer. Set to -1 to make it infinite - - - - --- debian-mssh.orig/src/mssh-window.c +++ debian-mssh/src/mssh-window.c @@ -2,7 +2,6 @@ #include #include -#include #include #include @@ -94,7 +93,7 @@ static void mssh_window_pref(GtkWidget *widget, gpointer data) { MSSHWindow *window = MSSH_WINDOW(data); - GtkWidget *pref = mssh_pref_new(); + GtkWidget *pref = mssh_pref_new(window->settings); gtk_window_set_transient_for(GTK_WINDOW(pref), GTK_WINDOW(window)); gtk_window_set_modal(GTK_WINDOW(pref), TRUE); @@ -139,22 +138,16 @@ static gboolean mssh_window_entry_focused(GtkWidget *widget, GtkDirectionType dir, gpointer data) { - GConfClient *client; - GConfEntry *entry; MSSHWindow *window = MSSH_WINDOW(data); gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME" - All"); window->last_focus = NULL; /* clear the coloring for the focused window */ - client = gconf_client_get_default(); - - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR, NULL, - TRUE, NULL); - mssh_gconf_notify_fg_colour(client, 0, entry, window); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR, NULL, - TRUE, NULL); - mssh_gconf_notify_bg_colour(client, 0, entry, window); + mssh_gconf_notify_fg_colour(window->settings, MSSH_GCONF_KEY_FG_COLOUR, + window); + mssh_gconf_notify_bg_colour(window->settings, MSSH_GCONF_KEY_BG_COLOUR, + window); return FALSE; } @@ -163,8 +156,6 @@ { MSSHWindow *window = MSSH_WINDOW(data); GtkWidget *focus; - GConfClient *client; - GConfEntry *entry; int i, idx = -1, len = window->terminals->len; int wcols = window->columns_override ? window->columns_override : @@ -183,16 +174,12 @@ } } - client = gconf_client_get_default(); - /* recolor the windows */ if (window->recolor_focused) { - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR, NULL, - TRUE, NULL); - mssh_gconf_notify_fg_colour(client, 0, entry, window); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR, NULL, - TRUE, NULL); - mssh_gconf_notify_bg_colour(client, 0, entry, window); + mssh_gconf_notify_fg_colour(window->settings, + MSSH_GCONF_KEY_FG_COLOUR, window); + mssh_gconf_notify_bg_colour(window->settings, + MSSH_GCONF_KEY_BG_COLOUR, window); } if(focus == window->global_entry && keyval == GDK_KEY_Down && window->dir_focus) @@ -326,8 +313,6 @@ char *title; size_t len; - GConfClient *client; - GConfEntry *entry; MSSHWindow *window = MSSH_WINDOW(data); len = strlen(PACKAGE_NAME" - ") + strlen(terminal->hostname) + 1; @@ -338,31 +323,26 @@ gtk_window_set_title(GTK_WINDOW(window), title); free(title); - client = gconf_client_get_default(); /* recolor all windows */ - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR, NULL, - TRUE, NULL); - mssh_gconf_notify_fg_colour(client, 0, entry, window); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR, NULL, - TRUE, NULL); - mssh_gconf_notify_bg_colour(client, 0, entry, window); + mssh_gconf_notify_fg_colour(window->settings, MSSH_GCONF_KEY_FG_COLOUR, + window); + mssh_gconf_notify_bg_colour(window->settings, MSSH_GCONF_KEY_BG_COLOUR, + window); /* recolor the focused window - if needed */ if (window->recolor_focused && window->is_maximized == 0) { - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR_FOCUS, NULL, - TRUE, NULL); - mssh_gconf_notify_fg_colour_focus(client, 0, entry, window); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR_FOCUS, NULL, - TRUE, NULL); - mssh_gconf_notify_bg_colour_focus(client, 0, entry, window); + mssh_gconf_notify_fg_colour_focus(window->settings, + MSSH_GCONF_KEY_FG_COLOUR_FOCUS, + window); + mssh_gconf_notify_bg_colour_focus(window->settings, + MSSH_GCONF_KEY_BG_COLOUR_FOCUS, + window); } } void mssh_window_relayout(MSSHWindow *window) { - GConfClient *client; - GConfEntry *entry; GtkWidget *focus; int i, len = window->terminals->len; int wcols = window->columns_override ? window->columns_override : @@ -428,19 +408,13 @@ } } - client = gconf_client_get_default(); - gtk_widget_show_all(GTK_WIDGET(window)); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FONT, NULL, - TRUE, NULL); - mssh_gconf_notify_font(client, 0, entry, window); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR, NULL, - TRUE, NULL); - mssh_gconf_notify_fg_colour(client, 0, entry, window); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR, NULL, - TRUE, NULL); - mssh_gconf_notify_bg_colour(client, 0, entry, window); + mssh_gconf_notify_font(window->settings, MSSH_GCONF_KEY_FONT, window); + mssh_gconf_notify_fg_colour(window->settings, MSSH_GCONF_KEY_FG_COLOUR, + window); + mssh_gconf_notify_bg_colour(window->settings, MSSH_GCONF_KEY_BG_COLOUR, + window); gtk_window_set_focus(GTK_WINDOW(window), GTK_WIDGET(focus)); } @@ -467,8 +441,6 @@ static void mssh_window_init(MSSHWindow* window) { - GConfClient *client; - GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); GtkWidget *entry = gtk_entry_new(); @@ -553,46 +525,54 @@ gtk_window_set_default_size(GTK_WINDOW(window), 1024, 768); gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME); - client = gconf_client_get_default(); + window->settings = g_settings_new("es.hgarcia.mssh"); - gconf_client_add_dir(client, MSSH_GCONF_PATH, - GCONF_CLIENT_PRELOAD_RECURSIVE, NULL); - - gconf_client_notify_add(client, MSSH_GCONF_KEY_FONT, - mssh_gconf_notify_font, window, NULL, NULL); - gconf_client_notify_add(client, MSSH_GCONF_KEY_FG_COLOUR, - mssh_gconf_notify_fg_colour, window, NULL, NULL); - gconf_client_notify_add(client, MSSH_GCONF_KEY_BG_COLOUR, - mssh_gconf_notify_bg_colour, window, NULL, NULL); - gconf_client_notify_add(client, MSSH_GCONF_KEY_FG_COLOUR_FOCUS, - mssh_gconf_notify_fg_colour_focus, window, NULL, NULL); - gconf_client_notify_add(client, MSSH_GCONF_KEY_BG_COLOUR_FOCUS, - mssh_gconf_notify_bg_colour_focus, window, NULL, NULL); - gconf_client_notify_add(client, MSSH_GCONF_KEY_COLUMNS, - mssh_gconf_notify_columns, window, NULL, NULL); - gconf_client_notify_add(client, MSSH_GCONF_KEY_TIMEOUT, - mssh_gconf_notify_timeout, window, NULL, NULL); - gconf_client_notify_add(client, MSSH_GCONF_KEY_CLOSE_ENDED, - mssh_gconf_notify_close_ended, window, NULL, NULL); - gconf_client_notify_add(client, MSSH_GCONF_KEY_RECOLOR_FOCUSED, - mssh_gconf_notify_recolor_focused, window, NULL, NULL); - gconf_client_notify_add(client, MSSH_GCONF_KEY_QUIT_ALL_ENDED, - mssh_gconf_notify_quit_all_ended, window, NULL, NULL); - gconf_client_notify_add(client, MSSH_GCONF_KEY_DIR_FOCUS, - mssh_gconf_notify_dir_focus, window, NULL, NULL); - gconf_client_notify_add(client, MSSH_GCONF_KEY_MODIFIER, - mssh_gconf_notify_modifier, window, NULL, NULL); - gconf_client_notify_add(client, MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE, - mssh_gconf_backscroll_buffer_size, window, NULL, NULL); - - gconf_client_notify(client, MSSH_GCONF_KEY_COLUMNS); - gconf_client_notify(client, MSSH_GCONF_KEY_TIMEOUT); - gconf_client_notify(client, MSSH_GCONF_KEY_CLOSE_ENDED); - gconf_client_notify(client, MSSH_GCONF_KEY_RECOLOR_FOCUSED); - gconf_client_notify(client, MSSH_GCONF_KEY_QUIT_ALL_ENDED); - gconf_client_notify(client, MSSH_GCONF_KEY_DIR_FOCUS); - gconf_client_notify(client, MSSH_GCONF_KEY_MODIFIER); - gconf_client_notify(client, MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE); + g_signal_connect(window->settings, "changed::"MSSH_GCONF_KEY_FONT, + G_CALLBACK(mssh_gconf_notify_font), window); + g_signal_connect(window->settings, "changed::"MSSH_GCONF_KEY_FG_COLOUR, + G_CALLBACK(mssh_gconf_notify_fg_colour), window); + g_signal_connect(window->settings, "changed::"MSSH_GCONF_KEY_BG_COLOUR, + G_CALLBACK(mssh_gconf_notify_bg_colour), window); + g_signal_connect(window->settings, + "changed::"MSSH_GCONF_KEY_FG_COLOUR_FOCUS, + G_CALLBACK(mssh_gconf_notify_fg_colour_focus), window); + g_signal_connect(window->settings, + "changed::"MSSH_GCONF_KEY_BG_COLOUR_FOCUS, + G_CALLBACK(mssh_gconf_notify_bg_colour_focus), window); + g_signal_connect(window->settings, "changed::"MSSH_GCONF_KEY_COLUMNS, + G_CALLBACK(mssh_gconf_notify_columns), window); + g_signal_connect(window->settings, "changed::"MSSH_GCONF_KEY_TIMEOUT, + G_CALLBACK(mssh_gconf_notify_timeout), window); + g_signal_connect(window->settings, "changed::"MSSH_GCONF_KEY_CLOSE_ENDED, + G_CALLBACK(mssh_gconf_notify_close_ended), window); + g_signal_connect(window->settings, + "changed::"MSSH_GCONF_KEY_RECOLOR_FOCUSED, + G_CALLBACK(mssh_gconf_notify_recolor_focused), window); + g_signal_connect(window->settings, "changed::"MSSH_GCONF_KEY_QUIT_ALL_ENDED, + G_CALLBACK(mssh_gconf_notify_quit_all_ended), window); + g_signal_connect(window->settings, "changed::"MSSH_GCONF_KEY_DIR_FOCUS, + G_CALLBACK(mssh_gconf_notify_dir_focus), window); + g_signal_connect(window->settings, "changed::"MSSH_GCONF_KEY_MODIFIER, + G_CALLBACK(mssh_gconf_notify_modifier), window); + g_signal_connect(window->settings, + "changed::"MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE, + G_CALLBACK(mssh_gconf_backscroll_buffer_size), window); + + mssh_gconf_notify_columns(window->settings, MSSH_GCONF_KEY_COLUMNS, window); + mssh_gconf_notify_timeout(window->settings, MSSH_GCONF_KEY_TIMEOUT, window); + mssh_gconf_notify_close_ended(window->settings, MSSH_GCONF_KEY_CLOSE_ENDED, + window); + mssh_gconf_notify_recolor_focused(window->settings, + MSSH_GCONF_KEY_RECOLOR_FOCUSED, window); + mssh_gconf_notify_quit_all_ended(window->settings, + MSSH_GCONF_KEY_QUIT_ALL_ENDED, window); + mssh_gconf_notify_dir_focus(window->settings, MSSH_GCONF_KEY_DIR_FOCUS, + window); + mssh_gconf_notify_modifier(window->settings, MSSH_GCONF_KEY_MODIFIER, + window); + mssh_gconf_backscroll_buffer_size(window->settings, + MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE, + window); gtk_accel_group_connect(accel, GDK_KEY_Up, window->modifier, GTK_ACCEL_VISIBLE, g_cclosure_new( @@ -667,8 +647,6 @@ void mssh_window_relayout_for_one(MSSHWindow *window, GtkWidget *t) { - GConfClient *client; - GConfEntry *entry; int len = window->terminals->len; int wcols = window->columns_override ? window->columns_override : window->columns; @@ -692,14 +670,10 @@ /* remove the coloring */ if (window->recolor_focused) { - client = gconf_client_get_default(); - - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR, NULL, - TRUE, NULL); - mssh_gconf_notify_fg_colour(client, 0, entry, window); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR, NULL, - TRUE, NULL); - mssh_gconf_notify_bg_colour(client, 0, entry, window); + mssh_gconf_notify_fg_colour(window->settings, MSSH_GCONF_KEY_FG_COLOUR, + window); + mssh_gconf_notify_bg_colour(window->settings, MSSH_GCONF_KEY_BG_COLOUR, + window); } g_object_unref(terminal); @@ -731,8 +705,6 @@ int i; int idx = -1; int len = window->terminals->len; - GConfClient *client; - GConfEntry *entry; /* get the currently focused window */ GtkWidget *focus = gtk_window_get_focus(GTK_WINDOW(window)); @@ -752,14 +724,10 @@ /* recolor the window with the normal color */ if (window->recolor_focused) { - client = gconf_client_get_default(); - - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR, NULL, - TRUE, NULL); - mssh_gconf_notify_fg_colour(client, 0, entry, window); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR, NULL, - TRUE, NULL); - mssh_gconf_notify_bg_colour(client, 0, entry, window); + mssh_gconf_notify_fg_colour(window->settings, MSSH_GCONF_KEY_FG_COLOUR, + window); + mssh_gconf_notify_bg_colour(window->settings, MSSH_GCONF_KEY_BG_COLOUR, + window); } if (idx == -1) { /* there's no window focused, do nothing */ @@ -774,8 +742,6 @@ static void mssh_window_restore_layout(GtkWidget *widget, gpointer data) { - GConfClient *client; - GConfEntry *entry; /* get the window */ MSSHWindow *window = MSSH_WINDOW(data); @@ -789,14 +755,13 @@ } /* recolor the focused window - if needed */ - client = gconf_client_get_default(); if (window->recolor_focused && window->is_maximized == 0) { - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR_FOCUS, NULL, - TRUE, NULL); - mssh_gconf_notify_fg_colour_focus(client, 0, entry, window); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR_FOCUS, NULL, - TRUE, NULL); - mssh_gconf_notify_bg_colour_focus(client, 0, entry, window); + mssh_gconf_notify_fg_colour_focus(window->settings, + MSSH_GCONF_KEY_FG_COLOUR_FOCUS, + window); + mssh_gconf_notify_bg_colour_focus(window->settings, + MSSH_GCONF_KEY_BG_COLOUR_FOCUS, + window); } } --- debian-mssh.orig/src/mssh-window.h +++ debian-mssh/src/mssh-window.h @@ -41,6 +41,7 @@ int is_maximized; gboolean recolor_focused; GData **commands; + GSettings *settings; } MSSHWindow; typedef struct --- debian-mssh.orig/src/mssh-gconf.h +++ debian-mssh/src/mssh-gconf.h @@ -1,48 +1,47 @@ #ifndef __MSSH_GCONF__ #define __MSSH_GCONF__ -#include +#include -#define MSSH_GCONF_PATH "/apps/mssh" -#define MSSH_GCONF_KEY_FONT MSSH_GCONF_PATH"/font" -#define MSSH_GCONF_KEY_FG_COLOUR MSSH_GCONF_PATH"/fg_colour" -#define MSSH_GCONF_KEY_BG_COLOUR MSSH_GCONF_PATH"/bg_colour" -#define MSSH_GCONF_KEY_FG_COLOUR_FOCUS MSSH_GCONF_PATH"/fg_colour_focus" -#define MSSH_GCONF_KEY_BG_COLOUR_FOCUS MSSH_GCONF_PATH"/bg_colour_focus" -#define MSSH_GCONF_KEY_COLUMNS MSSH_GCONF_PATH"/columns" -#define MSSH_GCONF_KEY_TIMEOUT MSSH_GCONF_PATH"/timeout" -#define MSSH_GCONF_KEY_CLOSE_ENDED MSSH_GCONF_PATH"/close_ended" -#define MSSH_GCONF_KEY_RECOLOR_FOCUSED MSSH_GCONF_PATH"/recolor_focused" -#define MSSH_GCONF_KEY_QUIT_ALL_ENDED MSSH_GCONF_PATH"/quit_all_ended" -#define MSSH_GCONF_KEY_MODIFIER MSSH_GCONF_PATH"/modifier" -#define MSSH_GCONF_KEY_DIR_FOCUS MSSH_GCONF_PATH"/dir_focus" -#define MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE MSSH_GCONF_PATH"/backscroll_buffer_size" +#define MSSH_GCONF_KEY_FONT "font" +#define MSSH_GCONF_KEY_FG_COLOUR "fg-colour" +#define MSSH_GCONF_KEY_BG_COLOUR "bg-colour" +#define MSSH_GCONF_KEY_FG_COLOUR_FOCUS "fg-colour-focus" +#define MSSH_GCONF_KEY_BG_COLOUR_FOCUS "bg-colour-focus" +#define MSSH_GCONF_KEY_COLUMNS "columns" +#define MSSH_GCONF_KEY_TIMEOUT "timeout" +#define MSSH_GCONF_KEY_CLOSE_ENDED "close-ended" +#define MSSH_GCONF_KEY_RECOLOR_FOCUSED "recolor-focused" +#define MSSH_GCONF_KEY_QUIT_ALL_ENDED "quit-all-ended" +#define MSSH_GCONF_KEY_MODIFIER "modifier" +#define MSSH_GCONF_KEY_DIR_FOCUS "dir-focus" +#define MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE "backscroll-buffer-size" -void mssh_gconf_notify_font(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); -void mssh_gconf_notify_fg_colour(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); -void mssh_gconf_notify_bg_colour(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); -void mssh_gconf_notify_fg_colour_focus(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); -void mssh_gconf_notify_bg_colour_focus(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); -void mssh_gconf_notify_columns(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); -void mssh_gconf_notify_timeout(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); -void mssh_gconf_notify_close_ended(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); -void mssh_gconf_notify_quit_all_ended(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); -void mssh_gconf_notify_modifier(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); -void mssh_gconf_notify_dir_focus(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); -void mssh_gconf_backscroll_buffer_size(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); -void mssh_gconf_notify_recolor_focused(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data); +void mssh_gconf_notify_font(GSettings *settings, const gchar *key, + gpointer data); +void mssh_gconf_notify_fg_colour(GSettings *settings, const gchar *key, + gpointer data); +void mssh_gconf_notify_bg_colour(GSettings *settings, const gchar *key, + gpointer data); +void mssh_gconf_notify_fg_colour_focus(GSettings *settings, const gchar *key, + gpointer data); +void mssh_gconf_notify_bg_colour_focus(GSettings *settings, const gchar *key, + gpointer data); +void mssh_gconf_notify_columns(GSettings *settings, const gchar *key, + gpointer data); +void mssh_gconf_notify_timeout(GSettings *settings, const gchar *key, + gpointer data); +void mssh_gconf_notify_close_ended(GSettings *settings, const gchar *key, + gpointer data); +void mssh_gconf_notify_quit_all_ended(GSettings *settings, const gchar *key, + gpointer data); +void mssh_gconf_notify_modifier(GSettings *settings, const gchar *key, + gpointer data); +void mssh_gconf_notify_dir_focus(GSettings *settings, const gchar *key, + gpointer data); +void mssh_gconf_backscroll_buffer_size(GSettings *settings, const gchar *key, + gpointer data); +void mssh_gconf_notify_recolor_focused(GSettings *settings, const gchar *key, + gpointer data); #endif --- debian-mssh.orig/src/mssh-pref.c +++ debian-mssh/src/mssh-pref.c @@ -1,5 +1,3 @@ -#include - #define GETTEXT_PACKAGE "mssh" #include @@ -7,13 +5,17 @@ #include "mssh-pref.h" +GSettings *settings; + static void mssh_pref_init(MSSHPref* pref); static void mssh_pref_class_init(MSSHPrefClass *klass); G_DEFINE_TYPE(MSSHPref, mssh_pref, GTK_TYPE_WINDOW) -GtkWidget* mssh_pref_new(void) +GtkWidget* mssh_pref_new(GSettings *window_settings) { + settings = window_settings; + return g_object_new(MSSH_TYPE_PREF, NULL); } @@ -26,169 +28,125 @@ static void mssh_pref_font_select(GtkWidget *widget, gpointer data) { - GConfClient *client; const gchar *font; - client = gconf_client_get_default(); - font = gtk_font_chooser_get_font (GTK_FONT_CHOOSER(widget)); - gconf_client_set_string(client, MSSH_GCONF_KEY_FONT, font, NULL); + g_settings_set_string(settings, MSSH_GCONF_KEY_FONT, font); } static void mssh_pref_fg_colour_select(GtkWidget *widget, gpointer data) { - GConfClient *client; GdkRGBA colour; const gchar *colour_s; - client = gconf_client_get_default(); - gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), &colour); colour_s = gdk_rgba_to_string(&colour); - gconf_client_set_string(client, MSSH_GCONF_KEY_FG_COLOUR, colour_s, - NULL); + g_settings_set_string(settings, MSSH_GCONF_KEY_FG_COLOUR, colour_s); } static void mssh_pref_bg_colour_select(GtkWidget *widget, gpointer data) { - GConfClient *client; GdkRGBA colour; const gchar *colour_s; - client = gconf_client_get_default(); - gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), &colour); colour_s = gdk_rgba_to_string(&colour); - gconf_client_set_string(client, MSSH_GCONF_KEY_BG_COLOUR, colour_s, - NULL); + g_settings_set_string(settings, MSSH_GCONF_KEY_BG_COLOUR, colour_s); } static void mssh_pref_fg_colour_select_focus(GtkWidget *widget, gpointer data) { - GConfClient *client; GdkRGBA colour; const gchar *colour_s; - client = gconf_client_get_default(); - gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), &colour); colour_s = gdk_rgba_to_string(&colour); - gconf_client_set_string(client, MSSH_GCONF_KEY_FG_COLOUR_FOCUS, colour_s, - NULL); + g_settings_set_string(settings, MSSH_GCONF_KEY_FG_COLOUR_FOCUS, colour_s); } static void mssh_pref_bg_colour_select_focus(GtkWidget *widget, gpointer data) { - GConfClient *client; GdkRGBA colour; const gchar *colour_s; - client = gconf_client_get_default(); - gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(widget), &colour); colour_s = gdk_rgba_to_string(&colour); - gconf_client_set_string(client, MSSH_GCONF_KEY_BG_COLOUR_FOCUS, colour_s, - NULL); + g_settings_set_string(settings, MSSH_GCONF_KEY_BG_COLOUR_FOCUS, colour_s); } static void mssh_pref_columns_select(GtkWidget *widget, gpointer data) { - GConfClient *client; int columns; - client = gconf_client_get_default(); - columns = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); - gconf_client_set_int(client, MSSH_GCONF_KEY_COLUMNS, columns, NULL); + g_settings_set_int(settings, MSSH_GCONF_KEY_COLUMNS, columns); } static void mssh_pref_backscroll_buffer_size_select(GtkWidget *widget, gpointer data) { - GConfClient *client; gint backscroll_buffer_size; - client = gconf_client_get_default(); - backscroll_buffer_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); - gconf_client_set_int(client, MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE, backscroll_buffer_size, NULL); + g_settings_set_int(settings, MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE, backscroll_buffer_size); } static void mssh_pref_timeout_select(GtkWidget *widget, gpointer data) { - GConfClient *client; int timeout; - client = gconf_client_get_default(); - timeout = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget)); - gconf_client_set_int(client, MSSH_GCONF_KEY_TIMEOUT, timeout, NULL); + g_settings_set_int(settings, MSSH_GCONF_KEY_TIMEOUT, timeout); } static void mssh_pref_close_check(GtkWidget *widget, gpointer data) { - GConfClient *client; gboolean close; - client = gconf_client_get_default(); - close = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - gconf_client_set_bool(client, MSSH_GCONF_KEY_CLOSE_ENDED, close, NULL); + g_settings_set_boolean(settings, MSSH_GCONF_KEY_CLOSE_ENDED, close); } static void mssh_pref_recolor_focused_check(GtkWidget *widget, gpointer data) { - GConfClient *client; gboolean recolor_focused; - client = gconf_client_get_default(); - recolor_focused = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - gconf_client_set_bool(client, MSSH_GCONF_KEY_RECOLOR_FOCUSED, recolor_focused, NULL); + g_settings_set_boolean(settings, MSSH_GCONF_KEY_RECOLOR_FOCUSED, recolor_focused); } static void mssh_pref_exit_check(GtkWidget *widget, gpointer data) { - GConfClient *client; gboolean close; - client = gconf_client_get_default(); - close = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - gconf_client_set_bool(client, MSSH_GCONF_KEY_QUIT_ALL_ENDED, close, - NULL); + g_settings_set_boolean(settings, MSSH_GCONF_KEY_QUIT_ALL_ENDED, close); } static void mssh_pref_dir_focus_check(GtkWidget *widget, gpointer data) { - GConfClient *client; gboolean focus; - client = gconf_client_get_default(); - focus = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - gconf_client_set_bool(client, MSSH_GCONF_KEY_DIR_FOCUS, focus, NULL); + g_settings_set_boolean(settings, MSSH_GCONF_KEY_DIR_FOCUS, focus); } static void mssh_pref_modifier_check(GtkWidget *widget, gpointer data) { - GConfClient *client; gboolean ctrl, alt, shift, super; gint val; MSSHPref * pref = MSSH_PREF(data); - client = gconf_client_get_default(); - ctrl = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pref->ctrl)); shift = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pref->shift)); alt = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pref->alt)); @@ -196,14 +154,12 @@ val = (shift << 0) | (ctrl << 2) | (alt << 3) | (super << 26); - gconf_client_set_int(client, MSSH_GCONF_KEY_MODIFIER, val, NULL); + g_settings_set_int(settings, MSSH_GCONF_KEY_MODIFIER, val); } static void mssh_pref_init(MSSHPref* pref) { - GConfClient *client; - GConfEntry *entry; - GConfValue *value; + GVariant *value; GdkRGBA colour; const gchar *colour_s; @@ -378,99 +334,84 @@ g_signal_connect(G_OBJECT(mod_super_check), "toggled", G_CALLBACK(mssh_pref_modifier_check), pref); - client = gconf_client_get_default(); - - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FONT, NULL, - TRUE, NULL); - value = gconf_entry_get_value(entry); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_FONT); gtk_font_chooser_set_font(GTK_FONT_CHOOSER(font_select), - gconf_value_get_string(value)); + g_variant_get_string(value, NULL)); + g_variant_unref(value); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR, NULL, - TRUE, NULL); - value = gconf_entry_get_value(entry); - colour_s = gconf_value_get_string(value); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_FG_COLOUR); + colour_s = g_variant_get_string(value, NULL); gdk_rgba_parse(&colour, colour_s); gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(fg_colour_select), &colour); + g_variant_unref(value); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR, NULL, - TRUE, NULL); - value = gconf_entry_get_value(entry); - colour_s = gconf_value_get_string(value); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_BG_COLOUR); + colour_s = g_variant_get_string(value, NULL); gdk_rgba_parse(&colour, colour_s); gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(bg_colour_select), &colour); + g_variant_unref(value); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_FG_COLOUR_FOCUS, NULL, - TRUE, NULL); - value = gconf_entry_get_value(entry); - colour_s = gconf_value_get_string(value); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_FG_COLOUR_FOCUS); + colour_s = g_variant_get_string(value, NULL); gdk_rgba_parse(&colour, colour_s); gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(fg_colour_select_focus), &colour); + g_variant_unref(value); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BG_COLOUR_FOCUS, NULL, - TRUE, NULL); - value = gconf_entry_get_value(entry); - colour_s = gconf_value_get_string(value); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_BG_COLOUR_FOCUS); + colour_s = g_variant_get_string(value, NULL); gdk_rgba_parse(&colour, colour_s); gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(bg_colour_select_focus), &colour); + g_variant_unref(value); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_COLUMNS, NULL, - TRUE, NULL); - value = gconf_entry_get_value(entry); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_COLUMNS); gtk_spin_button_set_value(GTK_SPIN_BUTTON(columns_select), - gconf_value_get_int(value)); + g_variant_get_int32(value)); + g_variant_unref(value); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE, NULL, - TRUE, NULL); - value = gconf_entry_get_value(entry); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE); gtk_spin_button_set_value(GTK_SPIN_BUTTON(backscroll_buffer_size_select), - gconf_value_get_int(value)); + g_variant_get_int32(value)); + g_variant_unref(value); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_TIMEOUT, NULL, - TRUE, NULL); - value = gconf_entry_get_value(entry); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_TIMEOUT); gtk_spin_button_set_value(GTK_SPIN_BUTTON(timeout_select), - gconf_value_get_int(value)); + g_variant_get_int32(value)); + g_variant_unref(value); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_CLOSE_ENDED, - NULL, TRUE, NULL); - value = gconf_entry_get_value(entry); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_CLOSE_ENDED); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(close_check), - gconf_value_get_bool(value)); + g_variant_get_boolean(value)); + g_variant_unref(value); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_RECOLOR_FOCUSED, - NULL, TRUE, NULL); - value = gconf_entry_get_value(entry); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_RECOLOR_FOCUSED); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(recolor_focused_check), - gconf_value_get_bool(value)); + g_variant_get_boolean(value)); + g_variant_unref(value); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_QUIT_ALL_ENDED, - NULL, TRUE, NULL); - value = gconf_entry_get_value(entry); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_QUIT_ALL_ENDED); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(exit_check), - gconf_value_get_bool(value)); + g_variant_get_boolean(value)); + g_variant_unref(value); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_DIR_FOCUS, - NULL, TRUE, NULL); - value = gconf_entry_get_value(entry); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_DIR_FOCUS); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dir_focus_check), - gconf_value_get_bool(value)); + g_variant_get_boolean(value)); + g_variant_unref(value); - entry = gconf_client_get_entry(client, MSSH_GCONF_KEY_MODIFIER, - NULL, TRUE, NULL); - value = gconf_entry_get_value(entry); + value = g_settings_get_value(settings, MSSH_GCONF_KEY_MODIFIER); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mod_ctrl_check), - (gconf_value_get_int(value) & GDK_CONTROL_MASK) ? 1 : 0); + (g_variant_get_int32(value) & GDK_CONTROL_MASK) ? 1 : 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mod_shift_check), - (gconf_value_get_int(value) & GDK_SHIFT_MASK) ? 1 : 0); + (g_variant_get_int32(value) & GDK_SHIFT_MASK) ? 1 : 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mod_alt_check), - (gconf_value_get_int(value) & GDK_MOD1_MASK) ? 1 : 0); + (g_variant_get_int32(value) & GDK_MOD1_MASK) ? 1 : 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mod_super_check), - (gconf_value_get_int(value) & GDK_SUPER_MASK) ? 1 : 0); + (g_variant_get_int32(value) & GDK_SUPER_MASK) ? 1 : 0); + g_variant_unref(value); } static void mssh_pref_class_init(MSSHPrefClass *klass) --- debian-mssh.orig/src/mssh-pref.h +++ debian-mssh/src/mssh-pref.h @@ -31,7 +31,7 @@ GType mssh_pref_get_type(void) G_GNUC_CONST; -GtkWidget* mssh_pref_new(void); +GtkWidget* mssh_pref_new(GSettings *settings); G_END_DECLS --- debian-mssh.orig/src/mssh-gconf.c +++ debian-mssh/src/mssh-gconf.c @@ -5,39 +5,38 @@ #include "mssh-window.h" #include "mssh-terminal.h" -void mssh_gconf_notify_font(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_notify_font(GSettings *settings, const gchar *key, + gpointer data) { PangoFontDescription *font_desc; - GConfValue *value; + gchar *value; int i; MSSHWindow *window = MSSH_WINDOW(data); - value = gconf_entry_get_value(entry); + value = g_settings_get_string(settings, key); - font_desc = pango_font_description_from_string(gconf_value_get_string(value)); + font_desc = pango_font_description_from_string(value); for(i = 0; i < window->terminals->len; i++) { vte_terminal_set_font(VTE_TERMINAL(g_array_index( window->terminals, MSSHTerminal*, i)), font_desc); } + g_free(value); pango_font_description_free(font_desc); } -void mssh_gconf_notify_fg_colour(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_notify_fg_colour(GSettings *settings, const gchar *key, + gpointer data) { - GConfValue *value; - const gchar *colour_s; + 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); + colour_s = g_settings_get_string(settings, key); gdk_rgba_parse(&colour, colour_s); for(i = 0; i < window->terminals->len; i++) @@ -45,20 +44,20 @@ vte_terminal_set_color_foreground(VTE_TERMINAL(g_array_index( window->terminals, MSSHTerminal*, i)), &colour); } + + g_free (colour_s); } -void mssh_gconf_notify_bg_colour(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_notify_bg_colour(GSettings *settings, const gchar *key, + gpointer data) { - GConfValue *value; - const gchar *colour_s; + 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); + colour_s = g_settings_get_string(settings, key); gdk_rgba_parse(&colour, colour_s); for(i = 0; i < window->terminals->len; i++) @@ -66,13 +65,14 @@ vte_terminal_set_color_background(VTE_TERMINAL(g_array_index( window->terminals, MSSHTerminal*, i)), &colour); } + + g_free(colour_s); } -void mssh_gconf_notify_fg_colour_focus(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_notify_fg_colour_focus(GSettings *settings, const gchar *key, + gpointer data) { - GConfValue *value; - const gchar *colour_s; + gchar *colour_s; GdkRGBA colour; int i; int idx = -1; @@ -80,8 +80,7 @@ MSSHWindow *window = MSSH_WINDOW(data); - value = gconf_entry_get_value(entry); - colour_s = gconf_value_get_string(value); + colour_s = g_settings_get_string(settings, key); gdk_rgba_parse(&colour, colour_s); /* get the currently focused window */ @@ -103,13 +102,14 @@ vte_terminal_set_color_foreground(VTE_TERMINAL(g_array_index( window->terminals, MSSHTerminal*, idx)), &colour); } + + g_free(colour_s); } -void mssh_gconf_notify_bg_colour_focus(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_notify_bg_colour_focus(GSettings *settings, const gchar *key, + gpointer data) { - GConfValue *value; - const gchar *colour_s; + gchar *colour_s; GdkRGBA colour; int i; int idx = -1; @@ -117,8 +117,7 @@ MSSHWindow *window = MSSH_WINDOW(data); - value = gconf_entry_get_value(entry); - colour_s = gconf_value_get_string(value); + colour_s = g_settings_get_string(settings, key); gdk_rgba_parse(&colour, colour_s); /* get the currently focused window */ @@ -141,62 +140,55 @@ window->terminals, MSSHTerminal*, idx)), &colour); } + g_free(colour_s); } -void mssh_gconf_notify_columns(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_notify_columns(GSettings *settings, const gchar *key, + gpointer data) { - GConfValue *value; int columns; MSSHWindow *window = MSSH_WINDOW(data); - value = gconf_entry_get_value(entry); - columns = gconf_value_get_int(value); + columns = g_settings_get_int(settings, key); if(columns <= 0) { columns = 1; - gconf_client_set_int(client, MSSH_GCONF_KEY_COLUMNS, columns, - NULL); + g_settings_set_int(settings, MSSH_GCONF_KEY_COLUMNS, columns); } window->columns = columns; mssh_window_relayout(window); } -void mssh_gconf_notify_timeout(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_notify_timeout(GSettings *settings, const gchar *key, + gpointer data) { - GConfValue *value; int timeout; MSSHWindow *window = MSSH_WINDOW(data); - value = gconf_entry_get_value(entry); - timeout = gconf_value_get_int(value); + timeout = g_settings_get_int(settings, key); if(timeout < 0) { timeout = 0; - gconf_client_set_int(client, MSSH_GCONF_KEY_TIMEOUT, timeout, - NULL); + g_settings_set_int(settings, MSSH_GCONF_KEY_TIMEOUT, timeout); } window->timeout = timeout; mssh_window_relayout(window); } -void mssh_gconf_notify_close_ended(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_notify_close_ended(GSettings *settings, const gchar *key, + 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); + close_ended = g_settings_get_boolean(settings, key); window->close_ended_sessions = close_ended; @@ -215,54 +207,40 @@ } } -void mssh_gconf_notify_recolor_focused(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_notify_recolor_focused(GSettings *settings, const gchar *key, + 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); + recolor_focused = g_settings_get_boolean(settings, key); window->recolor_focused = recolor_focused; } -void mssh_gconf_notify_quit_all_ended(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_notify_quit_all_ended(GSettings *settings, const gchar *key, + 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); + window->exit_on_all_closed = g_settings_get_boolean(settings, key); } -void mssh_gconf_notify_dir_focus(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_notify_dir_focus(GSettings *settings, const gchar *key, + gpointer data) { - GConfValue *value; - MSSHWindow *window = MSSH_WINDOW(data); - value = gconf_entry_get_value(entry); - - window->dir_focus = gconf_value_get_bool(value); + window->dir_focus = g_settings_get_boolean(settings, key); } -void mssh_gconf_notify_modifier(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_notify_modifier(GSettings *settings, const gchar *key, + 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, @@ -275,7 +253,7 @@ window->modifier); } - window->modifier = gconf_value_get_int(value); + window->modifier = g_settings_get_int(settings, key); if(window->accel) { @@ -295,10 +273,9 @@ } -void mssh_gconf_backscroll_buffer_size(GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer data) +void mssh_gconf_backscroll_buffer_size(GSettings *settings, const gchar *key, + gpointer data) { - GConfValue *value; gint backscroll_buffer_size; MSSHWindow *window = MSSH_WINDOW(data); @@ -306,15 +283,13 @@ int i; int len = window->terminals->len; - value = gconf_entry_get_value(entry); - backscroll_buffer_size = gconf_value_get_int(value); + backscroll_buffer_size = g_settings_get_int(settings, key); if (backscroll_buffer_size < -1) { backscroll_buffer_size = 5000; - gconf_client_set_int(client, MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE, backscroll_buffer_size, - NULL); + g_settings_set_int(settings, MSSH_GCONF_KEY_BACKSCROLL_BUFFER_SIZE, backscroll_buffer_size); } window->backscroll_buffer_size = backscroll_buffer_size; --- debian-mssh.orig/src/mssh.c +++ debian-mssh/src/mssh.c @@ -227,6 +227,69 @@ return commands; } +/* Migrate existing GConf settings. */ +static gchar *migrate_gconf_settings(const gchar *name) +{ + gboolean needed = TRUE; + GError *error = NULL; + GKeyFile *kf; + gchar **list; + gchar *msg = NULL; + gsize i, n; + + kf = g_key_file_new(); + + if (!g_key_file_load_from_data_dirs(kf, "gsettings-data-convert", + NULL, G_KEY_FILE_NONE, NULL)) + { + g_key_file_free(kf); + return NULL; + } + + list = g_key_file_get_string_list(kf, "State", "converted", &n, NULL); + + if (list) + { + for (i = 0; i < n; i++) + if (!g_strcmp0(list[i], name)) + { + needed = FALSE; + break; + } + + g_strfreev(list); + } + + g_key_file_free(kf); + + if (needed) + { + g_spawn_command_line_sync("gsettings-data-convert", + NULL, NULL, NULL, &error); + if (error) + { + msg = g_strdup_printf(_("Could not migrate old GConf settings: %s\n" + "Please make sure that GConf is installed " + "and the gsettings-data-convert tool is in " + "your PATH.\nAlternatively, ignore this " + "message and convert your old settings " + "manually."), error->message); + g_error_free(error); + } + else + { + msg = g_strdup(_("Old GConf settings were migrated successfully.")); + + /* Allow some time for the GSettings backend to record the + changes, otherwise the default values from the new schema + might be set. */ + sleep(1); + } + } + + return msg; +} + int main(int argc, char* argv[], char* env[]) { GtkWidget* window; @@ -236,6 +299,7 @@ GData **aliases = NULL; GData **commands = NULL; GArray *hosts = NULL; + gchar *gconf_migration_msg = NULL; static struct option long_options[] = { @@ -356,8 +420,23 @@ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); + gconf_migration_msg = migrate_gconf_settings("mssh.convert"); + window = GTK_WIDGET(mssh_window_new()); + if (gconf_migration_msg) + { + GtkWidget *dlg; + + dlg = gtk_message_dialog_new(GTK_WINDOW(window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, + "%s", gconf_migration_msg); + g_free(gconf_migration_msg); + gtk_dialog_run(GTK_DIALOG(dlg)); + gtk_widget_destroy(dlg); + } + g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(on_mssh_destroy), NULL); --- debian-mssh.orig/po/POTFILES.in +++ debian-mssh/po/POTFILES.in @@ -3,3 +3,4 @@ ./src/mssh-pref.c ./src/mssh-terminal.c ./src/mssh-window.c +[type: gettext/gsettings]es.hgarcia.mssh.gschema.xml