Got rid of GOption

master
Yevgen Muntyan 2005-10-31 17:13:06 +00:00
parent 5f3e8cfd20
commit 391a77c8d1
5 changed files with 61 additions and 1845 deletions

View File

@ -1,5 +1,5 @@
Editor
======
========
1. Color settings!!!
2. Default lang, for ggap.
@ -10,3 +10,10 @@ Terminal
========
1. Think about profiles, can they help?
2. Terminal settings.
App
========
1. Command line options

View File

@ -188,7 +188,8 @@ enum {
static guint signals[LAST_SIGNAL];
static void moo_app_class_init (MooAppClass *klass)
static void
moo_app_class_init (MooAppClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
@ -367,9 +368,10 @@ moo_app_instance_init (MooApp *app)
}
static GObject *moo_app_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
static GObject*
moo_app_constructor (GType type,
guint n_params,
GObjectConstructParam *params)
{
GObject *object;
MooApp *app;
@ -394,7 +396,8 @@ static GObject *moo_app_constructor (GType type,
}
static void moo_app_finalize (GObject *object)
static void
moo_app_finalize (GObject *object)
{
MooApp *app = MOO_APP(object);
@ -421,10 +424,11 @@ static void moo_app_finalize (GObject *object)
}
static void moo_app_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
static void
moo_app_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
MooApp *app = MOO_APP (object);
@ -476,10 +480,11 @@ static void moo_app_set_property (GObject *object,
}
}
static void moo_app_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
static void
moo_app_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
MooApp *app = MOO_APP (object);
@ -527,7 +532,8 @@ static void moo_app_get_property (GObject *object,
}
MooApp *moo_app_get_instance (void)
MooApp*
moo_app_get_instance (void)
{
return moo_app_instance;
}
@ -730,6 +736,7 @@ void moo_app_hide_python_console (G_GNUC_UNUSED MooApp *app)
g_return_if_fail (moo_app_python != NULL);
gtk_widget_hide (GTK_WIDGET (moo_app_python->console));
}
#endif /* !MOO_USE_PYTHON */
static guint strv_length (char **argv)
@ -745,7 +752,6 @@ static guint strv_length (char **argv)
return len;
}
#endif /* !MOO_USE_PYTHON */
MooEditor *moo_app_get_editor (MooApp *app)
@ -762,7 +768,8 @@ const MooAppInfo*moo_app_get_info (MooApp *app)
}
static gboolean moo_app_init_real (MooApp *app)
static gboolean
moo_app_init_real (MooApp *app)
{
G_GNUC_UNUSED const char *app_dir;
const char *rc_file;
@ -770,6 +777,36 @@ static gboolean moo_app_init_real (MooApp *app)
MooUIXML *ui_xml;
GError *error = NULL;
#if 0
if (app->priv->enable_options)
{
int argc = strv_length (app->priv->argv);
g_option_context_add_group (app->priv->option_ctx,
gtk_get_option_group (TRUE));
g_option_context_parse (app->priv->option_ctx, &argc,
&app->priv->argv, &error);
if (error || argc > 1)
{
if (error)
{
g_print ("%s\n", error->message);
g_error_free (error);
error = NULL;
}
else
{
g_print ("Unknown option %s\n", app->priv->argv[1]);
}
g_print ("Type '%s --help' for usage\n", g_get_prgname ());
exit (1);
}
}
#endif
#ifdef __WIN32__
app_dir = moo_app_get_application_dir (app);
#endif

View File

@ -20,10 +20,6 @@ glib_2_8_sources = \
gmappedfile.c \
gmappedfile.h
glib_2_6_sources = \
goption.c \
goption.h
gtk_2_4_sources = \
gtkcolorbutton.c \
gtkcolorbutton.h \
@ -32,17 +28,12 @@ gtk_2_4_sources = \
EXTRA_DIST = \
$(glib_2_8_sources) \
$(glib_2_6_sources) \
$(gtk_2_4_sources)
if !GLIB_2_8
libnewgtk_la_SOURCES += $(glib_2_8_sources)
endif !GLIB_2_8
if !GLIB_2_6
libnewgtk_la_SOURCES += $(glib_2_6_sources)
endif !GLIB_2_6
if !GTK_2_4
libnewgtk_la_SOURCES += $(gtk_2_4_sources)
endif

File diff suppressed because it is too large Load Diff

View File

@ -1,148 +0,0 @@
/* goption.h - Option parser
*
* Copyright (C) 2004 Anders Carlsson <andersca@gnome.org>
*
* 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
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Taken from glib-2.6.4 for glib < 2.6
*/
#ifndef __G_OPTION_H__
#define __G_OPTION_H__
#include <glib/gerror.h>
#include <glib/gquark.h>
G_BEGIN_DECLS
typedef const gchar * (*GTranslateFunc) (const gchar *str,
gpointer data);
typedef struct _GOptionContext GOptionContext;
typedef struct _GOptionGroup GOptionGroup;
typedef struct _GOptionEntry GOptionEntry;
typedef enum
{
G_OPTION_FLAG_HIDDEN = 1 << 0,
G_OPTION_FLAG_IN_MAIN = 1 << 1,
G_OPTION_FLAG_REVERSE = 1 << 2
} GOptionFlags;
typedef enum
{
G_OPTION_ARG_NONE,
G_OPTION_ARG_STRING,
G_OPTION_ARG_INT,
G_OPTION_ARG_CALLBACK,
G_OPTION_ARG_FILENAME,
G_OPTION_ARG_STRING_ARRAY,
G_OPTION_ARG_FILENAME_ARRAY
} GOptionArg;
typedef gboolean (*GOptionArgFunc) (const gchar *option_name,
const gchar *value,
gpointer data,
GError **error);
typedef gboolean (*GOptionParseFunc) (GOptionContext *context,
GOptionGroup *group,
gpointer data,
GError **error);
typedef void (*GOptionErrorFunc) (GOptionContext *context,
GOptionGroup *group,
gpointer data,
GError **error);
#define G_OPTION_ERROR (g_option_error_quark ())
typedef enum
{
G_OPTION_ERROR_UNKNOWN_OPTION,
G_OPTION_ERROR_BAD_VALUE,
G_OPTION_ERROR_FAILED
} GOptionError;
GQuark g_option_error_quark (void);
struct _GOptionEntry
{
const gchar *long_name;
gchar short_name;
gint flags;
GOptionArg arg;
gpointer arg_data;
const gchar *description;
const gchar *arg_description;
};
#define G_OPTION_REMAINING ""
GOptionContext *g_option_context_new (const gchar *parameter_string);
void g_option_context_free (GOptionContext *context);
void g_option_context_set_help_enabled (GOptionContext *context,
gboolean help_enabled);
gboolean g_option_context_get_help_enabled (GOptionContext *context);
void g_option_context_set_ignore_unknown_options (GOptionContext *context,
gboolean ignore_unknown);
gboolean g_option_context_get_ignore_unknown_options (GOptionContext *context);
void g_option_context_add_main_entries (GOptionContext *context,
const GOptionEntry *entries,
const gchar *translation_domain);
gboolean g_option_context_parse (GOptionContext *context,
gint *argc,
gchar ***argv,
GError **error);
void g_option_context_add_group (GOptionContext *context,
GOptionGroup *group);
void g_option_context_set_main_group (GOptionContext *context,
GOptionGroup *group);
GOptionGroup *g_option_context_get_main_group (GOptionContext *context);
GOptionGroup *g_option_group_new (const gchar *name,
const gchar *description,
const gchar *help_description,
gpointer user_data,
GDestroyNotify destroy);
void g_option_group_set_parse_hooks (GOptionGroup *group,
GOptionParseFunc pre_parse_func,
GOptionParseFunc post_parse_func);
void g_option_group_set_error_hook (GOptionGroup *group,
GOptionErrorFunc error_func);
void g_option_group_free (GOptionGroup *group);
void g_option_group_add_entries (GOptionGroup *group,
const GOptionEntry *entries);
void g_option_group_set_translate_func (GOptionGroup *group,
GTranslateFunc func,
gpointer data,
GDestroyNotify destroy_notify);
void g_option_group_set_translation_domain (GOptionGroup *group,
const gchar *domain);
G_END_DECLS
#endif /* __G_OPTION_H__ */