|
42 | 42 |
|
43 | 43 | enum { |
44 | 44 | INTERESTING_FOLDER_BAR_ACTION_OPEN_DOC = 1, |
45 | | - INTERESTING_FOLDER_BAR_SCRIPT_OPEN_DOC |
| 45 | + INTERESTING_FOLDER_BAR_SCRIPT_OPEN_DOC, |
| 46 | + INTERESTING_FOLDER_BAR_TEMPLATE_OPEN_DOC |
46 | 47 | }; |
47 | 48 |
|
48 | 49 | struct NemoInterestingFolderBarPrivate |
@@ -137,6 +138,10 @@ nemo_interesting_folder_bar_constructed (GObject *obj) |
137 | 138 | INTERESTING_FOLDER_BAR_SCRIPT_OPEN_DOC); |
138 | 139 | gtk_widget_set_tooltip_text (w, _("View additional information about creating scripts")); |
139 | 140 | break; |
| 141 | + case TYPE_TEMPLATES_FOLDER: |
| 142 | + label = gtk_label_new (_("Templates: Files in this folder will appear in the Create New Document " |
| 143 | + "submenu.")); |
| 144 | + break; |
140 | 145 | case TYPE_NONE_FOLDER: |
141 | 146 | default: |
142 | 147 | label = gtk_label_new ("undefined"); |
@@ -179,7 +184,7 @@ nemo_interesting_folder_bar_class_init (NemoInterestingFolderBarClass *klass) |
179 | 184 | "type", |
180 | 185 | "the InterestingFolderType", |
181 | 186 | TYPE_NONE_FOLDER, |
182 | | - TYPE_SCRIPTS_FOLDER, |
| 187 | + TYPE_TEMPLATES_FOLDER, |
183 | 188 | TYPE_NONE_FOLDER, |
184 | 189 | G_PARAM_WRITABLE | |
185 | 190 | G_PARAM_CONSTRUCT_ONLY | |
@@ -213,24 +218,34 @@ nemo_interesting_folder_bar_new_for_location (NemoView *view, GFile *location) |
213 | 218 |
|
214 | 219 | path = nemo_action_manager_get_user_directory_path (); |
215 | 220 | tmp_loc = g_file_new_for_path (path); |
| 221 | + g_free (path); |
216 | 222 |
|
217 | 223 | if (g_file_equal (location, tmp_loc)) { |
218 | 224 | type = TYPE_ACTIONS_FOLDER; |
219 | | - goto out; |
220 | 225 | } |
221 | | - |
222 | | - g_free (path); |
223 | 226 | g_object_unref (tmp_loc); |
224 | 227 |
|
225 | | - path = nemo_get_scripts_directory_path (); |
226 | | - tmp_loc = g_file_new_for_path (path); |
| 228 | + if (type == TYPE_NONE_FOLDER) { |
| 229 | + path = nemo_get_scripts_directory_path (); |
| 230 | + tmp_loc = g_file_new_for_path (path); |
| 231 | + g_free (path); |
227 | 232 |
|
228 | | - if (g_file_equal (location, tmp_loc)) |
229 | | - type = TYPE_SCRIPTS_FOLDER; |
| 233 | + if (g_file_equal (location, tmp_loc)) { |
| 234 | + type = TYPE_SCRIPTS_FOLDER; |
| 235 | + } |
| 236 | + g_object_unref (tmp_loc); |
| 237 | + } |
230 | 238 |
|
231 | | -out: |
232 | | - g_free (path); |
233 | | - g_object_unref (tmp_loc); |
| 239 | + if (type == TYPE_NONE_FOLDER) { |
| 240 | + path = nemo_get_templates_directory (); |
| 241 | + tmp_loc = g_file_new_for_path (path); |
| 242 | + g_free (path); |
| 243 | + |
| 244 | + if (g_file_equal (location, tmp_loc)) { |
| 245 | + type = TYPE_TEMPLATES_FOLDER; |
| 246 | + } |
| 247 | + g_object_unref (tmp_loc); |
| 248 | + } |
234 | 249 |
|
235 | 250 | return type == TYPE_NONE_FOLDER ? NULL : nemo_interesting_folder_bar_new (view, type); |
236 | 251 | } |
0 commit comments