Little cleanup

master
Yevgen Muntyan 2006-03-13 01:03:57 -06:00
parent b82d2739fd
commit 5c6dbfb04a
3 changed files with 70 additions and 14 deletions

View File

@ -564,13 +564,6 @@ moo_app_set_argv (MooApp *app,
}
int
moo_app_get_exit_code (MooApp *app)
{
g_return_val_if_fail (MOO_IS_APP (app), -1);
return app->priv->exit_code;
}
void
moo_app_set_exit_code (MooApp *app,
int code)
@ -1647,3 +1640,23 @@ moo_app_tempnam (MooApp *app)
g_warning ("%s: could not generate temp file name", G_STRLOC);
return NULL;
}
GType
moo_app_data_type_get_type (void)
{
static GType type = 0;
if (!type)
{
static const GEnumValue values[] = {
{ MOO_APP_DATA_SHARE, (char*) "MOO_APP_DATA_SHARE", (char*) "share" },
{ MOO_APP_DATA_LIB, (char*) "MOO_APP_DATA_LIB", (char*) "lib" },
{ 0, NULL, NULL },
};
type = g_enum_register_static ("MooAppDataType", values);
}
return type;
}

View File

@ -21,6 +21,7 @@ G_BEGIN_DECLS
#define MOO_TYPE_APP_INFO (moo_app_info_get_type ())
#define MOO_TYPE_APP_DATA_TYPE (moo_app_data_type_get_type ())
#define MOO_TYPE_APP (moo_app_get_type ())
#define MOO_APP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_APP, MooApp))
@ -79,6 +80,7 @@ struct _MooAppClass
GType moo_app_get_type (void) G_GNUC_CONST;
GType moo_app_info_get_type (void) G_GNUC_CONST;
GType moo_app_data_type_get_type (void) G_GNUC_CONST;
MooApp *moo_app_get_instance (void);
@ -86,7 +88,6 @@ gboolean moo_app_init (MooApp *app);
int moo_app_run (MooApp *app);
gboolean moo_app_quit (MooApp *app);
int moo_app_get_exit_code (MooApp *app);
void moo_app_set_exit_code (MooApp *app,
int code);

View File

@ -25,6 +25,15 @@
;; )
;; )
(define-enum DataType
(in-module "Moo")
(c-name "MooAppDataType")
(gtype-id "MOO_TYPE_APP_DATA_TYPE")
(values
'("share" "MOO_APP_DATA_SHARE")
'("lib" "MOO_APP_DATA_LIB")
)
)
;; From mooapp.h
@ -51,12 +60,6 @@
(return-type "gboolean")
)
(define-method get_exit_code
(of-object "MooApp")
(c-name "moo_app_get_exit_code")
(return-type "int")
)
(define-method set_exit_code
(of-object "MooApp")
(c-name "moo_app_set_exit_code")
@ -142,3 +145,42 @@
'("int" "len")
)
)
(define-method get_data_dir
(of-object "MooApp")
(c-name "moo_app_get_data_dir")
(return-type "char*")
(parameters
'("MooAppDataType" "type")
)
)
(define-method get_user_data_dir
(of-object "MooApp")
(c-name "moo_app_get_user_data_dir")
(return-type "char*")
(parameters
'("MooAppDataType" "type")
)
)
(define-method get_data_dirs
(of-object "MooApp")
(c-name "moo_app_get_data_dirs")
(return-type "char*")
(parameters
'("MooAppDataType" "type")
'("guint*" "n_dirs")
)
)
(define-method get_data_subdirs
(of-object "MooApp")
(c-name "moo_app_get_data_subdirs")
(return-type "char*")
(parameters
'("const-char*" "subdir")
'("MooAppDataType" "type")
'("guint*" "n_dirs")
)
)