Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workbench: renamed "folder" to "sub-directory" #678

Merged
merged 2 commits into from
Jan 18, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions workbench/README
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ These are the available items:
if you right clicked inside of a project. After selecting it a dialog
will be opened. Chosse the directory which shall be added. After that
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose

the directory will be shown inside the project folder. After adding a
new directory, all files and folders beneath the directory will be
new directory, all files and sub-directories beneath the directory will be
displayed. See "Directory settings" for more information.

**Remove directory**
Expand All @@ -101,18 +101,18 @@ These are the available items:
**Directory settings**
Select this item to change the directory settings. It is only available
if you right clicked inside of a project directory. In the directory
settings you can set a filter which controls the files and folders
settings you can set a filter which controls the files and sub-directories
that shall be displayed or not.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More idiomatic to say "will" in this context.


**Fold/unfold directory**
Fold or unfold the items belonging to the directory. It is only available
if you right clicked inside of a directory.

**Unfold All**
Select this item to unfold all projects, directories and folders.
Select this item to unfold all projects, directories and sub-directories.

**Collapse All**
Select this item to collpase/fold all projects, directories and folders.
Select this item to collpase/fold all projects, directories and sub-directories.

**Add to Workbench Bookmarks**
Add the file to the Workbench Bookmarks. It is only available
Expand Down
58 changes: 29 additions & 29 deletions workbench/src/popup_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ static struct
GtkWidget *fold_unfold_directory;
GtkWidget *directory_open_all;
GtkWidget *directory_close_all;
GtkWidget *folder_open_all;
GtkWidget *folder_close_all;
GtkWidget *subdir_open_all;
GtkWidget *subdir_close_all;
GtkWidget *expand_all;
GtkWidget *collapse_all;
GtkWidget *add_wb_bookmark;
Expand Down Expand Up @@ -89,8 +89,8 @@ void popup_menu_show(POPUP_CONTEXT context, GdkEventButton *event)
gtk_widget_set_sensitive (s_popup_menu.add_wb_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.add_prj_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.remove_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.folder_open_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.folder_close_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.subdir_open_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.subdir_close_all, FALSE);
break;
case POPUP_CONTEXT_DIRECTORY:
gtk_widget_set_sensitive (s_popup_menu.add_project, TRUE);
Expand All @@ -108,10 +108,10 @@ void popup_menu_show(POPUP_CONTEXT context, GdkEventButton *event)
gtk_widget_set_sensitive (s_popup_menu.add_wb_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.add_prj_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.remove_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.folder_open_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.folder_close_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.subdir_open_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.subdir_close_all, FALSE);
break;
case POPUP_CONTEXT_FOLDER:
case POPUP_CONTEXT_SUB_DIRECTORY:
gtk_widget_set_sensitive (s_popup_menu.add_project, TRUE);
gtk_widget_set_sensitive (s_popup_menu.remove_project, TRUE);
gtk_widget_set_sensitive (s_popup_menu.fold_unfold_project, TRUE);
Expand All @@ -127,8 +127,8 @@ void popup_menu_show(POPUP_CONTEXT context, GdkEventButton *event)
gtk_widget_set_sensitive (s_popup_menu.add_wb_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.add_prj_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.remove_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.folder_open_all, TRUE);
gtk_widget_set_sensitive (s_popup_menu.folder_close_all, TRUE);
gtk_widget_set_sensitive (s_popup_menu.subdir_open_all, TRUE);
gtk_widget_set_sensitive (s_popup_menu.subdir_close_all, TRUE);
break;
case POPUP_CONTEXT_FILE:
gtk_widget_set_sensitive (s_popup_menu.add_project, TRUE);
Expand All @@ -146,8 +146,8 @@ void popup_menu_show(POPUP_CONTEXT context, GdkEventButton *event)
gtk_widget_set_sensitive (s_popup_menu.add_wb_bookmark, TRUE);
gtk_widget_set_sensitive (s_popup_menu.add_prj_bookmark, TRUE);
gtk_widget_set_sensitive (s_popup_menu.remove_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.folder_open_all, TRUE);
gtk_widget_set_sensitive (s_popup_menu.folder_close_all, TRUE);
gtk_widget_set_sensitive (s_popup_menu.subdir_open_all, TRUE);
gtk_widget_set_sensitive (s_popup_menu.subdir_close_all, TRUE);
break;
case POPUP_CONTEXT_BACKGROUND:
gtk_widget_set_sensitive (s_popup_menu.add_project, TRUE);
Expand All @@ -165,8 +165,8 @@ void popup_menu_show(POPUP_CONTEXT context, GdkEventButton *event)
gtk_widget_set_sensitive (s_popup_menu.add_wb_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.add_prj_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.remove_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.folder_open_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.folder_close_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.subdir_open_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.subdir_close_all, FALSE);
break;
case POPUP_CONTEXT_WB_BOOKMARK:
gtk_widget_set_sensitive (s_popup_menu.add_project, TRUE);
Expand All @@ -184,8 +184,8 @@ void popup_menu_show(POPUP_CONTEXT context, GdkEventButton *event)
gtk_widget_set_sensitive (s_popup_menu.add_wb_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.add_prj_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.remove_bookmark, TRUE);
gtk_widget_set_sensitive (s_popup_menu.folder_open_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.folder_close_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.subdir_open_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.subdir_close_all, FALSE);
break;
case POPUP_CONTEXT_PRJ_BOOKMARK:
gtk_widget_set_sensitive (s_popup_menu.add_project, TRUE);
Expand All @@ -203,8 +203,8 @@ void popup_menu_show(POPUP_CONTEXT context, GdkEventButton *event)
gtk_widget_set_sensitive (s_popup_menu.add_wb_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.add_prj_bookmark, FALSE);
gtk_widget_set_sensitive (s_popup_menu.remove_bookmark, TRUE);
gtk_widget_set_sensitive (s_popup_menu.folder_open_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.folder_close_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.subdir_open_all, FALSE);
gtk_widget_set_sensitive (s_popup_menu.subdir_close_all, FALSE);
break;
}
gtk_menu_popup(GTK_MENU(s_popup_menu.widget), NULL, NULL, NULL, NULL,
Expand Down Expand Up @@ -478,12 +478,12 @@ static void popup_menu_on_remove_from_bookmarks(G_GNUC_UNUSED GtkMenuItem *menui
}


/* Handle popup menu item "Open all files" (folder) */
static void popup_menu_on_folder_open_all (G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data)
/* Handle popup menu item "Open all files" (sub-directory) */
static void popup_menu_on_subdir_open_all (G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data)
{
GPtrArray *list;

list = sidebar_get_selected_folder_filelist();
list = sidebar_get_selected_subdir_filelist();
if (list != NULL)
{
open_all_files_in_list(list);
Expand All @@ -492,12 +492,12 @@ static void popup_menu_on_folder_open_all (G_GNUC_UNUSED GtkMenuItem *menuitem,
}


/* Handle popup menu item "Close all files" (folder) */
static void popup_menu_on_folder_close_all (G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data)
/* Handle popup menu item "Close all files" (sub-directory) */
static void popup_menu_on_subdir_close_all (G_GNUC_UNUSED GtkMenuItem *menuitem, G_GNUC_UNUSED gpointer user_data)
{
GPtrArray *list;

list = sidebar_get_selected_folder_filelist();
list = sidebar_get_selected_subdir_filelist();
if (list != NULL)
{
close_all_files_in_list(list);
Expand Down Expand Up @@ -601,17 +601,17 @@ void popup_menu_init(void)
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item);

item = gtk_menu_item_new_with_mnemonic(_("_Open all files in folder"));
item = gtk_menu_item_new_with_mnemonic(_("_Open all files in sub-directory"));
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item);
g_signal_connect(item, "activate", G_CALLBACK(popup_menu_on_folder_open_all), NULL);
s_popup_menu.folder_open_all = item;
g_signal_connect(item, "activate", G_CALLBACK(popup_menu_on_subdir_open_all), NULL);
s_popup_menu.subdir_open_all = item;

item = gtk_menu_item_new_with_mnemonic(_("_Close all files in folder"));
item = gtk_menu_item_new_with_mnemonic(_("_Close all files in sub-directory"));
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(s_popup_menu.widget), item);
g_signal_connect(item, "activate", G_CALLBACK(popup_menu_on_folder_close_all), NULL);
s_popup_menu.folder_close_all = item;
g_signal_connect(item, "activate", G_CALLBACK(popup_menu_on_subdir_close_all), NULL);
s_popup_menu.subdir_close_all = item;

item = gtk_separator_menu_item_new();
gtk_widget_show(item);
Expand Down
2 changes: 1 addition & 1 deletion workbench/src/popup_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ typedef enum
{
POPUP_CONTEXT_PROJECT,
POPUP_CONTEXT_DIRECTORY,
POPUP_CONTEXT_FOLDER,
POPUP_CONTEXT_SUB_DIRECTORY,
POPUP_CONTEXT_FILE,
POPUP_CONTEXT_BACKGROUND,
POPUP_CONTEXT_WB_BOOKMARK,
Expand Down
28 changes: 14 additions & 14 deletions workbench/src/sidebar.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ enum
DATA_ID_PRJ_BOOKMARK,
DATA_ID_DIRECTORY,
DATA_ID_NO_DIRS,
DATA_ID_FOLDER,
DATA_ID_SUB_DIRECTORY,
DATA_ID_FILE,
};

Expand Down Expand Up @@ -90,7 +90,7 @@ static void sidebar_remove_children(GtkTreeIter *parent)
}


/* Create a branch for a folder */
/* Create a branch for a sub-directory */
static void sidebar_create_branch(gint level, const gchar *abs_base_dir, GSList *leaf_list, GtkTreeIter *parent)
{
GSList *dir_list = NULL;
Expand Down Expand Up @@ -185,7 +185,7 @@ static void sidebar_create_branch(gint level, const gchar *abs_base_dir, GSList
gtk_tree_store_insert_with_values(sidebar.file_store, &iter, parent, 0,
FILEVIEW_COLUMN_ICON, icon_dir,
FILEVIEW_COLUMN_NAME, last_dir_name,
FILEVIEW_COLUMN_DATA_ID, DATA_ID_FOLDER,
FILEVIEW_COLUMN_DATA_ID, DATA_ID_SUB_DIRECTORY,
-1);

sidebar_create_branch(level+1, abs_base_dir, tmp_list, &iter);
Expand All @@ -201,7 +201,7 @@ static void sidebar_create_branch(gint level, const gchar *abs_base_dir, GSList
gtk_tree_store_insert_with_values(sidebar.file_store, &iter, parent, 0,
FILEVIEW_COLUMN_ICON, icon_dir,
FILEVIEW_COLUMN_NAME, last_dir_name,
FILEVIEW_COLUMN_DATA_ID, DATA_ID_FOLDER,
FILEVIEW_COLUMN_DATA_ID, DATA_ID_SUB_DIRECTORY,
-1);

sidebar_create_branch(level+1, abs_base_dir, tmp_list, &iter);
Expand All @@ -225,7 +225,7 @@ static int rev_strcmp(const char *str1, const char *str2)
}


/* Insert given directory/folder into the sidebar file tree */
/* Insert given directory/sub-directory into the sidebar file tree */
static void sidebar_insert_project_directory(WB_PROJECT *prj, WB_PROJECT_DIR *directory, GtkTreeIter *parent)
{
GSList *lst = NULL;
Expand Down Expand Up @@ -757,9 +757,9 @@ static gboolean sidebar_file_view_on_button_release(G_GNUC_UNUSED GtkWidget * wi
{
popup_context = POPUP_CONTEXT_FILE;
}
else if (context.folder != NULL)
else if (context.subdir != NULL)
{
popup_context = POPUP_CONTEXT_FOLDER;
popup_context = POPUP_CONTEXT_SUB_DIRECTORY;
}
else if (context.directory != NULL)
{
Expand Down Expand Up @@ -960,8 +960,8 @@ gboolean sidebar_file_view_get_selected_context(SIDEBAR_CONTEXT *context)
case DATA_ID_NO_DIRS:
/* Has not got any data. */
break;
case DATA_ID_FOLDER:
context->folder = data;
case DATA_ID_SUB_DIRECTORY:
context->subdir = data;
break;
case DATA_ID_FILE:
context->file = data;
Expand Down Expand Up @@ -999,7 +999,7 @@ static void sidebar_get_filelist_for_iter(GPtrArray *list, GtkTreeIter iter)
g_ptr_array_add(list, g_strdup(filename));
break;
case DATA_ID_DIRECTORY:
case DATA_ID_FOLDER:
case DATA_ID_SUB_DIRECTORY:
if (gtk_tree_model_iter_children(model, &childs, &iter) == TRUE)
{
sidebar_get_filelist_for_iter(list, childs);
Expand All @@ -1013,7 +1013,7 @@ static void sidebar_get_filelist_for_iter(GPtrArray *list, GtkTreeIter iter)


/* Get the lkist of files belonging to the current selection for
id (id = project, directory, folder) */
id (id = project, directory, sub-directory) */
static GPtrArray *sidebar_get_selected_filelist (guint id)
{
GtkTreeModel *model;
Expand Down Expand Up @@ -1057,14 +1057,14 @@ GPtrArray *sidebar_get_selected_directory_filelist (void)
}


/** Get the list of files corresponding to the selected folder.
/** Get the list of files corresponding to the selected sub-directory.
*
* @return GPtrArray containing file names or NULL.
*
**/
GPtrArray *sidebar_get_selected_folder_filelist (void)
GPtrArray *sidebar_get_selected_subdir_filelist (void)
{
return sidebar_get_selected_filelist(DATA_ID_FOLDER);
return sidebar_get_selected_filelist(DATA_ID_SUB_DIRECTORY);
}

/** Setup the sidebar.
Expand Down
4 changes: 2 additions & 2 deletions workbench/src/sidebar.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef struct
{
WB_PROJECT *project;
WB_PROJECT_DIR *directory;
gchar *folder;
gchar *subdir;
gchar *file;
gchar *wb_bookmark;
gchar *prj_bookmark;
Expand Down Expand Up @@ -74,6 +74,6 @@ gboolean sidebar_file_view_get_selected_context(SIDEBAR_CONTEXT *context);

GPtrArray *sidebar_get_selected_project_filelist (void);
GPtrArray *sidebar_get_selected_directory_filelist (void);
GPtrArray *sidebar_get_selected_folder_filelist (void);
GPtrArray *sidebar_get_selected_subdir_filelist (void);

#endif
8 changes: 4 additions & 4 deletions workbench/src/wb_project.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct S_WB_PROJECT_DIR
gchar **ignored_dirs_patterns;
gchar **ignored_file_patterns;
guint file_count;
guint folder_count;
guint subdir_count;
GHashTable *file_table; /* contains all file names within base_dir, maps file_name->TMSourceFile */
gboolean is_prj_base_dir;
};
Expand Down Expand Up @@ -527,8 +527,8 @@ static guint wb_project_dir_rescan_int(WB_PROJECT *prj, WB_PROJECT_DIR *root)

searchdir = get_combined_path(prj->filename, root->base_dir);
root->file_count = 0;
root->folder_count = 0;
lst = gp_filelist_scan_directory(&(root->file_count), &(root->folder_count),
root->subdir_count = 0;
lst = gp_filelist_scan_directory(&(root->file_count), &(root->subdir_count),
searchdir, file_patterns, root->ignored_dirs_patterns, root->ignored_file_patterns);
g_free(searchdir);

Expand Down Expand Up @@ -978,7 +978,7 @@ gchar *wb_project_dir_get_info (WB_PROJECT_DIR *dir)
g_string_append(temp, "\n");
}

g_string_append_printf(temp, _("Number of Sub-Folders: %u\n"), dir->folder_count);
g_string_append_printf(temp, _("Number of Sub-Directories: %u\n"), dir->subdir_count);
g_string_append_printf(temp, _("Number of Files: %u\n"), dir->file_count);

/* Steal string content */
Expand Down