Made few files c++-friendly
This commit is contained in:
parent
c7e503627d
commit
076aae1aac
@ -181,7 +181,7 @@ MOO_CHECK_COMPILER_FLAGS(GCC -Wno-missing-field-initializers -Wno-overlength-str
|
||||
|
||||
MOO_CHECK_COMPILER_FLAGS(GCC DEBUG -ftrapv)
|
||||
|
||||
MOO_ADD_COMPILER_FLAGS(GCC CXX -std=c++98 -pedantic)
|
||||
MOO_ADD_COMPILER_FLAGS(GCC CXX -std=c++98)
|
||||
MOO_CHECK_COMPILER_FLAGS(GCC CXX -fno-rtti)
|
||||
MOO_CHECK_COMPILER_FLAGS(GCC CXX RELEASE -fno-enforce-eh-specs)
|
||||
|
||||
|
@ -21,6 +21,7 @@ SET(MOOEDIT_SOURCES
|
||||
mooedit-bookmarks.c
|
||||
mooedit-bookmarks.h
|
||||
mooedit.c
|
||||
mooedit.h
|
||||
mooeditconfig.c
|
||||
mooeditconfig.h
|
||||
mooeditdialogs.c
|
||||
@ -29,7 +30,7 @@ SET(MOOEDIT_SOURCES
|
||||
mooedit-fileops.h
|
||||
mooeditfiltersettings.c
|
||||
mooeditfiltersettings.h
|
||||
mooedit.h
|
||||
mooedit-impl.h
|
||||
mooedit-lua-api.c
|
||||
mooedit-lua.c
|
||||
mooedit-lua.h
|
||||
|
@ -46,7 +46,7 @@ moo_edit_bookmark_class_init (MooEditBookmarkClass *klass)
|
||||
static void
|
||||
moo_edit_bookmark_init (MooEditBookmark *bk)
|
||||
{
|
||||
g_object_set (bk, "visible", TRUE, NULL);
|
||||
g_object_set (bk, "visible", TRUE, (char*) 0);
|
||||
}
|
||||
|
||||
|
||||
@ -110,42 +110,42 @@ cmp_bookmarks (MooLineMark *a,
|
||||
static gboolean
|
||||
update_bookmarks (MooEdit *edit)
|
||||
{
|
||||
GSList *deleted, *dup, *old, *new, *l;
|
||||
GSList *deleted, *dup, *old, *new_, *l;
|
||||
|
||||
edit->priv->update_bookmarks_idle = 0;
|
||||
old = edit->priv->bookmarks;
|
||||
edit->priv->bookmarks = NULL;
|
||||
|
||||
for (deleted = NULL, new = NULL, l = old; l != NULL; l = l->next)
|
||||
for (deleted = NULL, new_ = NULL, l = old; l != NULL; l = l->next)
|
||||
if (moo_line_mark_get_deleted (MOO_LINE_MARK (l->data)))
|
||||
deleted = g_slist_prepend (deleted, l->data);
|
||||
else
|
||||
new = g_slist_prepend (new, l->data);
|
||||
new_ = g_slist_prepend (new_, l->data);
|
||||
|
||||
g_slist_foreach (deleted, (GFunc) disconnect_bookmark, NULL);
|
||||
g_slist_foreach (deleted, (GFunc) g_object_unref, NULL);
|
||||
g_slist_free (deleted);
|
||||
|
||||
new = g_slist_sort (new, (GCompareFunc) cmp_bookmarks);
|
||||
old = new;
|
||||
new = NULL;
|
||||
new_ = g_slist_sort (new_, (GCompareFunc) cmp_bookmarks);
|
||||
old = new_;
|
||||
new_ = NULL;
|
||||
dup = NULL;
|
||||
|
||||
for (l = old; l != NULL; l = l->next)
|
||||
if (new && moo_line_mark_get_line (new->data) == moo_line_mark_get_line (l->data))
|
||||
if (new_ && moo_line_mark_get_line (MOO_LINE_MARK (new_->data)) == moo_line_mark_get_line (MOO_LINE_MARK (l->data)))
|
||||
dup = g_slist_prepend (dup, l->data);
|
||||
else
|
||||
new = g_slist_prepend (new, l->data);
|
||||
new_ = g_slist_prepend (new_, l->data);
|
||||
|
||||
while (dup)
|
||||
{
|
||||
disconnect_bookmark (dup->data);
|
||||
moo_text_buffer_delete_line_mark (get_moo_buffer (edit), dup->data);
|
||||
disconnect_bookmark (MOO_EDIT_BOOKMARK (dup->data));
|
||||
moo_text_buffer_delete_line_mark (get_moo_buffer (edit), MOO_LINE_MARK (dup->data));
|
||||
g_object_unref (dup->data);
|
||||
dup = g_slist_delete_link (dup, dup);
|
||||
}
|
||||
|
||||
edit->priv->bookmarks = g_slist_reverse (new);
|
||||
edit->priv->bookmarks = g_slist_reverse (new_);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -207,7 +207,7 @@ moo_edit_get_bookmark_at_line (MooEdit *edit,
|
||||
{
|
||||
if (MOO_IS_EDIT_BOOKMARK (l->data) && g_slist_find (edit->priv->bookmarks, l->data))
|
||||
{
|
||||
bk = l->data;
|
||||
bk = MOO_EDIT_BOOKMARK (l->data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -244,7 +244,7 @@ get_unused_bookmark_no (MooEdit *edit)
|
||||
|
||||
while (list)
|
||||
{
|
||||
MooEditBookmark *bk = list->data;
|
||||
MooEditBookmark *bk = MOO_EDIT_BOOKMARK (list->data);
|
||||
used[bk->no] = 1;
|
||||
list = list->next;
|
||||
}
|
||||
@ -267,9 +267,9 @@ moo_edit_add_bookmark (MooEdit *edit,
|
||||
g_return_if_fail (line < get_line_count (edit));
|
||||
g_return_if_fail (moo_edit_get_bookmark_at_line (edit, line) == NULL);
|
||||
|
||||
g_object_set (edit, "show-line-marks", TRUE, NULL);
|
||||
g_object_set (edit, "show-line-marks", TRUE, (char*) 0);
|
||||
|
||||
bk = g_object_new (MOO_TYPE_EDIT_BOOKMARK, "background", get_bookmark_color (edit), NULL);
|
||||
bk = MOO_EDIT_BOOKMARK (g_object_new (MOO_TYPE_EDIT_BOOKMARK, "background", get_bookmark_color (edit), (char*) 0));
|
||||
moo_text_buffer_add_line_mark (get_moo_buffer (edit), MOO_LINE_MARK (bk), line);
|
||||
g_object_set_data (G_OBJECT (bk), "moo-edit-bookmark", GINT_TO_POINTER (TRUE));
|
||||
|
||||
@ -303,7 +303,7 @@ moo_edit_add_bookmark (MooEdit *edit,
|
||||
static void
|
||||
disconnect_bookmark (MooEditBookmark *bk)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (bk), "moo-edit-bookmark", NULL);
|
||||
g_object_set_data (G_OBJECT (bk), "moo-edit-bookmark", (char*) 0);
|
||||
}
|
||||
|
||||
|
||||
@ -367,7 +367,7 @@ moo_edit_get_bookmarks_in_range (MooEdit *edit,
|
||||
|
||||
for (l = all, range = NULL; l != NULL; l = l->next)
|
||||
{
|
||||
int line = moo_line_mark_get_line (l->data);
|
||||
int line = moo_line_mark_get_line (MOO_LINE_MARK (l->data));
|
||||
|
||||
if (line < first_line)
|
||||
continue;
|
||||
@ -394,11 +394,11 @@ _moo_edit_delete_bookmarks (MooEdit *edit,
|
||||
{
|
||||
while (bookmarks)
|
||||
{
|
||||
disconnect_bookmark (bookmarks->data);
|
||||
disconnect_bookmark (MOO_EDIT_BOOKMARK (bookmarks->data));
|
||||
|
||||
if (!in_destroy)
|
||||
moo_text_buffer_delete_line_mark (get_moo_buffer (edit),
|
||||
bookmarks->data);
|
||||
MOO_LINE_MARK (bookmarks->data));
|
||||
|
||||
g_object_unref (bookmarks->data);
|
||||
bookmarks = g_slist_delete_link (bookmarks, bookmarks);
|
||||
@ -423,7 +423,7 @@ moo_edit_get_bookmark (MooEdit *edit,
|
||||
|
||||
while (list)
|
||||
{
|
||||
MooEditBookmark *bk = list->data;
|
||||
MooEditBookmark *bk = MOO_EDIT_BOOKMARK (list->data);
|
||||
|
||||
if (bk->no == n)
|
||||
return bk;
|
||||
@ -507,7 +507,7 @@ _moo_edit_update_bookmarks_style (MooEdit *edit)
|
||||
bookmarks = moo_edit_list_bookmarks (edit);
|
||||
while (bookmarks)
|
||||
{
|
||||
moo_line_mark_set_background (bookmarks->data, color);
|
||||
moo_line_mark_set_background (MOO_LINE_MARK (bookmarks->data), color);
|
||||
bookmarks = bookmarks->next;
|
||||
}
|
||||
}
|
||||
|
@ -325,19 +325,19 @@ try_load (MooEdit *edit,
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
gboolean enable_highlight;
|
||||
LoadResult result;
|
||||
LoadResult result = ERROR_FILE;
|
||||
|
||||
moo_return_val_if_fail (MOO_IS_EDIT (edit), FALSE);
|
||||
moo_return_val_if_fail (G_IS_FILE (file), FALSE);
|
||||
moo_return_val_if_fail (encoding && encoding[0], FALSE);
|
||||
moo_return_val_if_fail (MOO_IS_EDIT (edit), result);
|
||||
moo_return_val_if_fail (G_IS_FILE (file), result);
|
||||
moo_return_val_if_fail (encoding && encoding[0], result);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (edit));
|
||||
gtk_text_buffer_set_text (buffer, "", 0);
|
||||
|
||||
g_object_get (edit, "enable-highlight", &enable_highlight, NULL);
|
||||
g_object_set (edit, "enable-highlight", FALSE, NULL);
|
||||
g_object_get (edit, "enable-highlight", &enable_highlight, (char*) 0);
|
||||
g_object_set (edit, "enable-highlight", FALSE, (char*) 0);
|
||||
result = do_load (edit, file, encoding, error);
|
||||
g_object_set (edit, "enable-highlight", enable_highlight, NULL);
|
||||
g_object_set (edit, "enable-highlight", enable_highlight, (char*) 0);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -354,7 +354,7 @@ check_regular (GFile *file,
|
||||
if (!g_file_is_native (file))
|
||||
return TRUE;
|
||||
|
||||
if (!(info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE, 0, NULL, NULL)))
|
||||
if (!(info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE, (GFileQueryInfoFlags) 0, NULL, NULL)))
|
||||
return TRUE;
|
||||
|
||||
type = g_file_info_get_file_type (info);
|
||||
@ -418,9 +418,9 @@ moo_edit_load_local (MooEdit *edit,
|
||||
|
||||
while (encodings)
|
||||
{
|
||||
char *enc = encodings->data;
|
||||
char *enc;
|
||||
|
||||
enc = encodings->data;
|
||||
enc = (char*) encodings->data;
|
||||
encodings = g_slist_delete_link (encodings, encodings);
|
||||
|
||||
g_clear_error (error);
|
||||
@ -464,7 +464,7 @@ moo_edit_load_local (MooEdit *edit,
|
||||
/* XXX */
|
||||
gtk_text_buffer_get_start_iter (buffer, &start);
|
||||
gtk_text_buffer_place_cursor (buffer, &start);
|
||||
edit->priv->status = 0;
|
||||
edit->priv->status = (MooEditStatus) 0;
|
||||
moo_edit_set_modified (edit, FALSE);
|
||||
_moo_edit_set_file (edit, file, encoding);
|
||||
if (edit->priv->line_end_type != saved_le)
|
||||
@ -533,7 +533,7 @@ do_load (MooEdit *edit,
|
||||
{
|
||||
gboolean insert_line_term = FALSE;
|
||||
gsize len, line_term_pos;
|
||||
MooLineEndType le_here = 0;
|
||||
MooLineEndType le_here = MOO_LE_NONE;
|
||||
|
||||
status = g_io_channel_read_line (file, &line, &len, &line_term_pos, error);
|
||||
|
||||
@ -750,20 +750,20 @@ moo_edit_reload_local (MooEdit *edit,
|
||||
|
||||
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||
gtk_text_buffer_delete (buffer, &start, &end);
|
||||
g_object_get (edit, "enable-highlight", &enable_highlight, NULL);
|
||||
g_object_set (edit, "enable-highlight", FALSE, NULL);
|
||||
g_object_get (edit, "enable-highlight", &enable_highlight, (char*) 0);
|
||||
g_object_set (edit, "enable-highlight", FALSE, (char*) 0);
|
||||
|
||||
result = _moo_edit_load_file (edit, file,
|
||||
encoding ? encoding : edit->priv->encoding,
|
||||
error);
|
||||
|
||||
g_object_set (edit, "enable-highlight", enable_highlight, NULL);
|
||||
g_object_set (edit, "enable-highlight", enable_highlight, (char*) 0);
|
||||
gtk_text_buffer_end_user_action (buffer);
|
||||
unblock_buffer_signals (edit);
|
||||
|
||||
if (result)
|
||||
{
|
||||
edit->priv->status = 0;
|
||||
edit->priv->status = (MooEditStatus) 0;
|
||||
moo_edit_set_modified (edit, FALSE);
|
||||
_moo_edit_start_file_watch (edit);
|
||||
g_clear_error (error);
|
||||
@ -881,7 +881,7 @@ do_write (GFile *file,
|
||||
|
||||
moo_return_val_if_fail (G_IS_FILE (file), FALSE);
|
||||
|
||||
writer_flags = (flags & MOO_EDIT_SAVE_BACKUP) ? MOO_FILE_WRITER_SAVE_BACKUP : 0;
|
||||
writer_flags = (flags & MOO_EDIT_SAVE_BACKUP) ? MOO_FILE_WRITER_SAVE_BACKUP : (MooFileWriterFlags) 0;
|
||||
|
||||
if ((writer = moo_file_writer_new_for_file (file, writer_flags, error)))
|
||||
{
|
||||
@ -974,7 +974,7 @@ moo_edit_save_local (MooEdit *edit,
|
||||
|
||||
if (do_save_local (edit, file, encoding, flags, error, &result))
|
||||
{
|
||||
edit->priv->status = 0;
|
||||
edit->priv->status = (MooEditStatus) 0;
|
||||
_moo_edit_set_file (edit, file,
|
||||
result ? encoding : MOO_ENCODING_UTF8);
|
||||
moo_edit_set_modified (edit, FALSE);
|
||||
@ -1025,7 +1025,7 @@ file_watch_callback (G_GNUC_UNUSED MooFileWatch *watch,
|
||||
MooFileEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
MooEdit *edit = data;
|
||||
MooEdit *edit = MOO_EDIT (data);
|
||||
|
||||
moo_return_if_fail (MOO_IS_EDIT (data));
|
||||
moo_return_if_fail (event->monitor_id == edit->priv->file_monitor_id);
|
||||
@ -1170,7 +1170,7 @@ static void
|
||||
add_status (MooEdit *edit,
|
||||
MooEditStatus s)
|
||||
{
|
||||
edit->priv->status |= s;
|
||||
edit->priv->status = (MooEditStatus) (edit->priv->status | s);
|
||||
g_signal_emit_by_name (edit, "doc-status-changed", NULL);
|
||||
}
|
||||
|
||||
|
123
moo/mooedit/mooedit-impl.h
Normal file
123
moo/mooedit/mooedit-impl.h
Normal file
@ -0,0 +1,123 @@
|
||||
/*
|
||||
* mooedit-impl.h
|
||||
*
|
||||
* Copyright (C) 2004-2010 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 MOO_EDIT_IMPL_H
|
||||
#define MOO_EDIT_IMPL_H
|
||||
|
||||
#include "mooedit/moolinemark.h"
|
||||
#include "mooedit/mooeditor.h"
|
||||
#include "mooedit/mootextview.h"
|
||||
#include "mooutils/mdhistorymgr.h"
|
||||
#include "mooutils/moolist.h"
|
||||
#include <gio/gio.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
struct MooEditFileInfo {
|
||||
GFile *file;
|
||||
char *encoding;
|
||||
};
|
||||
|
||||
MOO_DEFINE_SLIST(MooEditList, moo_edit_list, MooEdit)
|
||||
|
||||
extern MooEditList *_moo_edit_instances;
|
||||
|
||||
void _moo_edit_add_class_actions (MooEdit *edit);
|
||||
void _moo_edit_check_actions (MooEdit *edit);
|
||||
void _moo_edit_class_init_actions (MooEditClass *klass);
|
||||
|
||||
void _moo_edit_do_popup (MooEdit *edit,
|
||||
GdkEventButton *event);
|
||||
|
||||
gboolean _moo_edit_has_comments (MooEdit *edit,
|
||||
gboolean *single_line,
|
||||
gboolean *multi_line);
|
||||
|
||||
#define MOO_EDIT_GOTO_BOOKMARK_ACTION "GoToBookmark"
|
||||
void _moo_edit_delete_bookmarks (MooEdit *edit,
|
||||
gboolean in_destroy);
|
||||
void _moo_edit_line_mark_moved (MooEdit *edit,
|
||||
MooLineMark *mark);
|
||||
void _moo_edit_line_mark_deleted (MooEdit *edit,
|
||||
MooLineMark *mark);
|
||||
gboolean _moo_edit_line_mark_clicked (MooTextView *view,
|
||||
int line);
|
||||
void _moo_edit_update_bookmarks_style(MooEdit *edit);
|
||||
|
||||
void _moo_edit_history_item_set_encoding (MdHistoryItem *item,
|
||||
const char *encoding);
|
||||
void _moo_edit_history_item_set_line (MdHistoryItem *item,
|
||||
int line);
|
||||
const char *_moo_edit_history_item_get_encoding (MdHistoryItem *item);
|
||||
int _moo_edit_history_item_get_line (MdHistoryItem *item);
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* Preferences
|
||||
*/
|
||||
enum {
|
||||
MOO_EDIT_SETTING_LANG,
|
||||
MOO_EDIT_SETTING_INDENT,
|
||||
MOO_EDIT_SETTING_STRIP,
|
||||
MOO_EDIT_SETTING_ADD_NEWLINE,
|
||||
MOO_EDIT_SETTING_WRAP_MODE,
|
||||
MOO_EDIT_SETTING_SHOW_LINE_NUMBERS,
|
||||
MOO_EDIT_SETTING_TAB_WIDTH,
|
||||
MOO_EDIT_SETTING_WORD_CHARS,
|
||||
MOO_EDIT_LAST_SETTING
|
||||
};
|
||||
|
||||
extern guint *_moo_edit_settings;
|
||||
|
||||
void _moo_edit_update_global_config (void);
|
||||
void _moo_edit_init_config (void);
|
||||
void _moo_edit_update_lang_config (void);
|
||||
|
||||
void _moo_edit_apply_prefs (MooEdit *edit);
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* File operations
|
||||
*/
|
||||
|
||||
GFile *_moo_edit_get_file (MooEdit *edit);
|
||||
|
||||
void _moo_edit_set_file (MooEdit *edit,
|
||||
GFile *file,
|
||||
const char *encoding);
|
||||
const char *_moo_edit_get_default_encoding (void);
|
||||
void _moo_edit_ensure_newline (MooEdit *edit);
|
||||
|
||||
void _moo_edit_stop_file_watch (MooEdit *edit);
|
||||
|
||||
void _moo_edit_set_status (MooEdit *edit,
|
||||
MooEditStatus status);
|
||||
|
||||
void _moo_edit_set_state (MooEdit *edit,
|
||||
MooEditState state,
|
||||
const char *text,
|
||||
GDestroyNotify cancel,
|
||||
gpointer data);
|
||||
void _moo_edit_create_progress_dialog (MooEdit *edit);
|
||||
void _moo_edit_set_progress_text (MooEdit *edit,
|
||||
const char *text);
|
||||
|
||||
GdkPixbuf *_moo_edit_get_icon (MooEdit *edit,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* MOO_EDIT_IMPL_H */
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* mooedit-private.h
|
||||
*
|
||||
* Copyright (C) 2004-2008 by Yevgen Muntyan <muntyan@tamu.edu>
|
||||
* Copyright (C) 2004-2010 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
|
||||
@ -13,18 +13,10 @@
|
||||
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MOOEDIT_COMPILATION
|
||||
#error "Do not include this file"
|
||||
#endif
|
||||
|
||||
#ifndef MOO_EDIT_PRIVATE_H
|
||||
#define MOO_EDIT_PRIVATE_H
|
||||
|
||||
#include "mooedit/moolinemark.h"
|
||||
#include "mooedit/mooeditor.h"
|
||||
#include "mooedit/mootextview.h"
|
||||
#include "mooutils/mdhistorymgr.h"
|
||||
#include <gio/gio.h>
|
||||
#include "mooedit/mooedit-impl.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -32,99 +24,8 @@ G_BEGIN_DECLS
|
||||
#define PROGRESS_WIDTH 300
|
||||
#define PROGRESS_HEIGHT 100
|
||||
|
||||
|
||||
extern GSList *_moo_edit_instances;
|
||||
void _moo_edit_add_class_actions (MooEdit *edit);
|
||||
void _moo_edit_check_actions (MooEdit *edit);
|
||||
void _moo_edit_class_init_actions (MooEditClass *klass);
|
||||
|
||||
void _moo_edit_do_popup (MooEdit *edit,
|
||||
GdkEventButton *event);
|
||||
|
||||
gboolean _moo_edit_has_comments (MooEdit *edit,
|
||||
gboolean *single_line,
|
||||
gboolean *multi_line);
|
||||
|
||||
#define MOO_EDIT_GOTO_BOOKMARK_ACTION "GoToBookmark"
|
||||
void _moo_edit_delete_bookmarks (MooEdit *edit,
|
||||
gboolean in_destroy);
|
||||
void _moo_edit_line_mark_moved (MooEdit *edit,
|
||||
MooLineMark *mark);
|
||||
void _moo_edit_line_mark_deleted (MooEdit *edit,
|
||||
MooLineMark *mark);
|
||||
gboolean _moo_edit_line_mark_clicked (MooTextView *view,
|
||||
int line);
|
||||
void _moo_edit_update_bookmarks_style(MooEdit *edit);
|
||||
|
||||
void _moo_edit_history_item_set_encoding (MdHistoryItem *item,
|
||||
const char *encoding);
|
||||
void _moo_edit_history_item_set_line (MdHistoryItem *item,
|
||||
int line);
|
||||
const char *_moo_edit_history_item_get_encoding (MdHistoryItem *item);
|
||||
int _moo_edit_history_item_get_line (MdHistoryItem *item);
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* Preferences
|
||||
*/
|
||||
enum {
|
||||
MOO_EDIT_SETTING_LANG,
|
||||
MOO_EDIT_SETTING_INDENT,
|
||||
MOO_EDIT_SETTING_STRIP,
|
||||
MOO_EDIT_SETTING_ADD_NEWLINE,
|
||||
MOO_EDIT_SETTING_WRAP_MODE,
|
||||
MOO_EDIT_SETTING_SHOW_LINE_NUMBERS,
|
||||
MOO_EDIT_SETTING_TAB_WIDTH,
|
||||
MOO_EDIT_SETTING_WORD_CHARS,
|
||||
MOO_EDIT_LAST_SETTING
|
||||
};
|
||||
|
||||
extern guint *_moo_edit_settings;
|
||||
|
||||
void _moo_edit_update_global_config (void);
|
||||
void _moo_edit_init_config (void);
|
||||
void _moo_edit_update_lang_config (void);
|
||||
|
||||
void _moo_edit_apply_prefs (MooEdit *edit);
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* File operations
|
||||
*/
|
||||
|
||||
GFile *_moo_edit_get_file (MooEdit *edit);
|
||||
|
||||
void _moo_edit_set_file (MooEdit *edit,
|
||||
GFile *file,
|
||||
const char *encoding);
|
||||
const char *_moo_edit_get_default_encoding (void);
|
||||
void _moo_edit_ensure_newline (MooEdit *edit);
|
||||
|
||||
void _moo_edit_stop_file_watch (MooEdit *edit);
|
||||
|
||||
void _moo_edit_set_status (MooEdit *edit,
|
||||
MooEditStatus status);
|
||||
|
||||
void _moo_edit_set_state (MooEdit *edit,
|
||||
MooEditState state,
|
||||
const char *text,
|
||||
GDestroyNotify cancel,
|
||||
gpointer data);
|
||||
void _moo_edit_create_progress_dialog (MooEdit *edit);
|
||||
void _moo_edit_set_progress_text (MooEdit *edit,
|
||||
const char *text);
|
||||
|
||||
GdkPixbuf *_moo_edit_get_icon (MooEdit *edit,
|
||||
GtkWidget *widget,
|
||||
GtkIconSize size);
|
||||
|
||||
#define MOO_EDIT_IS_UNTITLED(edit) (!(edit)->priv->file)
|
||||
|
||||
struct MooEditFileInfo {
|
||||
GFile *file;
|
||||
char *encoding;
|
||||
};
|
||||
|
||||
struct MooEditPrivate {
|
||||
MooEditor *editor;
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
#define KEY_LINE "line"
|
||||
|
||||
|
||||
GSList *_moo_edit_instances = NULL;
|
||||
MooEditList *_moo_edit_instances = NULL;
|
||||
|
||||
static GObject *moo_edit_constructor (GType type,
|
||||
guint n_construct_properties,
|
||||
@ -152,7 +152,7 @@ moo_edit_class_init (MooEditClass *klass)
|
||||
"editor",
|
||||
"editor",
|
||||
MOO_TYPE_EDITOR,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ENABLE_BOOKMARKS,
|
||||
@ -160,7 +160,7 @@ moo_edit_class_init (MooEditClass *klass)
|
||||
"enable-bookmarks",
|
||||
"enable-bookmarks",
|
||||
TRUE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
(GParamFlags) (G_PARAM_READWRITE | G_PARAM_CONSTRUCT)));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HAS_COMMENTS,
|
||||
@ -172,7 +172,8 @@ moo_edit_class_init (MooEditClass *klass)
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_LINE_END_TYPE,
|
||||
g_param_spec_enum ("line-end-type", "line-end-type", "line-end-type",
|
||||
MOO_TYPE_LINE_END_TYPE, MOO_LE_NONE, G_PARAM_READWRITE));
|
||||
MOO_TYPE_LINE_END_TYPE, MOO_LE_NONE,
|
||||
(GParamFlags) G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ENCODING,
|
||||
@ -180,12 +181,12 @@ moo_edit_class_init (MooEditClass *klass)
|
||||
"encoding",
|
||||
"encoding",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
(GParamFlags) G_PARAM_READWRITE));
|
||||
|
||||
signals[CONFIG_NOTIFY] =
|
||||
g_signal_new ("config-notify",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED,
|
||||
(GSignalFlags) (G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED),
|
||||
G_STRUCT_OFFSET (MooEditClass, config_notify),
|
||||
NULL, NULL,
|
||||
_moo_marshal_VOID__UINT_POINTER,
|
||||
@ -214,7 +215,7 @@ moo_edit_class_init (MooEditClass *klass)
|
||||
signals[COMMENT] =
|
||||
_moo_signal_new_cb ("comment",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
(GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
|
||||
G_CALLBACK (moo_edit_comment),
|
||||
NULL, NULL,
|
||||
_moo_marshal_VOID__VOID,
|
||||
@ -223,7 +224,7 @@ moo_edit_class_init (MooEditClass *klass)
|
||||
signals[UNCOMMENT] =
|
||||
_moo_signal_new_cb ("uncomment",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
(GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
|
||||
G_CALLBACK (moo_edit_uncomment),
|
||||
NULL, NULL,
|
||||
_moo_marshal_VOID__VOID,
|
||||
@ -297,7 +298,7 @@ moo_edit_constructor (GType type,
|
||||
edit = MOO_EDIT (object);
|
||||
|
||||
_moo_edit_add_class_actions (edit);
|
||||
_moo_edit_instances = g_slist_prepend (_moo_edit_instances, edit);
|
||||
_moo_edit_instances = moo_edit_list_prepend (_moo_edit_instances, edit);
|
||||
|
||||
edit->priv->modified_changed_handler_id =
|
||||
g_signal_connect (get_buffer (edit),
|
||||
@ -341,7 +342,7 @@ moo_edit_dispose (GObject *object)
|
||||
{
|
||||
MooEdit *edit = MOO_EDIT (object);
|
||||
|
||||
_moo_edit_instances = g_slist_remove (_moo_edit_instances, edit);
|
||||
_moo_edit_instances = moo_edit_list_remove (_moo_edit_instances, edit);
|
||||
|
||||
if (edit->config)
|
||||
{
|
||||
@ -406,6 +407,17 @@ modified_changed_cb (GtkTextBuffer *buffer,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
modify_status (MooEdit *edit,
|
||||
MooEditStatus status,
|
||||
gboolean add)
|
||||
{
|
||||
if (add)
|
||||
edit->priv->status = (MooEditStatus) (edit->priv->status | status);
|
||||
else
|
||||
edit->priv->status = (MooEditStatus) (edit->priv->status & ~status);
|
||||
}
|
||||
|
||||
void
|
||||
moo_edit_set_modified (MooEdit *edit,
|
||||
gboolean modified)
|
||||
@ -429,10 +441,7 @@ moo_edit_set_modified (MooEdit *edit,
|
||||
edit->priv->modified_changed_handler_id);
|
||||
}
|
||||
|
||||
if (modified)
|
||||
edit->priv->status |= MOO_EDIT_MODIFIED;
|
||||
else
|
||||
edit->priv->status &= ~MOO_EDIT_MODIFIED;
|
||||
modify_status (edit, MOO_EDIT_MODIFIED, modified);
|
||||
|
||||
moo_edit_status_changed (edit);
|
||||
}
|
||||
@ -443,10 +452,7 @@ moo_edit_set_clean (MooEdit *edit,
|
||||
gboolean clean)
|
||||
{
|
||||
g_return_if_fail (MOO_IS_EDIT (edit));
|
||||
if (clean)
|
||||
edit->priv->status |= MOO_EDIT_CLEAN;
|
||||
else
|
||||
edit->priv->status &= ~MOO_EDIT_CLEAN;
|
||||
modify_status (edit, MOO_EDIT_CLEAN, clean);
|
||||
moo_edit_status_changed (edit);
|
||||
}
|
||||
|
||||
@ -467,7 +473,6 @@ moo_edit_status_changed (MooEdit *edit)
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void
|
||||
_moo_edit_set_status (MooEdit *edit,
|
||||
MooEditStatus status)
|
||||
@ -480,7 +485,6 @@ _moo_edit_set_status (MooEdit *edit,
|
||||
moo_edit_status_changed (edit);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
gboolean
|
||||
@ -509,7 +513,7 @@ moo_edit_is_untitled (MooEdit *edit)
|
||||
MooEditStatus
|
||||
moo_edit_get_status (MooEdit *edit)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_EDIT (edit), 0);
|
||||
g_return_val_if_fail (MOO_IS_EDIT (edit), (MooEditStatus) 0);
|
||||
return edit->priv->status;
|
||||
}
|
||||
|
||||
@ -525,7 +529,7 @@ moo_edit_set_property (GObject *object,
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_EDITOR:
|
||||
edit->priv->editor = g_value_get_object (value);
|
||||
edit->priv->editor = (MooEditor*) g_value_get_object (value);
|
||||
break;
|
||||
|
||||
case PROP_ENABLE_BOOKMARKS:
|
||||
@ -537,7 +541,7 @@ moo_edit_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_LINE_END_TYPE:
|
||||
moo_edit_set_line_end_type (edit, g_value_get_enum (value));
|
||||
moo_edit_set_line_end_type (edit, (MooLineEndType) g_value_get_enum (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -654,7 +658,7 @@ moo_edit_file_info_new_uri (const char *uri,
|
||||
MooEditFileInfo *
|
||||
moo_edit_file_info_copy (MooEditFileInfo *info)
|
||||
{
|
||||
return info ? moo_edit_file_info_new (g_object_ref (info->file), info->encoding) : NULL;
|
||||
return info ? moo_edit_file_info_new ((GFile*) g_object_ref (info->file), info->encoding) : NULL;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1085,7 +1089,7 @@ moo_edit_apply_config (MooEdit *edit)
|
||||
"show-line-numbers", &line_numbers,
|
||||
"tab-width", &tab_width,
|
||||
"word-chars", &word_chars,
|
||||
NULL);
|
||||
(char*) 0);
|
||||
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (edit), wrap_mode);
|
||||
moo_text_view_set_show_line_numbers (MOO_TEXT_VIEW (edit), line_numbers);
|
||||
@ -1140,7 +1144,7 @@ _moo_edit_update_config_from_global (MooEdit *edit)
|
||||
void
|
||||
_moo_edit_update_lang_config (void)
|
||||
{
|
||||
GSList *l;
|
||||
MooEditList *l;
|
||||
|
||||
for (l = _moo_edit_instances; l != NULL; l = l->next)
|
||||
{
|
||||
@ -1176,7 +1180,7 @@ moo_edit_filename_changed (MooEdit *edit,
|
||||
}
|
||||
|
||||
moo_edit_config_set (edit->config, MOO_EDIT_CONFIG_SOURCE_FILENAME,
|
||||
"lang", lang_id, "indent", NULL, NULL);
|
||||
"lang", lang_id, "indent", (void*) NULL, (char*) NULL);
|
||||
|
||||
if (filter_config)
|
||||
moo_edit_config_parse (edit->config, filter_config,
|
||||
@ -1477,14 +1481,14 @@ block_uncomment (GtkTextBuffer *buffer,
|
||||
}
|
||||
|
||||
limit = *end;
|
||||
found = moo_text_search_forward (start, comment_start, 0,
|
||||
found = moo_text_search_forward (start, comment_start, (MooTextSearchFlags) 0,
|
||||
&start1, &start2,
|
||||
&limit);
|
||||
|
||||
if (!found)
|
||||
{
|
||||
gtk_text_iter_set_line_offset (&limit, 0);
|
||||
found = gtk_text_iter_backward_search (start, comment_start, 0,
|
||||
found = gtk_text_iter_backward_search (start, comment_start, (GtkTextSearchFlags) 0,
|
||||
&start1, &start2,
|
||||
&limit);
|
||||
}
|
||||
@ -1493,14 +1497,14 @@ block_uncomment (GtkTextBuffer *buffer,
|
||||
return;
|
||||
|
||||
limit = start2;
|
||||
found = gtk_text_iter_backward_search (end, comment_end, 0,
|
||||
found = gtk_text_iter_backward_search (end, comment_end, (GtkTextSearchFlags) 0,
|
||||
&end1, &end2, &limit);
|
||||
|
||||
if (!found)
|
||||
{
|
||||
limit = *end;
|
||||
iter_to_line_end (&limit);
|
||||
found = moo_text_search_forward (end, comment_end, 0,
|
||||
found = moo_text_search_forward (end, comment_end, (MooTextSearchFlags) 0,
|
||||
&end1, &end2, &limit);
|
||||
}
|
||||
|
||||
@ -1716,8 +1720,8 @@ _moo_edit_do_popup (MooEdit *edit,
|
||||
xml = moo_editor_get_doc_ui_xml (edit->priv->editor);
|
||||
g_return_if_fail (xml != NULL);
|
||||
|
||||
menu = moo_ui_xml_create_widget (xml, MOO_UI_MENU, "Editor/Popup", edit->priv->actions,
|
||||
window ? MOO_WINDOW(window)->accel_group : NULL);
|
||||
menu = (GtkMenu*) moo_ui_xml_create_widget (xml, MOO_UI_MENU, "Editor/Popup", edit->priv->actions,
|
||||
window ? MOO_WINDOW(window)->accel_group : NULL);
|
||||
g_return_if_fail (menu != NULL);
|
||||
MOO_OBJECT_REF_SINK (menu);
|
||||
|
||||
@ -2055,8 +2059,8 @@ test_encodings_1 (const char *name,
|
||||
else
|
||||
encoding = g_strdup (name);
|
||||
|
||||
filename = g_build_filename (test_data.encodings_dir, name, NULL);
|
||||
filename2 = g_build_filename (working_dir, name, NULL);
|
||||
filename = g_build_filename (test_data.encodings_dir, name, (char*)0);
|
||||
filename2 = g_build_filename (working_dir, name, (char*)0);
|
||||
|
||||
editor = moo_editor_instance ();
|
||||
doc = moo_editor_open_file (editor, NULL, NULL, filename, encoding);
|
||||
@ -2090,7 +2094,7 @@ test_encodings (void)
|
||||
return;
|
||||
}
|
||||
|
||||
working_dir = g_build_filename (test_data.working_dir, "encodings", NULL);
|
||||
working_dir = g_build_filename (test_data.working_dir, "encodings", (char*)0);
|
||||
_moo_mkdir_with_parents (working_dir);
|
||||
|
||||
while ((name = g_dir_read_name (dir)))
|
||||
@ -2111,9 +2115,9 @@ test_suite_init (G_GNUC_UNUSED gpointer data)
|
||||
}
|
||||
|
||||
test_data.working_dir = g_build_filename (moo_test_get_working_dir (),
|
||||
"editor-work", NULL);
|
||||
"editor-work", (char*)0);
|
||||
test_data.encodings_dir = g_build_filename (moo_test_get_data_dir (),
|
||||
"encodings", NULL);
|
||||
"encodings", (char*)0);
|
||||
|
||||
if (_moo_mkdir_with_parents (test_data.working_dir) != 0)
|
||||
{
|
||||
|
@ -68,7 +68,8 @@ action_info_new (MooActionFactory *action,
|
||||
g_return_val_if_fail (MOO_IS_ACTION_FACTORY (action), NULL);
|
||||
|
||||
info = g_new0 (ActionInfo, 1);
|
||||
info->action = g_object_ref (action);
|
||||
g_object_ref (action);
|
||||
info->action = action;
|
||||
info->conditions = g_strdupv (conditions);
|
||||
|
||||
return info;
|
||||
@ -132,21 +133,21 @@ create_action (const char *action_id,
|
||||
action = moo_action_factory_create_action (info->action, edit,
|
||||
"closure-object", edit,
|
||||
"name", action_id,
|
||||
NULL);
|
||||
(char*) 0);
|
||||
else if (g_type_is_a (info->action->action_type, MOO_TYPE_TOGGLE_ACTION))
|
||||
action = moo_action_factory_create_action (info->action, edit,
|
||||
"toggled-object", edit,
|
||||
"name", action_id,
|
||||
NULL);
|
||||
(char*) 0);
|
||||
else
|
||||
action = moo_action_factory_create_action (info->action, edit,
|
||||
"name", action_id,
|
||||
NULL);
|
||||
(char*) 0);
|
||||
|
||||
g_return_val_if_fail (action != NULL, NULL);
|
||||
|
||||
if (g_type_is_a (info->action->action_type, MOO_TYPE_EDIT_ACTION))
|
||||
g_object_set (action, "doc", edit, NULL);
|
||||
g_object_set (action, "doc", edit, (char*) 0);
|
||||
g_object_set_data (G_OBJECT (action), "moo-edit", edit);
|
||||
|
||||
if (info->conditions)
|
||||
@ -179,6 +180,12 @@ moo_edit_class_new_action (MooEditClass *klass,
|
||||
}
|
||||
|
||||
|
||||
static GHashTable *
|
||||
get_actions_hash (GType type)
|
||||
{
|
||||
return (GHashTable*) g_type_get_qdata (type, MOO_EDIT_ACTIONS_QUARK);
|
||||
}
|
||||
|
||||
static void
|
||||
moo_edit_class_install_action (MooEditClass *klass,
|
||||
const char *action_id,
|
||||
@ -188,14 +195,14 @@ moo_edit_class_install_action (MooEditClass *klass,
|
||||
GHashTable *actions;
|
||||
ActionInfo *info;
|
||||
GType type;
|
||||
GSList *l;
|
||||
MooEditList *l;
|
||||
|
||||
g_return_if_fail (MOO_IS_EDIT_CLASS (klass));
|
||||
g_return_if_fail (MOO_IS_ACTION_FACTORY (factory));
|
||||
g_return_if_fail (action_id && action_id[0]);
|
||||
|
||||
type = G_OBJECT_CLASS_TYPE (klass);
|
||||
actions = g_type_get_qdata (type, MOO_EDIT_ACTIONS_QUARK);
|
||||
actions = get_actions_hash (type);
|
||||
|
||||
if (!actions)
|
||||
{
|
||||
@ -248,7 +255,7 @@ moo_edit_class_new_actionv (MooEditClass *klass,
|
||||
name = first_prop_name;
|
||||
while (name)
|
||||
{
|
||||
GParameter param = {NULL, {0, {{0}, {0}}}};
|
||||
GParameter param = { 0 };
|
||||
GParamSpec *pspec;
|
||||
char *err = NULL;
|
||||
|
||||
@ -279,7 +286,7 @@ moo_edit_class_new_actionv (MooEditClass *klass,
|
||||
goto error;
|
||||
}
|
||||
|
||||
action_class = g_type_class_ref (action_type);
|
||||
action_class = G_OBJECT_CLASS (g_type_class_ref (action_type));
|
||||
}
|
||||
else if (!strncmp (name, "condition::", strlen ("condition::")))
|
||||
{
|
||||
@ -311,7 +318,7 @@ moo_edit_class_new_actionv (MooEditClass *klass,
|
||||
{
|
||||
if (!action_type)
|
||||
action_type = MOO_TYPE_EDIT_ACTION;
|
||||
action_class = g_type_class_ref (action_type);
|
||||
action_class = G_OBJECT_CLASS (g_type_class_ref (action_type));
|
||||
}
|
||||
|
||||
pspec = g_object_class_find_property (action_class, name);
|
||||
@ -416,8 +423,8 @@ custom_action_factory_func (MooEdit *edit,
|
||||
|
||||
g_return_val_if_fail (MOO_IS_EDIT (edit), NULL);
|
||||
|
||||
action_id = g_object_get_data (G_OBJECT (factory), "moo-edit-class-action-id");
|
||||
func = g_object_get_data (G_OBJECT (factory), "moo-edit-class-action-func");
|
||||
action_id = (const char *) g_object_get_data (G_OBJECT (factory), "moo-edit-class-action-id");
|
||||
func = (MooEditActionFunc) g_object_get_data (G_OBJECT (factory), "moo-edit-class-action-func");
|
||||
func_data = g_object_get_data (G_OBJECT (factory), "moo-edit-class-action-func-data");
|
||||
|
||||
g_return_val_if_fail (action_id != NULL, NULL);
|
||||
@ -444,7 +451,7 @@ moo_edit_class_new_action_custom (MooEditClass *klass,
|
||||
g_object_set_data (G_OBJECT (action_factory), "moo-edit-class", klass);
|
||||
g_object_set_data_full (G_OBJECT (action_factory), "moo-edit-class-action-id",
|
||||
g_strdup (action_id), g_free);
|
||||
g_object_set_data (G_OBJECT (action_factory), "moo-edit-class-action-func", func);
|
||||
g_object_set_data (G_OBJECT (action_factory), "moo-edit-class-action-func", (gpointer) func);
|
||||
g_object_set_data_full (G_OBJECT (action_factory), "moo-edit-class-action-func-data",
|
||||
data, notify);
|
||||
|
||||
@ -458,9 +465,9 @@ type_action_func (MooEdit *edit,
|
||||
gpointer klass)
|
||||
{
|
||||
GQuark quark = g_quark_from_static_string ("moo-edit-class-action-id");
|
||||
const char *id = g_type_get_qdata (G_TYPE_FROM_CLASS (klass), quark);
|
||||
return g_object_new (G_TYPE_FROM_CLASS (klass),
|
||||
"doc", edit, "name", id, NULL);
|
||||
const char *id = (const char*) g_type_get_qdata (G_TYPE_FROM_CLASS (klass), quark);
|
||||
return GTK_ACTION (g_object_new (G_TYPE_FROM_CLASS (klass),
|
||||
"doc", edit, "name", id, (char*) 0));
|
||||
}
|
||||
|
||||
|
||||
@ -491,12 +498,12 @@ moo_edit_class_remove_action (MooEditClass *klass,
|
||||
{
|
||||
GHashTable *actions;
|
||||
GType type;
|
||||
GSList *l;
|
||||
MooEditList *l;
|
||||
|
||||
g_return_if_fail (MOO_IS_EDIT_CLASS (klass));
|
||||
|
||||
type = G_OBJECT_CLASS_TYPE (klass);
|
||||
actions = g_type_get_qdata (type, MOO_EDIT_ACTIONS_QUARK);
|
||||
actions = get_actions_hash (type);
|
||||
|
||||
if (actions)
|
||||
g_hash_table_remove (actions, action_id);
|
||||
@ -556,7 +563,7 @@ _moo_edit_add_class_actions (MooEdit *edit)
|
||||
{
|
||||
GHashTable *actions;
|
||||
|
||||
actions = g_type_get_qdata (type, MOO_EDIT_ACTIONS_QUARK);
|
||||
actions = get_actions_hash (type);
|
||||
|
||||
if (actions)
|
||||
g_hash_table_foreach (actions, (GHFunc) add_action, edit);
|
||||
@ -576,7 +583,7 @@ create_input_methods_menu_item (GtkAction *action)
|
||||
GtkWidget *item, *menu;
|
||||
gboolean visible = TRUE;
|
||||
|
||||
edit = g_object_get_data (G_OBJECT (action), "moo-edit");
|
||||
edit = GTK_TEXT_VIEW (g_object_get_data (G_OBJECT (action), "moo-edit"));
|
||||
g_return_val_if_fail (MOO_IS_EDIT (edit), NULL);
|
||||
|
||||
item = gtk_menu_item_new ();
|
||||
@ -590,9 +597,9 @@ create_input_methods_menu_item (GtkAction *action)
|
||||
#if GTK_CHECK_VERSION(2, 10, 0)
|
||||
g_object_get (gtk_widget_get_settings (GTK_WIDGET (edit)),
|
||||
"gtk-show-input-method-menu", &visible,
|
||||
NULL);
|
||||
(char*) 0);
|
||||
#endif
|
||||
g_object_set (action, "visible", visible, NULL);
|
||||
g_object_set (action, "visible", visible, (char*) 0);
|
||||
|
||||
return item;
|
||||
}
|
||||
@ -604,7 +611,7 @@ create_special_chars_menu_item (GtkAction *action)
|
||||
GtkWidget *item, *menu;
|
||||
gboolean visible = TRUE;
|
||||
|
||||
edit = g_object_get_data (G_OBJECT (action), "moo-edit");
|
||||
edit = GTK_TEXT_VIEW (g_object_get_data (G_OBJECT (action), "moo-edit"));
|
||||
g_return_val_if_fail (MOO_IS_EDIT (edit), NULL);
|
||||
|
||||
item = gtk_menu_item_new ();
|
||||
@ -616,9 +623,9 @@ create_special_chars_menu_item (GtkAction *action)
|
||||
#if GTK_CHECK_VERSION(2, 10, 0)
|
||||
g_object_get (gtk_widget_get_settings (GTK_WIDGET (edit)),
|
||||
"gtk-show-unicode-menu", &visible,
|
||||
NULL);
|
||||
(char*) 0);
|
||||
#endif
|
||||
g_object_set (action, "visible", visible, NULL);
|
||||
g_object_set (action, "visible", visible, (char*) 0);
|
||||
|
||||
return item;
|
||||
}
|
||||
@ -633,7 +640,7 @@ _moo_edit_class_init_actions (MooEditClass *klass)
|
||||
"stock-id", GTK_STOCK_UNDO,
|
||||
"closure-signal", "undo",
|
||||
"condition::sensitive", "can-undo",
|
||||
NULL);
|
||||
(char*) 0);
|
||||
|
||||
moo_edit_class_new_action (klass, "Redo",
|
||||
"display-name", GTK_STOCK_REDO,
|
||||
@ -642,27 +649,27 @@ _moo_edit_class_init_actions (MooEditClass *klass)
|
||||
"stock-id", GTK_STOCK_REDO,
|
||||
"closure-signal", "redo",
|
||||
"condition::sensitive", "can-redo",
|
||||
NULL);
|
||||
(char*) 0);
|
||||
|
||||
moo_edit_class_new_action (klass, "Cut",
|
||||
"display-name", GTK_STOCK_CUT,
|
||||
"stock-id", GTK_STOCK_CUT,
|
||||
"closure-signal", "cut-clipboard",
|
||||
"condition::sensitive", "has-selection",
|
||||
NULL);
|
||||
(char*) 0);
|
||||
|
||||
moo_edit_class_new_action (klass, "Copy",
|
||||
"display-name", GTK_STOCK_COPY,
|
||||
"stock-id", GTK_STOCK_COPY,
|
||||
"closure-signal", "copy-clipboard",
|
||||
"condition::sensitive", "has-selection",
|
||||
NULL);
|
||||
(char*) 0);
|
||||
|
||||
moo_edit_class_new_action (klass, "Paste",
|
||||
"display-name", GTK_STOCK_PASTE,
|
||||
"stock-id", GTK_STOCK_PASTE,
|
||||
"closure-signal", "paste-clipboard",
|
||||
NULL);
|
||||
(char*) 0);
|
||||
|
||||
moo_edit_class_new_action (klass, "SelectAll",
|
||||
"display-name", GTK_STOCK_SELECT_ALL,
|
||||
@ -671,19 +678,19 @@ _moo_edit_class_init_actions (MooEditClass *klass)
|
||||
"stock-id", GTK_STOCK_SELECT_ALL,
|
||||
"closure-callback", moo_text_view_select_all,
|
||||
"condition::sensitive", "has-text",
|
||||
NULL);
|
||||
(char*) 0);
|
||||
|
||||
moo_edit_class_new_action (klass, "InputMethods",
|
||||
"action-type::", MOO_TYPE_MENU_ACTION,
|
||||
"label", D_("Input _Methods", "gtk20"),
|
||||
"menu-func", create_input_methods_menu_item,
|
||||
NULL);
|
||||
(char*) 0);
|
||||
|
||||
moo_edit_class_new_action (klass, "SpecialChars",
|
||||
"action-type::", MOO_TYPE_MENU_ACTION,
|
||||
"label", D_("_Insert Unicode Control Character", "gtk20"),
|
||||
"menu-func", create_special_chars_menu_item,
|
||||
NULL);
|
||||
(char*) 0);
|
||||
}
|
||||
|
||||
|
||||
@ -717,7 +724,7 @@ bidi_menu_item_activate (GtkWidget *menuitem,
|
||||
|
||||
g_return_if_fail (GTK_IS_TEXT_VIEW (view));
|
||||
|
||||
entry = g_object_get_data (G_OBJECT (menuitem), "unicode-menu-entry");
|
||||
entry = (struct BidiMenuEntry*) g_object_get_data (G_OBJECT (menuitem), "unicode-menu-entry");
|
||||
g_return_if_fail (entry != NULL);
|
||||
|
||||
string[g_unichar_to_utf8 (entry->ch, string)] = 0;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#define MOOEDIT_COMPILATION
|
||||
#include "mooedit/mooeditaction.h"
|
||||
#include "mooedit/mooeditaction-factory.h"
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooeditfiltersettings.h"
|
||||
#include <glib/gregex.h>
|
||||
#include <string.h>
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#define MOOEDIT_COMPILATION
|
||||
#include "mooedit/mooeditdialogs.h"
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooedit/mooedit-fileops.h"
|
||||
#include "mooutils/moodialogs.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "mooedit/mooeditor.h"
|
||||
#include "mooutils/mdhistorymgr.h"
|
||||
#include "mooutils/moofilewatch.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -49,7 +50,7 @@ void _moo_editor_move_doc (MooEditor *editor,
|
||||
MooEditWindow *dest,
|
||||
gboolean focus);
|
||||
|
||||
gpointer _moo_editor_get_file_watch (MooEditor *editor);
|
||||
MooFileWatch *_moo_editor_get_file_watch (MooEditor *editor);
|
||||
void _moo_editor_reload (MooEditor *editor,
|
||||
MooEdit *doc,
|
||||
const char *encoding,
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "mooedit/mooedit-fileops.h"
|
||||
#include "mooedit/mooplugin.h"
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooedit-impl.h"
|
||||
#include "mooedit/mooedit-accels.h"
|
||||
#include "mooedit/moolangmgr.h"
|
||||
#include "mooedit/mooeditfiltersettings.h"
|
||||
@ -30,7 +30,6 @@
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
#include "mooutils/mooaction-private.h"
|
||||
#include "mooutils/mooutils-gobject.h"
|
||||
#include "mooutils/moofilewatch.h"
|
||||
#include "mooutils/mooutils-fs.h"
|
||||
#include "mooutils/moostock.h"
|
||||
#include "mooutils/mooi18n.h"
|
||||
@ -416,7 +415,7 @@ _moo_editor_set_focused_doc (MooEditor *editor,
|
||||
{
|
||||
g_return_if_fail (MOO_IS_EDITOR (editor));
|
||||
g_return_if_fail (MOO_IS_EDIT (doc));
|
||||
g_return_if_fail (doc->priv->editor == editor);
|
||||
g_return_if_fail (moo_edit_get_editor (doc) == editor);
|
||||
|
||||
if (editor->priv->focused_doc != doc)
|
||||
{
|
||||
@ -431,7 +430,7 @@ _moo_editor_unset_focused_doc (MooEditor *editor,
|
||||
{
|
||||
g_return_if_fail (MOO_IS_EDITOR (editor));
|
||||
g_return_if_fail (MOO_IS_EDIT (doc));
|
||||
g_return_if_fail (doc->priv->editor == editor);
|
||||
g_return_if_fail (moo_edit_get_editor (doc) == editor);
|
||||
|
||||
if (editor->priv->focused_doc == doc)
|
||||
{
|
||||
@ -441,7 +440,7 @@ _moo_editor_unset_focused_doc (MooEditor *editor,
|
||||
}
|
||||
|
||||
|
||||
gpointer
|
||||
MooFileWatch *
|
||||
_moo_editor_get_file_watch (MooEditor *editor)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_EDITOR (editor), NULL);
|
||||
@ -890,7 +889,7 @@ _moo_editor_move_doc (MooEditor *editor,
|
||||
int new_pos = -1;
|
||||
|
||||
g_return_if_fail (MOO_IS_EDITOR (editor));
|
||||
g_return_if_fail (MOO_IS_EDIT (doc) && doc->priv->editor == editor);
|
||||
g_return_if_fail (MOO_IS_EDIT (doc) && moo_edit_get_editor (doc) == editor);
|
||||
g_return_if_fail (!dest || (MOO_IS_EDIT_WINDOW (dest) && moo_edit_window_get_editor (dest) == editor));
|
||||
|
||||
if (!dest)
|
||||
@ -1934,7 +1933,7 @@ moo_editor_new_uri (MooEditor *editor,
|
||||
if (!doc)
|
||||
doc = moo_editor_new_doc (editor, window);
|
||||
|
||||
doc->priv->status = MOO_EDIT_NEW;
|
||||
_moo_edit_set_status (doc, MOO_EDIT_NEW);
|
||||
_moo_edit_set_file (doc, file, encoding);
|
||||
moo_editor_set_active_doc (editor, doc);
|
||||
gtk_widget_grab_focus (GTK_WIDGET (doc));
|
||||
@ -1983,7 +1982,7 @@ moo_editor_new_file (MooEditor *editor,
|
||||
if (!doc)
|
||||
doc = moo_editor_new_doc (editor, window);
|
||||
|
||||
doc->priv->status = MOO_EDIT_NEW;
|
||||
_moo_edit_set_status (doc, MOO_EDIT_NEW);
|
||||
file = g_file_new_for_path (filename);
|
||||
_moo_edit_set_file (doc, file, encoding);
|
||||
moo_editor_set_active_doc (editor, doc);
|
||||
@ -2196,7 +2195,7 @@ _moo_editor_save_as (MooEditor *editor,
|
||||
else
|
||||
{
|
||||
if (!encoding)
|
||||
encoding = doc->priv->encoding;
|
||||
encoding = moo_edit_get_encoding (doc);
|
||||
file_info = moo_edit_file_info_new_path (filename, encoding);
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#define MOOEDIT_COMPILATION
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooedit-impl.h"
|
||||
#include "mooedit/mooedit-fileops.h"
|
||||
#include "mooedit/mootextview-private.h"
|
||||
#include "mooedit/mooedit-enums.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
#define MOOEDIT_COMPILATION
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooedit-impl.h"
|
||||
#include "mooedit/mooeditor-private.h"
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooedit/moolangmgr.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
#endif
|
||||
|
||||
#define MOOEDIT_COMPILATION
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooedit-impl.h"
|
||||
#include "mooedit/mooedit-accels.h"
|
||||
#include "mooedit/mooeditor-private.h"
|
||||
#include "mooedit/mooeditfiltersettings.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define MOOEDIT_COMPILATION
|
||||
#include "mooedit/mootextprint-private.h"
|
||||
#include "mooedit/mooedit.h"
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooedit-impl.h"
|
||||
#include "mooedit/mooeditprefs.h"
|
||||
#include "mooedit/mootext-private.h"
|
||||
#include "mooedit/mooprintpreview.h"
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#define MOOEDIT_COMPILATION
|
||||
#include "mooedit/mootextview-private.h"
|
||||
#include "mooedit/mooedit-private.h"
|
||||
#include "mooedit/mooedit-impl.h"
|
||||
#include "mooedit/mootextiter.h"
|
||||
#include "mooedit/mootextbuffer.h"
|
||||
#include "mooutils/mooutils-misc.h"
|
||||
|
@ -245,7 +245,7 @@ param_array_concatenate (GParameter *props1,
|
||||
}
|
||||
|
||||
|
||||
gpointer
|
||||
GtkAction *
|
||||
moo_action_factory_create_action (MooActionFactory *factory,
|
||||
gpointer data,
|
||||
const char *prop_name,
|
||||
@ -293,7 +293,7 @@ moo_action_factory_create_action (MooActionFactory *factory,
|
||||
_moo_param_array_free (props, n_props);
|
||||
_moo_param_array_free (add_props, n_add_props);
|
||||
|
||||
return object;
|
||||
return GTK_ACTION (object);
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,10 +69,10 @@ MooActionFactory *moo_action_factory_new_a (GType object_
|
||||
GParameter *params,
|
||||
guint n_params);
|
||||
|
||||
gpointer moo_action_factory_create_action(MooActionFactory *factory,
|
||||
GtkAction *moo_action_factory_create_action(MooActionFactory *factory,
|
||||
gpointer data,
|
||||
const char *additional_prop_name,
|
||||
...);
|
||||
...) G_GNUC_NULL_TERMINATED;
|
||||
|
||||
|
||||
GtkAction *moo_action_group_add_action (GtkActionGroup *group,
|
||||
|
Loading…
x
Reference in New Issue
Block a user