Added MooCommandBuiltin
parent
a040b0fe15
commit
85f88c861a
|
@ -51,6 +51,8 @@ mooedit_sources = \
|
|||
moocommand.c \
|
||||
moocommanddisplay.c \
|
||||
moocommanddisplay.h \
|
||||
moocommand-builtin.h \
|
||||
moocommand-builtin.c \
|
||||
moocommand-exe.h \
|
||||
moocommand-exe-private.h \
|
||||
moocommand.h \
|
||||
|
|
|
@ -3,33 +3,9 @@
|
|||
id = SwitchHeaderAndImplementation
|
||||
name = Switch _Header and Implementation
|
||||
langs = c, cpp, objc, chdr, gap
|
||||
type = moo-script
|
||||
type = builtin
|
||||
options = need-file
|
||||
extensions = [[['.h', '.hh', '.hpp', '.hxx', '.H'], ['.c', '.cc', '.cpp', '.cxx', '.C', '.m']],
|
||||
[['.gd'], ['.gi']]];
|
||||
new = none;
|
||||
|
||||
for p in extensions do
|
||||
if doc.ext in p[0] then
|
||||
new = p[1];
|
||||
break;
|
||||
elif doc.ext in p[1] then
|
||||
new = p[0];
|
||||
break;
|
||||
fi;
|
||||
od;
|
||||
|
||||
if not new then
|
||||
return;
|
||||
fi;
|
||||
|
||||
for e in new do
|
||||
file = doc.dir + '/' + doc.base + e;
|
||||
if FileExists(file) then
|
||||
Open(file);
|
||||
return;
|
||||
fi;
|
||||
od;
|
||||
func = switch-header-and-impl
|
||||
|
||||
[tool]
|
||||
id=DVI_Forward_Search
|
||||
|
|
|
@ -0,0 +1,187 @@
|
|||
/*
|
||||
* moocommand-builtin.c
|
||||
*
|
||||
* Copyright (C) 2004-2007 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "mooeditor.h"
|
||||
#include "moocommand-builtin.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include <string.h>
|
||||
|
||||
#define KEY_FUNC "func"
|
||||
#define INDEX_FUNC 0
|
||||
|
||||
typedef void (*RunCommandFunc) (MooCommandContext *ctx);
|
||||
|
||||
struct _MooCommandBuiltinPrivate {
|
||||
RunCommandFunc func;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MooCommandBuiltin, _moo_command_builtin, MOO_TYPE_COMMAND)
|
||||
|
||||
typedef MooCommandFactory MooCommandFactoryBuiltin;
|
||||
typedef MooCommandFactoryClass MooCommandFactoryBuiltinClass;
|
||||
MOO_DEFINE_TYPE_STATIC (MooCommandFactoryBuiltin, _moo_command_factory_builtin, MOO_TYPE_COMMAND_FACTORY)
|
||||
|
||||
|
||||
static void switch_header_and_impl (MooCommandContext *ctx);
|
||||
|
||||
|
||||
static void
|
||||
_moo_command_builtin_init (MooCommandBuiltin *cmd)
|
||||
{
|
||||
cmd->priv = G_TYPE_INSTANCE_GET_PRIVATE (cmd,
|
||||
MOO_TYPE_COMMAND_BUILTIN,
|
||||
MooCommandBuiltinPrivate);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_command_builtin_run (MooCommand *cmd_base,
|
||||
MooCommandContext *ctx)
|
||||
{
|
||||
MooCommandBuiltin *cmd = MOO_COMMAND_BUILTIN (cmd_base);
|
||||
g_return_if_fail (cmd->priv->func != NULL);
|
||||
cmd->priv->func (ctx);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_moo_command_builtin_class_init (MooCommandBuiltinClass *klass)
|
||||
{
|
||||
MooCommandFactory *factory;
|
||||
static const char *const data_keys[] = {KEY_FUNC, NULL};
|
||||
|
||||
MOO_COMMAND_CLASS(klass)->run = moo_command_builtin_run;
|
||||
|
||||
g_type_class_add_private (klass, sizeof (MooCommandBuiltinPrivate));
|
||||
|
||||
factory = g_object_new (_moo_command_factory_builtin_get_type (), NULL);
|
||||
moo_command_factory_register ("builtin", "builtin", factory, (char**) data_keys);
|
||||
g_object_unref (factory);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_moo_command_factory_builtin_init (G_GNUC_UNUSED MooCommandFactoryBuiltin *factory)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static MooCommand *
|
||||
factory_create_command (G_GNUC_UNUSED MooCommandFactory *factory,
|
||||
MooCommandData *data,
|
||||
const char *options)
|
||||
{
|
||||
MooCommandBuiltin *cmd;
|
||||
const char *funcname;
|
||||
RunCommandFunc func = NULL;
|
||||
|
||||
funcname = moo_command_data_get (data, INDEX_FUNC);
|
||||
g_return_val_if_fail (funcname && funcname[0], NULL);
|
||||
|
||||
if (!strcmp (funcname, "switch-header-and-impl"))
|
||||
func = switch_header_and_impl;
|
||||
|
||||
if (!func)
|
||||
{
|
||||
g_critical ("unknown function `%s'", funcname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cmd = g_object_new (MOO_TYPE_COMMAND_BUILTIN, "options",
|
||||
moo_command_options_parse (options), NULL);
|
||||
cmd->priv->func = func;
|
||||
|
||||
return MOO_COMMAND (cmd);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
factory_data_equal (G_GNUC_UNUSED MooCommandFactory *factory,
|
||||
MooCommandData *data1,
|
||||
MooCommandData *data2)
|
||||
{
|
||||
const char *val1 = moo_command_data_get (data1, INDEX_FUNC);
|
||||
const char *val2 = moo_command_data_get (data2, INDEX_FUNC);
|
||||
return val1 ? (val2 && !strcmp (val1, val2)) : (!val2);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_moo_command_factory_builtin_class_init (MooCommandFactoryBuiltinClass *klass)
|
||||
{
|
||||
klass->create_command = factory_create_command;
|
||||
klass->data_equal = factory_data_equal;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
find_ext (const char *extension,
|
||||
char **list)
|
||||
{
|
||||
for (; *list; ++list)
|
||||
if (!strcmp (extension, *list))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
switch_header_and_impl (MooCommandContext *ctx)
|
||||
{
|
||||
const char *doc_ext, *doc_dir, *doc_base;
|
||||
char **new_ext;
|
||||
static const char *const c_h[] = {".h", ".hh", ".hpp", ".hxx", ".H", NULL};
|
||||
static const char *const c_impl[] = {".c", ".cc", ".cpp", ".cxx", ".C", ".m", NULL};
|
||||
static const char *const gap_h[] = {".gd", NULL};
|
||||
static const char *const gap_impl[] = {".gi", NULL};
|
||||
static char **pairs[] = {(char**) c_h, (char**) c_impl, (char**) gap_h, (char**) gap_impl};
|
||||
guint i;
|
||||
|
||||
doc_ext = moo_command_context_get_string (ctx, "DOC_EXT");
|
||||
doc_dir = moo_command_context_get_string (ctx, "DOC_DIR");
|
||||
doc_base = moo_command_context_get_string (ctx, "DOC_BASE");
|
||||
g_return_if_fail (doc_ext && doc_dir && doc_base);
|
||||
|
||||
new_ext = NULL;
|
||||
|
||||
for (i = 0; !new_ext && i < G_N_ELEMENTS (pairs)/2; ++i)
|
||||
{
|
||||
if (find_ext (doc_ext, pairs[2*i]))
|
||||
new_ext = pairs[2*i+1];
|
||||
else if (find_ext (doc_ext, pairs[2*i+1]))
|
||||
new_ext = pairs[2*i];
|
||||
}
|
||||
|
||||
if (!new_ext)
|
||||
return;
|
||||
|
||||
for (; *new_ext; ++new_ext)
|
||||
{
|
||||
char *filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s%s",
|
||||
doc_dir, doc_base, *new_ext);
|
||||
|
||||
if (g_file_test (filename, G_FILE_TEST_EXISTS))
|
||||
{
|
||||
moo_editor_open_file (moo_editor_instance (),
|
||||
moo_command_context_get_window (ctx),
|
||||
NULL, filename, NULL);
|
||||
g_free (filename);
|
||||
return;
|
||||
}
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* moocommand-builtin.h
|
||||
*
|
||||
* Copyright (C) 2004-2007 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifndef MOO_COMMAND_BUILTIN_H
|
||||
#define MOO_COMMAND_BUILTIN_H
|
||||
|
||||
#include <mooedit/moocommand.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define MOO_TYPE_COMMAND_BUILTIN (_moo_command_builtin_get_type ())
|
||||
#define MOO_COMMAND_BUILTIN(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_COMMAND_BUILTIN, MooCommandBuiltin))
|
||||
#define MOO_COMMAND_BUILTIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_COMMAND_BUILTIN, MooCommandBuiltinClass))
|
||||
#define MOO_IS_COMMAND_BUILTIN(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_COMMAND_BUILTIN))
|
||||
#define MOO_IS_COMMAND_BUILTIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_COMMAND_BUILTIN))
|
||||
#define MOO_COMMAND_BUILTIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_COMMAND_BUILTIN, MooCommandBuiltinClass))
|
||||
|
||||
typedef struct _MooCommandBuiltin MooCommandBuiltin;
|
||||
typedef struct _MooCommandBuiltinPrivate MooCommandBuiltinPrivate;
|
||||
typedef struct _MooCommandBuiltinClass MooCommandBuiltinClass;
|
||||
|
||||
struct _MooCommandBuiltin {
|
||||
MooCommand base;
|
||||
MooCommandBuiltinPrivate *priv;
|
||||
};
|
||||
|
||||
struct _MooCommandBuiltinClass {
|
||||
MooCommandClass base_class;
|
||||
};
|
||||
|
||||
|
||||
GType _moo_command_builtin_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* MOO_COMMAND_BUILTIN_H */
|
|
@ -61,7 +61,7 @@ struct _MooCommandExePrivate {
|
|||
};
|
||||
|
||||
|
||||
G_DEFINE_TYPE (MooCommandExe, moo_command_exe, MOO_TYPE_COMMAND)
|
||||
G_DEFINE_TYPE (MooCommandExe, _moo_command_exe, MOO_TYPE_COMMAND)
|
||||
|
||||
typedef MooCommandFactory MooCommandFactoryExe;
|
||||
typedef MooCommandFactoryClass MooCommandFactoryExeClass;
|
||||
|
@ -69,7 +69,7 @@ MOO_DEFINE_TYPE_STATIC (MooCommandFactoryExe, _moo_command_factory_exe, MOO_TYPE
|
|||
|
||||
|
||||
static void
|
||||
moo_command_exe_init (MooCommandExe *cmd)
|
||||
_moo_command_exe_init (MooCommandExe *cmd)
|
||||
{
|
||||
cmd->priv = G_TYPE_INSTANCE_GET_PRIVATE (cmd,
|
||||
MOO_TYPE_COMMAND_EXE,
|
||||
|
@ -85,7 +85,7 @@ moo_command_exe_finalize (GObject *object)
|
|||
g_free (cmd->priv->filter);
|
||||
g_free (cmd->priv->cmd_line);
|
||||
|
||||
G_OBJECT_CLASS (moo_command_exe_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (_moo_command_exe_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
|
@ -530,12 +530,12 @@ moo_command_exe_check_sensitive (MooCommand *cmd_base,
|
|||
|
||||
moo_command_set_options (cmd_base, options);
|
||||
|
||||
return MOO_COMMAND_CLASS (moo_command_exe_parent_class)->check_sensitive (cmd_base, doc, window);
|
||||
return MOO_COMMAND_CLASS (_moo_command_exe_parent_class)->check_sensitive (cmd_base, doc, window);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_command_exe_class_init (MooCommandExeClass *klass)
|
||||
_moo_command_exe_class_init (MooCommandExeClass *klass)
|
||||
{
|
||||
MooCommandFactory *factory;
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define MOO_TYPE_COMMAND_EXE (moo_command_exe_get_type ())
|
||||
#define MOO_COMMAND_EXE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_COMMAND_EXE, MooCommandExe))
|
||||
#define MOO_COMMAND_EXE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_COMMAND_EXE, MooCommandExeClass))
|
||||
#define MOO_IS_COMMAND_EXE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_COMMAND_EXE))
|
||||
#define MOO_IS_COMMAND_EXE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_COMMAND_EXE))
|
||||
#define MOO_COMMAND_EXE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_COMMAND_EXE, MooCommandExeClass))
|
||||
#define MOO_TYPE_COMMAND_EXE (_moo_command_exe_get_type ())
|
||||
#define MOO_COMMAND_EXE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_COMMAND_EXE, MooCommandExe))
|
||||
#define MOO_COMMAND_EXE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_COMMAND_EXE, MooCommandExeClass))
|
||||
#define MOO_IS_COMMAND_EXE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_COMMAND_EXE))
|
||||
#define MOO_IS_COMMAND_EXE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_COMMAND_EXE))
|
||||
#define MOO_COMMAND_EXE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_COMMAND_EXE, MooCommandExeClass))
|
||||
|
||||
typedef struct _MooCommandExe MooCommandExe;
|
||||
typedef struct _MooCommandExePrivate MooCommandExePrivate;
|
||||
|
@ -40,7 +40,7 @@ struct _MooCommandExeClass {
|
|||
};
|
||||
|
||||
|
||||
GType moo_command_exe_get_type (void) G_GNUC_CONST;
|
||||
GType _moo_command_exe_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -29,7 +29,7 @@ struct _MooCommandScriptPrivate {
|
|||
MSNode *script;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MooCommandScript, moo_command_script, MOO_TYPE_COMMAND)
|
||||
G_DEFINE_TYPE (MooCommandScript, _moo_command_script, MOO_TYPE_COMMAND)
|
||||
|
||||
typedef MooCommandFactory MooCommandFactoryScript;
|
||||
typedef MooCommandFactoryClass MooCommandFactoryScriptClass;
|
||||
|
@ -107,7 +107,7 @@ moo_command_script_dispose (GObject *object)
|
|||
cmd->priv = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS(moo_command_script_parent_class)->dispose (object);
|
||||
G_OBJECT_CLASS(_moo_command_script_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
||||
|
@ -228,7 +228,7 @@ _moo_command_factory_script_class_init (MooCommandFactoryClass *klass)
|
|||
|
||||
|
||||
static void
|
||||
moo_command_script_class_init (MooCommandScriptClass *klass)
|
||||
_moo_command_script_class_init (MooCommandScriptClass *klass)
|
||||
{
|
||||
MooCommandFactory *factory;
|
||||
|
||||
|
@ -244,7 +244,7 @@ moo_command_script_class_init (MooCommandScriptClass *klass)
|
|||
|
||||
|
||||
static void
|
||||
moo_command_script_init (MooCommandScript *cmd)
|
||||
_moo_command_script_init (MooCommandScript *cmd)
|
||||
{
|
||||
cmd->priv = G_TYPE_INSTANCE_GET_PRIVATE (cmd,
|
||||
MOO_TYPE_COMMAND_SCRIPT,
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define MOO_TYPE_COMMAND_SCRIPT (moo_command_script_get_type ())
|
||||
#define MOO_COMMAND_SCRIPT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_COMMAND_SCRIPT, MooCommandScript))
|
||||
#define MOO_COMMAND_SCRIPT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_COMMAND_SCRIPT, MooCommandScriptClass))
|
||||
#define MOO_IS_COMMAND_SCRIPT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_COMMAND_SCRIPT))
|
||||
#define MOO_IS_COMMAND_SCRIPT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_COMMAND_SCRIPT))
|
||||
#define MOO_COMMAND_SCRIPT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_COMMAND_SCRIPT, MooCommandScriptClass))
|
||||
#define MOO_TYPE_COMMAND_SCRIPT (_moo_command_script_get_type ())
|
||||
#define MOO_COMMAND_SCRIPT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_COMMAND_SCRIPT, MooCommandScript))
|
||||
#define MOO_COMMAND_SCRIPT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_COMMAND_SCRIPT, MooCommandScriptClass))
|
||||
#define MOO_IS_COMMAND_SCRIPT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), MOO_TYPE_COMMAND_SCRIPT))
|
||||
#define MOO_IS_COMMAND_SCRIPT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_COMMAND_SCRIPT))
|
||||
#define MOO_COMMAND_SCRIPT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_COMMAND_SCRIPT, MooCommandScriptClass))
|
||||
|
||||
typedef struct _MooCommandScript MooCommandScript;
|
||||
typedef struct _MooCommandScriptPrivate MooCommandScriptPrivate;
|
||||
|
@ -40,7 +40,7 @@ struct _MooCommandScriptClass {
|
|||
};
|
||||
|
||||
|
||||
GType moo_command_script_get_type (void) G_GNUC_CONST;
|
||||
GType _moo_command_script_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "mooedit/moocommand-private.h"
|
||||
#include "mooedit/moocommand-script.h"
|
||||
#include "mooedit/moocommand-exe.h"
|
||||
#include "mooedit/moocommand-builtin.h"
|
||||
#include "mooedit/mooeditwindow.h"
|
||||
#include "mooedit/moooutputfilterregex.h"
|
||||
#include "mooedit/mooedit-enums.h"
|
||||
|
@ -190,10 +191,34 @@ moo_command_factory_finalize (GObject *object)
|
|||
G_OBJECT_CLASS (moo_command_factory_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
dummy_create_widget (G_GNUC_UNUSED MooCommandFactory *factory)
|
||||
{
|
||||
return gtk_vbox_new (FALSE, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
dummy_load_data (G_GNUC_UNUSED MooCommandFactory *factory,
|
||||
G_GNUC_UNUSED GtkWidget *page,
|
||||
G_GNUC_UNUSED MooCommandData *data)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
dummy_save_data (G_GNUC_UNUSED MooCommandFactory *factory,
|
||||
G_GNUC_UNUSED GtkWidget *page,
|
||||
G_GNUC_UNUSED MooCommandData *data)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
moo_command_factory_class_init (MooCommandFactoryClass *klass)
|
||||
{
|
||||
G_OBJECT_CLASS (klass)->finalize = moo_command_factory_finalize;
|
||||
klass->create_widget = dummy_create_widget;
|
||||
klass->load_data = dummy_load_data;
|
||||
klass->save_data = dummy_save_data;
|
||||
}
|
||||
|
||||
|
||||
|
@ -613,7 +638,6 @@ moo_command_context_get (MooCommandContext *ctx,
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
const char *
|
||||
moo_command_context_get_string (MooCommandContext *ctx,
|
||||
const char *name)
|
||||
|
@ -631,7 +655,6 @@ moo_command_context_get_string (MooCommandContext *ctx,
|
|||
g_return_val_if_fail (G_VALUE_TYPE (&var->value) == G_TYPE_STRING, NULL);
|
||||
return g_value_get_string (&var->value);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
|
@ -1115,6 +1138,7 @@ _moo_command_init (void)
|
|||
|
||||
if (!been_here)
|
||||
{
|
||||
g_type_class_unref (g_type_class_ref (MOO_TYPE_COMMAND_BUILTIN));
|
||||
g_type_class_unref (g_type_class_ref (MOO_TYPE_COMMAND_SCRIPT));
|
||||
#ifndef __WIN32__
|
||||
g_type_class_unref (g_type_class_ref (MOO_TYPE_COMMAND_EXE));
|
||||
|
|
|
@ -177,9 +177,11 @@ gboolean moo_command_context_get (MooCommandContext *ctx,
|
|||
GValue *value);
|
||||
void moo_command_context_unset (MooCommandContext *ctx,
|
||||
const char *name);
|
||||
void moo_command_context_set_string (MooCommandContext *ctx,
|
||||
void moo_command_context_set_string (MooCommandContext *ctx,
|
||||
const char *name,
|
||||
const char *value);
|
||||
const char *moo_command_context_get_string (MooCommandContext *ctx,
|
||||
const char *name);
|
||||
|
||||
typedef void (*MooCommandContextForeachFunc) (const char *name,
|
||||
const GValue *value,
|
||||
|
|
Loading…
Reference in New Issue