summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGlynn Foster <glynn.foster@sun.com>2004-09-13 04:56:26 +0000
committerGlynn Foster <gman@src.gnome.org>2004-09-13 04:56:26 +0000
commit03f3e5b060977c9566bd66bc8e4eaac14c4ee781 (patch)
treea9c6c9dfcfcf0392c5da3ceed7e337b097343a98 /src
parentPost release bump, for unstable 2.9.x development. (diff)
downloadzenity-03f3e5b060977c9566bd66bc8e4eaac14c4ee781.tar.gz
zenity-03f3e5b060977c9566bd66bc8e4eaac14c4ee781.tar.bz2
zenity-03f3e5b060977c9566bd66bc8e4eaac14c4ee781.zip
Update Update. Patch from Lucas Rocha to implement save and directory
2004-09-13 Glynn Foster <glynn.foster@sun.com> * THANKS: Update * src/about.c: Update. * src/fileselection.c, src/main.c, src/zenity.h: Patch from Lucas Rocha to implement save and directory selection in the file selection dialog. Fixes #138342.
Diffstat (limited to 'src')
-rw-r--r--src/about.c11
-rw-r--r--src/fileselection.c13
-rw-r--r--src/main.c34
-rw-r--r--src/zenity.h2
4 files changed, 58 insertions, 2 deletions
diff --git a/src/about.c b/src/about.c
index d9be6d44..60cb5704 100644
--- a/src/about.c
+++ b/src/about.c
@@ -70,6 +70,7 @@ static const gchar *author_credits[] = {
"Tomasz Koczko <kloczek pld org pl>",
"Jordi Mallach <jordi sindominio net>",
"Kjartan Maraas <kmaraas gnome org>",
+ "Breda McColgan <breda mccolgan sun com>",
"Baptiste Mille-Mathias <bmm80 free fr>",
"Buhan Milne <bgmilne linux-mandrake com>",
"Christian Monneckes <c-w-m gmx de>",
@@ -78,6 +79,7 @@ static const gchar *author_credits[] = {
"Jan Arne Petersen <jpetersen uni-bonn de>",
"Kevin C Krinke <kckrinke opendoorsoftware com>",
"Kristian Rietveld <kris gtk org>",
+ "Lucas Rocha <lucasr im ufba br>",
"Christian Rose <menthos menthos com>",
"Jakub Steiner <jimmac ximian com>",
"Luke Suchocki <gnome lukiepoo com>",
@@ -92,6 +94,7 @@ static const gchar *author_credits[] = {
"Taneem Ahmed <taneem bengalinux org>",
"Takeshi Aihana <aihana gnome gr jp>",
"Amanpreet Singh Alam <amanlinux netscape net>",
+ "Metin Amiroff <metin karegen com>",
"Sanlig Badral <badral openmn org>",
"John C Barstow <jbowtie amathaine com>",
"Aygimantas Beruka <uid0 tuxfamily org>",
@@ -104,7 +107,8 @@ static const gchar *author_credits[] = {
"Fatih Demir <kabalak gtranslator org>",
"Laurent Dhima <laurenti alblinux net>",
"Paul Duffy <dubhthach frink nuigalway ie>",
- " Laszlo Dvornik <dvornik gnome hu>",
+ "Laszlo Dvornik <dvornik gnome hu>",
+ "Maxim Dziumanenko <mvd mylinux com ua>",
"Francisco Javier Fernandez <serrador arrakis es>",
"Artur Flinta <aflinta cvs gnome org>",
"Alessio Frusciante <algol firenze linux it>",
@@ -112,7 +116,9 @@ static const gchar *author_credits[] = {
"Pablo Gonzalo del Campo <pablodc bigfoot com>",
"Dhurba Gnawali <dhurbagnawali hotmail com>",
"Sammi Gunnarsson <sammi techattack nu>",
+ "Martin Willemoes Hansen <mwh sysrq dk>",
"Dafydd Harries <daf parnassus ath cx>",
+ "Raphael Higino <raphaelh cvs gnome org>",
"Wang Jian <lark linux net cn>",
"Guntupalli Karunakar <karunakar freedomink org>",
"Tomas Kuliavas <tokul users sourceforge net>",
@@ -120,6 +126,7 @@ static const gchar *author_credits[] = {
"Iaki Larraaga <dooteo euskalgnu org>",
"Ole Laursen <olau hardworking dk>",
"Toivo Leedjrv <toivo linux ee>",
+ "David Lodge <dave cirt net>",
"Duarte Loreto <happyguy_pt hotmail com>",
"Johanna Makkonen <johanna makkonen iki fi>",
"Jordi Mallach <jordi sindominio net>",
@@ -136,10 +143,12 @@ static const gchar *author_credits[] = {
"Metin Omirov <metin karegen com>",
"Gareth Owen <gowen72 yahoo com>",
"Kostas Papadimas <pkst gmx net>",
+ "Ankit Patel <ankit redhat com>",
"Sami Pesonen <sampeson iki fi>",
"Roozbeh Pournader <roozbeh sharif edu>",
"Jarkko Ranta <jjranta cc joensuu fi>",
"Rostislav Raykov <zbrox dir bg>",
+ "Hendrik Richter <hendrik gnome de org>",
"Christian Rose <menthos menthos com>",
"Changwoo Ryu <cwryu debian org>",
"Pablo Saratxaga <pablo mandrakesoft com>",
diff --git a/src/fileselection.c b/src/fileselection.c
index 995ba03f..fdd40fdd 100644
--- a/src/fileselection.c
+++ b/src/fileselection.c
@@ -34,11 +34,22 @@ void zenity_fileselection (ZenityData *data, ZenityFileData *file_data)
GtkWidget *dialog;
gchar *dir;
gchar *basename;
+ GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
zen_data = data;
+ if (file_data->directory) {
+ if (file_data->save)
+ action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER;
+ else
+ action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
+ } else {
+ if (file_data->save)
+ action = GTK_FILE_CHOOSER_ACTION_SAVE;
+ }
+
dialog = gtk_file_chooser_dialog_new (NULL, NULL,
- GTK_FILE_CHOOSER_ACTION_OPEN,
+ action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
diff --git a/src/main.c b/src/main.c
index 02a67f3f..09b1519c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -94,6 +94,8 @@ enum {
OPTION_INFOTEXT,
OPTION_FILENAME,
OPTION_MULTIFILE,
+ OPTION_DIR,
+ OPTION_SAVE,
OPTION_TEXTFILENAME,
OPTION_LISTTEXT,
OPTION_COLUMN,
@@ -441,6 +443,24 @@ struct poptOption file_selection_options[] = {
NULL
},
{
+ "directory",
+ '\0',
+ POPT_ARG_NONE,
+ NULL,
+ OPTION_DIR,
+ N_("Activate directory-only selection"),
+ NULL
+ },
+ {
+ "save",
+ '\0',
+ POPT_ARG_NONE,
+ NULL,
+ OPTION_SAVE,
+ N_("Activate save mode"),
+ NULL
+ },
+ {
"separator",
'\0',
POPT_ARG_STRING,
@@ -971,6 +991,8 @@ zenity_init_parsing_options (void) {
results->calendar_data->year = 0;
results->calendar_data->dialog_text = NULL;
results->file_data->multi = FALSE;
+ results->file_data->directory = FALSE;
+ results->file_data->save = FALSE;
results->file_data->separator = g_strdup ("|");
results->text_data->editable = FALSE;
results->tree_data->separator = g_strdup ("|");
@@ -1409,6 +1431,18 @@ zenity_parse_options_callback (poptContext ctx,
results->file_data->multi = TRUE;
break;
+ case OPTION_DIR:
+ if (results->mode != MODE_FILE)
+ zenity_error ("--directory", ERROR_SUPPORT);
+
+ results->file_data->directory = TRUE;
+ break;
+ case OPTION_SAVE:
+ if (results->mode != MODE_FILE)
+ zenity_error ("--save", ERROR_SUPPORT);
+
+ results->file_data->save = TRUE;
+ break;
case OPTION_COLUMN:
if (results->mode != MODE_LIST)
zenity_error ("--column", ERROR_SUPPORT);
diff --git a/src/zenity.h b/src/zenity.h
index 36cf52e2..d9aff43f 100644
--- a/src/zenity.h
+++ b/src/zenity.h
@@ -62,6 +62,8 @@ typedef struct {
typedef struct {
gchar *uri;
gboolean multi;
+ gboolean directory;
+ gboolean save;
gchar *separator;
} ZenityFileData;
bgstack15