Bunch of MOO_DEFINE_* macros
This commit is contained in:
parent
da721f2209
commit
385ae2f749
@ -38,8 +38,8 @@ libmooedit_SOURCES_ = \
|
||||
mooeditdialogs.h \
|
||||
mooedit-enums.c \
|
||||
mooedit-enums.h \
|
||||
mooeditfileops.c \
|
||||
mooeditfileops.h \
|
||||
mooedit-fileops.c \
|
||||
mooedit-fileops.h \
|
||||
mooeditfiltersettings.c \
|
||||
mooeditfiltersettings.h \
|
||||
mooedit.h \
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "mooedit/mooedit-enums.h"
|
||||
#include "mooutils/mooutils-debug.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include "mooedit/moocommand-exe.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gstdio.h>
|
||||
@ -39,6 +40,7 @@
|
||||
G_DEFINE_TYPE (MooCommand, moo_command, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE (MooCommandFactory, moo_command_factory, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE (MooCommandContext, moo_command_context, G_TYPE_OBJECT)
|
||||
MOO_DEFINE_BOXED_TYPE_R (MooCommandData, moo_command_data)
|
||||
|
||||
enum {
|
||||
CTX_PROP_0,
|
||||
@ -1339,20 +1341,6 @@ moo_command_data_get_code (MooCommandData *data)
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
moo_command_data_get_type (void)
|
||||
{
|
||||
static GType type;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooCommandData",
|
||||
(GBoxedCopyFunc) moo_command_data_ref,
|
||||
(GBoxedFreeFunc) moo_command_data_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_moo_command_init (void)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* mooeditfileops.c
|
||||
* mooedit-fileops.c
|
||||
*
|
||||
* Copyright (C) 2004-2008 by Yevgen Muntyan <muntyan@tamu.edu>
|
||||
*
|
||||
@ -20,7 +20,7 @@
|
||||
#define MOOEDIT_COMPILATION
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooeditor-private.h"
|
||||
#include "mooedit/mooeditfileops.h"
|
||||
#include "mooedit/mooedit-fileops.h"
|
||||
#include "mooedit/mooeditdialogs.h"
|
||||
#include "mooedit/mootextbuffer.h"
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
@ -28,6 +28,7 @@
|
||||
#include "mooutils/moofilewatch.h"
|
||||
#include "mooutils/mooencodings.h"
|
||||
#include "mooutils/mooi18n.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@ -49,6 +50,8 @@
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
MOO_DEFINE_QUARK (MooEditFileErrorQuark, _moo_edit_file_error_quark)
|
||||
|
||||
static GSList *UNTITLED = NULL;
|
||||
static GHashTable *UNTITLED_NO = NULL;
|
||||
|
||||
@ -82,18 +85,6 @@ static char *_moo_edit_filename_to_utf8 (const char *filename);
|
||||
static void _moo_edit_start_file_watch (MooEdit *edit);
|
||||
|
||||
|
||||
GQuark
|
||||
_moo_edit_file_error_quark (void)
|
||||
{
|
||||
static GQuark q;
|
||||
|
||||
if (!q)
|
||||
q = g_quark_from_static_string ("MooEditFileErrorQuark");
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
normalize_encoding (const char *encoding,
|
||||
gboolean for_save)
|
59
moo/mooedit/mooedit-fileops.h
Normal file
59
moo/mooedit/mooedit-fileops.h
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* mooedit-fileops.h
|
||||
*
|
||||
* Copyright (C) 2004-2008 by Yevgen Muntyan <muntyan@tamu.edu>
|
||||
*
|
||||
* This file is part of medit. medit 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.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MOOEDIT_COMPILATION
|
||||
#error "This file may not be included"
|
||||
#endif
|
||||
|
||||
#ifndef MOO_EDIT_FILE_OPS_H
|
||||
#define MOO_EDIT_FILE_OPS_H
|
||||
|
||||
#include "mooedit/mooedit.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
const char *_moo_get_default_encodings (void);
|
||||
|
||||
typedef enum {
|
||||
MOO_EDIT_SAVE_BACKUP = 1 << 0
|
||||
} MooEditSaveFlags;
|
||||
|
||||
#define MOO_EDIT_FILE_ERROR (_moo_edit_file_error_quark ())
|
||||
#define MOO_EDIT_FILE_ERROR_ENCODING 0
|
||||
|
||||
GQuark _moo_edit_file_error_quark (void) G_GNUC_CONST;
|
||||
|
||||
gboolean _moo_edit_load_file (MooEdit *edit,
|
||||
const char *file,
|
||||
const char *encoding,
|
||||
GError **error);
|
||||
gboolean _moo_edit_reload_file (MooEdit *edit,
|
||||
const char *encoding,
|
||||
GError **error);
|
||||
gboolean _moo_edit_save_file (MooEdit *edit,
|
||||
const char *file,
|
||||
const char *encoding,
|
||||
MooEditSaveFlags flags,
|
||||
GError **error);
|
||||
gboolean _moo_edit_save_file_copy (MooEdit *edit,
|
||||
const char *file,
|
||||
const char *encoding,
|
||||
GError **error);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* MOO_EDIT_FILE_OPS_H */
|
@ -17,6 +17,7 @@
|
||||
#include "mooedit/mooedit-lua.h"
|
||||
#include "mooedit/mooeditor.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include <string.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include <gtk/gtk.h>
|
||||
@ -26,19 +27,12 @@
|
||||
/* GObject
|
||||
*/
|
||||
|
||||
MOO_DEFINE_QUARK_STATIC (moo-lua-type, lua_type_quark)
|
||||
|
||||
#ifdef MOO_ENABLE_UNIT_TESTS
|
||||
static int object_count;
|
||||
#endif
|
||||
|
||||
static GQuark
|
||||
lua_type_quark (void)
|
||||
{
|
||||
static GQuark q;
|
||||
if (G_UNLIKELY (!q))
|
||||
q = g_quark_from_static_string ("moo-lua-type");
|
||||
return q;
|
||||
}
|
||||
|
||||
static GObject **
|
||||
check_gobject (lua_State *L)
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ GdkPixbuf *_moo_edit_get_icon (MooEdit *edit,
|
||||
|
||||
#define MOO_EDIT_IS_UNTITLED(edit) (!(edit)->priv->filename)
|
||||
|
||||
struct _MooEditFileInfo {
|
||||
struct MooEditFileInfo {
|
||||
char *filename;
|
||||
char *encoding;
|
||||
};
|
||||
@ -140,7 +140,7 @@ typedef enum {
|
||||
MOO_EDIT_LINE_END_MIX
|
||||
} MooEditLineEndType;
|
||||
|
||||
struct _MooEditPrivate {
|
||||
struct MooEditPrivate {
|
||||
MooEditor *editor;
|
||||
|
||||
gulong modified_changed_handler_id;
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "marshals.h"
|
||||
#include "mooutils/mooi18n.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include "glade/mooeditprogress-gxml.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@ -38,7 +39,6 @@
|
||||
|
||||
GSList *_moo_edit_instances = NULL;
|
||||
|
||||
|
||||
static GObject *moo_edit_constructor (GType type,
|
||||
guint n_construct_properties,
|
||||
GObjectConstructParam *construct_param);
|
||||
@ -113,7 +113,7 @@ enum {
|
||||
PROP_ENCODING
|
||||
};
|
||||
|
||||
/* MOO_TYPE_EDIT */
|
||||
MOO_DEFINE_BOXED_TYPE_C (MooEditFileInfo, moo_edit_file_info)
|
||||
G_DEFINE_TYPE (MooEdit, moo_edit, MOO_TYPE_TEXT_VIEW)
|
||||
|
||||
|
||||
@ -473,40 +473,6 @@ _moo_edit_set_status (MooEdit *edit,
|
||||
#endif
|
||||
|
||||
|
||||
MooEditFileInfo*
|
||||
moo_edit_file_info_new (const char *filename,
|
||||
const char *encoding)
|
||||
{
|
||||
MooEditFileInfo *info = g_new0 (MooEditFileInfo, 1);
|
||||
info->filename = g_strdup (filename);
|
||||
info->encoding = g_strdup (encoding);
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
MooEditFileInfo*
|
||||
moo_edit_file_info_copy (const MooEditFileInfo *info)
|
||||
{
|
||||
MooEditFileInfo *copy;
|
||||
g_return_val_if_fail (info != NULL, NULL);
|
||||
copy = g_new (MooEditFileInfo, 1);
|
||||
copy->encoding = g_strdup (info->encoding);
|
||||
copy->filename = g_strdup (info->filename);
|
||||
return copy;
|
||||
}
|
||||
|
||||
void
|
||||
moo_edit_file_info_free (MooEditFileInfo *info)
|
||||
{
|
||||
if (info)
|
||||
{
|
||||
g_free (info->encoding);
|
||||
g_free (info->filename);
|
||||
g_free (info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
moo_edit_is_empty (MooEdit *edit)
|
||||
{
|
||||
@ -641,15 +607,31 @@ moo_edit_focus_out (GtkWidget *widget,
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
moo_edit_file_info_get_type (void)
|
||||
MooEditFileInfo *
|
||||
moo_edit_file_info_new (const char *filename,
|
||||
const char *encoding)
|
||||
{
|
||||
static GType type = 0;
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooEditFileInfo",
|
||||
(GBoxedCopyFunc) moo_edit_file_info_copy,
|
||||
(GBoxedFreeFunc) moo_edit_file_info_free);
|
||||
return type;
|
||||
MooEditFileInfo *info = g_new0 (MooEditFileInfo, 1);
|
||||
info->filename = g_strdup (filename);
|
||||
info->encoding = g_strdup (encoding);
|
||||
return info;
|
||||
}
|
||||
|
||||
MooEditFileInfo *
|
||||
moo_edit_file_info_copy (MooEditFileInfo *info)
|
||||
{
|
||||
return info ? moo_edit_file_info_new (info->filename, info->encoding) : NULL;
|
||||
}
|
||||
|
||||
void
|
||||
moo_edit_file_info_free (MooEditFileInfo *info)
|
||||
{
|
||||
if (info)
|
||||
{
|
||||
g_free (info->encoding);
|
||||
g_free (info->filename);
|
||||
g_free (info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,20 +55,18 @@ typedef enum
|
||||
#define MOO_EDIT_IS_CLEAN(edit) (moo_edit_get_status (edit) & MOO_EDIT_CLEAN)
|
||||
#define MOO_EDIT_IS_BUSY(edit) (moo_edit_get_state (edit) != MOO_EDIT_STATE_NORMAL)
|
||||
|
||||
typedef struct _MooEditFileInfo MooEditFileInfo;
|
||||
typedef struct _MooEdit MooEdit;
|
||||
typedef struct _MooEditPrivate MooEditPrivate;
|
||||
typedef struct _MooEditClass MooEditClass;
|
||||
typedef struct MooEdit MooEdit;
|
||||
typedef struct MooEditPrivate MooEditPrivate;
|
||||
typedef struct MooEditClass MooEditClass;
|
||||
|
||||
|
||||
struct _MooEdit
|
||||
struct MooEdit
|
||||
{
|
||||
MooTextView parent;
|
||||
MooEditConfig *config;
|
||||
MooEditPrivate *priv;
|
||||
};
|
||||
|
||||
struct _MooEditClass
|
||||
struct MooEditClass
|
||||
{
|
||||
MooTextViewClass parent_class;
|
||||
|
||||
@ -111,11 +109,6 @@ MooEditStatus moo_edit_get_status (MooEdit *edit);
|
||||
void moo_edit_status_changed (MooEdit *edit);
|
||||
MooEditState moo_edit_get_state (MooEdit *edit);
|
||||
|
||||
MooEditFileInfo *moo_edit_file_info_new (const char *filename,
|
||||
const char *encoding);
|
||||
MooEditFileInfo *moo_edit_file_info_copy (const MooEditFileInfo *info);
|
||||
void moo_edit_file_info_free (MooEditFileInfo *info);
|
||||
|
||||
gboolean moo_edit_close (MooEdit *edit,
|
||||
gboolean ask_confirm);
|
||||
gboolean moo_edit_save (MooEdit *edit,
|
||||
@ -132,6 +125,12 @@ gboolean moo_edit_save_copy (MooEdit *edit,
|
||||
void moo_edit_comment (MooEdit *edit);
|
||||
void moo_edit_uncomment (MooEdit *edit);
|
||||
|
||||
typedef struct MooEditFileInfo MooEditFileInfo;
|
||||
MooEditFileInfo *moo_edit_file_info_new (const char *filename,
|
||||
const char *encoding);
|
||||
MooEditFileInfo *moo_edit_file_info_copy (MooEditFileInfo *info);
|
||||
void moo_edit_file_info_free (MooEditFileInfo *info);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "mooutils/mooactionbase.h"
|
||||
#include "mooutils/moomenuaction.h"
|
||||
#include "mooutils/mooi18n.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include "mooutils/moocompat.h"
|
||||
#include <string.h>
|
||||
#include <gobject/gvaluecollector.h>
|
||||
@ -49,7 +50,8 @@ static void append_special_char_menuitems (GtkMenuShell *menu,
|
||||
GtkTextView *view);
|
||||
|
||||
|
||||
#define MOO_EDIT_ACTIONS_QUARK (moo_edit_get_actions_quark ())
|
||||
#define MOO_EDIT_ACTIONS_QUARK (moo_edit_actions_quark ())
|
||||
MOO_DEFINE_QUARK_STATIC (moo-edit-actions, moo_edit_actions_quark)
|
||||
|
||||
typedef struct {
|
||||
MooActionFactory *action;
|
||||
@ -57,18 +59,6 @@ typedef struct {
|
||||
} ActionInfo;
|
||||
|
||||
|
||||
static GQuark
|
||||
moo_edit_get_actions_quark (void)
|
||||
{
|
||||
static GQuark q;
|
||||
|
||||
if (!q)
|
||||
q = g_quark_from_static_string ("moo-edit-actions");
|
||||
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
static ActionInfo*
|
||||
action_info_new (MooActionFactory *action,
|
||||
char **conditions)
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "mooedit/mooeditdialogs.h"
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooedit/mooeditfileops.h"
|
||||
#include "mooedit/mooedit-fileops.h"
|
||||
#include "mooutils/moodialogs.h"
|
||||
#include "mooutils/moocompat.h"
|
||||
#include "mooutils/moostock.h"
|
||||
|
@ -16,8 +16,8 @@
|
||||
#ifndef MOO_EDIT_DIALOGS_H
|
||||
#define MOO_EDIT_DIALOGS_H
|
||||
|
||||
#include "mooedit/mooedit.h"
|
||||
#include "mooutils/moodialogs.h"
|
||||
#include "mooedit/mooedit.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* mooeditfileops.h
|
||||
*
|
||||
* Copyright (C) 2004-2008 by Yevgen Muntyan <muntyan@tamu.edu>
|
||||
*
|
||||
* This file is part of medit. medit 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.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MOOEDIT_COMPILATION
|
||||
#error "This file may not be included"
|
||||
#endif
|
||||
|
||||
#ifndef MOO_EDIT_FILE_OPS_H
|
||||
#define MOO_EDIT_FILE_OPS_H
|
||||
|
||||
#include "mooedit/mooedit.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
const char *_moo_get_default_encodings (void);
|
||||
|
||||
typedef enum {
|
||||
MOO_EDIT_SAVE_BACKUP = 1 << 0
|
||||
} MooEditSaveFlags;
|
||||
|
||||
#define MOO_EDIT_FILE_ERROR (_moo_edit_file_error_quark ())
|
||||
#define MOO_EDIT_FILE_ERROR_ENCODING 0
|
||||
|
||||
GQuark _moo_edit_file_error_quark (void) G_GNUC_CONST;
|
||||
|
||||
gboolean _moo_edit_load_file (MooEdit *edit,
|
||||
const char *file,
|
||||
const char *encoding,
|
||||
GError **error);
|
||||
gboolean _moo_edit_reload_file (MooEdit *edit,
|
||||
const char *encoding,
|
||||
GError **error);
|
||||
gboolean _moo_edit_save_file (MooEdit *edit,
|
||||
const char *file,
|
||||
const char *encoding,
|
||||
MooEditSaveFlags flags,
|
||||
GError **error);
|
||||
gboolean _moo_edit_save_file_copy (MooEdit *edit,
|
||||
const char *file,
|
||||
const char *encoding,
|
||||
GError **error);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* MOO_EDIT_FILE_OPS_H */
|
@ -16,7 +16,7 @@
|
||||
#define MOOEDIT_COMPILATION
|
||||
#include "mooedit/mooeditor-private.h"
|
||||
#include "mooedit/mooeditdialogs.h"
|
||||
#include "mooedit/mooeditfileops.h"
|
||||
#include "mooedit/mooedit-fileops.h"
|
||||
#include "mooedit/mooplugin.h"
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooedit/mooedit-private.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define MOOEDIT_COMPILATION
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooeditfileops.h"
|
||||
#include "mooedit/mooedit-fileops.h"
|
||||
#include "mooedit/mootextview-private.h"
|
||||
#include "mooedit/mooedit-enums.h"
|
||||
#include "mooedit/mootextbuffer.h"
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "mooedit/mookeyfile.h"
|
||||
#include "mooutils/mooutils-gobject.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@ -47,6 +48,12 @@ typedef struct {
|
||||
|
||||
#define CHAR_IS_SPACE(c__) ((c__) == ' ' || (c__) == '\t')
|
||||
|
||||
#define MOO_KEY_FILE_ERROR (moo_key_file_error_quark ())
|
||||
MOO_DEFINE_QUARK_STATIC (moo-key-file-error, moo_key_file_error_quark)
|
||||
|
||||
MOO_DEFINE_BOXED_TYPE_R (MooKeyFile, moo_key_file)
|
||||
MOO_DEFINE_POINTER_TYPE (MooKeyFileItem, moo_key_file_item)
|
||||
|
||||
static gboolean moo_key_file_parse_file (MooKeyFile *key_file,
|
||||
const char *filename,
|
||||
GError **error);
|
||||
@ -85,9 +92,6 @@ static gboolean line_is_blank (const char *line,
|
||||
gsize line_len,
|
||||
guint *indent);
|
||||
|
||||
#define MOO_KEY_FILE_ERROR (moo_key_file_error_quark ())
|
||||
static GQuark moo_key_file_error_quark (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
static void
|
||||
get_line (const char *line,
|
||||
@ -790,39 +794,6 @@ moo_key_file_item_set_content (MooKeyFileItem *item,
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
moo_key_file_get_type (void)
|
||||
{
|
||||
static GType type;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooKeyFile",
|
||||
(GBoxedCopyFunc) moo_key_file_ref,
|
||||
(GBoxedFreeFunc) moo_key_file_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
moo_key_file_item_get_type (void)
|
||||
{
|
||||
static GType type;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_pointer_type_register_static ("MooKeyFileItem");
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
static GQuark
|
||||
moo_key_file_error_quark (void)
|
||||
{
|
||||
return g_quark_from_static_string ("moo-key-file-error");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
format_key (const char *key,
|
||||
const char *value,
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "marshals.h"
|
||||
#include "mooutils/mooutils-debug.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@ -290,7 +291,6 @@ moo_file_line_data_new (const char *file,
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
static MooFileLineData *
|
||||
moo_file_line_data_copy (MooFileLineData *data)
|
||||
{
|
||||
@ -305,7 +305,6 @@ moo_file_line_data_copy (MooFileLineData *data)
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
moo_file_line_data_free (MooFileLineData *data)
|
||||
{
|
||||
@ -316,19 +315,7 @@ moo_file_line_data_free (MooFileLineData *data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
moo_file_line_data_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooFileLineData",
|
||||
(GBoxedCopyFunc) moo_file_line_data_copy,
|
||||
(GBoxedFreeFunc) moo_file_line_data_free);
|
||||
|
||||
return type;
|
||||
}
|
||||
MOO_DEFINE_BOXED_TYPE_C (MooFileLineData, moo_file_line_data)
|
||||
|
||||
|
||||
const char *
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mooutils-debug.h"
|
||||
#include "mooutils/moohelp.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include "help-sections.h"
|
||||
#include <string.h>
|
||||
#include <gmodule.h>
|
||||
@ -52,6 +53,8 @@ static PluginStore *plugin_store = NULL;
|
||||
#define MOO_PLUGIN_QUARK plugin_store->plugin_quark
|
||||
#define MOO_PLUGIN_METHS_QUARK plugin_store->meths_quark
|
||||
|
||||
MOO_DEFINE_BOXED_TYPE_C (MooPluginInfo, moo_plugin_info)
|
||||
MOO_DEFINE_BOXED_TYPE_C (MooPluginParams, moo_plugin_params)
|
||||
|
||||
static void plugin_store_init (void);
|
||||
static void plugin_store_add (MooPlugin *plugin);
|
||||
@ -1202,34 +1205,6 @@ moo_plugin_params_free (MooPluginParams *params)
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
moo_plugin_info_get_type (void)
|
||||
{
|
||||
static GType type;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooPluginInfo",
|
||||
(GBoxedCopyFunc) moo_plugin_info_copy,
|
||||
(GBoxedFreeFunc) moo_plugin_info_free);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
moo_plugin_params_get_type (void)
|
||||
{
|
||||
static GType type;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooPluginParams",
|
||||
(GBoxedCopyFunc) moo_plugin_params_copy,
|
||||
(GBoxedFreeFunc) moo_plugin_params_free);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* Preferences dialog
|
||||
*/
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "mooutils/mooi18n.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mooutils-debug.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include "glade/mooprint-gxml.h"
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
@ -263,7 +264,7 @@ moo_print_settings_new_default (void)
|
||||
|
||||
|
||||
static MooPrintSettings *
|
||||
moo_print_settings_copy (MooPrintSettings *settings)
|
||||
_moo_print_settings_copy (MooPrintSettings *settings)
|
||||
{
|
||||
MooPrintSettings *copy;
|
||||
|
||||
@ -279,9 +280,8 @@ moo_print_settings_copy (MooPrintSettings *settings)
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_print_settings_free (MooPrintSettings *settings)
|
||||
_moo_print_settings_free (MooPrintSettings *settings)
|
||||
{
|
||||
if (settings)
|
||||
{
|
||||
@ -293,19 +293,7 @@ moo_print_settings_free (MooPrintSettings *settings)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
_moo_print_settings_get_type (void)
|
||||
{
|
||||
static GType t = 0;
|
||||
|
||||
if (G_UNLIKELY (!t))
|
||||
t = g_boxed_type_register_static ("MooPrintSettings",
|
||||
(GBoxedCopyFunc) moo_print_settings_copy,
|
||||
(GBoxedFreeFunc) moo_print_settings_free);
|
||||
|
||||
return t;
|
||||
}
|
||||
MOO_DEFINE_BOXED_TYPE_C (MooPrintSettings, _moo_print_settings)
|
||||
|
||||
|
||||
static void
|
||||
@ -316,10 +304,10 @@ moo_print_operation_set_settings (MooPrintOperation *op,
|
||||
|
||||
if (op->priv->settings != settings)
|
||||
{
|
||||
moo_print_settings_free (op->priv->settings);
|
||||
_moo_print_settings_free (op->priv->settings);
|
||||
|
||||
if (settings)
|
||||
op->priv->settings = moo_print_settings_copy (settings);
|
||||
op->priv->settings = _moo_print_settings_copy (settings);
|
||||
else
|
||||
op->priv->settings = moo_print_settings_new_default ();
|
||||
|
||||
@ -341,7 +329,7 @@ moo_print_operation_finalize (GObject *object)
|
||||
if (op->priv->buffer)
|
||||
g_object_unref (op->priv->buffer);
|
||||
|
||||
moo_print_settings_free (op->priv->settings);
|
||||
_moo_print_settings_free (op->priv->settings);
|
||||
g_free (op->priv->filename);
|
||||
g_free (op->priv->basename);
|
||||
g_free (op->priv->tm);
|
||||
@ -1630,7 +1618,7 @@ moo_print_operation_load_prefs (MooPrintOperation *op)
|
||||
{
|
||||
MooPrintSettings *settings = get_settings_from_prefs ();
|
||||
moo_print_operation_set_settings (op, settings);
|
||||
moo_print_settings_free (settings);
|
||||
_moo_print_settings_free (settings);
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,16 +71,6 @@ typedef struct {
|
||||
|
||||
typedef MooEditActionClass MooToolActionClass;
|
||||
|
||||
MOO_DEFINE_TYPE_STATIC (MooToolAction, _moo_tool_action, MOO_TYPE_EDIT_ACTION)
|
||||
#define MOO_TYPE_TOOL_ACTION (_moo_tool_action_get_type())
|
||||
#define MOO_IS_TOOL_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, MOO_TYPE_TOOL_ACTION))
|
||||
#define MOO_TOOL_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, MOO_TYPE_TOOL_ACTION, MooToolAction))
|
||||
|
||||
|
||||
static const char *FILENAMES[N_TOOLS] = {"menu.cfg", "context.cfg"};
|
||||
static ToolStore *tools_stores[N_TOOLS];
|
||||
|
||||
|
||||
static MooCommandContext *create_command_context (gpointer window,
|
||||
gpointer doc);
|
||||
static MooUserToolInfo *_moo_user_tool_info_ref (MooUserToolInfo *info);
|
||||
@ -88,6 +78,14 @@ static void add_info (MooUserToolInfo *info,
|
||||
GSList **list,
|
||||
GHashTable *ids);
|
||||
|
||||
MOO_DEFINE_BOXED_TYPE_R (MooUserToolInfo, _moo_user_tool_info)
|
||||
MOO_DEFINE_TYPE_STATIC (MooToolAction, _moo_tool_action, MOO_TYPE_EDIT_ACTION)
|
||||
#define MOO_TYPE_TOOL_ACTION (_moo_tool_action_get_type())
|
||||
#define MOO_IS_TOOL_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, MOO_TYPE_TOOL_ACTION))
|
||||
#define MOO_TOOL_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST (obj, MOO_TYPE_TOOL_ACTION, MooToolAction))
|
||||
|
||||
static const char *FILENAMES[N_TOOLS] = {"menu.cfg", "context.cfg"};
|
||||
static ToolStore *tools_stores[N_TOOLS];
|
||||
|
||||
static void
|
||||
unload_user_tools (int type)
|
||||
@ -1136,20 +1134,6 @@ _moo_user_tool_info_unref (MooUserToolInfo *info)
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
_moo_user_tool_info_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooUserToolInfo",
|
||||
(GBoxedCopyFunc) _moo_user_tool_info_ref,
|
||||
(GBoxedFreeFunc) _moo_user_tool_info_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
moo_tool_action_set_property (GObject *object,
|
||||
guint property_id,
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ctags-view.h"
|
||||
#include "readtags.h"
|
||||
#include <mooutils/mooutils-misc.h>
|
||||
#include <mooutils/mootype-macros.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
@ -27,6 +28,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
MOO_DEFINE_BOXED_TYPE_R (MooCtagsEntry, _moo_ctags_entry)
|
||||
G_DEFINE_TYPE (MooCtagsDocPlugin, _moo_ctags_doc_plugin, MOO_TYPE_DOC_PLUGIN)
|
||||
|
||||
struct _MooCtagsDocPluginPrivate
|
||||
@ -381,20 +383,6 @@ moo_ctags_doc_plugin_update (MooCtagsDocPlugin *plugin)
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
_moo_ctags_entry_get_type (void)
|
||||
{
|
||||
static GType type;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooCtagsEntry",
|
||||
(GBoxedCopyFunc) _moo_ctags_entry_ref,
|
||||
(GBoxedFreeFunc) _moo_ctags_entry_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
MooCtagsEntry *
|
||||
_moo_ctags_entry_ref (MooCtagsEntry *entry)
|
||||
{
|
||||
|
@ -162,6 +162,7 @@ static gboolean drag_dest_row_drop_possible (GtkTreeDragDest *drag_dest,
|
||||
GtkTreePath *dest_path,
|
||||
GtkSelectionData *selection_data);
|
||||
|
||||
MOO_DEFINE_BOXED_TYPE_STATIC_R (MooFileListItem, item)
|
||||
MOO_DEFINE_TYPE_STATIC_WITH_CODE (FileList, file_list, GTK_TYPE_TREE_STORE,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE,
|
||||
file_list_drag_source_iface_init)
|
||||
@ -436,19 +437,6 @@ item_unref (Item *item)
|
||||
}
|
||||
}
|
||||
|
||||
static GType
|
||||
item_get_type (void)
|
||||
{
|
||||
static GType type;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooFileListItem",
|
||||
(GBoxedCopyFunc) item_ref,
|
||||
(GBoxedFreeFunc) item_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
file_list_iter_is_auto (FileList *list,
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "mooutils/mooactionfactory.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/moostock.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include "glade/moobookmark-editor-gxml.h"
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
@ -66,7 +67,7 @@ static gboolean mgr_update_menus (MooBookmarkMgr *mgr);
|
||||
static MooBookmark *_moo_bookmark_copy (MooBookmark *bookmark);
|
||||
|
||||
|
||||
/* MOO_TYPE_BOOKMARK_MGR */
|
||||
MOO_DEFINE_BOXED_TYPE_C (MooBookmark, _moo_bookmark)
|
||||
G_DEFINE_TYPE (MooBookmarkMgr, _moo_bookmark_mgr, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
@ -269,18 +270,6 @@ _moo_bookmark_free (MooBookmark *bookmark)
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
_moo_bookmark_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooBookmark",
|
||||
(GBoxedCopyFunc) _moo_bookmark_copy,
|
||||
(GBoxedFreeFunc) _moo_bookmark_free);
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void
|
||||
_moo_bookmark_set_path (MooBookmark *bookmark,
|
||||
|
@ -28,8 +28,6 @@ G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define MOO_TYPE_FILE (_moo_file_get_type ())
|
||||
#define MOO_TYPE_FILE_INFO (_moo_file_info_get_type ())
|
||||
#define MOO_TYPE_FILE_FLAGS (_moo_file_flags_get_type ())
|
||||
|
||||
#ifdef __WIN32__
|
||||
/* FILETIME */
|
||||
@ -60,8 +58,6 @@ struct _MooFile
|
||||
|
||||
|
||||
GType _moo_file_get_type (void) G_GNUC_CONST;
|
||||
GType _moo_file_flags_get_type (void) G_GNUC_CONST;
|
||||
GType _moo_file_info_get_type (void) G_GNUC_CONST;
|
||||
|
||||
MooFile *_moo_file_new (const char *dirname,
|
||||
const char *basename);
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "mooutils/moofileicon.h"
|
||||
#include "mooutils/mooutils-fs.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include "mooutils/mooutils-debug.h"
|
||||
#include "mooutils/moocompat.h"
|
||||
#include "marshals.h"
|
||||
@ -63,8 +64,9 @@ G_STMT_START { \
|
||||
static MooIconType get_folder_icon (const char *path);
|
||||
static MooIconEmblem get_icon_flags (const MooFile *file);
|
||||
|
||||
#define MAKE_PATH(dirname,file) g_build_filename (dirname, file->name, NULL)
|
||||
MOO_DEFINE_BOXED_TYPE_R (MooFile, _moo_file)
|
||||
|
||||
#define MAKE_PATH(dirname,file) g_build_filename (dirname, file->name, NULL)
|
||||
|
||||
void
|
||||
_moo_file_find_mime_type (MooFile *file,
|
||||
@ -570,60 +572,6 @@ _moo_file_get_stat (const MooFile *file)
|
||||
#endif
|
||||
|
||||
|
||||
GType
|
||||
_moo_file_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooFile",
|
||||
(GBoxedCopyFunc) _moo_file_ref,
|
||||
(GBoxedFreeFunc) _moo_file_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
_moo_file_flags_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
static const GFlagsValue values[] = {
|
||||
{ MOO_FILE_HAS_MIME_TYPE, (char*)"MOO_FILE_HAS_MIME_TYPE", (char*)"has-mime-type" },
|
||||
{ MOO_FILE_HAS_ICON, (char*)"MOO_FILE_HAS_ICON", (char*)"has-icon" },
|
||||
{ MOO_FILE_HAS_STAT, (char*)"MOO_FILE_HAS_STAT", (char*)"has-stat" },
|
||||
{ MOO_FILE_ALL_FLAGS, (char*)"MOO_FILE_ALL_FLAGS", (char*)"all-flags" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_flags_register_static ("MooFileFlags", values);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
_moo_file_info_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
static const GFlagsValue values[] = {
|
||||
{ MOO_FILE_INFO_EXISTS, (char*)"MOO_FILE_INFO_EXISTS", (char*)"exists" },
|
||||
{ MOO_FILE_INFO_IS_DIR, (char*)"MOO_FILE_INFO_IS_DIR", (char*)"is-folder" },
|
||||
{ MOO_FILE_INFO_IS_HIDDEN, (char*)"MOO_FILE_INFO_IS_HIDDEN", (char*)"is-hidden" },
|
||||
{ MOO_FILE_INFO_IS_LINK, (char*)"MOO_FILE_INFO_IS_LINK", (char*)"is-link" },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_flags_register_static ("MooFileInfo", values);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
guint8
|
||||
_moo_file_get_icon_type (MooFile *file,
|
||||
const char *dirname)
|
||||
|
@ -19,9 +19,11 @@
|
||||
#endif
|
||||
#include "moopython/moopython-utils.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#define NO_IMPORT_PYGOBJECT
|
||||
#include "pygobject.h"
|
||||
|
||||
MOO_DEFINE_BOXED_TYPE_R (MooPyObject, _moo_py_object)
|
||||
|
||||
PyObject *
|
||||
_moo_strv_to_pyobject (char **strv)
|
||||
@ -271,20 +273,6 @@ _moo_py_object_unref (PyObject *obj)
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
_moo_py_object_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooPyObject",
|
||||
(GBoxedCopyFunc) _moo_py_object_ref,
|
||||
(GBoxedFreeFunc) _moo_py_object_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
_moo_py_err_string (void)
|
||||
{
|
||||
|
@ -14,9 +14,13 @@
|
||||
*/
|
||||
|
||||
#include "mooutils/mooclosure.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include "marshals.h"
|
||||
|
||||
|
||||
MOO_DEFINE_BOXED_TYPE_R (MooClosure, moo_closure)
|
||||
|
||||
|
||||
MooClosure*
|
||||
moo_closure_alloc (gsize size,
|
||||
MooClosureCall call,
|
||||
@ -117,20 +121,6 @@ moo_closure_invalidate (MooClosure *closure)
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
moo_closure_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooClosure",
|
||||
(GBoxedCopyFunc) moo_closure_ref,
|
||||
(GBoxedFreeFunc) moo_closure_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
/* MooClosureSignal
|
||||
*/
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mooutils-mem.h"
|
||||
#include "mooutils/moofilewatch.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include "marshals.h"
|
||||
#include "mooutils/mooutils-thread.h"
|
||||
|
||||
@ -102,9 +103,6 @@ struct _MooFileWatch {
|
||||
guint alive : 1;
|
||||
};
|
||||
|
||||
|
||||
#define MOO_FILE_WATCH_ERROR (moo_file_watch_error_quark ())
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MOO_FILE_WATCH_ERROR_CLOSED,
|
||||
@ -118,8 +116,10 @@ typedef enum
|
||||
MOO_FILE_WATCH_ERROR_ACCESS_DENIED
|
||||
} MooFileWatchError;
|
||||
|
||||
static GQuark moo_file_watch_error_quark (void);
|
||||
MOO_DEFINE_BOXED_TYPE_R (MooFileWatch, moo_file_watch)
|
||||
|
||||
#define MOO_FILE_WATCH_ERROR (moo_file_watch_error_quark ())
|
||||
MOO_DEFINE_QUARK_STATIC (moo-file-watch-error, moo_file_watch_error_quark)
|
||||
|
||||
#ifdef MOO_USE_FAM
|
||||
static gboolean watch_fam_start (MooFileWatch *watch,
|
||||
@ -265,30 +265,6 @@ moo_file_watch_new (GError **error)
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
moo_file_watch_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooFileWatch",
|
||||
(GBoxedCopyFunc) moo_file_watch_ref,
|
||||
(GBoxedFreeFunc) moo_file_watch_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
static GQuark
|
||||
moo_file_watch_error_quark (void)
|
||||
{
|
||||
static GQuark quark = 0;
|
||||
if (G_UNLIKELY (!quark))
|
||||
quark = g_quark_from_static_string ("moo-file-watch-error");
|
||||
return quark;
|
||||
}
|
||||
|
||||
|
||||
static MooFileEvent *
|
||||
moo_file_event_new (const char *filename,
|
||||
guint monitor_id,
|
||||
@ -332,18 +308,7 @@ moo_file_event_free (MooFileEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
GType
|
||||
moo_file_event_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooFileEvent",
|
||||
(GBoxedCopyFunc) moo_file_event_copy,
|
||||
(GBoxedFreeFunc) moo_file_event_free);
|
||||
|
||||
return type;
|
||||
}
|
||||
MOO_DEFINE_BOXED_TYPE_C (MooFileEvent, moo_file_event)
|
||||
|
||||
|
||||
gboolean
|
||||
|
@ -33,20 +33,20 @@
|
||||
#include "mooutils/mooentry.h"
|
||||
#include "mooutils/mooaccelbutton.h"
|
||||
#include "mooutils/mooi18n.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
G_DEFINE_TYPE (MooGladeXML, moo_glade_xml, G_TYPE_OBJECT)
|
||||
|
||||
typedef enum {
|
||||
MOO_GLADE_XML_ERROR_FAILED
|
||||
} MooGladeXMLError;
|
||||
|
||||
#define MOO_GLADE_XML_ERROR (moo_glade_xml_error_quark ())
|
||||
static GQuark moo_glade_xml_error_quark (void) G_GNUC_CONST;
|
||||
MOO_DEFINE_QUARK_STATIC (moo-glade-xml-error, moo_glade_xml_error_quark)
|
||||
|
||||
G_DEFINE_TYPE (MooGladeXML, moo_glade_xml, G_TYPE_OBJECT)
|
||||
|
||||
#define FOREACH_ELM_START(parent,elm) \
|
||||
G_STMT_START { \
|
||||
@ -2602,13 +2602,6 @@ func_data_pair_free (FuncDataPair *pair)
|
||||
}
|
||||
|
||||
|
||||
static GQuark
|
||||
moo_glade_xml_error_quark (void)
|
||||
{
|
||||
return g_quark_from_static_string ("moo-glade-xml-error");
|
||||
}
|
||||
|
||||
|
||||
#define REGISTER_TYPE(class_name,type) \
|
||||
if (!strcmp (name, class_name)) \
|
||||
return type
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "marshals.h"
|
||||
#include "mooutils/moohistorylist.h"
|
||||
#include "mooutils/mooprefs.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -46,6 +47,8 @@ struct _MooHistoryListPrivate {
|
||||
gboolean allow_empty;
|
||||
};
|
||||
|
||||
MOO_DEFINE_BOXED_TYPE_C (MooHistoryItem, moo_history_item)
|
||||
|
||||
static GHashTable *named_lists;
|
||||
|
||||
static void moo_history_list_class_init (MooHistoryListClass *klass);
|
||||
@ -730,20 +733,6 @@ moo_history_list_get (const char *user_id)
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
moo_history_item_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooHistoryItem",
|
||||
(GBoxedCopyFunc) moo_history_item_copy,
|
||||
(GBoxedFreeFunc) moo_history_item_free);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
GtkTreeModel*
|
||||
moo_history_list_get_model (MooHistoryList *list)
|
||||
{
|
||||
|
@ -17,37 +17,18 @@
|
||||
#include "mooutils/mooutils-fs.h"
|
||||
#include "mooutils/mooutils-gobject.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
|
||||
GType
|
||||
moo_markup_doc_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooMarkupDoc",
|
||||
(GBoxedCopyFunc) moo_markup_doc_ref,
|
||||
(GBoxedFreeFunc) moo_markup_doc_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
GQuark
|
||||
moo_parse_error_quark (void)
|
||||
{
|
||||
static GQuark q;
|
||||
if (G_UNLIKELY (!q))
|
||||
q = g_quark_from_static_string ("moo-parse-error");
|
||||
return q;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
MooMarkupDoc *doc;
|
||||
MooMarkupNode *current;
|
||||
} ParserState;
|
||||
|
||||
MOO_DEFINE_BOXED_TYPE_R (MooMarkupDoc, moo_markup_doc)
|
||||
MOO_DEFINE_QUARK (moo-parse-error, moo_parse_error_quark)
|
||||
|
||||
static MooMarkupDoc *moo_markup_doc_new_priv (const char *name);
|
||||
static void moo_markup_doc_set_name (MooMarkupDoc *doc,
|
||||
|
@ -80,4 +80,72 @@ type_name##_get_type (void)
|
||||
MOO_DEFINE_TYPE_STATIC_WITH_CODE (TypeName, type_name, TYPE_PARENT, {})
|
||||
|
||||
|
||||
#define MOO_DEFINE_BOXED_TYPE__(TypeName,type_name,copy_func,free_func) \
|
||||
{ \
|
||||
static GType g_define_type_id; \
|
||||
\
|
||||
if (G_UNLIKELY (!g_define_type_id)) \
|
||||
g_define_type_id = \
|
||||
g_boxed_type_register_static (#TypeName, \
|
||||
(GBoxedCopyFunc) copy_func, \
|
||||
(GBoxedFreeFunc) free_func); \
|
||||
\
|
||||
return g_define_type_id; \
|
||||
}
|
||||
|
||||
#define MOO_DEFINE_BOXED_TYPE(TypeName,type_name,copy_func,free_func) \
|
||||
GType type_name##_get_type (void) \
|
||||
MOO_DEFINE_BOXED_TYPE__(TypeName,type_name,copy_func,free_func)
|
||||
|
||||
#define MOO_DEFINE_BOXED_TYPE_C(TypeName,type_name) \
|
||||
MOO_DEFINE_BOXED_TYPE(TypeName,type_name,type_name##_copy,type_name##_free)
|
||||
|
||||
#define MOO_DEFINE_BOXED_TYPE_R(TypeName,type_name) \
|
||||
MOO_DEFINE_BOXED_TYPE(TypeName,type_name,type_name##_ref,type_name##_unref)
|
||||
|
||||
#define MOO_DEFINE_BOXED_TYPE_STATIC(TypeName,type_name,copy_func,free_func) \
|
||||
static GType type_name##_get_type (void) G_GNUC_CONST; \
|
||||
static GType type_name##_get_type (void) \
|
||||
MOO_DEFINE_BOXED_TYPE__(TypeName,type_name,copy_func,free_func)
|
||||
|
||||
#define MOO_DEFINE_BOXED_TYPE_STATIC_C(TypeName,type_name) \
|
||||
MOO_DEFINE_BOXED_TYPE_STATIC(TypeName,type_name,type_name##_copy,type_name##_free)
|
||||
|
||||
#define MOO_DEFINE_BOXED_TYPE_STATIC_R(TypeName,type_name) \
|
||||
MOO_DEFINE_BOXED_TYPE_STATIC(TypeName,type_name,type_name##_ref,type_name##_unref)
|
||||
|
||||
|
||||
#define MOO_DEFINE_POINTER_TYPE(TypeName,type_name) \
|
||||
GType type_name##_get_type (void) \
|
||||
{ \
|
||||
static GType g_define_type_id; \
|
||||
\
|
||||
if (G_UNLIKELY (!g_define_type_id)) \
|
||||
g_define_type_id = \
|
||||
g_pointer_type_register_static (#TypeName); \
|
||||
\
|
||||
return g_define_type_id; \
|
||||
}
|
||||
|
||||
|
||||
#define MOO_DEFINE_QUARK__(QuarkName) \
|
||||
{ \
|
||||
static GQuark q; \
|
||||
\
|
||||
if (G_UNLIKELY (!q)) \
|
||||
q = g_quark_from_static_string (#QuarkName); \
|
||||
\
|
||||
return q; \
|
||||
}
|
||||
|
||||
#define MOO_DEFINE_QUARK(QuarkName,quark_func) \
|
||||
GQuark quark_func (void) \
|
||||
MOO_DEFINE_QUARK__(QuarkName)
|
||||
|
||||
#define MOO_DEFINE_QUARK_STATIC(QuarkName,quark_func) \
|
||||
static GQuark quark_func (void) G_GNUC_CONST; \
|
||||
static GQuark quark_func (void) \
|
||||
MOO_DEFINE_QUARK__(QuarkName)
|
||||
|
||||
|
||||
#endif /* MOO_TYPE_MACROS_H */
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "mooutils/moomenutoolbutton.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mooi18n.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -80,6 +81,8 @@ typedef enum {
|
||||
|
||||
#define TOPLEVEL_QUARK (toplevel_quark ())
|
||||
#define NODE_QUARK (node_quark ())
|
||||
MOO_DEFINE_QUARK_STATIC (moo-ui-xml-toplevel, toplevel_quark)
|
||||
MOO_DEFINE_QUARK_STATIC (moo-ui-xml-node, node_quark)
|
||||
|
||||
#define SLIST_FOREACH(list,var) \
|
||||
G_STMT_START { \
|
||||
@ -141,9 +144,6 @@ static void toplevel_free (Toplevel *toplevel);
|
||||
static GtkWidget *toplevel_get_widget (Toplevel *toplevel,
|
||||
Node *node);
|
||||
|
||||
static GQuark toplevel_quark (void);
|
||||
static GQuark node_quark (void);
|
||||
|
||||
static void xml_add_item_widget (MooUIXML *xml,
|
||||
GtkWidget *widget);
|
||||
static void xml_add_widget (MooUIXML *xml,
|
||||
@ -1457,23 +1457,6 @@ toplevel_free (Toplevel *toplevel)
|
||||
}
|
||||
|
||||
|
||||
static GQuark toplevel_quark (void)
|
||||
{
|
||||
static GQuark q = 0;
|
||||
if (!q)
|
||||
q = g_quark_from_static_string ("moo-ui-xml-toplevel");
|
||||
return q;
|
||||
}
|
||||
|
||||
static GQuark node_quark (void)
|
||||
{
|
||||
static GQuark q = 0;
|
||||
if (!q)
|
||||
q = g_quark_from_static_string ("moo-ui-xml-node");
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
static Node *
|
||||
get_effective_parent (Node *node)
|
||||
{
|
||||
|
@ -51,6 +51,7 @@
|
||||
|
||||
#define BROKEN_NAME "<" "????" ">"
|
||||
|
||||
MOO_DEFINE_QUARK (moo-file-error-quark, _moo_file_error_quark)
|
||||
|
||||
/* XXX fix this */
|
||||
gboolean
|
||||
@ -342,18 +343,6 @@ _moo_rename_file (const char *path,
|
||||
}
|
||||
|
||||
|
||||
GQuark
|
||||
_moo_file_error_quark (void)
|
||||
{
|
||||
static GQuark quark = 0;
|
||||
|
||||
if (quark == 0)
|
||||
quark = g_quark_from_static_string ("moo-file-error-quark");
|
||||
|
||||
return quark;
|
||||
}
|
||||
|
||||
|
||||
MooFileError
|
||||
_moo_file_error_from_errno (int code)
|
||||
{
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "mooutils/mooutils-gobject-private.h"
|
||||
#include "mooutils/mooclosure.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include <gobject/gvaluecollector.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
@ -1993,7 +1994,6 @@ _moo_ptr_ref (MooPtr *ptr)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_moo_ptr_unref (MooPtr *ptr)
|
||||
{
|
||||
@ -2005,6 +2005,7 @@ _moo_ptr_unref (MooPtr *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
MOO_DEFINE_BOXED_TYPE_R (MooPtr, _moo_ptr)
|
||||
|
||||
static MooPtr *
|
||||
_moo_ptr_new (gpointer data,
|
||||
@ -2024,20 +2025,6 @@ _moo_ptr_new (gpointer data,
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
_moo_ptr_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooPtr",
|
||||
(GBoxedCopyFunc) _moo_ptr_ref,
|
||||
(GBoxedFreeFunc) _moo_ptr_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
static MooData *
|
||||
_moo_data_ref (MooData *data)
|
||||
{
|
||||
@ -2057,19 +2044,7 @@ _moo_data_unref (MooData *data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GType
|
||||
_moo_data_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (G_UNLIKELY (!type))
|
||||
type = g_boxed_type_register_static ("MooData",
|
||||
(GBoxedCopyFunc) _moo_data_ref,
|
||||
(GBoxedFreeFunc) _moo_data_unref);
|
||||
|
||||
return type;
|
||||
}
|
||||
MOO_DEFINE_BOXED_TYPE_R (MooData, _moo_data)
|
||||
|
||||
|
||||
static void
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mooutils-mem.h"
|
||||
#include "mooutils/mooeditops.h"
|
||||
#include "mooutils/mootype-macros.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
@ -1210,9 +1211,12 @@ get_toolbar_style (MooWindow *window)
|
||||
/* Actions
|
||||
*/
|
||||
|
||||
#define MOO_WINDOW_NAME_QUARK (get_quark__(0))
|
||||
#define MOO_WINDOW_ID_QUARK (get_quark__(1))
|
||||
#define MOO_WINDOW_ACTIONS_QUARK_ (get_quark__(2))
|
||||
#define MOO_WINDOW_NAME_QUARK (moo_window_name_quark ())
|
||||
MOO_DEFINE_QUARK_STATIC (moo-window-name, moo_window_name_quark)
|
||||
#define MOO_WINDOW_ID_QUARK (moo_window_id_quark ())
|
||||
MOO_DEFINE_QUARK_STATIC (moo-window-id, moo_window_id_quark)
|
||||
#define MOO_WINDOW_ACTIONS_QUARK (moo_window_actions_quark ())
|
||||
MOO_DEFINE_QUARK_STATIC (moo-window-actions, moo_window_actions_quark)
|
||||
|
||||
typedef struct {
|
||||
GHashTable *groups; /* name -> display_name */
|
||||
@ -1235,24 +1239,6 @@ typedef struct {
|
||||
} ActionInfo;
|
||||
|
||||
|
||||
static GQuark
|
||||
get_quark__ (guint n)
|
||||
{
|
||||
static GQuark q[3];
|
||||
|
||||
g_assert (n < 3);
|
||||
|
||||
if (!q[0])
|
||||
{
|
||||
q[0] = g_quark_from_static_string ("moo-window-name");
|
||||
q[1] = g_quark_from_static_string ("moo-window-id");
|
||||
q[2] = g_quark_from_static_string ("moo-window-actions");
|
||||
}
|
||||
|
||||
return q[n];
|
||||
}
|
||||
|
||||
|
||||
static ActionInfo*
|
||||
action_info_new (MooActionFactory *action,
|
||||
const char *group,
|
||||
@ -1308,19 +1294,19 @@ action_store_new (void)
|
||||
static ActionStore *
|
||||
type_get_store (GType type)
|
||||
{
|
||||
return g_type_get_qdata (type, MOO_WINDOW_ACTIONS_QUARK_);
|
||||
return g_type_get_qdata (type, MOO_WINDOW_ACTIONS_QUARK);
|
||||
}
|
||||
|
||||
|
||||
static ActionStore *
|
||||
type_ensure_store (GType type)
|
||||
{
|
||||
ActionStore *store = g_type_get_qdata (type, MOO_WINDOW_ACTIONS_QUARK_);
|
||||
ActionStore *store = g_type_get_qdata (type, MOO_WINDOW_ACTIONS_QUARK);
|
||||
|
||||
if (!store)
|
||||
{
|
||||
store = action_store_new ();
|
||||
g_type_set_qdata (type, MOO_WINDOW_ACTIONS_QUARK_, store);
|
||||
g_type_set_qdata (type, MOO_WINDOW_ACTIONS_QUARK, store);
|
||||
}
|
||||
|
||||
return store;
|
||||
|
@ -14,7 +14,7 @@ moo/mooedit/moocommand-exe.c
|
||||
moo/mooedit/moocommand-lua.c
|
||||
moo/mooedit/mooeditaction-factory.c
|
||||
moo/mooedit/mooeditdialogs.c
|
||||
moo/mooedit/mooeditfileops.c
|
||||
moo/mooedit/mooedit-fileops.c
|
||||
moo/mooedit/mooeditor.c
|
||||
moo/mooedit/mooeditprefspage.c
|
||||
moo/mooedit/mooeditwindow.c
|
||||
|
@ -26,7 +26,7 @@ moo/mooedit/moocommand-exe.c
|
||||
moo/mooedit/moocommand-lua.c
|
||||
moo/mooedit/mooeditaction-factory.c
|
||||
moo/mooedit/mooeditdialogs.c
|
||||
moo/mooedit/mooeditfileops.c
|
||||
moo/mooedit/mooedit-fileops.c
|
||||
moo/mooedit/mooeditor.c
|
||||
moo/mooedit/mooeditprefspage.c
|
||||
moo/mooedit/mooeditwindow.c
|
||||
|
Loading…
x
Reference in New Issue
Block a user