diff options
author | Antenore Gatta <antenore@simbiosi.org> | 2019-03-14 02:59:24 +0300 |
---|---|---|
committer | Antenore Gatta <antenore@simbiosi.org> | 2019-03-14 02:59:24 +0300 |
commit | 7419fe16852b81cbe90b8853fd79294b5b7f2bbd (patch) | |
tree | f5fa2cd4364acef544f1846c4780bdbe0ef8b70b | |
parent | c07ec965ae7c2127947c283171db26f3c8bca592 (diff) |
Setting remmina_datadir as the first folder to be parsed by remmina_file_get_datadir
-rw-r--r-- | src/remmina_file_manager.c | 7 | ||||
-rw-r--r-- | src/remmina_pref.c | 11 | ||||
-rw-r--r-- | src/remmina_pref.h | 7 | ||||
-rw-r--r-- | src/remmina_pref_dialog.c | 17 | ||||
-rw-r--r-- | src/remmina_pref_dialog.h | 7 |
5 files changed, 34 insertions, 15 deletions
diff --git a/src/remmina_file_manager.c b/src/remmina_file_manager.c index 699394dd3..7caf546f0 100644 --- a/src/remmina_file_manager.c +++ b/src/remmina_file_manager.c @@ -40,6 +40,7 @@ #include <string.h> #include "remmina_public.h" +#include "remmina_pref.h" #include "remmina_string_array.h" #include "remmina_plugin_manager.h" #include "remmina_file_manager.h" @@ -55,6 +56,12 @@ gchar *remmina_file_get_datadir(void) TRACE_CALL(__func__); const gchar *dir = ".remmina"; int i; + /* From preferences, datadir_path */ + remminadir = remmina_pref_get_value ("datadir_path"); + if (remminadir != NULL) + if (g_file_test(remminadir, G_FILE_TEST_IS_DIR)) + return remminadir; + g_free(remminadir), remminadir = NULL; /* Legacy ~/.remmina */ remminadir = g_build_path("/", g_get_home_dir(), dir, NULL); if (g_file_test(remminadir, G_FILE_TEST_IS_DIR)) diff --git a/src/remmina_pref.c b/src/remmina_pref.c index 90674d830..43fc9fdbf 100644 --- a/src/remmina_pref.c +++ b/src/remmina_pref.c @@ -399,6 +399,10 @@ void remmina_pref_init(void) else remmina_pref.deny_screenshot_clipboard = TRUE; + if (g_key_file_has_key(gkeyfile, "remmina_pref", "datadir_path", NULL)) { + remmina_pref.datadir_path = g_key_file_get_string(gkeyfile, "remmina_pref", "datadir_path", NULL); + } + if (g_key_file_has_key(gkeyfile, "remmina_pref", "screenshot_path", NULL)) { remmina_pref.screenshot_path = g_key_file_get_string(gkeyfile, "remmina_pref", "screenshot_path", NULL); }else{ @@ -655,8 +659,11 @@ gboolean remmina_pref_save(void) g_key_file_load_from_file(gkeyfile, remmina_pref_file, G_KEY_FILE_NONE, NULL); - g_key_file_set_boolean(gkeyfile, "remmina_pref", "save_view_mode", remmina_pref.save_view_mode); + g_key_file_set_string(gkeyfile, "remmina_pref", "datadir_path", remmina_pref.datadir_path); + g_key_file_set_string(gkeyfile, "remmina_pref", "screenshot_path", remmina_pref.screenshot_path); + g_key_file_set_string(gkeyfile, "remmina_pref", "screenshot_name", remmina_pref.screenshot_name); g_key_file_set_boolean(gkeyfile, "remmina_pref", "deny_screenshot_clipboard", remmina_pref.deny_screenshot_clipboard); + g_key_file_set_boolean(gkeyfile, "remmina_pref", "save_view_mode", remmina_pref.save_view_mode); g_key_file_set_integer(gkeyfile, "remmina_pref", "floating_toolbar_placement", remmina_pref.floating_toolbar_placement); g_key_file_set_integer(gkeyfile, "remmina_pref", "toolbar_placement", remmina_pref.toolbar_placement); g_key_file_set_boolean(gkeyfile, "remmina_pref", "prevent_snap_welcome_message", remmina_pref.prevent_snap_welcome_message); @@ -667,8 +674,6 @@ gboolean remmina_pref_save(void) g_key_file_set_integer(gkeyfile, "remmina_pref", "default_action", remmina_pref.default_action); g_key_file_set_integer(gkeyfile, "remmina_pref", "scale_quality", remmina_pref.scale_quality); g_key_file_set_integer(gkeyfile, "remmina_pref", "ssh_loglevel", remmina_pref.ssh_loglevel); - g_key_file_set_string(gkeyfile, "remmina_pref", "screenshot_path", remmina_pref.screenshot_path); - g_key_file_set_string(gkeyfile, "remmina_pref", "screenshot_name", remmina_pref.screenshot_name); g_key_file_set_boolean(gkeyfile, "remmina_pref", "ssh_parseconfig", remmina_pref.ssh_parseconfig); g_key_file_set_boolean(gkeyfile, "remmina_pref", "hide_toolbar", remmina_pref.hide_toolbar); g_key_file_set_boolean(gkeyfile, "remmina_pref", "small_toolbutton", remmina_pref.small_toolbutton); diff --git a/src/remmina_pref.h b/src/remmina_pref.h index 01c1be64f..56161f8ce 100644 --- a/src/remmina_pref.h +++ b/src/remmina_pref.h @@ -110,12 +110,13 @@ typedef struct _RemminaColorPref { typedef struct _RemminaPref { /* In RemminaPrefDialog options tab */ + const gchar *datadir_path; + const gchar *screenshot_path; + gboolean deny_screenshot_clipboard; + const gchar *screenshot_name; gboolean save_view_mode; gint default_action; gint scale_quality; - gboolean deny_screenshot_clipboard; - const gchar *screenshot_path; - const gchar *screenshot_name; gint auto_scroll_step; gint recent_maximum; gchar *resolutions; diff --git a/src/remmina_pref_dialog.c b/src/remmina_pref_dialog.c index 68f11ef4c..fe70aae56 100644 --- a/src/remmina_pref_dialog.c +++ b/src/remmina_pref_dialog.c @@ -160,8 +160,11 @@ void remmina_pref_on_dialog_destroy(GtkWidget *widget, gpointer user_data) GdkRGBA color; gboolean rebuild_remmina_icon = FALSE; - remmina_pref.save_view_mode = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_options_remember_last_view_mode)); + remmina_pref.datadir_path = gtk_file_chooser_get_filename(remmina_pref_dialog->filechooserbutton_options_datadir_path); + remmina_pref.screenshot_path = gtk_file_chooser_get_filename(remmina_pref_dialog->filechooserbutton_options_screenshots_path); + remmina_pref.screenshot_name = gtk_entry_get_text(remmina_pref_dialog->entry_options_screenshot_name); remmina_pref.deny_screenshot_clipboard = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_options_deny_screenshot_clipboard)); + remmina_pref.save_view_mode = gtk_switch_get_active(GTK_SWITCH(remmina_pref_dialog->switch_options_remember_last_view_mode)); remmina_pref.fullscreen_on_auto = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_fullscreen_on_auto)); remmina_pref.always_show_tab = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_show_tabs)); remmina_pref.hide_connection_toolbar = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(remmina_pref_dialog->checkbutton_appearance_hide_toolbar)); @@ -181,8 +184,6 @@ void remmina_pref_on_dialog_destroy(GtkWidget *widget, gpointer user_data) remmina_pref.tab_mode = gtk_combo_box_get_active(remmina_pref_dialog->comboboxtext_appearance_tab_interface); remmina_pref.fullscreen_toolbar_visibility = gtk_combo_box_get_active(remmina_pref_dialog->comboboxtext_appearance_fullscreen_toolbar_visibility); remmina_pref.scale_quality = gtk_combo_box_get_active(remmina_pref_dialog->comboboxtext_options_scale_quality); - remmina_pref.screenshot_path = gtk_file_chooser_get_filename(remmina_pref_dialog->filechooserbutton_options_screenshots_path); - remmina_pref.screenshot_name = gtk_entry_get_text(remmina_pref_dialog->entry_options_screenshot_name); remmina_pref.ssh_loglevel = gtk_combo_box_get_active(remmina_pref_dialog->comboboxtext_options_ssh_loglevel); remmina_pref.sshtunnel_port = atoi(gtk_entry_get_text(remmina_pref_dialog->entry_options_ssh_port)); if (remmina_pref.sshtunnel_port <= 0) @@ -506,6 +507,9 @@ static void remmina_pref_dialog_init(void) gtk_combo_box_set_active(remmina_pref_dialog->comboboxtext_appearance_fullscreen_toolbar_visibility, remmina_pref.fullscreen_toolbar_visibility); gtk_combo_box_set_active(remmina_pref_dialog->comboboxtext_options_scale_quality, remmina_pref.scale_quality); gtk_combo_box_set_active(remmina_pref_dialog->comboboxtext_options_ssh_loglevel, remmina_pref.ssh_loglevel); + if (remmina_pref.datadir_path != NULL) { + gtk_file_chooser_set_filename(remmina_pref_dialog->filechooserbutton_options_datadir_path, remmina_pref.datadir_path); + } if (remmina_pref.screenshot_path != NULL) { gtk_file_chooser_set_filename(remmina_pref_dialog->filechooserbutton_options_screenshots_path, remmina_pref.screenshot_path); }else{ @@ -543,9 +547,12 @@ GtkDialog* remmina_pref_dialog_new(gint default_tab, GtkWindow *parent) remmina_pref_dialog->notebook_preferences = GTK_NOTEBOOK(GET_OBJECT("notebook_preferences")); + remmina_pref_dialog->filechooserbutton_options_datadir_path = GTK_FILE_CHOOSER(GET_OBJECT("filechooserbutton_options_datadir_path")); + remmina_pref_dialog->filechooserbutton_options_screenshots_path = GTK_FILE_CHOOSER(GET_OBJECT("filechooserbutton_options_screenshots_path")); + remmina_pref_dialog->entry_options_screenshot_name = GTK_ENTRY(GET_OBJECT("entry_options_screenshot_name")); + remmina_pref_dialog->switch_options_deny_screenshot_clipboard = GTK_SWITCH(GET_OBJECT("switch_options_deny_screenshot_clipboard")); remmina_pref_dialog->switch_options_remember_last_view_mode = GTK_SWITCH(GET_OBJECT("switch_options_remember_last_view_mode")); remmina_pref_dialog->checkbutton_options_save_settings = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_options_save_settings")); - remmina_pref_dialog->switch_options_deny_screenshot_clipboard = GTK_SWITCH(GET_OBJECT("switch_options_deny_screenshot_clipboard")); remmina_pref_dialog->checkbutton_appearance_fullscreen_on_auto = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_fullscreen_on_auto")); remmina_pref_dialog->checkbutton_appearance_show_tabs = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_show_tabs")); remmina_pref_dialog->checkbutton_appearance_hide_toolbar = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_appearance_hide_toolbar")); @@ -558,8 +565,6 @@ GtkDialog* remmina_pref_dialog_new(gint default_tab, GtkWindow *parent) remmina_pref_dialog->comboboxtext_options_scale_quality = GTK_COMBO_BOX(GET_OBJECT("comboboxtext_options_scale_quality")); remmina_pref_dialog->checkbutton_options_ssh_parseconfig = GTK_CHECK_BUTTON(GET_OBJECT("checkbutton_options_ssh_parseconfig")); remmina_pref_dialog->comboboxtext_options_ssh_loglevel = GTK_COMBO_BOX(GET_OBJECT("comboboxtext_options_ssh_loglevel")); - remmina_pref_dialog->filechooserbutton_options_screenshots_path = GTK_FILE_CHOOSER(GET_OBJECT("filechooserbutton_options_screenshots_path")); - remmina_pref_dialog->entry_options_screenshot_name = GTK_ENTRY(GET_OBJECT("entry_options_screenshot_name")); remmina_pref_dialog->entry_options_ssh_port = GTK_ENTRY(GET_OBJECT("entry_options_ssh_port")); remmina_pref_dialog->entry_options_ssh_tcp_keepidle = GTK_ENTRY(GET_OBJECT("entry_options_ssh_tcp_keepidle")); remmina_pref_dialog->entry_options_ssh_tcp_keepintvl = GTK_ENTRY(GET_OBJECT("entry_options_ssh_tcp_keepintvl")); diff --git a/src/remmina_pref_dialog.h b/src/remmina_pref_dialog.h index f56c73e22..1e2cbfb1f 100644 --- a/src/remmina_pref_dialog.h +++ b/src/remmina_pref_dialog.h @@ -48,8 +48,11 @@ typedef struct _RemminaPrefDialog { GtkDialog *dialog; GtkNotebook *notebook_preferences; - GtkSwitch *switch_options_remember_last_view_mode; + GtkFileChooser *filechooserbutton_options_datadir_path; + GtkFileChooser *filechooserbutton_options_screenshots_path; + GtkEntry *entry_options_screenshot_name; GtkSwitch *switch_options_deny_screenshot_clipboard; + GtkSwitch *switch_options_remember_last_view_mode; GtkCheckButton *checkbutton_options_save_settings; GtkCheckButton *checkbutton_appearance_fullscreen_on_auto; GtkCheckButton *checkbutton_appearance_show_tabs; @@ -62,8 +65,6 @@ typedef struct _RemminaPrefDialog { GtkComboBox *comboboxtext_options_scale_quality; GtkComboBox *comboboxtext_options_ssh_loglevel; GtkComboBox *comboboxtext_appearance_fullscreen_toolbar_visibility; - GtkFileChooser *filechooserbutton_options_screenshots_path; - GtkEntry *entry_options_screenshot_name; GtkCheckButton *checkbutton_options_ssh_parseconfig; GtkEntry *entry_options_ssh_port; GtkEntry *entry_options_ssh_tcp_keepidle; |