source: variable.c @ 120dac7

release-1.10
Last change on this file since 120dac7 was 9d4dfdc, checked in by David Benjamin <davidben@mit.edu>, 11 years ago
When replacing a variable, keep the old value This unbreaks variable behavior on module reload. Reported-By: Robert Jacobs <rnjacobs@mit.edu>
  • Property mode set to 100644
File size: 46.0 KB
Line 
1#include "owl.h"
2#include <stdio.h>
3#include "gmarshal_funcs.h"
4
5/* TODO(davidben): When we can require 2.30 and up, remove this. */
6#ifndef G_VALUE_INIT
7#define G_VALUE_INIT { 0, { { 0 } } }
8#endif
9
10typedef const char *(*get_string_t)(const owl_variable *);
11typedef int (*get_int_t)(const owl_variable *);
12typedef bool (*get_bool_t)(const owl_variable *);
13
14typedef int (*set_string_t)(owl_variable *, const char *);
15typedef int (*set_int_t)(owl_variable *, int);
16typedef int (*set_bool_t)(owl_variable *, bool);
17
18typedef int (*validate_string_t)(const owl_variable *, const char *);
19typedef int (*validate_int_t)(const owl_variable *, int);
20typedef int (*validate_bool_t)(const owl_variable *, bool);
21
22static void owl_variable_dict_newvar_bool_full(owl_vardict *vd,
23                                               const char *name,
24                                               bool default_val,
25                                               const char *summary,
26                                               const char *description,
27                                               validate_bool_t validate_fn,
28                                               set_bool_t set_fn,
29                                               get_bool_t get_fn);
30
31static void owl_variable_dict_newvar_string_full(owl_vardict *vd,
32                                                 const char *name,
33                                                 const char *default_val,
34                                                 const char *summary,
35                                                 const char *description,
36                                                 const char *validsettings,
37                                                 validate_string_t validate_fn,
38                                                 set_string_t set_fn,
39                                                 get_string_t get_fn);
40
41static void owl_variable_dict_newvar_int_full(owl_vardict *vd,
42                                              const char *name,
43                                              int default_val,
44                                              const char *summary,
45                                              const char *description,
46                                              const char *validsettings,
47                                              validate_int_t validate_fn,
48                                              set_int_t set_fn,
49                                              get_int_t get_fn);
50
51static void owl_variable_dict_newvar_enum_full(owl_vardict *vd,
52                                               const char *name,
53                                               int default_val,
54                                               const char *summary,
55                                               const char *description,
56                                               const char *validsettings,
57                                               validate_int_t validate_fn,
58                                               set_int_t set_fn,
59                                               get_int_t get_fn);
60
61#define OWLVAR_BOOL(name, default, summary, description) \
62        owl_variable_dict_newvar_bool(vd, name, default, summary, description)
63
64#define OWLVAR_BOOL_FULL(name, default, summary, description, validate, set, get) \
65        owl_variable_dict_newvar_bool_full(vd, name, default, summary, description, \
66                                           validate, set, get)
67
68#define OWLVAR_INT(name, default, summary, description) \
69        owl_variable_dict_newvar_int(vd, name, default, summary, description)
70
71#define OWLVAR_INT_FULL(name,default,summary,description,validset,validate,set,get) \
72        owl_variable_dict_newvar_int_full(vd, name, default, summary, description, \
73                                          validset, validate, set, get)
74
75#define OWLVAR_PATH(name, default, summary, description) \
76        owl_variable_dict_newvar_path(vd, name, default, summary, description)
77
78#define OWLVAR_STRING(name, default, summary, description) \
79        owl_variable_dict_newvar_string(vd, name, default, summary, description)
80
81#define OWLVAR_STRING_FULL(name, default, validset, summary, description, validate, set, get) \
82        owl_variable_dict_newvar_string_full(vd, name, default, summary, description, \
83                                             validset, validate, set, get)
84
85/* enums are really integers, but where validset is a comma-separated
86 * list of strings which can be specified.  The tokens, starting at 0,
87 * correspond to the values that may be specified. */
88#define OWLVAR_ENUM(name, default, summary, description, validset) \
89        owl_variable_dict_newvar_enum(vd, name, default, summary, description, validset)
90
91#define OWLVAR_ENUM_FULL(name,default,summary,description,validset,validate, set, get) \
92        owl_variable_dict_newvar_enum_full(vd, name, default, summary, description, \
93                                           validset, validate, set, get)
94
95void owl_variable_add_defaults(owl_vardict *vd)
96{
97  OWLVAR_STRING( "personalbell" /* %OwlVarStub */, "off",
98                 "ring the terminal bell when personal messages are received",
99                 "Can be set to 'on', 'off', or the name of a filter which\n"
100                 "messages need to match in order to ring the bell");
101
102  OWLVAR_BOOL( "bell" /* %OwlVarStub */, 1,
103               "enable / disable the terminal bell", "" );
104
105  OWLVAR_BOOL_FULL( "debug" /* %OwlVarStub */, OWL_DEBUG,
106                    "whether debugging is enabled",
107                    "If set to 'on', debugging messages are logged to the\n"
108                    "file specified by the debugfile variable.\n",
109                    NULL, owl_variable_debug_set, NULL);
110
111  OWLVAR_BOOL( "startuplogin" /* %OwlVarStub */, 1,
112               "send a login message when BarnOwl starts", "" );
113
114  OWLVAR_BOOL( "shutdownlogout" /* %OwlVarStub */, 1,
115               "send a logout message when BarnOwl exits", "" );
116
117  OWLVAR_BOOL( "rxping" /* %OwlVarStub */, 0,
118               "display received pings", "" );
119
120  OWLVAR_BOOL( "txping" /* %OwlVarStub */, 1,
121               "send pings", "" );
122
123  OWLVAR_BOOL( "sepbar_disable" /* %OwlVarStub */, 0,
124               "disable printing information in the separator bar", "" );
125
126  OWLVAR_BOOL( "smartstrip" /* %OwlVarStub */, 1,
127               "strip kerberos instance for reply", "");
128
129  OWLVAR_BOOL( "newlinestrip" /* %OwlVarStub */, 1,
130               "strip leading and trailing newlines", "");
131
132  OWLVAR_BOOL( "displayoutgoing" /* %OwlVarStub */, 1,
133               "display outgoing messages", "" );
134
135  OWLVAR_BOOL( "loginsubs" /* %OwlVarStub */, 1,
136               "load logins from .anyone on startup", "" );
137
138  OWLVAR_BOOL( "logging" /* %OwlVarStub */, 0,
139               "turn personal logging on or off", 
140               "If this is set to on, personal messages are\n"
141               "logged in the directory specified\n"
142               "by the 'logpath' variable.  The filename in that\n"
143               "directory is derived from the sender of the message.\n" );
144
145  OWLVAR_BOOL( "classlogging" /* %OwlVarStub */, 0,
146               "turn class logging on or off",
147               "If this is set to on, class messages are\n"
148               "logged in the directory specified\n"
149               "by the 'classlogpath' variable.\n" 
150               "The filename in that directory is derived from\n"
151               "the name of the class to which the message was sent.\n" );
152
153  OWLVAR_ENUM( "loggingdirection" /* %OwlVarStub */, OWL_LOGGING_DIRECTION_BOTH,
154               "specifies which kind of messages should be logged",
155               "Can be one of 'both', 'in', or 'out'.  If 'in' is\n"
156               "selected, only incoming messages are logged, if 'out'\n"
157               "is selected only outgoing messages are logged.  If 'both'\n"
158               "is selected both incoming and outgoing messages are\n"
159               "logged.",
160               "both,in,out");
161
162  OWLVAR_BOOL_FULL( "colorztext" /* %OwlVarStub */, 1,
163                    "allow @color() in zephyrs to change color",
164                    NULL, NULL, owl_variable_colorztext_set, NULL);
165
166  OWLVAR_BOOL( "fancylines" /* %OwlVarStub */, 1,
167               "Use 'nice' line drawing on the terminal.",
168               "If turned off, dashes, pipes and pluses will be used\n"
169               "to draw lines on the screen.  Useful when the terminal\n"
170               "is causing problems" );
171
172  OWLVAR_BOOL( "zcrypt" /* %OwlVarStub */, 1,
173               "Do automatic zcrypt processing",
174               "" );
175
176  OWLVAR_BOOL_FULL( "pseudologins" /* %OwlVarStub */, 0,
177                    "Enable zephyr pseudo logins",
178                    "When this is enabled, BarnOwl will periodically check the zephyr\n"
179                    "location of users in your .anyone file.  If a user is present\n"
180                    "but sent no login message, or a user is not present that sent no\n"
181                    "logout message, a pseudo login or logout message will be created\n",
182                    NULL, owl_variable_pseudologins_set, NULL);
183
184  OWLVAR_BOOL( "ignorelogins" /* %OwlVarStub */, 0,
185               "Enable printing of login notifications",
186               "When this is enabled, BarnOwl will print login and logout notifications\n"
187               "for AIM, zephyr, or other protocols.  If disabled BarnOwl will not print\n"
188               "login or logout notifications.\n");
189
190  OWLVAR_STRING( "logfilter" /* %OwlVarStub */, "",
191                 "name of a filter controlling which messages to log",
192
193                 "If non empty, any messages matching the given filter will be logged.\n"
194                 "This is a completely separate mechanism from the other logging\n"
195                 "variables like logging, classlogging, loglogins, loggingdirection,\n"
196                 "etc.  If you want this variable to control all logging, make sure\n"
197                 "all other logging variables are in their default state.\n");
198
199  OWLVAR_BOOL( "loglogins" /* %OwlVarStub */, 0,
200               "Enable logging of login notifications",
201               "When this is enabled, BarnOwl will log login and logout notifications\n"
202               "for AIM, zephyr, or other protocols.  If disabled BarnOwl will not print\n"
203               "login or logout notifications.\n");
204
205  OWLVAR_ENUM_FULL( "disable-ctrl-d" /* %OwlVarStub:lockout_ctrld */, 1,
206                    "don't send zephyrs on C-d",
207                    "If set to 'on', C-d won't send a zephyr from the edit\n"
208                    "window.  If set to 'off', C-d will always send a zephyr\n"
209                    "being composed in the edit window.  If set to 'middle',\n"
210                    "C-d will only ever send a zephyr if the cursor is at\n"
211                    "the end of the message being composed.\n\n"
212                    "Note that this works by changing the C-d keybinding\n"
213                    "in the editmulti keymap.\n",
214                    "off,middle,on",
215                    NULL, owl_variable_disable_ctrl_d_set, NULL);
216
217  OWLVAR_PATH( "logpath" /* %OwlVarStub */, "~/zlog/people",
218               "path for logging personal zephyrs", 
219               "Specifies a directory which must exist.\n"
220               "Files will be created in the directory for each sender.\n");
221
222  OWLVAR_PATH( "classlogpath" /* %OwlVarStub:classlogpath */, "~/zlog/class",
223               "path for logging class zephyrs",
224               "Specifies a directory which must exist.\n"
225               "Files will be created in the directory for each class.\n");
226
227  OWLVAR_PATH( "debug_file" /* %OwlVarStub */, OWL_DEBUG_FILE,
228               "path for logging debug messages when debugging is enabled",
229               "This file will be logged to if 'debug' is set to 'on'.\n"
230               "BarnOwl will append a dot and the current process's pid to the filename.");
231 
232  OWLVAR_PATH( "zsigproc" /* %OwlVarStub:zsigproc */, NULL,
233               "name of a program to run that will generate zsigs",
234               "This program should produce a zsig on stdout when run.\n"
235               "Note that it is important that this program not block.\n\n"
236               "See the documentation for 'zsig' for more information about\n"
237               "how the outgoing zsig is chosen."
238               );
239
240  OWLVAR_PATH( "newmsgproc" /* %OwlVarStub:newmsgproc */, NULL,
241               "name of a program to run when new messages are present",
242               "The named program will be run when BarnOwl receives new\n"
243               "messages.  It will not be run again until the first\n"
244               "instance exits");
245
246  OWLVAR_STRING( "zsender" /* %OwlVarStub */, "",
247             "zephyr sender name",
248         "Allows you to customize the outgoing username in\n"
249         "zephyrs.  If this is unset, it will use your Kerberos\n"
250         "principal. Note that customizing the sender name will\n"
251         "cause your zephyrs to be sent unauthenticated.");
252
253  OWLVAR_STRING( "zsigfunc" /* %OwlVarStub */, "BarnOwl::default_zephyr_signature()",
254                 "zsig perl function",
255                 "Called every time you start a zephyrgram without an\n"
256                 "explicit zsig.  The default setting implements the policy\n"
257                 "described in the documentation for the 'zsig' variable.\n"
258                 "See also BarnOwl::random_zephyr_signature().\n");
259
260  OWLVAR_STRING( "zsig" /* %OwlVarStub */, "",
261                 "zephyr signature",
262                 "The zsig to get on outgoing messages. If this variable is\n"
263                 "unset, 'zsigproc' will be run to generate a zsig. If that is\n"
264                 "also unset, the 'zwrite-signature' zephyr variable will be\n"
265                 "used instead.\n");
266
267  OWLVAR_STRING( "appendtosepbar" /* %OwlVarStub */, "",
268                 "string to append to the end of the sepbar",
269                 "The sepbar is the bar separating the top and bottom\n"
270                 "of the BarnOwl screen.  Any string specified here will\n"
271                 "be displayed on the right of the sepbar\n");
272
273  OWLVAR_BOOL( "zaway" /* %OwlVarStub */, 0,
274               "turn zaway on or off", "" );
275
276  OWLVAR_STRING( "zaway_msg" /* %OwlVarStub */, 
277                 OWL_DEFAULT_ZAWAYMSG,
278                 "zaway msg for responding to zephyrs when away", "" );
279
280  OWLVAR_STRING( "zaway_msg_default" /* %OwlVarStub */, 
281                 OWL_DEFAULT_ZAWAYMSG,
282                 "default zaway message", "" );
283
284  OWLVAR_BOOL_FULL( "aaway" /* %OwlVarStub */, 0,
285                    "Set AIM away status",
286                    "",
287                    NULL, owl_variable_aaway_set, NULL);
288
289  OWLVAR_STRING( "aaway_msg" /* %OwlVarStub */, 
290                 OWL_DEFAULT_AAWAYMSG,
291                 "AIM away msg for responding when away", "" );
292
293  OWLVAR_STRING( "aaway_msg_default" /* %OwlVarStub */, 
294                 OWL_DEFAULT_AAWAYMSG,
295                 "default AIM away message", "" );
296
297  OWLVAR_STRING( "view_home" /* %OwlVarStub */, "all",
298                 "home view to switch to after 'X' and 'V'", 
299                 "SEE ALSO: view, filter\n" );
300
301  OWLVAR_STRING( "alert_filter" /* %OwlVarStub */, "none",
302                 "filter on which to trigger alert actions",
303                 "" );
304
305  OWLVAR_STRING( "alert_action" /* %OwlVarStub */, "nop",
306                 "BarnOwl command to execute for alert actions",
307                 "" );
308
309  OWLVAR_STRING_FULL( "tty" /* %OwlVarStub */, "", "<string>", "tty name for zephyr location", "",
310                      NULL, owl_variable_tty_set, NULL);
311
312  OWLVAR_STRING( "default_style" /* %OwlVarStub */, "default",
313                 "name of the default formatting style",
314                 "This sets the default message formatting style.\n"
315                 "Styles may be created with the 'style' command.\n"
316                 "Some built-in styles include:\n"
317                 "   default  - the default BarnOwl formatting\n"
318                 "   oneline  - one line per-message\n"
319                 "   perl     - legacy perl interface\n"
320                 "\nSEE ALSO: style, show styles, view -s <style>\n"
321                 );
322
323
324  OWLVAR_INT(    "edit:maxfillcols" /* %OwlVarStub:edit_maxfillcols */, 70,
325                 "maximum number of columns for M-q (edit:fill-paragraph) to fill text to",
326                 "This specifies the maximum number of columns for M-q to fill text\n"
327                 "to.  If set to 0, M-q will wrap to the width of the window, and\n"
328                 "values less than 0 disable M-q entirely.\n");
329
330  OWLVAR_INT(    "edit:maxwrapcols" /* %OwlVarStub:edit_maxwrapcols */, 70,
331                 "maximum number of columns for line-wrapping",
332                 "This specifies the maximum number of columns for\n"
333                 "auto-line-wrapping.  If set to 0, text will be wrapped at the\n"
334                 "window width. Values less than 0 disable automatic wrapping.\n"
335                 "\n"
336                 "As a courtesy to recipients, it is recommended that outgoing\n"
337                 "Zephyr messages be no wider than 70 columns.\n");
338
339  OWLVAR_INT( "aim_ignorelogin_timer" /* %OwlVarStub */, 15,
340              "number of seconds after AIM login to ignore login messages",
341              "This specifies the number of seconds to wait after an\n"
342              "AIM login before allowing the receipt of AIM login notifications.\n"
343              "By default this is set to 15.  If you would like to view login\n"
344              "notifications of buddies as soon as you login, set it to 0 instead.");
345
346             
347  OWLVAR_INT_FULL( "typewinsize" /* %OwlVarStub:typwin_lines */, 
348                   OWL_TYPWIN_SIZE,
349                  "number of lines in the typing window", 
350                   "This specifies the height of the window at the\n"
351                   "bottom of the screen where commands are entered\n"
352                   "and where messages are composed.\n",
353                   "int > 0",
354                   owl_variable_int_validate_gt0,
355                   owl_variable_typewinsize_set,
356                   NULL /* use default for get */
357                   );
358
359  OWLVAR_INT( "typewindelta" /* %OwlVarStub */, 0,
360                  "number of lines to add to the typing window when in use",
361                   "On small screens you may want the typing window to\n"
362                   "auto-hide when not entering a command or message.\n"
363                   "This variable is the number of lines to add to the\n"
364           "typing window when it is in use; you can then set\n"
365           "typewinsize to 1.\n\n"
366           "This works a lot better with a non-default scrollmode;\n"
367           "try :set scrollmode pagedcenter.\n");
368
369  OWLVAR_ENUM( "scrollmode" /* %OwlVarStub */, OWL_SCROLLMODE_NORMAL,
370               "how to scroll up and down",
371               "This controls how the screen is scrolled as the\n"
372               "cursor moves between messages being displayed.\n"
373               "The following modes are supported:\n\n"
374               "   normal      - This is the BarnOwl default.  Scrolling happens\n"
375               "                 when it needs to, and an attempt is made to\n"
376               "                 keep the current message roughly near\n"
377               "                 the middle of the screen.\n"
378               "   top         - The current message will always be the\n"
379               "                 the top message displayed.\n"
380               "   neartop     - The current message will be one down\n"
381               "                 from the top message displayed,\n"
382               "                 where possible.\n"
383               "   center      - An attempt is made to keep the current\n"
384               "                 message near the center of the screen.\n"
385               "   paged       - The top message displayed only changes\n"
386               "                 when user moves the cursor to the top\n"
387               "                 or bottom of the screen.  When it moves,\n"
388               "                 the screen will be paged up or down and\n"
389               "                 the cursor will be near the top or\n"
390               "                 the bottom.\n"
391               "   pagedcenter - The top message displayed only changes\n"
392               "                 when user moves the cursor to the top\n"
393               "                 or bottom of the screen.  When it moves,\n"
394               "                 the screen will be paged up or down and\n"
395               "                 the cursor will be near the center.\n",
396               "normal,top,neartop,center,paged,pagedcenter" );
397
398  OWLVAR_BOOL( "narrow-related" /* %OwlVarStub:narrow_related */, 1,
399               "Make smartnarrow use broader filters",
400               "Causes smartfilter to narrow to messages \"related\" to \n"
401               "the current message, as well as ones to the same place.\n\n"
402               "for Zephyr, this controls whether to narrow to e.g. class-help or\n"
403               "class-help.d alone, or to related-class-help, which includes\n"
404               "help, unhelp, help.d, etc.\n\nDefault is true (include unclasses, etc.).\n" );
405
406  OWLVAR_BOOL( "_followlast" /* %OwlVarStub */, 0,
407               "enable automatic following of the last zephyr",
408               "If the cursor is at the last message, it will\n"
409               "continue to follow the last message if this is set.\n"
410               "Note that this is currently risky as you might accidentally\n"
411               "delete a message right as it came in.\n" );
412
413  OWLVAR_STRING_FULL( "default_exposure" /* %OwlVarStub */, "",
414                      "none,opstaff,realm-visible,realm-announced,net-visible,net-announced",
415                      "controls the persistent value for exposure",
416                      "The default exposure level corresponds to the Zephyr exposure value\n"
417                      "in ~/.zephyr.vars.  Defaults to realm-visible if there is no value in\n"
418                      "~/.zephyr.vars.\n"
419                      "See the description of exposure for the values this can be.",
420                      NULL, owl_variable_default_exposure_set, owl_variable_default_exposure_get );
421
422  OWLVAR_STRING_FULL( "exposure" /* %OwlVarStub */, "",
423                      "none,opstaff,realm-visible,realm-announced,net-visible,net-announced",
424                      "controls who can zlocate you",
425                      "The exposure level, defaulting to the value of default_exposure,\n"
426                      "can be one of the following (from least exposure to widest exposure,\n"
427                      "as listed in zctl(1)):\n"
428                      "\n"
429                      "   none            - This completely disables Zephyr for the user. \n"
430                      "                     The user is not registered with Zephyr.  No user\n"
431                      "                     location information is retained by Zephyr.  No\n"
432                      "                     login or logout announcements will be sent.  No\n"
433                      "                     subscriptions will be entered for the user, and\n"
434                      "                     no notices will be displayed by zwgc(1).\n"
435                      "   opstaff         - The user is registered with Zephyr.  No login or\n"
436                      "                     logout announcements will be sent, and location\n"
437                      "                     information will only be visible to Operations\n"
438                      "                     staff.  Default subscriptions and any additional\n"
439                      "                     personal subscriptions will be entered for the\n"
440                      "                     user.\n"
441                      "   realm-visible   - The user is registered with Zephyr.  User\n"
442                      "                     location information is retained by Zephyr and\n"
443                      "                     made available only to users within the user’s\n"
444                      "                     Kerberos realm.  No login or logout\n"
445                      "                     announcements will be sent.  This is the system\n"
446                      "                     default.  Default subscriptions and any\n"
447                      "                     additional personal subscriptions will be\n"
448                      "                     entered for the user.\n"
449                      "   realm-announced - The user is registered with Zephyr.  User\n"
450                      "                     location information is retained by Zephyr and\n"
451                      "                     made available only to users authenticated\n"
452                      "                     within the user’s Kerberos realm.  Login and\n"
453                      "                     logout announcements will be sent, but only to\n"
454                      "                     users within the user’s Kerberos realm who have\n"
455                      "                     explicitly requested such via subscriptions. \n"
456                      "                     Default subscriptions and any additional\n"
457                      "                     personal subscriptions will be entered for the\n"
458                      "                     user.\n"
459                      "   net-visible     - The user is registered with Zephyr.  User\n"
460                      "                     location information is retained by Zephyr and\n"
461                      "                     made available to any authenticated user who\n"
462                      "                     requests such.  Login and logout announcements\n"
463                      "                     will be sent only to users within the user’s\n"
464                      "                     Kerberos realm who have explicitly requested\n"
465                      "                     such via subscriptions.  Default subscriptions\n"
466                      "                     and any additional personal subscriptions will\n"
467                      "                     be entered for the user.\n"
468                      "   net-announced   - The user is registered with Zephyr.  User\n"
469                      "                     location information is retained by Zephyr and\n"
470                      "                     made available to any authenticated user who\n"
471                      "                     requests such.  Login and logout announcements\n"
472                      "                     will be sent to any user has requested such. \n"
473                      "                     Default subscriptions and any additional\n"
474                      "                     personal subscriptions will be entered for the\n"
475                      "                     user.\n",
476                      NULL, owl_variable_exposure_set, NULL /* use default for get */ );
477}
478
479/**************************************************************************/
480/*********************** SPECIFIC TO VARIABLES ****************************/
481/**************************************************************************/
482
483
484/* commonly useful */
485
486int owl_variable_int_validate_gt0(const owl_variable *v, int newval)
487{
488  return !(newval < 1);
489}
490
491int owl_variable_int_validate_positive(const owl_variable *v, int newval)
492{
493  return !(newval < 0);
494}
495
496/* typewinsize */
497int owl_variable_typewinsize_set(owl_variable *v, int newval)
498{
499  int rv;
500  rv = owl_variable_int_set_default(v, newval);
501  if (0 == rv) owl_mainpanel_layout_contents(&g.mainpanel);
502  return(rv);
503}
504
505/* debug (cache value in g->debug) */
506int owl_variable_debug_set(owl_variable *v, bool newval)
507{
508  g.debug = newval;
509  return owl_variable_bool_set_default(v, newval);
510}
511
512/* When 'aaway' is changed, need to notify the AIM server */
513int owl_variable_aaway_set(owl_variable *v, bool newval)
514{
515  if (newval) {
516    owl_aim_set_awaymsg(owl_global_get_aaway_msg(&g));
517  } else {
518    owl_aim_set_awaymsg("");
519  }
520  return owl_variable_bool_set_default(v, newval);
521}
522
523int owl_variable_colorztext_set(owl_variable *v, bool newval)
524{
525  int ret = owl_variable_bool_set_default(v, newval);
526  /* flush the format cache so that we see the update, but only if we're done initializing BarnOwl */
527  if (owl_global_get_msglist(&g) != NULL)
528    owl_messagelist_invalidate_formats(owl_global_get_msglist(&g));
529  if (owl_global_get_mainwin(&g) != NULL) {
530    owl_function_calculate_topmsg(OWL_DIRECTION_DOWNWARDS);
531    owl_mainwin_redisplay(owl_global_get_mainwin(&g));
532  }
533  return ret;
534}
535
536int owl_variable_pseudologins_set(owl_variable *v, bool newval)
537{
538  static guint timer = 0;
539  if (newval) {
540    owl_function_zephyr_buddy_check(0);
541    if (timer == 0) {
542      timer = g_timeout_add_seconds(180, owl_zephyr_buddycheck_timer, NULL);
543    }
544  } else {
545    if (timer != 0) {
546      g_source_remove(timer);
547      timer = 0;
548    }
549  }
550  return owl_variable_bool_set_default(v, newval);
551}
552
553/* note that changing the value of this will clobber
554 * any user setting of this */
555int owl_variable_disable_ctrl_d_set(owl_variable *v, int newval)
556{
557  if (!owl_context_is_startup(owl_global_get_context(&g))) {
558    if (newval == 2) {
559      owl_function_command_norv("bindkey editmulti C-d command edit:delete-next-char");
560    } else if (newval == 1) {
561      owl_function_command_norv("bindkey editmulti C-d command edit:done-or-delete");
562    } else {
563      owl_function_command_norv("bindkey editmulti C-d command edit:done");
564    }
565  } 
566  return owl_variable_int_set_default(v, newval);
567}
568
569int owl_variable_tty_set(owl_variable *v, const char *newval)
570{
571  owl_zephyr_set_locationinfo(g_get_host_name(), newval);
572  return owl_variable_string_set_default(v, newval);
573}
574
575int owl_variable_default_exposure_set(owl_variable *v, const char *newval)
576{
577  return owl_zephyr_set_default_exposure(newval);
578}
579
580const char *owl_variable_default_exposure_get(const owl_variable *v)
581{
582  return owl_zephyr_get_default_exposure();
583}
584
585int owl_variable_exposure_set(owl_variable *v, const char *newval)
586{
587  int ret = owl_zephyr_set_exposure(newval);
588  if (ret != 0)
589    return ret;
590  return owl_variable_string_set_default(v, owl_zephyr_normalize_exposure(newval));
591}
592
593/**************************************************************************/
594/****************************** GENERAL ***********************************/
595/**************************************************************************/
596
597void owl_variable_dict_setup(owl_vardict *vd) {
598  owl_dict_create(vd);
599  owl_variable_add_defaults(vd);
600}
601
602CALLER_OWN GClosure *owl_variable_make_closure(owl_variable *v,
603                                               GCallback fn,
604                                               GClosureMarshal marshal) {
605  GClosure *closure = g_cclosure_new_swap(fn, v, NULL);
606  g_closure_set_marshal(closure,marshal);
607  g_closure_ref(closure);
608  g_closure_sink(closure);
609  return closure;
610}
611
612void owl_variable_dict_add_variable(owl_vardict * vardict,
613                                    owl_variable * var) {
614  char *oldvalue = NULL;
615  owl_variable *oldvar = owl_variable_get_var(vardict, var->name);
616  /* Save the old value as a string. */
617  if (oldvar) {
618    oldvalue = owl_variable_get_tostring(oldvar);
619  }
620  owl_dict_insert_element(vardict, var->name, var, (void (*)(void *))owl_variable_delete);
621  /* Restore the old value. */
622  if (oldvalue) {
623    owl_variable_set_fromstring(var, oldvalue, 0);
624    g_free(oldvalue);
625  }
626}
627
628static owl_variable *owl_variable_newvar(int type, const char *name, const char *summary, const char *description, const char *validsettings) {
629  owl_variable *var = g_new0(owl_variable, 1);
630  var->type = type;
631  var->name = g_strdup(name);
632  var->summary = g_strdup(summary);
633  var->description = g_strdup(description);
634  var->validsettings = g_strdup(validsettings);
635  return var;
636}
637
638static void owl_variable_dict_newvar_int_full(owl_vardict *vd, const char *name, int default_val, const char *summary, const char *description, const char *validsettings, validate_int_t validate_fn, set_int_t set_fn, get_int_t get_fn)
639{
640  owl_variable *var = owl_variable_newvar(OWL_VARIABLE_INT, name, summary,
641                                          description, validsettings);
642  var->takes_on_off = false;
643  var->get_fn = G_CALLBACK(get_fn ? get_fn : owl_variable_int_get_default);
644  var->set_fn = G_CALLBACK(set_fn ? set_fn : owl_variable_int_set_default);
645  var->validate_fn = G_CALLBACK(validate_fn ? validate_fn : owl_variable_int_validate_default);
646
647  var->get_tostring_fn = owl_variable_make_closure(
648      var, G_CALLBACK(owl_variable_int_get_tostring_default),
649      g_cclosure_user_marshal_STRING__VOID);
650  var->set_fromstring_fn = owl_variable_make_closure(
651      var, G_CALLBACK(owl_variable_int_set_fromstring_default),
652      g_cclosure_user_marshal_INT__STRING);
653
654  g_value_init(&var->val, G_TYPE_INT);
655  owl_variable_set_int(var, default_val);
656
657  var->default_str = owl_variable_get_tostring(var);
658  owl_variable_dict_add_variable(vd, var);
659}
660
661void owl_variable_dict_newvar_int(owl_vardict *vd, const char *name, int default_val, const char *summary, const char *description) {
662  owl_variable_dict_newvar_int_full(vd, name, default_val, summary, description,
663                                    "<int>", NULL, NULL, NULL);
664}
665
666static void owl_variable_dict_newvar_bool_full(owl_vardict *vd, const char *name, bool default_val, const char *summary, const char *description, validate_bool_t validate_fn, set_bool_t set_fn, get_bool_t get_fn)
667{
668  owl_variable *var = owl_variable_newvar(OWL_VARIABLE_BOOL, name, summary,
669                                          description, "on,off");
670  var->takes_on_off = true;
671  var->get_fn = G_CALLBACK(get_fn ? get_fn : owl_variable_bool_get_default);
672  var->set_fn = G_CALLBACK(set_fn ? set_fn : owl_variable_bool_set_default);
673  var->validate_fn = G_CALLBACK(validate_fn ? validate_fn : owl_variable_bool_validate_default);
674
675  var->get_tostring_fn = owl_variable_make_closure(
676      var, G_CALLBACK(owl_variable_bool_get_tostring_default),
677      g_cclosure_user_marshal_STRING__VOID);
678  var->set_fromstring_fn = owl_variable_make_closure(
679      var, G_CALLBACK(owl_variable_bool_set_fromstring_default),
680      g_cclosure_user_marshal_INT__STRING);
681
682  g_value_init(&var->val, G_TYPE_BOOLEAN);
683  owl_variable_set_bool(var, default_val);
684
685  var->default_str = owl_variable_get_tostring(var);
686  owl_variable_dict_add_variable(vd, var);
687}
688
689void owl_variable_dict_newvar_bool(owl_vardict *vd, const char *name, bool default_val, const char *summary, const char *description) {
690  owl_variable_dict_newvar_bool_full(vd, name, default_val, summary, description,
691                                     NULL, NULL, NULL);
692}
693
694static void owl_variable_dict_newvar_string_full(owl_vardict *vd, const char *name, const char *default_val, const char *summary, const char *description, const char *validsettings, validate_string_t validate_fn, set_string_t set_fn, get_string_t get_fn)
695{
696  owl_variable *var = owl_variable_newvar(OWL_VARIABLE_STRING, name, summary,
697                                          description, validsettings);
698  var->takes_on_off = false;
699  var->get_fn = G_CALLBACK(get_fn ? get_fn : owl_variable_string_get_default);
700  var->set_fn = G_CALLBACK(set_fn ? set_fn : owl_variable_string_set_default);
701  var->validate_fn = G_CALLBACK(validate_fn ? validate_fn : owl_variable_string_validate_default);
702
703  var->get_tostring_fn = owl_variable_make_closure(
704      var, G_CALLBACK(owl_variable_string_get_tostring_default),
705      g_cclosure_user_marshal_STRING__VOID);
706  var->set_fromstring_fn = owl_variable_make_closure(
707      var, G_CALLBACK(owl_variable_string_set_fromstring_default),
708      g_cclosure_user_marshal_INT__STRING);
709
710  g_value_init(&var->val, G_TYPE_STRING);
711  owl_variable_set_string(var, default_val);
712
713  var->default_str = owl_variable_get_tostring(var);
714  owl_variable_dict_add_variable(vd, var);
715}
716
717void owl_variable_dict_newvar_string(owl_vardict *vd, const char *name, const char *default_val, const char *summary, const char *description) {
718  owl_variable_dict_newvar_string_full(vd, name, default_val, summary, description,
719                                       "<string>", NULL, NULL, NULL);
720}
721
722void owl_variable_dict_newvar_path(owl_vardict *vd, const char *name, const char *default_val, const char *summary, const char *description) {
723  owl_variable_dict_newvar_string_full(vd, name, default_val, summary, description,
724                                       "<path>", NULL, NULL, NULL);
725}
726
727static void owl_variable_dict_newvar_enum_full(owl_vardict *vd, const char *name, int default_val, const char *summary, const char *description, const char *validsettings, validate_int_t validate_fn, set_int_t set_fn, get_int_t get_fn)
728{
729  owl_variable *var = owl_variable_newvar(OWL_VARIABLE_INT, name, summary,
730                                          description, validsettings);
731  var->takes_on_off = false;
732  var->get_fn = G_CALLBACK(get_fn ? get_fn : owl_variable_int_get_default);
733  var->set_fn = G_CALLBACK(set_fn ? set_fn : owl_variable_int_set_default);
734  var->validate_fn = G_CALLBACK(validate_fn ? validate_fn : owl_variable_enum_validate);
735
736  var->get_tostring_fn = owl_variable_make_closure(
737      var, G_CALLBACK(owl_variable_enum_get_tostring),
738      g_cclosure_user_marshal_STRING__VOID);
739  var->set_fromstring_fn = owl_variable_make_closure(
740      var, G_CALLBACK(owl_variable_enum_set_fromstring),
741      g_cclosure_user_marshal_INT__STRING);
742
743  g_value_init(&var->val, G_TYPE_INT);
744  owl_variable_set_int(var, default_val);
745
746  var->default_str = owl_variable_get_tostring(var);
747  owl_variable_dict_add_variable(vd, var);
748}
749
750void owl_variable_dict_newvar_enum(owl_vardict *vd, const char *name, int default_val, const char *summary, const char *description, const char *validset) {
751  owl_variable_dict_newvar_enum_full(vd, name, default_val, summary, description,
752                                     validset, NULL, NULL, NULL);
753}
754
755void owl_variable_dict_newvar_other(owl_vardict *vd, const char *name, const char *summary, const char *description, const char *validsettings, bool takes_on_off, GClosure *get_tostring_fn, GClosure *set_fromstring_fn)
756{
757  owl_variable *var = owl_variable_newvar(OWL_VARIABLE_OTHER, name, summary,
758                                          description, validsettings);
759  var->takes_on_off = takes_on_off;
760
761  var->get_tostring_fn = g_closure_ref(get_tostring_fn);
762  g_closure_sink(get_tostring_fn);
763
764  var->set_fromstring_fn = g_closure_ref(set_fromstring_fn);
765  g_closure_sink(set_fromstring_fn);
766
767  var->default_str = owl_variable_get_tostring(var);
768
769  /* Note: this'll overwrite any existing variable of that name, even a C one,
770     but it's consistent with previous behavior and commands. */
771  owl_variable_dict_add_variable(vd, var);
772}
773
774void owl_variable_dict_cleanup(owl_vardict *d)
775{
776  owl_dict_cleanup(d, (void (*)(void *))owl_variable_delete);
777}
778
779CALLER_OWN GPtrArray *owl_variable_dict_get_names(const owl_vardict *d) {
780  return owl_dict_get_keys(d);
781}
782
783void owl_variable_delete(owl_variable *v)
784{
785  g_free(v->name);
786  g_free(v->summary);
787  g_free(v->description);
788  g_free(v->default_str);
789  g_free(v->validsettings);
790  if (v->type != OWL_VARIABLE_OTHER)
791    g_value_unset(&(v->val));
792  g_closure_unref(v->get_tostring_fn);
793  g_closure_unref(v->set_fromstring_fn);
794
795  g_free(v);
796}
797
798
799const char *owl_variable_get_name(const owl_variable *v)
800{
801  return v->name;
802}
803
804const char *owl_variable_get_description(const owl_variable *v) {
805  return v->description;
806}
807
808const char *owl_variable_get_summary(const owl_variable *v) {
809  return v->summary;
810}
811
812const char *owl_variable_get_validsettings(const owl_variable *v) {
813  return v->validsettings;
814}
815
816int owl_variable_get_type(const owl_variable *v)
817{
818  return v->type;
819}
820
821/* returns 0 on success, prints a status msg if msg is true */
822int owl_variable_set_fromstring(owl_variable *v, const char *value, int msg) {
823  char *tostring;
824  GValue values[] = {G_VALUE_INIT, G_VALUE_INIT};
825  GValue return_box = G_VALUE_INIT;
826  int set_successfully;
827
828  g_value_init(&values[0], G_TYPE_POINTER);
829  g_value_set_pointer(&values[0], NULL);
830  g_value_init(&values[1], G_TYPE_STRING);
831  g_value_set_static_string(&values[1], value);
832  g_value_init(&return_box, G_TYPE_INT);
833  g_closure_invoke(v->set_fromstring_fn, &return_box, 2, values, NULL);
834
835  set_successfully = g_value_get_int(&return_box);
836  if (0 != set_successfully) {
837    if (msg) owl_function_error("Unable to set %s (must be %s)", owl_variable_get_name(v),
838                                owl_variable_get_validsettings(v));
839  } else if (msg) {
840    tostring = owl_variable_get_tostring(v);
841    if (tostring) {
842      owl_function_makemsg("%s = '%s'", owl_variable_get_name(v), tostring);
843    } else {
844      owl_function_makemsg("%s = <null>", owl_variable_get_name(v));
845    }
846    g_free(tostring);
847  }
848
849  g_value_unset(&return_box);
850  g_value_unset(&values[1]);
851  g_value_unset(&values[0]);
852  return set_successfully;
853}
854 
855int owl_variable_set_string(owl_variable *v, const char *newval)
856{
857  g_return_val_if_fail(v->type == OWL_VARIABLE_STRING, -1);
858
859  set_string_t cb = (set_string_t) v->set_fn;
860  return cb(v, newval);
861}
862
863int owl_variable_set_int(owl_variable *v, int newval)
864{
865  g_return_val_if_fail(v->type == OWL_VARIABLE_INT, -1);
866
867  set_int_t cb = (set_int_t) v->set_fn;
868  return cb(v, newval);
869}
870
871int owl_variable_set_bool(owl_variable *v, bool newval) {
872  g_return_val_if_fail(v->type == OWL_VARIABLE_BOOL, -1);
873
874  set_bool_t cb = (set_bool_t) v->set_fn;
875  return cb(v, newval);
876}
877
878int owl_variable_set_bool_on(owl_variable *v)
879{
880  if (v->type != OWL_VARIABLE_BOOL) return -1;
881  return owl_variable_set_bool(v, true);
882}
883
884int owl_variable_set_bool_off(owl_variable *v)
885{
886  if (v->type != OWL_VARIABLE_BOOL) return -1;
887  return owl_variable_set_bool(v, false);
888}
889
890CALLER_OWN char *owl_variable_get_tostring(const owl_variable *v)
891{
892  GValue instance = G_VALUE_INIT;
893  GValue tostring_box = G_VALUE_INIT;
894  char *ret = NULL;
895
896  g_value_init(&instance, G_TYPE_POINTER);
897  g_value_set_pointer(&instance, NULL);
898  g_value_init(&tostring_box, G_TYPE_STRING);
899  g_closure_invoke(v->get_tostring_fn, &tostring_box, 1, &instance, NULL);
900
901  ret = g_value_dup_string(&tostring_box);
902
903  g_value_unset(&tostring_box);
904  g_value_unset(&instance);
905  return ret;
906}
907
908const char *owl_variable_get_default_tostring(const owl_variable *v)
909{
910  return v->default_str;
911}
912
913owl_variable *owl_variable_get_var(const owl_vardict *d, const char *name)
914{
915  return owl_dict_find_element(d, name);
916}
917
918const char *owl_variable_get_string(const owl_variable *v)
919{
920  g_return_val_if_fail(v->type == OWL_VARIABLE_STRING, NULL);
921
922  get_string_t cb = (get_string_t) v->get_fn;
923  return cb(v);
924}
925
926int owl_variable_get_int(const owl_variable *v)
927{
928  g_return_val_if_fail(v->type == OWL_VARIABLE_INT, 0);
929
930  get_int_t cb = (get_int_t) v->get_fn;
931  return cb(v);
932}
933
934bool owl_variable_get_bool(const owl_variable *v)
935{
936  g_return_val_if_fail(v->type == OWL_VARIABLE_BOOL, FALSE);
937
938  get_bool_t cb = (get_bool_t) v->get_fn;
939  return cb(v);
940}
941
942void owl_variable_describe(const owl_variable *v, owl_fmtext *fm)
943{
944  const char *default_str = owl_variable_get_default_tostring(v);
945  char *default_buf;
946
947  if (default_str)
948    default_buf = g_strdup_printf("'%s'", default_str);
949  else
950    default_buf = g_strdup("<null>");
951  owl_fmtext_appendf_normal(fm, OWL_TABSTR "%-20s - %s (default: %s)\n",
952                            owl_variable_get_name(v),
953                            owl_variable_get_summary(v), default_buf);
954  g_free(default_buf);
955}
956
957void owl_variable_get_help(const owl_variable *v, owl_fmtext *fm) {
958  char *tostring;
959  const char *default_str;
960
961  owl_fmtext_append_bold(fm, "OWL VARIABLE\n\n");
962  owl_fmtext_append_normal(fm, OWL_TABSTR);
963  owl_fmtext_append_normal(fm, owl_variable_get_name(v));
964  owl_fmtext_append_normal(fm, " - ");
965  owl_fmtext_append_normal(fm, owl_variable_get_summary(v));
966  owl_fmtext_append_normal(fm, "\n\n");
967
968  owl_fmtext_append_normal(fm, "Current:        ");
969  tostring = owl_variable_get_tostring(v);
970  owl_fmtext_append_normal(fm, (tostring ? tostring : "<null>"));
971  g_free(tostring);
972  owl_fmtext_append_normal(fm, "\n\n");
973
974  default_str = owl_variable_get_default_tostring(v);
975  owl_fmtext_append_normal(fm, "Default:        ");
976  owl_fmtext_append_normal(fm, (default_str ? default_str : "<null>"));
977  owl_fmtext_append_normal(fm, "\n\n");
978
979  owl_fmtext_append_normal(fm, "Valid Settings: ");
980  owl_fmtext_append_normal(fm, owl_variable_get_validsettings(v));
981  owl_fmtext_append_normal(fm, "\n\n");
982
983  if (v->description && *v->description) {
984    owl_fmtext_append_normal(fm, "Description:\n");
985    owl_fmtext_append_normal(fm, owl_variable_get_description(v));
986    owl_fmtext_append_normal(fm, "\n\n");
987  }
988}
989
990
991
992
993/**************************************************************************/
994/*********************** GENERAL TYPE-SPECIFIC ****************************/
995/**************************************************************************/
996
997/* default common functions */
998
999const char *owl_variable_string_get_default(const owl_variable *v) {
1000  return g_value_get_string(&(v->val));
1001}
1002
1003int owl_variable_int_get_default(const owl_variable *v) {
1004  return g_value_get_int(&(v->val));
1005}
1006
1007bool owl_variable_bool_get_default(const owl_variable *v) {
1008  return g_value_get_boolean(&(v->val));
1009}
1010
1011/* default functions for booleans */
1012
1013int owl_variable_bool_validate_default(const owl_variable *v, bool newval) {
1014  return (newval == 1) || (newval == 0);
1015}
1016
1017int owl_variable_bool_set_default(owl_variable *v, bool newval) {
1018  if (!((validate_bool_t)v->validate_fn)(v, newval))
1019    return -1;
1020
1021  g_value_set_boolean(&(v->val), newval);
1022  return(0);
1023}
1024
1025int owl_variable_bool_set_fromstring_default(owl_variable *v, const char *newval, void *dummy) {
1026  bool i;
1027  if (!strcmp(newval, "on")) {
1028    i = true;
1029  } else if (!strcmp(newval, "off")) {
1030    i = false;
1031  } else {
1032    return(-1);
1033  }
1034
1035  return owl_variable_set_bool(v, i);
1036}
1037
1038CALLER_OWN char *owl_variable_bool_get_tostring_default(const owl_variable *v, void *dummy)
1039{
1040  bool val = owl_variable_get_bool(v);
1041  if (val == 0) {
1042    return g_strdup("off");
1043  } else if (val == 1) {
1044    return g_strdup("on");
1045  } else {
1046    return g_strdup("<invalid>");
1047  }
1048}
1049
1050/* default functions for integers */
1051
1052int owl_variable_int_validate_default(const owl_variable *v, int newval)
1053{
1054  return (1);
1055}
1056
1057int owl_variable_int_set_default(owl_variable *v, int newval) {
1058  if (!((validate_int_t)v->validate_fn)(v, newval))
1059    return -1;
1060
1061  g_value_set_int(&(v->val), newval);
1062  return(0);
1063}
1064
1065int owl_variable_int_set_fromstring_default(owl_variable *v, const char *newval, void *dummy) {
1066  int i;
1067  char *ep;
1068  i = strtol(newval, &ep, 10);
1069  if (*ep || ep==newval) return(-1);
1070  return owl_variable_set_int(v, i);
1071}
1072
1073CALLER_OWN char *owl_variable_int_get_tostring_default(const owl_variable *v, void *dummy)
1074{
1075  return g_strdup_printf("%d", owl_variable_get_int(v));
1076}
1077
1078/* default functions for enums (a variant of integers) */
1079
1080int owl_variable_enum_validate(const owl_variable *v, int newval) {
1081  char **enums;
1082  int nenums, val;
1083  enums = g_strsplit_set(v->validsettings, ",", 0);
1084  nenums = g_strv_length(enums);
1085  g_strfreev(enums);
1086  val = newval;
1087  if (val < 0 || val >= nenums) {
1088    return(0);
1089  }
1090  return(1);
1091}
1092
1093int owl_variable_enum_set_fromstring(owl_variable *v, const char *newval, void *dummy) {
1094  char **enums;
1095  int i, val=-1;
1096  if (newval == NULL) return(-1);
1097  enums = g_strsplit_set(v->validsettings, ",", 0);
1098  for (i = 0; enums[i] != NULL; i++) {
1099    if (0==strcmp(newval, enums[i])) {
1100      val = i;
1101    }
1102  }
1103  g_strfreev(enums);
1104  if (val == -1) return(-1);
1105  return owl_variable_set_int(v, val);
1106}
1107
1108CALLER_OWN char *owl_variable_enum_get_tostring(const owl_variable *v, void *dummy)
1109{
1110  char **enums;
1111  int nenums, i;
1112  char *tostring;
1113
1114  enums = g_strsplit_set(v->validsettings, ",", 0);
1115  nenums = g_strv_length(enums);
1116  i = owl_variable_get_int(v);
1117  if (i<0 || i>=nenums) {
1118    g_strfreev(enums);
1119    return g_strdup_printf("<invalid:%d>", i);
1120  }
1121  tostring = g_strdup(enums[i]);
1122  g_strfreev(enums);
1123  return tostring;
1124}
1125
1126/* default functions for stringeans */
1127
1128int owl_variable_string_validate_default(const owl_variable *v, const char *newval) {
1129  if (newval == NULL) return(0);
1130  else return (1);
1131}
1132
1133int owl_variable_string_set_default(owl_variable *v, const char *newval) {
1134  if (!((validate_string_t)v->validate_fn)(v, newval))
1135    return -1;
1136
1137  g_value_set_string(&(v->val), newval);
1138  return(0);
1139}
1140
1141int owl_variable_string_set_fromstring_default(owl_variable *v, const char *newval, void *dummy) 
1142{
1143  return owl_variable_set_string(v, newval);
1144}
1145
1146CALLER_OWN char *owl_variable_string_get_tostring_default(const owl_variable *v, void *dummy)
1147{
1148  return g_strdup(owl_variable_get_string(v));
1149}
1150
Note: See TracBrowser for help on using the repository browser.