]>
Commit | Line | Data |
---|---|---|
a3ee9d16 JR |
1 | --- xfce4-terminal-0.6.1/terminal/terminal-preferences-dialog.c~ 2013-01-17 12:02:00.584298133 +0100 |
2 | +++ xfce4-terminal-0.6.1/terminal/terminal-preferences-dialog.c 2013-01-17 12:06:11.493576768 +0100 | |
3 | @@ -670,7 +670,7 @@ | |
4 | static void | |
5 | terminal_preferences_dialog_presets_load (TerminalPreferencesDialog *dialog) | |
6 | { | |
7 | - gchar **presets; | |
8 | + gchar **sys_presets,**user_presets; | |
9 | guint n; | |
10 | GObject *object; | |
11 | guint n_presets = 0; | |
12 | @@ -682,8 +682,9 @@ | |
13 | gchar *path; | |
14 | ||
15 | /* load schemes */ | |
16 | - presets = xfce_resource_match (XFCE_RESOURCE_DATA, "xfce4/terminal/colorschemes/*", TRUE); | |
17 | - if (G_LIKELY (presets != NULL)) | |
18 | + sys_presets = xfce_resource_match (XFCE_RESOURCE_DATA, "xfce4/terminal/colorschemes/*", TRUE); | |
19 | + user_presets = xfce_resource_match (XFCE_RESOURCE_CONFIG, "xfce4/terminal/colorschemes/*.theme", TRUE); | |
20 | + if (G_LIKELY (sys_presets != NULL) || (user_presets != NULL)) | |
21 | { | |
22 | /* create sorting store */ | |
23 | store = gtk_list_store_new (N_PRESET_COLUMNS, G_TYPE_STRING, | |
24 | @@ -693,10 +693,11 @@ | |
25 | GTK_SORT_ASCENDING); | |
26 | ||
27 | /* append files */ | |
28 | - for (n = 0; presets[n] != NULL; n++) | |
29 | + if (G_LIKELY (sys_presets != NULL)) { | |
30 | + for (n = 0; sys_presets[n] != NULL; n++) | |
31 | { | |
32 | /* open the scheme */ | |
33 | - path = xfce_resource_lookup (XFCE_RESOURCE_DATA, presets[n]); | |
34 | + path = xfce_resource_lookup (XFCE_RESOURCE_DATA, sys_presets[n]); | |
35 | if (G_UNLIKELY (path == NULL)) | |
36 | continue; | |
37 | ||
38 | @@ -722,6 +723,38 @@ | |
39 | xfce_rc_close (rc); | |
40 | g_free (path); | |
41 | } | |
42 | + } | |
43 | + if (user_presets != NULL) { | |
44 | + for (n = 0; user_presets[n] != NULL; n++) | |
45 | + { | |
46 | + /* open the scheme */ | |
47 | + path = xfce_resource_lookup (XFCE_RESOURCE_CONFIG, user_presets[n]); | |
48 | + if (G_UNLIKELY (path == NULL)) | |
49 | + continue; | |
50 | + | |
51 | + rc = xfce_rc_simple_open (path, TRUE); | |
52 | + if (G_UNLIKELY (rc == NULL)) | |
53 | + { | |
54 | + g_free (path); | |
55 | + continue; | |
56 | + } | |
57 | + | |
58 | + xfce_rc_set_group (rc, "Scheme"); | |
59 | + | |
60 | + /* translated name */ | |
61 | + title = xfce_rc_read_entry (rc, "Name", NULL); | |
62 | + if (G_LIKELY (title != NULL)) | |
63 | + { | |
64 | + gtk_list_store_insert_with_values (store, NULL, n_presets++, | |
65 | + PRESET_COLUMN_TITLE, title, | |
66 | + PRESET_COLUMN_PATH, path, | |
67 | + -1); | |
68 | + } | |
69 | + | |
70 | + xfce_rc_close (rc); | |
71 | + g_free (path); | |
72 | + } | |
73 | + } | |
74 | ||
75 | /* stop sorting */ | |
76 | gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), | |
77 | @@ -748,7 +781,8 @@ | |
78 | g_object_unref (store); | |
79 | } | |
80 | ||
81 | - g_strfreev (presets); | |
82 | + g_strfreev (sys_presets); | |
83 | + g_strfreev (user_presets); | |
84 | ||
85 | if (n_presets == 0) | |
86 | { |