@techee requested changes on this pull request.
@@ -300,6 +300,181 @@ static void on_follow_active(GtkToggleToolButton *button, G_GNUC_UNUSED gpointer
}
+/* returns parent folder of path from get_full_path_for_selection() + * if unable to find parent folder, returns home folder + * otherwise, returns NULL + * return path is in locale encoding */ +static gchar *get_folder_for_selection(void)
Once again, I don't understand why this function has so many tests and is so complicated. Basically, when you right-click some item, there should be a selection; if there's no selection, fall back just to whatever, e.g. the project base path. Basically, just call `parent_dir_for_create()` (maybe could be renamed to something different as it would be used here now) - use the return value when not NULL, otherwise fall back to project base path.
@@ -0,0 +1,72 @@
+/*
What is this file? Was it committed by mistake?
+ +void on_open_terminal(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_data) +{ + gchar *locale_path, *open_command; + + if(g_file_test(PRJORG_COMMAND_TERMINAL_ALT, G_FILE_TEST_EXISTS)) + { + gchar *alt_command; + alt_command = utils_get_real_path(PRJORG_COMMAND_TERMINAL_ALT); + open_command = g_path_get_basename(alt_command); + g_free(alt_command); + } + else + { + /* g_strdup is needed here to prevent segfault on g_free */
This comment isn't really necessary.
+ g_free(command); + g_free(locale_path); + } + else + { + msgwin_status_add(_("Unable to find folder.")); + } +} + + +void on_open_terminal(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_data) +{ + gchar *locale_path, *open_command; + + if(g_file_test(PRJORG_COMMAND_TERMINAL_ALT, G_FILE_TEST_EXISTS))
Space after 'if'.
- if(locale_path && !g_file_test(locale_path, G_FILE_TEST_IS_DIR))
+ { + g_free(locale_path); + locale_path = NULL; + } + + return locale_path; +} + + +void on_open_file_manager(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer user_data) +{ + gchar *locale_path; + gchar *open_command; + + open_command = PRJORG_COMMAND_OPEN;
Can be moved inside the `if` below and the variable can be `const`.