Revision: 1323 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1323&view=re... Author: colombanw Date: 2010-05-01 17:46:41 +0000 (Sat, 01 May 2010)
Log Message: ----------- GeanyGenDoc: Support for global environment overrides
Add a global environment to allow overrides and additions to the filetype-specific environments. This is useful e.g. to set a "insert since" property that will apply to all filetypes, an this without modifying filetypes themselves.
Modified Paths: -------------- trunk/geanygendoc/src/ggd-plugin.c trunk/geanygendoc/src/ggd-plugin.h trunk/geanygendoc/src/ggd.c
Modified: trunk/geanygendoc/src/ggd-plugin.c =================================================================== --- trunk/geanygendoc/src/ggd-plugin.c 2010-05-01 17:46:12 UTC (rev 1322) +++ trunk/geanygendoc/src/ggd-plugin.c 2010-05-01 17:46:41 UTC (rev 1323) @@ -82,6 +82,7 @@ gchar *GGD_OPT_doctype = NULL; gboolean GGD_OPT_save_to_refresh = FALSE; gboolean GGD_OPT_indent = TRUE; +gchar *GGD_OPT_environ = NULL;
@@ -151,6 +152,7 @@ ggd_opt_group_add_string (plugin->config, &GGD_OPT_doctype, "doctype"); ggd_opt_group_add_boolean (plugin->config, &GGD_OPT_save_to_refresh, "save_to_refresh"); ggd_opt_group_add_boolean (plugin->config, &GGD_OPT_indent, "indent"); + ggd_opt_group_add_string (plugin->config, &GGD_OPT_environ, "environ"); conffile = ggd_get_config_file ("ggd.conf", NULL, GGD_PERM_R, &err); if (conffile) { success = ggd_opt_group_load_from_file (plugin->config, conffile, &err); @@ -480,7 +482,31 @@ ggd_opt_group_set_proxy_gtktogglebutton (plugin->config, &GGD_OPT_indent, widget); gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0); + /* environ editor */ + widget = gtk_frame_new (_("Global environment")); + ui_widget_set_tooltip_text (widget, _("Global environment overrides and " + "additions. This environment will be " + "merged with the filetype-specific " + "ones.")); + { + GtkWidget *scrolled; + GtkWidget *view; + GObject *proxy; + + scrolled = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), + GTK_SHADOW_IN); + gtk_container_add (GTK_CONTAINER (widget), scrolled); + view = gtk_text_view_new (); + proxy = G_OBJECT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); + ggd_opt_group_set_proxy (plugin->config, &GGD_OPT_environ, proxy, "text"); + gtk_container_add (GTK_CONTAINER (scrolled), view); + } + gtk_box_pack_start (GTK_BOX (box), widget, TRUE, TRUE, 0);
+ gtk_widget_show_all (box);
return box;
Modified: trunk/geanygendoc/src/ggd-plugin.h =================================================================== --- trunk/geanygendoc/src/ggd-plugin.h 2010-05-01 17:46:12 UTC (rev 1322) +++ trunk/geanygendoc/src/ggd-plugin.h 2010-05-01 17:46:41 UTC (rev 1323) @@ -55,6 +55,7 @@ extern gchar *GGD_OPT_doctype; extern gboolean GGD_OPT_save_to_refresh; extern gboolean GGD_OPT_indent; +extern gchar *GGD_OPT_environ;
GGD_END_PLUGIN_API
Modified: trunk/geanygendoc/src/ggd.c =================================================================== --- trunk/geanygendoc/src/ggd.c 2010-05-01 17:46:12 UTC (rev 1322) +++ trunk/geanygendoc/src/ggd.c 2010-05-01 17:46:41 UTC (rev 1323) @@ -236,6 +236,11 @@
env = get_env_for_tag (ft, setting, tag_array, tag); ctpl_environ_merge (env, ft->user_env, FALSE); + if (! ctpl_environ_add_from_string (env, GGD_OPT_environ, &err)) { + msgwin_status_add (_("Failed to add global environment, skipping: %s"), + err->message); + g_clear_error (&err); + } comment = parser_parse_to_string (setting->template, env, &err); if (! comment) { msgwin_status_add (_("Failed to build comment: %s"), err->message);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
plugins-commits@lists.geany.org