Branch: refs/heads/master Author: LarsGit223 LarsGit223@users.noreply.github.com Committer: GitHub noreply@github.com Date: Sun, 15 Oct 2017 10:08:01 UTC Commit: 3fc192472611b5f821ac516106014133ec22cf43 https://github.com/geany/geany-plugins/commit/3fc192472611b5f821ac5161060141...
Log Message: ----------- Merge branch 'master' into wb-usecommonlib
Modified Paths: -------------- NEWS addons/src/addons.c addons/src/ao_markword.c addons/src/ao_markword.h build/projectorganizer.m4 geanylua/glspi_app.c geanylua/glspi_ver.h geanylua/gsdlg.c pretty-printer/src/ConfigUI.c pretty-printer/src/ConfigUI.h pretty-printer/src/PluginEntry.c pretty-printer/src/PrettyPrinter.c projectorganizer/Makefile.am projectorganizer/icons/Makefile.am projectorganizer/icons/prjorg-add-external.png projectorganizer/icons/prjorg-collapse.png projectorganizer/icons/prjorg-expand.png projectorganizer/icons/prjorg-file.png projectorganizer/icons/prjorg-follow.png projectorganizer/icons/prjorg-header.png projectorganizer/icons/prjorg-refresh.png projectorganizer/icons/prjorg-source.png projectorganizer/src/prjorg-main.c projectorganizer/src/prjorg-project.c projectorganizer/src/prjorg-sidebar.c scope/src/program.c scope/src/scope.c workbench/README workbench/src/plugin_main.c
Modified: NEWS 29 lines changed, 28 insertions(+), 1 deletions(-) =================================================================== @@ -1,7 +1,34 @@ Geany Plugins 1.32 (not yet released)
- No changes by now. + General: + * New plugin: workbench (PR #460) + * Travis: Update travis to system with c++11 compiler (#597) + + Addons + * markword: Deselect when the selection changes (PR #614) + + GeanyLua: + * Increase required geany API version to 235 for usage of + 'utils_get_real_path' to replace 'tm_get_real_path()' + + GitChangebar: + * Add the possibility to undo hunk at cursor position (PR #531) + + PrettyPrinter: + * Add saving and loading of preferences in/from a file. (#494, PR #581) + + Projectorganizer: + * Increase required geany API version to 235 for usage of + 'utils_get_real_path' to replace 'tm_get_real_path()' + * Close dir created with g_dir_open() in some special cases as well + as Don't keep directories open when enumerating their children (PR ##605) + + Scope: + * Only allow selection of folders for "working dir" (PR #623) + * Add tooltips to toolbar buttons (PR #617)
+ Treebrowser + * Fix some typos inside documentation (PR #595)
Geany Plugins 1.31 (2017-07-16)
Modified: addons/src/addons.c 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -178,6 +178,8 @@ gboolean ao_editor_notify_cb(GObject *object, GeanyEditor *editor, SCNotification *nt, gpointer data) { ao_bookmark_list_update_marker(ao_info->bookmarklist, editor, nt); + + ao_mark_editor_notify(ao_info->markword, editor, nt);
return FALSE; }
Modified: addons/src/ao_markword.c 25 lines changed, 25 insertions(+), 0 deletions(-) =================================================================== @@ -171,6 +171,31 @@ static gboolean on_editor_button_press_event(GtkWidget *widget, GdkEventButton * return FALSE; }
+void ao_mark_editor_notify(AoMarkWord *mw, GeanyEditor *editor, SCNotification *nt) +{ + // If something is about to be deleted and there is selected text clear the markers + if(nt->nmhdr.code == SCN_MODIFIED && + ((nt->modificationType & SC_MOD_BEFOREDELETE) == SC_MOD_BEFOREDELETE) && + sci_has_selection(editor->sci)) + { + AoMarkWordPrivate *priv = AO_MARKWORD_GET_PRIVATE(mw); + + if(priv->enable_markword && priv->enable_single_click_deselect) + clear_marker(); + } + + // In single click deselect mode, clear the markers when the cursor moves + else if(nt->nmhdr.code == SCN_UPDATEUI && + nt->updated == SC_UPDATE_SELECTION && + !sci_has_selection(editor->sci)) + { + AoMarkWordPrivate *priv = AO_MARKWORD_GET_PRIVATE(mw); + + if(priv->enable_markword && priv->enable_single_click_deselect) + clear_marker(); + } +} +
void ao_mark_document_new(AoMarkWord *mw, GeanyDocument *document) {
Modified: addons/src/ao_markword.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -44,6 +44,8 @@ AoMarkWord* ao_mark_word_new (gboolean enable, gboolean single_click_deselect void ao_mark_document_new (AoMarkWord *mw, GeanyDocument *document); void ao_mark_document_open (AoMarkWord *mw, GeanyDocument *document); void ao_mark_document_close (AoMarkWord *mw, GeanyDocument *document); +void ao_mark_editor_notify (AoMarkWord *mw, GeanyEditor *editor, + SCNotification *nt);
G_END_DECLS
Modified: build/projectorganizer.m4 1 lines changed, 0 insertions(+), 1 deletions(-) =================================================================== @@ -5,6 +5,5 @@ AC_DEFUN([GP_CHECK_PROJECTORGANIZER], AC_CONFIG_FILES([ projectorganizer/Makefile projectorganizer/src/Makefile - projectorganizer/icons/Makefile ]) ])
Modified: geanylua/glspi_app.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -256,7 +256,7 @@ static gint glspi_fullpath(lua_State* L) const gchar *fn=NULL; if (!lua_isstring(L,1)) { return FAIL_STRING_ARG(1); } fn=lua_tostring(L,1); - rp=tm_get_real_path(fn); + rp=utils_get_real_path(fn); if (rp) { lua_pushstring(L,rp); g_free(rp);
Modified: geanylua/glspi_ver.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -12,7 +12,7 @@
#define PLUGIN_AUTHOR "Jeff Pohlmeyer"
-#define MY_GEANY_API_VER 224 +#define MY_GEANY_API_VER 235
#define LUA_MODULE_NAME "geany"
Modified: geanylua/gsdlg.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -106,7 +106,7 @@ static void file_btn_clicked(GtkButton *button, gpointer user_data) fn=gtk_entry_get_text(GTK_ENTRY(user_data)); if (fn && *fn) { if (g_file_test(fn,G_FILE_TEST_IS_REGULAR)) { - gchar *rp=tm_get_real_path(fn); + gchar *rp=utils_get_real_path(fn); gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dlg), rp); if (rp) g_free(rp); } else { @@ -115,7 +115,7 @@ static void file_btn_clicked(GtkButton *button, gpointer user_data) } else { gchar *dn=g_path_get_dirname(fn); if (g_file_test(dn,G_FILE_TEST_IS_DIR)) { - gchar *rp=tm_get_real_path(dn); + gchar *rp=utils_get_real_path(dn); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dlg), rp); if (rp) g_free(rp); bn=g_path_get_basename(fn);
Modified: pretty-printer/src/ConfigUI.c 200 lines changed, 195 insertions(+), 5 deletions(-) =================================================================== @@ -93,11 +93,12 @@ GtkWidget* createPrettyPrinterConfigUI(GtkDialog * dialog) return container; }
-void saveSettings(void) +static void +fetchSettingsFromConfigUI(PrettyPrintingOptions* ppo) { int breakStyle; - PrettyPrintingOptions* ppo = prettyPrintingOptions;
+ if (ppo == NULL) return; ppo->oneLineComment = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(commentOneLine)); ppo->inlineComment = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(commentInline)); ppo->alignComment = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(commentAlign)); @@ -118,9 +119,198 @@ void saveSettings(void) ppo->indentChar = gtk_combo_box_get_active(GTK_COMBO_BOX(indentationChar))==0 ? '\t' : ' ';
breakStyle = gtk_combo_box_get_active(GTK_COMBO_BOX(lineBreak)); - if (breakStyle == 0) ppo->newLineChars = "\r"; - else if (breakStyle == 1) ppo->newLineChars = "\n"; - else ppo->newLineChars = "\r\n"; + g_free ((gpointer)ppo->newLineChars); + if (breakStyle == 0) ppo->newLineChars = g_strdup("\r"); + else if (breakStyle == 1) ppo->newLineChars = g_strdup("\n"); + else ppo->newLineChars = g_strdup("\r\n"); +} + +static gchar * +prefsToData (PrettyPrintingOptions* ppo, + gsize* size, + GError** error) +{ + GKeyFile *kf; + gchar *contents; + + kf = g_key_file_new (); + + g_key_file_set_string (kf, "pretty-printer", "newLineChars", ppo->newLineChars); + g_key_file_set_integer (kf, "pretty-printer", "indentChar", (int)ppo->indentChar); + g_key_file_set_integer (kf, "pretty-printer", "indentLength", ppo->indentLength); + g_key_file_set_boolean (kf, "pretty-printer", "oneLineText", ppo->oneLineText); + g_key_file_set_boolean (kf, "pretty-printer", "inlineText", ppo->inlineText); + g_key_file_set_boolean (kf, "pretty-printer", "oneLineComment", ppo->oneLineComment); + g_key_file_set_boolean (kf, "pretty-printer", "inlineComment", ppo->inlineComment); + g_key_file_set_boolean (kf, "pretty-printer", "oneLineCdata", ppo->oneLineCdata); + g_key_file_set_boolean (kf, "pretty-printer", "inlineCdata", ppo->inlineCdata); + g_key_file_set_boolean (kf, "pretty-printer", "emptyNodeStripping", ppo->emptyNodeStripping); + g_key_file_set_boolean (kf, "pretty-printer", "emptyNodeStrippingSpace", ppo->emptyNodeStrippingSpace); + g_key_file_set_boolean (kf, "pretty-printer", "forceEmptyNodeSplit", ppo->forceEmptyNodeSplit); + g_key_file_set_boolean (kf, "pretty-printer", "trimLeadingWhites", ppo->trimLeadingWhites); + g_key_file_set_boolean (kf, "pretty-printer", "trimTrailingWhites", ppo->trimTrailingWhites); + g_key_file_set_boolean (kf, "pretty-printer", "alignComment", ppo->alignComment); + g_key_file_set_boolean (kf, "pretty-printer", "alignText", ppo->alignText); + g_key_file_set_boolean (kf, "pretty-printer", "alignCdata", ppo->alignCdata); + + contents = g_key_file_to_data (kf, size, error); + g_key_file_free (kf); + return contents; +} + +static gboolean +prefsFromData (PrettyPrintingOptions* ppo, + const gchar* contents, + gssize size, + GError** error) +{ + GKeyFile *kf; + + g_return_val_if_fail (contents != NULL, FALSE); + + kf = g_key_file_new (); + + if (!g_key_file_load_from_data (kf, contents, size, + G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, + error)) + { + g_key_file_free (kf); + return FALSE; + } + + if (g_key_file_has_key (kf, "pretty-printer", "newLineChars", NULL)) + { + g_free ((gpointer)ppo->newLineChars); + ppo->newLineChars = g_key_file_get_string (kf, "pretty-printer", "newLineChars", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "indentChar", NULL)) + { + ppo->indentChar = (char)g_key_file_get_integer (kf, "pretty-printer", "indentChar", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "indentLength", NULL)) + { + ppo->indentLength = g_key_file_get_integer (kf, "pretty-printer", "indentLength", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "oneLineText", NULL)) + { + ppo->oneLineText = g_key_file_get_boolean (kf, "pretty-printer", "oneLineText", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "inlineText", NULL)) + { + ppo->inlineText = g_key_file_get_boolean (kf, "pretty-printer", "inlineText", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "oneLineComment", NULL)) + { + ppo->oneLineComment = g_key_file_get_boolean (kf, "pretty-printer", "oneLineComment", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "inlineComment", NULL)) + { + ppo->inlineComment = g_key_file_get_boolean (kf, "pretty-printer", "inlineComment", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "oneLineCdata", NULL)) + { + ppo->oneLineCdata = g_key_file_get_boolean (kf, "pretty-printer", "oneLineCdata", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "inlineCdata", NULL)) + { + ppo->inlineCdata = g_key_file_get_boolean (kf, "pretty-printer", "inlineCdata", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "emptyNodeStripping", NULL)) + { + ppo->emptyNodeStripping = g_key_file_get_boolean (kf, "pretty-printer", "emptyNodeStripping", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "emptyNodeStrippingSpace", NULL)) + { + ppo->emptyNodeStrippingSpace = g_key_file_get_boolean (kf, "pretty-printer", "emptyNodeStrippingSpace", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "forceEmptyNodeSplit", NULL)) + { + ppo->forceEmptyNodeSplit = g_key_file_get_boolean (kf, "pretty-printer", "forceEmptyNodeSplit", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "trimLeadingWhites", NULL)) + { + ppo->trimLeadingWhites = g_key_file_get_boolean (kf, "pretty-printer", "trimLeadingWhites", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "trimTrailingWhites", NULL)) + { + ppo->trimTrailingWhites = g_key_file_get_boolean (kf, "pretty-printer", "trimTrailingWhites", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "alignComment", NULL)) + { + ppo->alignComment = g_key_file_get_boolean (kf, "pretty-printer", "alignComment", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "alignText", NULL)) + { + ppo->alignText = g_key_file_get_boolean (kf, "pretty-printer", "alignText", error); + } + if (g_key_file_has_key (kf, "pretty-printer", "alignCdata", NULL)) + { + ppo->alignCdata = g_key_file_get_boolean (kf, "pretty-printer", "alignCdata", error); + } + + g_key_file_free (kf); + return TRUE; +} + +gboolean +prefsLoad (const gchar* filename, + GError** error) +{ + PrettyPrintingOptions* ppo; + gchar *contents = NULL; + gsize size = 0; + + g_return_val_if_fail (filename != NULL, FALSE); + + /* default printing options */ + if (prettyPrintingOptions == NULL) { prettyPrintingOptions = createDefaultPrettyPrintingOptions(); } + ppo = prettyPrintingOptions; + + if (!g_file_get_contents (filename, &contents, &size, error)) + return FALSE; + if (!prefsFromData (ppo, contents, size, error)) + { + g_free (contents); + return FALSE; + } + g_free (contents); + return TRUE; +} + +gboolean +prefsSave (const gchar* filename, + GError** error) +{ + PrettyPrintingOptions* ppo; + gchar *contents = NULL; + gsize size = 0; + + g_return_val_if_fail (filename != NULL, FALSE); + ppo = prettyPrintingOptions; + fetchSettingsFromConfigUI (ppo); + contents = prefsToData (ppo, &size, error); + if (contents == NULL) + return FALSE; + if (! g_file_set_contents (filename, contents, size, error)) + { + g_free (contents); + return FALSE; + } + g_free (contents); + return TRUE; +} + +gchar * +getDefaultPrefs (GError** error) +{ + gchar *contents = NULL; + gsize size = 0; + PrettyPrintingOptions* ppo; + + ppo = createDefaultPrettyPrintingOptions(); + g_return_val_if_fail (ppo != NULL, NULL); + contents = prefsToData (ppo, &size, error); + return contents; }
/*============================================= PRIVATE FUNCTIONS =======================================*/
Modified: pretty-printer/src/ConfigUI.h 4 lines changed, 3 insertions(+), 1 deletions(-) =================================================================== @@ -37,6 +37,8 @@ extern PrettyPrintingOptions* prettyPrintingOptions; /*========================================== FUNCTIONS ========================================================*/
GtkWidget* createPrettyPrinterConfigUI(GtkDialog* dialog); -void saveSettings(void); +gboolean prefsLoad (const gchar* filename, GError** error); +gboolean prefsSave (const gchar* filename, GError** error); +gchar *getDefaultPrefs (GError** error);
#endif
Modified: pretty-printer/src/PluginEntry.c 76 lines changed, 75 insertions(+), 1 deletions(-) =================================================================== @@ -21,7 +21,12 @@ * http://www.geany.org/manual/reference/howto.html */
+#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "PluginEntry.h" +#include <errno.h>
GeanyPlugin* geany_plugin; @@ -49,10 +54,70 @@ static void config_closed(GtkWidget* configWidget, gint response, gpointer data)
/*========================================== FUNCTIONS ===================================================================*/
+static gchar * +get_config_file (void) +{ + gchar *dir; + gchar *fn; + + dir = g_build_filename (geany_data->app->configdir, "plugins", "pretty-printer", NULL); + fn = g_build_filename (dir, "prefs.conf", NULL); + + if (! g_file_test (fn, G_FILE_TEST_IS_DIR)) + { + if (g_mkdir_with_parents (dir, 0755) != 0) + { + g_critical ("failed to create config dir '%s': %s", dir, g_strerror (errno)); + g_free (dir); + g_free (fn); + return NULL; + } + } + + g_free (dir); + + if (! g_file_test (fn, G_FILE_TEST_EXISTS)) + { + GError *error = NULL; + const gchar *def_config; + + def_config = getDefaultPrefs(&error); + if (def_config == NULL) + { + g_critical ("failed to fetch default config data (%s)", + error->message); + g_error_free (error); + g_free (fn); + return NULL; + } + if (!g_file_set_contents (fn, def_config, -1, &error)) + { + g_critical ("failed to save default config to file '%s': %s", + fn, error->message); + g_error_free (error); + g_free (fn); + return NULL; + } + } + + return fn; +} + void plugin_init(GeanyData *data) { + gchar *conf_file; + GError *error = NULL; GeanyKeyGroup *key_group;
+ /* load preferences */ + conf_file = get_config_file (); + if (!prefsLoad (conf_file, &error)) + { + g_critical ("failed to load preferences file '%s': %s", conf_file, error->message); + g_error_free (error); + } + g_free (conf_file); + /* initializes the libxml2 */ LIBXML_TEST_VERSION
@@ -95,7 +160,16 @@ void config_closed(GtkWidget* configWidget, gint response, gpointer gdata) if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_APPLY) { - saveSettings(); + gchar* conf_file; + GError* error = NULL; + + conf_file = get_config_file (); + if (! prefsSave (conf_file, &error)) + { + g_critical ("failed to save preferences to file '%s': %s", conf_file, error->message); + g_error_free (error); + } + g_free (conf_file); } }
Modified: pretty-printer/src/PrettyPrinter.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -172,7 +172,7 @@ PrettyPrintingOptions* createDefaultPrettyPrintingOptions(void) return NULL; }
- defaultOptions->newLineChars = "\r\n"; + defaultOptions->newLineChars = g_strdup ("\r\n"); defaultOptions->indentChar = ' '; defaultOptions->indentLength = 2; defaultOptions->oneLineText = FALSE;
Modified: projectorganizer/Makefile.am 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1,4 +1,4 @@ include $(top_srcdir)/build/vars.auxfiles.mk
-SUBDIRS = src icons +SUBDIRS = src plugin = projectorganizer
Modified: projectorganizer/icons/Makefile.am 23 lines changed, 0 insertions(+), 23 deletions(-) =================================================================== @@ -1,23 +0,0 @@ -icondir = $(datadir)/icons/hicolor/16x16/apps - -dist_icon_DATA = \ - prjorg-file.png \ - prjorg-header.png \ - prjorg-source.png \ - prjorg-expand.png \ - prjorg-collapse.png \ - prjorg-follow.png \ - prjorg-add-external.png \ - prjorg-refresh.png - -gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor -install-data-hook: update-icon-cache -uninstall-hook: update-icon-cache -update-icon-cache: - @-if test -z "$(DESTDIR)"; then \ - echo "Updating Gtk icon cache."; \ - $(gtk_update_icon_cache); \ - else \ - echo "*** Icon cache not updated. After (un)install, run this:"; \ - echo "*** $(gtk_update_icon_cache)"; \ - fi
Modified: projectorganizer/icons/prjorg-add-external.png 0 lines changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online
Modified: projectorganizer/icons/prjorg-collapse.png 0 lines changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online
Modified: projectorganizer/icons/prjorg-expand.png 0 lines changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online
Modified: projectorganizer/icons/prjorg-file.png 0 lines changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online
Modified: projectorganizer/icons/prjorg-follow.png 0 lines changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online
Modified: projectorganizer/icons/prjorg-header.png 0 lines changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online
Modified: projectorganizer/icons/prjorg-refresh.png 0 lines changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online
Modified: projectorganizer/icons/prjorg-source.png 0 lines changed, 0 insertions(+), 0 deletions(-) =================================================================== No diff available, check online
Modified: projectorganizer/src/prjorg-main.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -33,7 +33,7 @@ GeanyPlugin *geany_plugin; GeanyData *geany_data;
-PLUGIN_VERSION_CHECK(224) +PLUGIN_VERSION_CHECK(235) PLUGIN_SET_TRANSLATABLE_INFO( LOCALEDIR, GETTEXT_PACKAGE,
Modified: projectorganizer/src/prjorg-project.c 8 lines changed, 4 insertions(+), 4 deletions(-) =================================================================== @@ -75,10 +75,10 @@ static GSList *get_file_list(const gchar *utf8_path, GSList *patterns, GSList *list = NULL; GDir *dir; const gchar *child_name; - GSList *child; + GSList *child = NULL; GSList *children = NULL; gchar *locale_path = utils_get_locale_from_utf8(utf8_path); - gchar *real_path = tm_get_real_path(locale_path); + gchar *real_path = utils_get_real_path(locale_path);
dir = g_dir_open(locale_path, 0, NULL); if (!dir || !real_path || g_hash_table_lookup(visited_paths, real_path)) @@ -412,8 +412,8 @@ static gint root_comparator(PrjOrgRoot *a, PrjOrgRoot *b)
a_locale_base_dir = utils_get_locale_from_utf8(a->base_dir); b_locale_base_dir = utils_get_locale_from_utf8(b->base_dir); - a_realpath = tm_get_real_path(a_locale_base_dir); - b_realpath = tm_get_real_path(b_locale_base_dir); + a_realpath = utils_get_real_path(a_locale_base_dir); + b_realpath = utils_get_real_path(b_locale_base_dir);
res = g_strcmp0(a_realpath, b_realpath);
Modified: projectorganizer/src/prjorg-sidebar.c 59 lines changed, 18 insertions(+), 41 deletions(-) =================================================================== @@ -921,36 +921,13 @@ static void create_branch(gint level, GSList *leaf_list, GtkTreeIter *parent, g_free(content_type); }
- if (patterns_match(header_patterns, path_arr[level])) - { - if (! icon) - icon = g_icon_new_for_string("prjorg-header", NULL); - - gtk_tree_store_insert_with_values(s_file_store, &iter, parent, 0, - FILEVIEW_COLUMN_ICON, icon, - FILEVIEW_COLUMN_NAME, path_arr[level], - FILEVIEW_COLUMN_COLOR, project ? NULL : &s_external_color, -1); - } - else if (patterns_match(source_patterns, path_arr[level])) - { - if (! icon) - icon = g_icon_new_for_string("prjorg-source", NULL); + if (! icon) + icon = g_themed_icon_new("text-x-generic");
- gtk_tree_store_insert_with_values(s_file_store, &iter, parent, 0, - FILEVIEW_COLUMN_ICON, icon, - FILEVIEW_COLUMN_NAME, path_arr[level], - FILEVIEW_COLUMN_COLOR, project ? NULL : &s_external_color, -1); - } - else - { - if (! icon) - icon = g_icon_new_for_string("prjorg-file", NULL); - - gtk_tree_store_insert_with_values(s_file_store, &iter, parent, 0, - FILEVIEW_COLUMN_ICON, icon, - FILEVIEW_COLUMN_NAME, path_arr[level], - FILEVIEW_COLUMN_COLOR, project ? NULL : &s_external_color, -1); - } + gtk_tree_store_insert_with_values(s_file_store, &iter, parent, 0, + FILEVIEW_COLUMN_ICON, icon, + FILEVIEW_COLUMN_NAME, path_arr[level], + FILEVIEW_COLUMN_COLOR, project ? NULL : &s_external_color, -1);
if (icon) g_object_unref(icon); @@ -962,7 +939,7 @@ static void create_branch(gint level, GSList *leaf_list, GtkTreeIter *parent, GtkTreeIter iter; gchar **path_arr = dir_list->data; gchar *last_dir_name; - GIcon *icon_dir = g_icon_new_for_string("folder", NULL); + GIcon *icon_dir = g_themed_icon_new("folder");
last_dir_name = path_arr[level];
@@ -1087,7 +1064,7 @@ static void load_project(void) if (!prj_org || !geany_data->app->project) return;
- icon_dir = g_icon_new_for_string("folder", NULL); + icon_dir = g_themed_icon_new("folder");
header_patterns = get_precompiled_patterns(prj_org->header_patterns); source_patterns = get_precompiled_patterns(prj_org->source_patterns); @@ -1350,17 +1327,17 @@ void prjorg_sidebar_init(void)
g_signal_connect (s_toolbar, "realize", G_CALLBACK (sidebar_realized_cb), NULL);
- item = GTK_WIDGET(gtk_tool_button_new(NULL, NULL)); - gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(item), "prjorg-refresh"); + image = gtk_image_new_from_icon_name("view-refresh", GTK_ICON_SIZE_SMALL_TOOLBAR); + item = GTK_WIDGET(gtk_tool_button_new(image, NULL)); gtk_widget_set_tooltip_text(item, _("Reload all")); g_signal_connect(item, "clicked", G_CALLBACK(on_reload_project), NULL); gtk_container_add(GTK_CONTAINER(s_toolbar), item);
item = GTK_WIDGET(gtk_separator_tool_item_new()); gtk_container_add(GTK_CONTAINER(s_toolbar), item);
- item = GTK_WIDGET(gtk_tool_button_new(NULL, NULL)); - gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(item), "prjorg-add-external"); + image = gtk_image_new_from_icon_name("folder-new", GTK_ICON_SIZE_SMALL_TOOLBAR); + item = GTK_WIDGET(gtk_tool_button_new(image, NULL)); gtk_widget_set_tooltip_text(item, _("Add external directory")); g_signal_connect(item, "clicked", G_CALLBACK(on_add_external), NULL); gtk_container_add(GTK_CONTAINER(s_toolbar), item); @@ -1369,15 +1346,15 @@ void prjorg_sidebar_init(void) item = GTK_WIDGET(gtk_separator_tool_item_new()); gtk_container_add(GTK_CONTAINER(s_toolbar), item);
- item = GTK_WIDGET(gtk_tool_button_new(NULL, NULL)); - gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(item), "prjorg-expand"); + image = gtk_image_new_from_icon_name("list-add", GTK_ICON_SIZE_SMALL_TOOLBAR); + item = GTK_WIDGET(gtk_tool_button_new(image, NULL)); gtk_widget_set_tooltip_text(item, _("Expand all")); g_signal_connect(item, "clicked", G_CALLBACK(on_expand_all), NULL); gtk_container_add(GTK_CONTAINER(s_toolbar), item); s_project_toolbar.expand = item;
- item = GTK_WIDGET(gtk_tool_button_new(NULL, NULL)); - gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(item), "prjorg-collapse"); + image = gtk_image_new_from_icon_name("list-remove", GTK_ICON_SIZE_SMALL_TOOLBAR); + item = GTK_WIDGET(gtk_tool_button_new(image, NULL)); gtk_widget_set_tooltip_text(item, _("Collapse to project root")); g_signal_connect(item, "clicked", G_CALLBACK(on_collapse_all), NULL); gtk_container_add(GTK_CONTAINER(s_toolbar), item); @@ -1387,8 +1364,8 @@ void prjorg_sidebar_init(void) gtk_container_add(GTK_CONTAINER(s_toolbar), item);
item = GTK_WIDGET(gtk_toggle_tool_button_new()); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), "go-jump"); gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(item), TRUE); - gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(item), "prjorg-follow"); gtk_widget_set_tooltip_text(item, _("Follow active editor")); g_signal_connect(item, "clicked", G_CALLBACK(on_follow_active), NULL); gtk_container_add(GTK_CONTAINER(s_toolbar), item); @@ -1442,7 +1419,7 @@ void prjorg_sidebar_init(void)
s_popup_menu.widget = gtk_menu_new();
- image = gtk_image_new_from_icon_name("prjorg-expand", GTK_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name("list-add", GTK_ICON_SIZE_MENU); gtk_widget_show(image); item = gtk_image_menu_item_new_with_mnemonic(_("Expand All")); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image);
Modified: scope/src/program.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -465,7 +465,7 @@ void program_init(void) gtk_entry_set_max_length(working_dir_entry, PATH_MAX); stash_group_add_entry(group, &program_working_dir, "working_dir", "", working_dir_entry); ui_setup_open_button_callback(get_widget("program_working_dir_button"), NULL, - GTK_FILE_CHOOSER_ACTION_OPEN, working_dir_entry); + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, working_dir_entry);
load_script_entry = GTK_ENTRY(get_widget("program_load_script_entry")); gtk_entry_set_max_length(load_script_entry, PATH_MAX);
Modified: scope/src/scope.c 18 lines changed, 10 insertions(+), 8 deletions(-) =================================================================== @@ -153,18 +153,19 @@ typedef struct _ToolItem gint index; const char *icon[2]; GtkWidget *widget; + const char *tooltip_text; } ToolItem;
static ToolItem toolbar_items[] = { - { RUN_CONTINUE_KB, { "small_run_continue_icon", "large_run_continue_icon" }, NULL }, - { GOTO_CURSOR_KB, { "small_goto_cursor_icon", "large_goto_cursor_icon" }, NULL }, - { GOTO_SOURCE_KB, { "small_goto_source_icon", "large_goto_source_icon" }, NULL }, - { STEP_INTO_KB, { "small_step_into_icon", "large_step_into_icon" }, NULL }, - { STEP_OVER_KB, { "small_step_over_icon", "large_step_over_icon" }, NULL }, - { STEP_OUT_KB, { "small_step_out_icon", "large_step_out_icon" }, NULL }, - { TERMINATE_KB, { "small_terminate_icon", "large_terminate_icon" }, NULL }, - { BREAKPOINT_KB, { "small_breakpoint_icon", "large_breakpoint_icon", }, NULL }, + { RUN_CONTINUE_KB, { "small_run_continue_icon", "large_run_continue_icon" }, NULL, N_("Run/continue") }, + { GOTO_CURSOR_KB, { "small_goto_cursor_icon", "large_goto_cursor_icon" }, NULL, N_("Run to cursor") }, + { GOTO_SOURCE_KB, { "small_goto_source_icon", "large_goto_source_icon" }, NULL, N_("Run to source") }, + { STEP_INTO_KB, { "small_step_into_icon", "large_step_into_icon" }, NULL, N_("Step into") }, + { STEP_OVER_KB, { "small_step_over_icon", "large_step_over_icon" }, NULL, N_("Step over") }, + { STEP_OUT_KB, { "small_step_out_icon", "large_step_out_icon" }, NULL, N_("Step out") }, + { TERMINATE_KB, { "small_terminate_icon", "large_terminate_icon" }, NULL, N_("Terminate") }, + { BREAKPOINT_KB, { "small_breakpoint_icon", "large_breakpoint_icon", }, NULL, N_("Toggle breakpoint") }, { -1, { NULL, NULL }, NULL } };
@@ -631,6 +632,7 @@ void plugin_init(G_GNUC_UNUSED GeanyData *gdata) GtkMenuItem *menu_item = GTK_MENU_ITEM(debug_menu_items[tool_item->index].widget); GtkToolItem *button = gtk_tool_button_new(NULL, gtk_menu_item_get_label(menu_item));
+ gtk_widget_set_tooltip_text (GTK_WIDGET (button), tool_item->tooltip_text); gtk_tool_button_set_use_underline(GTK_TOOL_BUTTON(button), gtk_menu_item_get_use_underline(menu_item)); g_signal_connect(button, "clicked", G_CALLBACK(on_toolbar_button_clicked),
Modified: workbench/README 63 lines changed, 40 insertions(+), 23 deletions(-) =================================================================== @@ -19,7 +19,7 @@ Enabling the plugin ------------------- The plugin can be enabled in the plugin manager. After enabling the plugin a new tab will be displayed in the Sidebar. There will also be a new entry -in the menubar. Both are labeled "Workbench". +in the "Tools" menu. Both are labeled "Workbench".
The Workbench menu ------------------ @@ -30,13 +30,19 @@ simple text files containing key-value pairs.
The complete managment of the Workbench file is done using the Workbench menu: -- Item "New": as explained above, creates a new Workbench -- Item "Open": open a Workbench -- Item "Save": save the opened Workbench. This "only" saves any changes + +**Item "New"** + As explained above, creates a new Workbench. +**Item "Open"** + Open a Workbench. +**Item "Save"** + Save the opened Workbench. This "only" saves any changes in the Workbench file. It does not save any changes of the projects belonging to the Workbench. -- Item "Settings": open the Workbench settings dialog. -- Item "Close": closes the opened Workbench. +**Item "Settings"** + Open the Workbench settings dialog. +**Item "Close"** + Closes the opened Workbench.
The new Workbench ----------------- @@ -52,68 +58,78 @@ The Workbench context menu:
These are the available items:
-- "Add project": +**Add project** Add an existing Geany project to the Workbench. Create your projects with Geany. The Workbench plugin does not help you with that. After adding a project you need to save the workbench settings by selecting "Workbench / Save" in the menubar. -- "Save project": + +**Save project** Selecting this item will save the Workbench related project settings in the Geany project file. It is only available if you right clicked inside of a project. It will only save the settings of the project that you clicked on. -- "Remove project": + +**Remove project** Remove the project from the Workbench. It is only available if you right clicked inside of a project. After removing a project you need to save the workbench settings by selecting "Workbench / Save" in the menubar. -- "Fold/unfold project": + +**Fold/unfold project** Fold or unfold the items belonging to the project. It is only available if you right clicked inside of a project.
-- "Add directory": +**Add directory** Add a directory to the project. It is only available 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 the directory will be shown inside the project folder. After adding a new directory, all files and folders beneath the directory will be displayed. See "Directory settings" for more information. -- "Remove directory": + +**Remove directory** Remove the directory from the project. It is only available if you right clicked inside of a project directory. -- "Rescan directory": + +**Rescan directory** Rescan the directory for files and update the sidebar accordingly. It is only available if you right clicked inside of a project directory. If the content of a directory changes, e.g. a new file is added, then the new file will only be visible in the sidebar after a rescan. -- "Directory settings": + +**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 that shall be displayed or not. -- "Fold/unfold directory": + +**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": +**Unfold All** Select this item to unfold all projects, directories and folders. -- "Collapse All": + +**Collapse All** Select this item to collpase/fold all projects, directories and folders.
-- "Add to Workbench Bookmarks": +**Add to Workbench Bookmarks** Add the file to the Workbench Bookmarks. It is only available if you right clicked on a file. After adding a file to the Workbench bookmarks a ribbon will be shown for the file in the Workbench sidebar tab in front of the first project. Clicking on it will open the file. Workbench bookmarks give you quick access to files which you often need. -- "Add to Project Bookmarks": + +**Add to Project Bookmarks** Add the file to the Project Bookmarks. It is only available if you right clicked on a file. After adding a file to the Project bookmarks a ribbon will be shown for the file in the Workbench sidebar tab in front of the first directory of the project. Clicking on it will open the file. Project bookmarks give you quick access to files which you often need in that project. -- "Remove from Bookmarks": + +**Remove from Bookmarks** Remove file from the Workbench or project bookmarks. It is only available if you right clicked on a bookmark.
@@ -134,15 +150,16 @@ code of this program. Downloads =========
-The Workbench plugin is not (yet) part of the combined Geany Plugins release. -So please download it from the github page, see below. +The Workbench plugin is part of the combined Geany Plugins release. +For more information and downloads, please visit +http://plugins.geany.org/geany-plugins/
Development Code ================
Get the code from::
- git clone https://github.com/LarsGit223/geany-plugins + git clone https://github.com/geany/geany-plugins.git
Ideas, questions, patches and bug reports =========================================
Modified: workbench/src/plugin_main.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -128,7 +128,7 @@ void geany_load_module(GeanyPlugin *plugin) /* Set metadata */ plugin->info->name = _("Workbench"); plugin->info->description = _("Manage and customize multiple projects."); - plugin->info->version = "1.0"; + plugin->info->version = "1.01"; plugin->info->author = "LarsGit223";
/* Set functions */ @@ -138,5 +138,5 @@ void geany_load_module(GeanyPlugin *plugin) plugin->funcs->callbacks = plugin_workbench_callbacks;
/* Register! */ - GEANY_PLUGIN_REGISTER(plugin, 225); + GEANY_PLUGIN_REGISTER(plugin, 235); }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org