2003-01-03 13:26:04 +00:00
|
|
|
/*
|
|
|
|
* main.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
COPYING, src/about.c, src/calendar.c, src/eggtrayicon.c, src/entry.c,
2005-04-25 Glynn Foster <glynn.foster@sun.com>
* COPYING, src/about.c, src/calendar.c, src/eggtrayicon.c,
* src/entry.c, src/fileselection.c, src/main.c, src/msg.c,
* src/notification.c, src/option.c, src/progress.c,
* src/text.c, src/tree.c, src/util.c: Update the FSF address
to point to 51 Franklin Street, Fifth Floor as per forwarded
mail from Alvaro Lopez Ortega.
2005-04-25 03:20:45 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2003-01-03 13:26:04 +00:00
|
|
|
*
|
|
|
|
* Authors: Glynn Foster <glynn.foster@sun.com>
|
|
|
|
*/
|
|
|
|
|
2003-10-27 02:48:32 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
2003-01-03 13:26:04 +00:00
|
|
|
#include "zenity.h"
|
2004-12-07 00:17:16 +00:00
|
|
|
#include "option.h"
|
|
|
|
|
2003-06-04 12:53:46 +00:00
|
|
|
#include <stdlib.h>
|
2009-01-09 00:10:30 +00:00
|
|
|
#include <glib.h>
|
2004-12-07 00:17:16 +00:00
|
|
|
#include <gtk/gtk.h>
|
2003-01-13 17:35:57 +00:00
|
|
|
#include <langinfo.h>
|
2003-10-27 02:48:32 +00:00
|
|
|
#ifdef HAVE_LOCALE_H
|
|
|
|
#include <locale.h>
|
|
|
|
#endif
|
2003-01-03 13:26:04 +00:00
|
|
|
|
2003-01-06 15:06:17 +00:00
|
|
|
gint
|
|
|
|
main (gint argc, gchar **argv) {
|
2004-12-07 00:17:16 +00:00
|
|
|
ZenityParsingOptions *results;
|
|
|
|
gint retval;
|
Mass indentation cleanup. Make sure the glade dialogs aren't initially
2003-03-10 Glynn Foster <glynn.foster@sun.com>
* src/about.c, src/calendar.c, src/entry.c, src/fileselection.c,
src/main.c, src/msg.c, src/progress.c, src/text.c, src/tree.c,
src/util.c, src/util.h, src/zenity.glade, src/zenity.h:
Mass indentation cleanup. Make sure the glade dialogs aren't initially
visible because this avoids a visibility jump. Apparently == TRUE is
bad mojo. Fix up.
2003-03-10 17:11:18 +00:00
|
|
|
|
2003-10-27 02:48:32 +00:00
|
|
|
#ifdef HAVE_LOCALE_H
|
2003-08-22 08:30:15 +00:00
|
|
|
setlocale(LC_ALL,"");
|
2003-10-27 02:48:32 +00:00
|
|
|
#endif
|
|
|
|
|
Mass indentation cleanup. Make sure the glade dialogs aren't initially
2003-03-10 Glynn Foster <glynn.foster@sun.com>
* src/about.c, src/calendar.c, src/entry.c, src/fileselection.c,
src/main.c, src/msg.c, src/progress.c, src/text.c, src/tree.c,
src/util.c, src/util.h, src/zenity.glade, src/zenity.h:
Mass indentation cleanup. Make sure the glade dialogs aren't initially
visible because this avoids a visibility jump. Apparently == TRUE is
bad mojo. Fix up.
2003-03-10 17:11:18 +00:00
|
|
|
bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
|
2007-05-27 20:09:27 +00:00
|
|
|
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
Mass indentation cleanup. Make sure the glade dialogs aren't initially
2003-03-10 Glynn Foster <glynn.foster@sun.com>
* src/about.c, src/calendar.c, src/entry.c, src/fileselection.c,
src/main.c, src/msg.c, src/progress.c, src/text.c, src/tree.c,
src/util.c, src/util.h, src/zenity.glade, src/zenity.h:
Mass indentation cleanup. Make sure the glade dialogs aren't initially
visible because this avoids a visibility jump. Apparently == TRUE is
bad mojo. Fix up.
2003-03-10 17:11:18 +00:00
|
|
|
textdomain(GETTEXT_PACKAGE);
|
|
|
|
|
|
|
|
gtk_init (&argc, &argv);
|
|
|
|
|
2007-05-27 20:09:27 +00:00
|
|
|
results = zenity_option_parse (argc, argv);
|
|
|
|
|
Mass indentation cleanup. Make sure the glade dialogs aren't initially
2003-03-10 Glynn Foster <glynn.foster@sun.com>
* src/about.c, src/calendar.c, src/entry.c, src/fileselection.c,
src/main.c, src/msg.c, src/progress.c, src/text.c, src/tree.c,
src/util.c, src/util.h, src/zenity.glade, src/zenity.h:
Mass indentation cleanup. Make sure the glade dialogs aren't initially
visible because this avoids a visibility jump. Apparently == TRUE is
bad mojo. Fix up.
2003-03-10 17:11:18 +00:00
|
|
|
switch (results->mode) {
|
|
|
|
case MODE_CALENDAR:
|
|
|
|
zenity_calendar (results->data, results->calendar_data);
|
|
|
|
break;
|
|
|
|
case MODE_ENTRY:
|
2006-05-11 01:31:35 +00:00
|
|
|
results->entry_data->data = (const gchar **) argv + 1;
|
Mass indentation cleanup. Make sure the glade dialogs aren't initially
2003-03-10 Glynn Foster <glynn.foster@sun.com>
* src/about.c, src/calendar.c, src/entry.c, src/fileselection.c,
src/main.c, src/msg.c, src/progress.c, src/text.c, src/tree.c,
src/util.c, src/util.h, src/zenity.glade, src/zenity.h:
Mass indentation cleanup. Make sure the glade dialogs aren't initially
visible because this avoids a visibility jump. Apparently == TRUE is
bad mojo. Fix up.
2003-03-10 17:11:18 +00:00
|
|
|
zenity_entry (results->data, results->entry_data);
|
|
|
|
break;
|
|
|
|
case MODE_ERROR:
|
|
|
|
case MODE_QUESTION:
|
|
|
|
case MODE_WARNING:
|
|
|
|
case MODE_INFO:
|
|
|
|
zenity_msg (results->data, results->msg_data);
|
|
|
|
break;
|
2005-12-13 04:18:58 +00:00
|
|
|
case MODE_SCALE:
|
|
|
|
zenity_scale (results->data, results->scale_data);
|
|
|
|
break;
|
Mass indentation cleanup. Make sure the glade dialogs aren't initially
2003-03-10 Glynn Foster <glynn.foster@sun.com>
* src/about.c, src/calendar.c, src/entry.c, src/fileselection.c,
src/main.c, src/msg.c, src/progress.c, src/text.c, src/tree.c,
src/util.c, src/util.h, src/zenity.glade, src/zenity.h:
Mass indentation cleanup. Make sure the glade dialogs aren't initially
visible because this avoids a visibility jump. Apparently == TRUE is
bad mojo. Fix up.
2003-03-10 17:11:18 +00:00
|
|
|
case MODE_FILE:
|
|
|
|
zenity_fileselection (results->data, results->file_data);
|
|
|
|
break;
|
|
|
|
case MODE_LIST:
|
2004-12-07 00:17:16 +00:00
|
|
|
results->tree_data->data = (const gchar **) argv + 1;
|
Mass indentation cleanup. Make sure the glade dialogs aren't initially
2003-03-10 Glynn Foster <glynn.foster@sun.com>
* src/about.c, src/calendar.c, src/entry.c, src/fileselection.c,
src/main.c, src/msg.c, src/progress.c, src/text.c, src/tree.c,
src/util.c, src/util.h, src/zenity.glade, src/zenity.h:
Mass indentation cleanup. Make sure the glade dialogs aren't initially
visible because this avoids a visibility jump. Apparently == TRUE is
bad mojo. Fix up.
2003-03-10 17:11:18 +00:00
|
|
|
zenity_tree (results->data, results->tree_data);
|
|
|
|
break;
|
Add new notification icon. Update for new files. Restructure code a little
2004-09-13 Glynn Foster <glynn.foster@sun.com>
* data/Makefile.am, data/zenity-notification.png: Add new
notification icon.
* src/Makefile.am: Update for new files.
* src/about.c, src/calendar.c, src/entry.c, src/fileselection.c,
src/progress.c, src/text.c, src/tree.c, src/msg.c: Restructure code a
little bit for new utility functions for setting window icons.
* src/eggtrayicon.c, src/eggtrayicon.h: New files for notification area
support.
* src/main.c, src/notification.c, src/util.c, src/util.h, src/zenity.h:
Add support for notification area.
* data/zenity.1, help/*: Update docs for notification and new file
selection changes.
2004-09-13 07:51:51 +00:00
|
|
|
case MODE_NOTIFICATION:
|
|
|
|
zenity_notification (results->data, results->notification_data);
|
|
|
|
break;
|
Mass indentation cleanup. Make sure the glade dialogs aren't initially
2003-03-10 Glynn Foster <glynn.foster@sun.com>
* src/about.c, src/calendar.c, src/entry.c, src/fileselection.c,
src/main.c, src/msg.c, src/progress.c, src/text.c, src/tree.c,
src/util.c, src/util.h, src/zenity.glade, src/zenity.h:
Mass indentation cleanup. Make sure the glade dialogs aren't initially
visible because this avoids a visibility jump. Apparently == TRUE is
bad mojo. Fix up.
2003-03-10 17:11:18 +00:00
|
|
|
case MODE_PROGRESS:
|
|
|
|
zenity_progress (results->data, results->progress_data);
|
|
|
|
break;
|
|
|
|
case MODE_TEXTINFO:
|
|
|
|
zenity_text (results->data, results->text_data);
|
|
|
|
break;
|
|
|
|
case MODE_ABOUT:
|
|
|
|
zenity_about (results->data);
|
|
|
|
break;
|
2004-12-07 00:17:16 +00:00
|
|
|
case MODE_VERSION:
|
|
|
|
g_print ("%s\n", VERSION);
|
|
|
|
break;
|
Mass indentation cleanup. Make sure the glade dialogs aren't initially
2003-03-10 Glynn Foster <glynn.foster@sun.com>
* src/about.c, src/calendar.c, src/entry.c, src/fileselection.c,
src/main.c, src/msg.c, src/progress.c, src/text.c, src/tree.c,
src/util.c, src/util.h, src/zenity.glade, src/zenity.h:
Mass indentation cleanup. Make sure the glade dialogs aren't initially
visible because this avoids a visibility jump. Apparently == TRUE is
bad mojo. Fix up.
2003-03-10 17:11:18 +00:00
|
|
|
case MODE_LAST:
|
|
|
|
g_printerr (_("You must specify a dialog type. See 'zenity --help' for details\n"));
|
2004-12-07 00:17:16 +00:00
|
|
|
zenity_option_free ();
|
Mass indentation cleanup. Make sure the glade dialogs aren't initially
2003-03-10 Glynn Foster <glynn.foster@sun.com>
* src/about.c, src/calendar.c, src/entry.c, src/fileselection.c,
src/main.c, src/msg.c, src/progress.c, src/text.c, src/tree.c,
src/util.c, src/util.h, src/zenity.glade, src/zenity.h:
Mass indentation cleanup. Make sure the glade dialogs aren't initially
visible because this avoids a visibility jump. Apparently == TRUE is
bad mojo. Fix up.
2003-03-10 17:11:18 +00:00
|
|
|
exit (-1);
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
2004-12-07 00:17:16 +00:00
|
|
|
zenity_option_free ();
|
Mass indentation cleanup. Make sure the glade dialogs aren't initially
2003-03-10 Glynn Foster <glynn.foster@sun.com>
* src/about.c, src/calendar.c, src/entry.c, src/fileselection.c,
src/main.c, src/msg.c, src/progress.c, src/text.c, src/tree.c,
src/util.c, src/util.h, src/zenity.glade, src/zenity.h:
Mass indentation cleanup. Make sure the glade dialogs aren't initially
visible because this avoids a visibility jump. Apparently == TRUE is
bad mojo. Fix up.
2003-03-10 17:11:18 +00:00
|
|
|
exit (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = results->data->exit_code;
|
2003-06-10 21:30:22 +00:00
|
|
|
|
2004-12-07 00:17:16 +00:00
|
|
|
zenity_option_free ();
|
2003-01-19 12:48:57 +00:00
|
|
|
|
2004-12-07 00:17:16 +00:00
|
|
|
exit (retval);
|
2003-01-03 13:26:04 +00:00
|
|
|
}
|