Commit a525575623c4f30b93d0d34635ea3c728a5399af
1 parent
cdf52b6c
Exists in
master
and in
1 other branch
Working on clipboard settings dialog.
Showing
1 changed file
with
90 additions
and
20 deletions
Show diff stats
src/dialogs/settings/clipboard.c
| @@ -209,26 +209,6 @@ static void V3270ClipboardSettings_init(V3270ClipboardSettings *widget) { | @@ -209,26 +209,6 @@ static void V3270ClipboardSettings_init(V3270ClipboardSettings *widget) { | ||
| 209 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget->input.combos[ix]), text_renderer, "text", 0, NULL); | 209 | gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget->input.combos[ix]), text_renderer, "text", 0, NULL); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | - // HTML Font combo | ||
| 213 | - static const gchar * html_font_options[] = { | ||
| 214 | - N_("None (Don't export font name)"), | ||
| 215 | - N_("Same of the screen") | ||
| 216 | - }; | ||
| 217 | - | ||
| 218 | - model = GTK_LIST_STORE(gtk_combo_box_get_model(widget->input.combos[0])); | ||
| 219 | - for(ix = 0;ix < G_N_ELEMENTS(html_font_options); ix++) { | ||
| 220 | - | ||
| 221 | - gtk_list_store_append(model, &iter); | ||
| 222 | - gtk_list_store_set( | ||
| 223 | - model, | ||
| 224 | - &iter, | ||
| 225 | - 0, g_dgettext(PACKAGE_NAME, html_font_options[ix]), | ||
| 226 | - 1, (guint) ix, | ||
| 227 | - -1 | ||
| 228 | - ); | ||
| 229 | - | ||
| 230 | - } | ||
| 231 | - | ||
| 232 | // Color scheme combo | 212 | // Color scheme combo |
| 233 | static const gchar * html_color_options[] = { | 213 | static const gchar * html_color_options[] = { |
| 234 | N_("None (Don't export color)"), | 214 | N_("None (Don't export color)"), |
| @@ -249,6 +229,50 @@ static void V3270ClipboardSettings_init(V3270ClipboardSettings *widget) { | @@ -249,6 +229,50 @@ static void V3270ClipboardSettings_init(V3270ClipboardSettings *widget) { | ||
| 249 | 229 | ||
| 250 | } | 230 | } |
| 251 | 231 | ||
| 232 | + // Load color schemes | ||
| 233 | + { | ||
| 234 | + lib3270_autoptr(char) filename = lib3270_build_data_filename("colors.conf",NULL); | ||
| 235 | + if(g_file_test(filename,G_FILE_TEST_IS_REGULAR)) { | ||
| 236 | + | ||
| 237 | + GKeyFile * keyfile = g_key_file_new(); | ||
| 238 | + | ||
| 239 | + GError * error = NULL; | ||
| 240 | + g_key_file_load_from_file(keyfile,filename,G_KEY_FILE_NONE,&error); | ||
| 241 | + | ||
| 242 | + if(error) { | ||
| 243 | + | ||
| 244 | + g_warning(error->message); | ||
| 245 | + g_error_free(error); | ||
| 246 | + | ||
| 247 | + } else { | ||
| 248 | + | ||
| 249 | + gsize len; | ||
| 250 | + gchar **group = g_key_file_get_groups(keyfile,&len); | ||
| 251 | + GtkTreeIter iter; | ||
| 252 | + | ||
| 253 | + for(ix = 0; ix < (size_t) len; ix++) { | ||
| 254 | + | ||
| 255 | + g_autofree gchar * label = g_key_file_get_locale_string(keyfile,group[ix],"label",NULL,NULL); | ||
| 256 | + | ||
| 257 | + gtk_list_store_append((GtkListStore *) model,&iter); | ||
| 258 | + gtk_list_store_set( | ||
| 259 | + (GtkListStore *) model, | ||
| 260 | + &iter, | ||
| 261 | + 0, label ? label : group[ix], | ||
| 262 | + 1, (guint) 99, | ||
| 263 | + -1 | ||
| 264 | + ); | ||
| 265 | + | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + g_strfreev(group); | ||
| 269 | + | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + g_key_file_free(keyfile); | ||
| 273 | + } | ||
| 274 | + } | ||
| 275 | + | ||
| 252 | // Copy format combo | 276 | // Copy format combo |
| 253 | static const gchar * copy_formats[] = { | 277 | static const gchar * copy_formats[] = { |
| 254 | N_("Plain text only"), | 278 | N_("Plain text only"), |
| @@ -287,10 +311,56 @@ GtkWidget * v3270_clipboard_settings_new() { | @@ -287,10 +311,56 @@ GtkWidget * v3270_clipboard_settings_new() { | ||
| 287 | 311 | ||
| 288 | static void load(GtkWidget *w, GtkWidget *terminal) { | 312 | static void load(GtkWidget *w, GtkWidget *terminal) { |
| 289 | 313 | ||
| 314 | + size_t ix; | ||
| 315 | + | ||
| 290 | V3270ClipboardSettings *widget = (V3270ClipboardSettings *) w; | 316 | V3270ClipboardSettings *widget = (V3270ClipboardSettings *) w; |
| 291 | 317 | ||
| 292 | v3270_settings_load_toggle_buttons(toggles, G_N_ELEMENTS(toggles), terminal, widget->input.toggles); | 318 | v3270_settings_load_toggle_buttons(toggles, G_N_ELEMENTS(toggles), terminal, widget->input.toggles); |
| 293 | 319 | ||
| 320 | + // HTML Font combo | ||
| 321 | + { | ||
| 322 | + static const gchar * html_font_options[] = { | ||
| 323 | + N_("None (Don't export font name)"), | ||
| 324 | + N_("Same of the screen") | ||
| 325 | + }; | ||
| 326 | + | ||
| 327 | + GtkListStore * model = GTK_LIST_STORE(gtk_combo_box_get_model(widget->input.combos[0])); | ||
| 328 | + GtkTreeIter iter; | ||
| 329 | + gtk_list_store_clear(model); | ||
| 330 | + for(ix = 0;ix < G_N_ELEMENTS(html_font_options); ix++) { | ||
| 331 | + | ||
| 332 | + gtk_list_store_append(model, &iter); | ||
| 333 | + gtk_list_store_set( | ||
| 334 | + model, | ||
| 335 | + &iter, | ||
| 336 | + 0, g_dgettext(PACKAGE_NAME, html_font_options[ix]), | ||
| 337 | + 1, (guint) ix, | ||
| 338 | + -1 | ||
| 339 | + ); | ||
| 340 | + | ||
| 341 | + } | ||
| 342 | + | ||
| 343 | + PangoFontFamily **families; | ||
| 344 | + gint n_families; | ||
| 345 | + pango_context_list_families(gtk_widget_get_pango_context(terminal),&families, &n_families); | ||
| 346 | + | ||
| 347 | + for(ix=0; ((gint) ix) < n_families; ix++) { | ||
| 348 | + | ||
| 349 | + if(!pango_font_family_is_monospace(families[ix])) | ||
| 350 | + continue; | ||
| 351 | + | ||
| 352 | + const gchar *name = pango_font_family_get_name (families[ix]); | ||
| 353 | + GtkTreeIter iter; | ||
| 354 | + | ||
| 355 | + gtk_list_store_append((GtkListStore *) model,&iter); | ||
| 356 | + gtk_list_store_set((GtkListStore *) model, &iter,0, name, 1, (guint) 99, -1); | ||
| 357 | + | ||
| 358 | + } | ||
| 359 | + | ||
| 360 | + g_free(families); | ||
| 361 | + | ||
| 362 | + } | ||
| 363 | + | ||
| 294 | } | 364 | } |
| 295 | 365 | ||
| 296 | static void apply(GtkWidget *w, GtkWidget *terminal) { | 366 | static void apply(GtkWidget *w, GtkWidget *terminal) { |