86
89
prefs.menu_key = g_strdup(gtk_entry_get_text((GtkEntry*)menu_key_entry));
87
90
prefs.case_search = gtk_toggle_button_get_active((GtkToggleButton*)case_search);
88
91
prefs.type_search = gtk_toggle_button_get_active((GtkToggleButton*)type_search);
92
prefs.ignore_whiteonly = gtk_toggle_button_get_active((GtkToggleButton*)ignore_whiteonly);
93
prefs.trim_wspace_begend = gtk_toggle_button_get_active((GtkToggleButton*)trim_wspace_begend);
94
prefs.trim_newline = gtk_toggle_button_get_active((GtkToggleButton*)trim_newline);
90
96
/* Bind keys and apply the new history limit */
91
97
keybinder_bind(prefs.history_key, history_hotkey, NULL);
122
128
g_key_file_set_boolean(rc_key, "rc", "case_search", prefs.case_search);
123
129
g_key_file_set_boolean(rc_key, "rc", "type_search", prefs.type_search);
124
130
g_key_file_set_integer(rc_key, "rc", "data_size", prefs.data_size);
131
g_key_file_set_boolean(rc_key, "rc", "ignore_whiteonly", prefs.ignore_whiteonly);
132
g_key_file_set_boolean(rc_key, "rc", "trim_wspace_begend", prefs.trim_wspace_begend);
133
g_key_file_set_boolean(rc_key, "rc", "trim_newline", prefs.trim_newline);
126
134
/* Check config and data directories */
128
136
/* Save key to file */
129
gchar* rc_file = g_build_filename(g_get_home_dir(), PREFERENCES_FILE, NULL);
137
gchar* rc_file = g_build_filename(g_get_user_config_dir(), PREFERENCES_FILE, NULL);
130
138
g_file_set_contents(rc_file, g_key_file_to_data(rc_key, NULL, NULL), -1, NULL);
131
139
g_key_file_free(rc_key);
135
143
/* Read ~/.config/parcellite/parcelliterc */
136
144
void read_preferences()
138
gchar* rc_file = g_build_filename(g_get_home_dir(), PREFERENCES_FILE, NULL);
146
gchar* rc_file = g_build_filename(g_get_user_config_dir(), PREFERENCES_FILE, NULL);
141
149
GKeyFile* rc_key = g_key_file_new();
161
169
prefs.case_search = g_key_file_get_boolean(rc_key, "rc", "case_search", NULL);
162
170
prefs.type_search = g_key_file_get_boolean(rc_key, "rc", "type_search", NULL);
163
171
prefs.data_size = g_key_file_get_integer(rc_key, "rc", "data_size", NULL);
172
prefs.ignore_whiteonly = g_key_file_get_boolean(rc_key, "rc", "ignore_whiteonly", NULL);
173
prefs.trim_wspace_begend = g_key_file_get_boolean(rc_key, "rc", "trim_wspace_begend", NULL);
174
prefs.trim_newline = g_key_file_get_boolean(rc_key, "rc", "trim_newline", NULL);
164
175
if(0 == prefs.type_search)
165
176
prefs.case_search=0;
166
177
/* Check for errors and set default values if any */
196
207
static void read_actions()
198
209
/* Open the file for reading */
199
gchar* path = g_build_filename(g_get_home_dir(), ACTIONS_FILE, NULL);
210
gchar* path = g_build_filename(g_get_user_data_dir(), ACTIONS_FILE, NULL);
200
211
FILE* actions_file = fopen(path, "rb");
202
213
/* Check that it opened and begin read */
236
247
/* Check config and data directories */
238
249
/* Open the file for writing */
239
gchar* path = g_build_filename(g_get_home_dir(), ACTIONS_FILE, NULL);
250
gchar* path = g_build_filename(g_get_user_data_dir(), ACTIONS_FILE, NULL);
240
251
FILE* actions_file = fopen(path, "wb");
242
253
/* Check that it opened and begin write */
486
497
/**set the history position */
487
498
hbox = gtk_hbox_new(FALSE, 4);
488
499
gtk_box_pack_start((GtkBox*)vbox, hbox, FALSE, FALSE, 0);
489
history_pos = gtk_check_button_new_with_mnemonic(_("_Postion history"));
500
history_pos = gtk_check_button_new_with_mnemonic(_("_Position history"));
490
501
gtk_widget_set_tooltip_text(history_pos, _("Set the location where history appears. If unchecked, appears where the mouse is."));
491
502
gtk_box_pack_start((GtkBox*)hbox, history_pos, FALSE, FALSE, 0);
492
503
postition_history(NULL,&x,&y,NULL, (gpointer)1);
543
554
gtk_widget_set_tooltip_text(case_search, _("If checked, does case sensitive search"));
544
555
g_signal_connect((GObject*)case_search, "toggled", (GCallback)search_toggled, case_search);
545
556
gtk_box_pack_start((GtkBox*)vbox, case_search, FALSE, FALSE, 0);
557
/** ignore_whiteonly checkbox */
558
ignore_whiteonly = gtk_check_button_new_with_mnemonic(_("_Ignore Whitespace Only"));
559
gtk_widget_set_tooltip_text(ignore_whiteonly, _("If checked, will ignore any clipboard additions that contain only whitespace."));
560
gtk_box_pack_start((GtkBox*)vbox, ignore_whiteonly, FALSE, FALSE, 0);
561
/** trim_wspace_begend checkbox */
562
trim_wspace_begend = gtk_check_button_new_with_mnemonic(_("_Trim Whitespace"));
563
gtk_widget_set_tooltip_text(trim_wspace_begend, _("If checked, will trim whitespace from beginning and end of entry."));
564
gtk_box_pack_start((GtkBox*)vbox, trim_wspace_begend, FALSE, FALSE, 0);
565
/** trim_newline checkbox */
566
trim_newline = gtk_check_button_new_with_mnemonic(_("_Trim Newlines"));
567
gtk_widget_set_tooltip_text(trim_newline, _("If checked, will replace newlines with spaces."));
568
gtk_box_pack_start((GtkBox*)vbox, trim_newline, FALSE, FALSE, 0);
547
570
hyperlinks_check = gtk_check_button_new_with_mnemonic(_("Capture _hyperlinks only"));
548
571
gtk_box_pack_start((GtkBox*)vbox, hyperlinks_check, FALSE, FALSE, 0);
549
572
confirm_check = gtk_check_button_new_with_mnemonic(_("C_onfirm before clearing history"));
739
762
gtk_toggle_button_set_active((GtkToggleButton*)case_search, prefs.case_search);
740
763
gtk_toggle_button_set_active((GtkToggleButton*)type_search, prefs.type_search);
741
764
gtk_spin_button_set_value((GtkSpinButton*)data_size, (gdouble)prefs.data_size);
765
gtk_toggle_button_set_active((GtkToggleButton*)ignore_whiteonly, prefs.ignore_whiteonly);
766
gtk_toggle_button_set_active((GtkToggleButton*)trim_wspace_begend, prefs.trim_wspace_begend);
767
gtk_toggle_button_set_active((GtkToggleButton*)trim_newline, prefs.trim_newline);
743
769
/* Read actions */