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 #598

Closed
wants to merge 74 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
87b6d5c
New plugin 'workbench': initial commit.
lpaulsen93 Jul 30, 2017
4f5563d
Removed accidentally committed test files.
lpaulsen93 Jul 31, 2017
770bfbc
Put own content in NEWS file.
lpaulsen93 Jul 31, 2017
b5b9cc2
Also display context menu if nothing is selected in the workbench sid…
lpaulsen93 Jul 31, 2017
2890905
Added some content to the README file.
lpaulsen93 Jul 31, 2017
3a47865
Code cleanup.
lpaulsen93 Aug 2, 2017
1cb06e1
On adding a directory to a project, set the location of the project f…
lpaulsen93 Aug 2, 2017
dc219bd
Fixed to small buffer in function 'wb_project_load()'.
lpaulsen93 Aug 3, 2017
3e2c7c7
Only update project title in sidebar on saving of a project.
lpaulsen93 Aug 3, 2017
b93eb75
Cleaned up comment style.
lpaulsen93 Aug 3, 2017
b4cd244
Workbench: updated german translation. Fixed strings that do not need…
lpaulsen93 Aug 13, 2017
008194a
Fixed wrong parameter passed for error message.
lpaulsen93 Aug 14, 2017
4104285
Restored translation files without "real" changes.
lpaulsen93 Aug 18, 2017
b77f73a
Merge branch 'master' into workbench
LarsGit223 Aug 18, 2017
389d827
Added mnemonic for "Create" in dialog "Create new workbench".
lpaulsen93 Aug 18, 2017
7c66abf
Do not convert encoding of filename strings returned by file chooser …
lpaulsen93 Aug 18, 2017
fc99613
Added mnemonic for "Open" for "Open workbench" dialog.
lpaulsen93 Aug 18, 2017
76d1253
Replaced spaces with tab.
lpaulsen93 Aug 18, 2017
66acbb9
Fixed spaces between function names and the opening parenthesis.
lpaulsen93 Aug 18, 2017
7a9d154
Added mnemonic for "Add" for dialogs "Add project" and "Add directory".
lpaulsen93 Aug 18, 2017
8211ea8
Replaced spaces with tab.
lpaulsen93 Aug 18, 2017
d921260
Added mnemonics for workbench menu.
lpaulsen93 Aug 18, 2017
74a634c
Removed calls to "geany_plugin_set_data()" in menu.c.
lpaulsen93 Aug 18, 2017
e39fea5
Fixed useless leftover conditional return at end of function.
lpaulsen93 Aug 18, 2017
556f03f
Corrected storage class for "plugin_workbench_callbacks".
lpaulsen93 Aug 18, 2017
549cd76
Do not use "&&" in if conditions alone in a line.
lpaulsen93 Aug 19, 2017
4d1c33d
Removed useless casts to "gpointer" in calls to "g_signal_connect".
lpaulsen93 Aug 19, 2017
4451157
Use "g_slist_free_full()" to minimize code.
lpaulsen93 Aug 19, 2017
61b0991
Fixed increment of pointer, instead increment the value pointed to.
lpaulsen93 Aug 19, 2017
aff5cb9
Check for NULL pointers before calling "g_object_unref(icon)".
lpaulsen93 Aug 19, 2017
8846193
Replaced too similar variable names.
lpaulsen93 Aug 19, 2017
dc98c37
Replaced spaces with tab.
lpaulsen93 Aug 19, 2017
465d9ae
Replaced "strdup()" with "g_strdup()".
lpaulsen93 Aug 19, 2017
bbe27e8
Improved code for determining the "POPUP_CONTEXT".
lpaulsen93 Aug 19, 2017
6ae0a3b
Removed unused struct.
lpaulsen93 Aug 19, 2017
36fbfb6
Free old strings in "wb_project_set_filename()" (not happening today …
lpaulsen93 Aug 19, 2017
0212100
Fixed missing "const" qualifiers.
lpaulsen93 Aug 19, 2017
13d3b70
Minimized code by using "g_slist_free_full()".
lpaulsen93 Aug 19, 2017
cace73d
Fixed missing "g_dir_close()".
lpaulsen93 Aug 19, 2017
7574055
Removed useless cast.
lpaulsen93 Aug 19, 2017
00b8941
Small code improvement in "wb_project_dir_rescan_int()".
lpaulsen93 Aug 19, 2017
109b8d0
Use "g_return_val_if_fail()" instead of producing an own error message.
lpaulsen93 Aug 19, 2017
e0de82b
Minimized code.
lpaulsen93 Aug 19, 2017
daba342
Fixed missing ';'.
lpaulsen93 Aug 19, 2017
36f8d84
Fixed memory leak in "wb_project_free()".
lpaulsen93 Aug 19, 2017
65a5e5b
Parameter "filename" can be "const" in functions "workbench_set_filen…
lpaulsen93 Aug 19, 2017
4c92297
All filename parameters and return values in "wb_project.c" and "work…
lpaulsen93 Aug 19, 2017
fa97eaa
Minor code improvements in "workbench_add_bookmark_int()".
lpaulsen93 Aug 19, 2017
d6993d8
Do not use deprecated Gtk Stock Items.
lpaulsen93 Aug 19, 2017
4ae4580
Use "gtk_widget_destroy()" to clean up workbench menu.
lpaulsen93 Aug 19, 2017
c20dc6f
Re-factored control of menu item activation and de-activation.
lpaulsen93 Aug 19, 2017
6560f6b
Merged "sidebar_update_project()" and "sidebar_update_project_title()…
lpaulsen93 Aug 19, 2017
bfa8662
Use "GString" instead of doing manual string manipulation in "sidebar…
lpaulsen93 Aug 19, 2017
f67c194
Use "GString" instead of "g_snprintf()" in "wb_project_dir_get_info()".
lpaulsen93 Aug 19, 2017
6aa0b70
Use "GString" instead of "g_snprintf()" in "wb_project_get_info()".
lpaulsen93 Aug 19, 2017
c24fe00
Restored accidentally deleted strings.
lpaulsen93 Aug 19, 2017
9c90b80
Removed useless/duplicate check.
lpaulsen93 Aug 19, 2017
be25bad
Make sure to not continue if "g_key_file_to_data()" fails (especially…
lpaulsen93 Aug 19, 2017
fa35023
Attach workbench menu to the tools menu, not to the main menu bar.
lpaulsen93 Aug 20, 2017
eaa9265
Replaced deprecated "gtk_menu_append()" with "gtk_menu_shell_append()".
lpaulsen93 Aug 20, 2017
316e11f
Fixed too many initializers.
lpaulsen93 Aug 20, 2017
6d8d2d8
Use "ui_widget_modify_font_from_string()" to change the workbench sid…
lpaulsen93 Aug 20, 2017
145476a
Made message "File %s is not a valid workbench file!" translateable a…
lpaulsen93 Aug 20, 2017
ed27167
Made sidebar title translateable.
lpaulsen93 Aug 20, 2017
039d43f
Added ellipses (…) to "New", "Open", "Add project" and "Add directory".
lpaulsen93 Aug 20, 2017
8409530
Added mnemonics to popup menu.
lpaulsen93 Aug 20, 2017
48c08cc
Re-factored "get_combined_path()": now uses g_strconcat and handles a…
lpaulsen93 Aug 20, 2017
2e09b55
Re-factored "get_any_relative_path()": use "GPtrArray" to get rid of …
lpaulsen93 Aug 20, 2017
6199a6b
Also supply icons of the size 24x24, 32x32, 48x48 and scalable.
lpaulsen93 Aug 20, 2017
f7ba628
Fixed wrong dest directories (iconsdir) in sub-makefiles.
lpaulsen93 Aug 21, 2017
bea0a0f
Suppress warnings for intentionally unused parameters in callback fun…
lpaulsen93 Aug 21, 2017
01a8dfa
Fixed more compiler warnings.
lpaulsen93 Aug 21, 2017
d19678c
Set attribute "text" instead of markup for "GtkCellRendererText".
lpaulsen93 Aug 21, 2017
9fecc2c
Fixed missing NULL pointer check.
lpaulsen93 Aug 21, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
57 changes: 17 additions & 40 deletions workbench/src/sidebar.c
Expand Up @@ -405,8 +405,8 @@ static void sidebar_insert_project_bookmarks(WB_PROJECT *project, GtkTreeIter *p
}


/* Update the sidebar for a project, only update title */
static void sidebar_update_project_title(WB_PROJECT *project)
/* Update the sidebar for a project only */
static void sidebar_update_project(WB_PROJECT *project, gboolean title_only)
{
GtkTreeIter iter;

Expand All @@ -415,49 +415,26 @@ static void sidebar_update_project_title(WB_PROJECT *project)

if (sidebar_get_project_iter(project, &iter))
{
gint length;
gchar text[200];

length = g_snprintf(text, sizeof(text), "%s", wb_project_get_name(project));
if (length < (sizeof(text)-1) && wb_project_is_modified(project))
/* Update the title */
GString *name = g_string_new(wb_project_get_name(project));
if (wb_project_is_modified(project))
{
text [length] = '*';
text [length+1] = '\0';
g_string_append_c(name, '*');
}

gtk_tree_store_set(sidebar.file_store, &iter,
FILEVIEW_COLUMN_NAME, text,
FILEVIEW_COLUMN_NAME, name->str,
-1);
Copy link
Member

Choose a reason for hiding this comment

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

same, and looks like most of the code could be shared with the previous function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True. Merged the functions together and added a parameter to choose to only update the project title or all parts of the project.

}
}


/* Update the sidebar for a project only */
static void sidebar_update_project(WB_PROJECT *project)
{
GtkTreeIter iter;

if (wb_globals.opened_wb == NULL)
return;

if (sidebar_get_project_iter(project, &iter))
{
gint length, position;
gchar text[200];
g_string_free(name, TRUE);

length = g_snprintf(text, sizeof(text), "%s", wb_project_get_name(project));
if (length < (sizeof(text)-1) && wb_project_is_modified(project))
/* Update children/content to? */
if (!title_only)
{
text [length] = '*';
text [length+1] = '\0';
gint position = 0;
sidebar_remove_children(&iter);
sidebar_insert_project_bookmarks(project, &iter, &position);
sidebar_insert_project_directories(project, &iter, &position);
}
gtk_tree_store_set(sidebar.file_store, &iter,
FILEVIEW_COLUMN_NAME, text,
-1);

position = 0;
sidebar_remove_children(&iter);
sidebar_insert_project_bookmarks(project, &iter, &position);
sidebar_insert_project_directories(project, &iter, &position);
}
}

Expand Down Expand Up @@ -652,7 +629,7 @@ void sidebar_update (SIDEBAR_EVENT event, SIDEBAR_CONTEXT *context)
case SIDEBAR_CONTEXT_PROJECT_SAVED:
if (context != NULL && context->project != NULL)
{
sidebar_update_project_title(context->project);
sidebar_update_project(context->project, TRUE);
}
break;
case SIDEBAR_CONTEXT_DIRECTORY_ADDED:
Expand All @@ -663,7 +640,7 @@ void sidebar_update (SIDEBAR_EVENT event, SIDEBAR_CONTEXT *context)
case SIDEBAR_CONTEXT_PRJ_BOOKMARK_REMOVED:
if (context != NULL && context->project != NULL)
{
sidebar_update_project(context->project);
sidebar_update_project(context->project, FALSE);
}
break;
case SIDEBAR_CONTEXT_WB_BOOKMARK_ADDED:
Expand Down