There were a bug when using the checklist option. The message was :
(zenity:6946): GLib-GObject-CRITICAL **: g_value_dup_string: assertion
`G_VALUE_HOLDS_STRING (value)' failed
It was because of the option «print-column="1"» : when use with
checklist option it can’t work because the first column is the checkbox.
So I just removed it since it was useless : (from man zenity) « Specify
what column to print to standard output. The default is to return the
first column. 'ALL' may be used to print all columns. ».
I changed the way to manage options in order not to use too much
variables (and not use this one in particular : «print_column »). I add
the possibility to use too more options :
--hide-header
Hides the column headers
and for simple list (not checklist) :
--multiple
Allow multiple rows to be selected
---
zenity_list.m | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/zenity_list.m b/zenity_list.m
index b8bbfa2..c9ccae7 100644
--- a/zenity_list.m
+++ b/zenity_list.m
@@ -56,21 +56,21 @@ function s = zenity_list(title, columns, data, varargin)
print_usage();
endif
- checklist = radiolist = editable = "";
- print_column = "1";
+ listoptions="";
+
for i = 1:length(varargin)
option = varargin{i};
- isc = ischar(option);
- if (isc && strcmpi(option, "checklist"))
- checklist = "--checklist";
- elseif (isc && strcmpi(option, "radiolist"))
- radiolist = "--radiolist";
- elseif (isc && strcmpi(option, "editable"))
- editable = "--editable";
- elseif (isc && strcmpi(option, "all"))
- print_column = "all";
+ if(ischar(option))
+ switch option
+ case{"checklist","radiolist","editable","hide-header","multiple"}
+ listoptions = [listoptions " --" option];
+ case{"all"}
+ listoptions = [listoptions ' --print-column="all"'];
+ otherwise
+ error("zenity_list: unsupported option");
+ endswitch
elseif (isnumeric(option))
- print_column = num2str(option);
+ listoptions = [listoptions " --print-column=" num2str(option)];
else
error("zenity_list: unsupported option");
endif
@@ -80,8 +80,8 @@ function s = zenity_list(title, columns, data, varargin)
data = data';
data = sprintf("%s ", data{:});
- cmd = sprintf('zenity --list --title="%s" %s %s %s --print-column="%s"
--separator=":" %s %s', ...
- title, checklist, radiolist, editable, print_column, columns,
data);
+ cmd = sprintf('zenity --list --title="%s" %s --separator=":" %s %s', ...
+ title, listoptions, columns, data);
[status, output] = system(cmd);
if (status == 0)
if (length(output) > 0 && output(end) == "\n")
--
1.7.5
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev