summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--src/option.c26
-rw-r--r--src/tree.c13
-rw-r--r--src/zenity.h1
4 files changed, 39 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 36e5974..78e1f24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-06-26 Lucas Rocha <lucasr@cvs.gnome.org>
+
+ * src/zenity.h, src/option.c: new multiple option on list
+ dialog
+ * src/tree.c: now the default behavior is the single
+ selection. when --multiple is used, then multiple
+ rows can be selected. For radiolist and checklist,
+ normal selection is disabled (buttons = selection).
+
2005-06-17 Lucas Rocha <lucasr@cvs.gnome.org>
* src/notification.c: don't use parent widget for
diff --git a/src/option.c b/src/option.c
index 33a185f..a167488 100644
--- a/src/option.c
+++ b/src/option.c
@@ -32,6 +32,7 @@ int zenity_general_width;
int zenity_general_height;
gchar *zenity_general_dialog_text;
gchar *zenity_general_separator;
+gboolean zenity_general_multiple;
gboolean zenity_general_editable;
gchar *zenity_general_uri;
gboolean zenity_general_dialog_no_wrap;
@@ -56,7 +57,6 @@ gboolean zenity_info_active;
/* File Selection Dialog Options */
gboolean zenity_file_active;
-gboolean zenity_file_multiple;
gboolean zenity_file_directory;
gboolean zenity_file_save;
@@ -325,7 +325,7 @@ GOptionEntry file_selection_options[] = {
'\0',
0,
G_OPTION_ARG_NONE,
- &zenity_file_multiple,
+ &zenity_general_multiple,
N_("Allow multiple files to be selected"),
NULL
},
@@ -417,6 +417,15 @@ GOptionEntry list_options[] = {
N_("SEPARATOR")
},
{
+ "multiple",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_general_multiple,
+ N_("Allow multiple rows to be selected"),
+ NULL
+ },
+ {
"editable",
'\0',
0,
@@ -740,6 +749,7 @@ zenity_general_pre_callback (GOptionContext *context,
zenity_general_height = -1;
zenity_general_dialog_text = NULL;
zenity_general_separator = g_strdup ("|");
+ zenity_general_multiple = FALSE;
zenity_general_editable = FALSE;
zenity_general_uri = NULL;
zenity_general_dialog_no_wrap = FALSE;
@@ -804,7 +814,6 @@ zenity_file_pre_callback (GOptionContext *context,
GError **error)
{
zenity_file_active = FALSE;
- zenity_file_multiple = FALSE;
zenity_file_directory = FALSE;
zenity_file_save = FALSE;
@@ -1037,15 +1046,11 @@ zenity_file_post_callback (GOptionContext *context,
if (results->mode == MODE_FILE) {
results->file_data->uri = zenity_general_uri;
- results->file_data->multi = zenity_file_multiple;
+ results->file_data->multi = zenity_general_multiple;
results->file_data->directory = zenity_file_directory;
results->file_data->save = zenity_file_save;
results->file_data->separator = zenity_general_separator;
} else {
- if (zenity_file_multiple)
- zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_multiple),
- ERROR_SUPPORT);
-
if (zenity_file_directory)
zenity_option_error (zenity_option_get_name (file_selection_options, &zenity_file_directory),
ERROR_SUPPORT);
@@ -1082,6 +1087,7 @@ zenity_list_post_callback (GOptionContext *context,
results->tree_data->checkbox = zenity_list_checklist;
results->tree_data->radiobox = zenity_list_radiolist;
+ results->tree_data->multi = zenity_general_multiple;
results->tree_data->editable = zenity_general_editable;
results->tree_data->print_column = zenity_list_print_column;
results->tree_data->separator = zenity_general_separator;
@@ -1411,6 +1417,10 @@ zenity_option_parse (gint argc, gchar **argv)
if (results->mode != MODE_LIST && results->mode != MODE_FILE)
zenity_option_error (zenity_option_get_name (list_options, &zenity_general_separator), ERROR_SUPPORT);
+ if (zenity_general_multiple)
+ if (results->mode != MODE_FILE && results->mode != MODE_LIST)
+ zenity_option_error (zenity_option_get_name (list_options, &zenity_general_multiple), ERROR_SUPPORT);
+
if (zenity_general_editable)
if (results->mode != MODE_TEXTINFO && results->mode != MODE_LIST)
zenity_option_error (zenity_option_get_name (list_options, &zenity_general_editable), ERROR_SUPPORT);
diff --git a/src/tree.c b/src/tree.c
index b50a755..e60e262 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -354,8 +354,17 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (model));
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
- GTK_SELECTION_MULTIPLE);
+ if (!(tree_data->radiobox || tree_data->checkbox)) {
+ if (tree_data->multi)
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
+ GTK_SELECTION_MULTIPLE);
+ else
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
+ GTK_SELECTION_SINGLE);
+ }
+ else
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
+ GTK_SELECTION_NONE);
column_index = 0;
diff --git a/src/zenity.h b/src/zenity.h
index 7ab47cb..0e1dba1 100644
--- a/src/zenity.h
+++ b/src/zenity.h
@@ -94,6 +94,7 @@ typedef struct {
gboolean checkbox;
gboolean radiobox;
gchar *separator;
+ gboolean multi;
gboolean editable;
gchar *print_column;
const gchar **data;