1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-07 12:25:42 +02:00

script: add option "script.look.display_source" (display source code with detail of script, enabled by default)

This commit is contained in:
Sebastien Helleu
2012-08-28 16:11:51 +02:00
parent 5073048428
commit df7b14e41c
21 changed files with 460 additions and 41 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1
View File
@@ -27,6 +27,7 @@ struct t_repo_script;
extern struct t_gui_buffer *script_buffer;
extern int script_buffer_selected_line;
extern struct t_repo_script *script_buffer_detail_script;
extern int script_buffer_detail_script_line_source;
extern void script_buffer_refresh (int clear);
extern void script_buffer_set_current_line (int line);
+22 -3
View File
@@ -40,6 +40,7 @@ struct t_config_section *script_config_section_scripts = NULL;
/* script config, look section */
struct t_config_option *script_config_look_columns;
struct t_config_option *script_config_look_display_source;
struct t_config_option *script_config_look_quiet_actions;
struct t_config_option *script_config_look_sort;
struct t_config_option *script_config_look_translate_description;
@@ -138,21 +139,31 @@ script_config_get_xml_filename ()
* script_config_get_script_download_filename: get filename for a script to
* download, for eample:
* "/home/xxx/.weechat/script/iset.pl"
* (if suffix is not NULL, it is
* added to filename)
* Note: result must be freed after
* use
*/
char *
script_config_get_script_download_filename (struct t_repo_script *script)
script_config_get_script_download_filename (struct t_repo_script *script,
const char *suffix)
{
char *path, *filename;
int length;
path = script_config_get_dir ();
length = strlen (path) + 1 + strlen (script->name_with_extension) + 1;
length = strlen (path) + 1 + strlen (script->name_with_extension)
+ ((suffix) ? strlen (suffix) : 0) + 1;
filename = malloc (length);
if (filename)
snprintf (filename, length, "%s/%s", path, script->name_with_extension);
{
snprintf (filename, length,
"%s/%s%s",
path,
script->name_with_extension,
(suffix) ? suffix : "");
}
free (path);
return filename;
}
@@ -359,6 +370,14 @@ script_config_init ()
"%W=max_weechat)"),
NULL, 0, 0, "%s %n %V %v %u | %d | %t", NULL, 0,
NULL, NULL, &script_config_refresh_cb, NULL, NULL, NULL);
script_config_look_display_source = weechat_config_new_option (
script_config_file, ptr_section,
"display_source", "boolean",
N_("display source code of script on buffer with detail on a script "
"(script is downloaded in a temporary file when detail on script "
"is displayed)"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL);
script_config_look_quiet_actions = weechat_config_new_option (
script_config_file, ptr_section,
"quiet_actions", "boolean",
+3 -1
View File
@@ -25,6 +25,7 @@
struct t_repo_script;
extern struct t_config_option *script_config_look_columns;
extern struct t_config_option *script_config_look_display_source;
extern struct t_config_option *script_config_look_quiet_actions;
extern struct t_config_option *script_config_look_sort;
extern struct t_config_option *script_config_look_translate_description;
@@ -64,7 +65,8 @@ extern struct t_config_option *script_config_scripts_url;
extern char *script_config_get_dir ();
extern char *script_config_get_xml_filename ();
extern char *script_config_get_script_download_filename (struct t_repo_script *script);
extern char *script_config_get_script_download_filename (struct t_repo_script *script,
const char *suffix);
extern void script_config_hold (const char *name_with_extension);
extern void script_config_unhold (const char *name_with_extension);
extern int script_config_init ();