Renamed MdHistory* to MooHistory*

This commit is contained in:
Yevgen Muntyan 2010-12-08 01:17:17 -08:00
parent ca3fc47cbd
commit b0be51ae76
16 changed files with 506 additions and 556 deletions

View File

@ -16,6 +16,8 @@ moo_sources += \
mooedit/mooedit-fileops.h \
mooedit/mooeditfiltersettings.c \
mooedit/mooeditfiltersettings.h \
mooedit/mooedithistoryitem.c \
mooedit/mooedithistoryitem.h \
mooedit/mooedit-impl.h \
mooedit/mooeditor.c \
mooedit/mooeditor.h \

View File

@ -19,7 +19,7 @@
#include "mooedit/moolinemark.h"
#include "mooedit/mooeditor.h"
#include "mooedit/mootextview.h"
#include "mooutils/mdhistorymgr.h"
#include "mooutils/moohistorymgr.h"
#include <gio/gio.h>
G_BEGIN_DECLS
@ -48,14 +48,6 @@ 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
*/

View File

@ -714,52 +714,6 @@ moo_edit_get_editor (MooEdit *doc)
}
void
_moo_edit_history_item_set_encoding (MdHistoryItem *item,
const char *encoding)
{
g_return_if_fail (item != NULL);
md_history_item_set (item, KEY_ENCODING, encoding);
}
void
_moo_edit_history_item_set_line (MdHistoryItem *item,
int line)
{
char *value = NULL;
g_return_if_fail (item != NULL);
if (line >= 0)
value = g_strdup_printf ("%d", line + 1);
md_history_item_set (item, KEY_LINE, value);
g_free (value);
}
const char *
_moo_edit_history_item_get_encoding (MdHistoryItem *item)
{
g_return_val_if_fail (item != NULL, NULL);
return md_history_item_get (item, KEY_ENCODING);
}
int
_moo_edit_history_item_get_line (MdHistoryItem *item)
{
const char *strval;
g_return_val_if_fail (item != NULL, -1);
strval = md_history_item_get (item, KEY_LINE);
if (strval && strval[0])
return strtol (strval, NULL, 10) - 1;
else
return -1;
}
typedef void (*SetVarFunc) (MooEdit *edit,
const char *name,
char *val);

View File

@ -5,16 +5,16 @@
#define KEY_LINE "line"
void
_moo_edit_history_item_set_encoding (MdHistoryItem *item,
const char *encoding)
_moo_edit_history_item_set_encoding (MooHistoryItem *item,
const char *encoding)
{
g_return_if_fail (item != NULL);
md_history_item_set (item, KEY_ENCODING, encoding);
moo_history_item_set (item, KEY_ENCODING, encoding);
}
void
_moo_edit_history_item_set_line (MdHistoryItem *item,
int line)
_moo_edit_history_item_set_line (MooHistoryItem *item,
int line)
{
char *value = NULL;
@ -23,25 +23,25 @@ _moo_edit_history_item_set_line (MdHistoryItem *item,
if (line >= 0)
value = g_strdup_printf ("%d", line + 1);
md_history_item_set (item, KEY_LINE, value);
moo_history_item_set (item, KEY_LINE, value);
g_free (value);
}
const char *
_moo_edit_history_item_get_encoding (MdHistoryItem *item)
_moo_edit_history_item_get_encoding (MooHistoryItem *item)
{
g_return_val_if_fail (item != NULL, NULL);
return md_history_item_get (item, KEY_ENCODING);
return moo_history_item_get (item, KEY_ENCODING);
}
int
_moo_edit_history_item_get_line (MdHistoryItem *item)
_moo_edit_history_item_get_line (MooHistoryItem *item)
{
const char *strval;
g_return_val_if_fail (item != NULL, -1);
strval = md_history_item_get (item, KEY_LINE);
strval = moo_history_item_get (item, KEY_LINE);
if (strval && strval[0])
return strtol (strval, NULL, 10) - 1;

View File

@ -1,16 +1,16 @@
#ifndef MOO_EDIT_HISTORY_ITEM_H
#define MOO_EDIT_HISTORY_ITEM_H
#include <mooutils/mdhistorymgr.h>
#include <mooutils/moohistorymgr.h>
G_BEGIN_DECLS
void _moo_edit_history_item_set_encoding (MdHistoryItem *item,
void _moo_edit_history_item_set_encoding (MooHistoryItem *item,
const char *encoding);
void _moo_edit_history_item_set_line (MdHistoryItem *item,
void _moo_edit_history_item_set_line (MooHistoryItem *item,
int line);
const char *_moo_edit_history_item_get_encoding (MdHistoryItem *item);
int _moo_edit_history_item_get_line (MdHistoryItem *item);
const char *_moo_edit_history_item_get_encoding (MooHistoryItem *item);
int _moo_edit_history_item_get_line (MooHistoryItem *item);
G_END_DECLS

View File

@ -6,12 +6,12 @@
#endif
#include "mooedit/mooeditor.h"
#include "mooutils/mdhistorymgr.h"
#include "mooutils/moohistorymgr.h"
#include "mooutils/moofilewatch.h"
G_BEGIN_DECLS
MdHistoryMgr *_moo_editor_get_history_mgr (MooEditor *editor);
MooHistoryMgr *_moo_editor_get_history_mgr (MooEditor *editor);
void _moo_editor_set_focused_doc (MooEditor *editor,
MooEdit *doc);

View File

@ -35,7 +35,7 @@ struct MooEditorPrivate {
MooEditWindowArray *windows;
MooUiXml *doc_ui_xml;
MooUiXml *ui_xml;
MdHistoryMgr *history;
MooHistoryMgr *history;
MooFileWatch *file_watch;
MooEditorOptions opts;

View File

@ -2,7 +2,7 @@
#include "mooedit/mooeditor-tests.h"
#include "mooedit/mooeditor-impl.h"
#include "mooutils/mooutils-fs.h"
#include "mooutils/mdhistorymgr.h"
#include "mooutils/moohistorymgr.h"
static struct {
char *working_dir;
@ -235,7 +235,7 @@ test_suite_cleanup (G_GNUC_UNUSED gpointer data)
editor = moo_editor_instance ();
// moo_editor_close_all (editor, FALSE, FALSE);
recent_file = _md_history_mgr_get_filename (_moo_editor_get_history_mgr (editor));
recent_file = _moo_history_mgr_get_filename (_moo_editor_get_history_mgr (editor));
if (!g_file_test (recent_file, G_FILE_TEST_EXISTS))
g_critical ("recent file %s does not exist", recent_file);

View File

@ -24,6 +24,7 @@
#include "mooedit/mooedit-accels.h"
#include "mooedit/mooeditfiltersettings.h"
#include "mooedit/moofileenc.h"
#include "mooedit/mooedithistoryitem.h"
#include "mooedit-ui.h"
#include "medit-ui.h"
#include "mooutils/moomenuaction.h"
@ -234,9 +235,10 @@ moo_editor_constructor (GType type,
editor->priv->history = NULL;
if (!is_embedded (editor))
editor->priv->history = MD_HISTORY_MGR (g_object_new (MD_TYPE_HISTORY_MGR,
"name", "Editor",
(const char*) NULL));
editor->priv->history = MOO_HISTORY_MGR (
g_object_new (MOO_TYPE_HISTORY_MGR,
"name", "Editor",
(const char*) NULL));
moo_prefs_new_key_string (moo_edit_setting (MOO_EDIT_PREFS_DEFAULT_LANG),
MOO_LANG_NONE);
@ -585,7 +587,7 @@ moo_editor_set_ui_xml (MooEditor *editor,
}
MdHistoryMgr *
MooHistoryMgr *
_moo_editor_get_history_mgr (MooEditor *editor)
{
g_return_val_if_fail (MOO_IS_EDITOR (editor), NULL);
@ -597,7 +599,7 @@ add_recent_uri (MooEditor *editor,
const char *uri)
{
if (!is_embedded (editor))
md_history_mgr_add_uri (editor->priv->history, uri);
moo_history_mgr_add_uri (editor->priv->history, uri);
}
static void
@ -615,15 +617,15 @@ recent_item_activated (GSList *items,
const char *encoding;
const char *uri;
char *filename;
MdHistoryItem *item = items->data;
MooHistoryItem *item = items->data;
uri = md_history_item_get_uri (item);
uri = moo_history_item_get_uri (item);
filename = g_filename_from_uri (uri, NULL, NULL);
g_return_if_fail (filename != NULL);
encoding = _moo_edit_history_item_get_encoding (item);
if (!moo_editor_open_uri (editor, window, GTK_WIDGET (window), uri, encoding))
md_history_mgr_remove_uri (editor->priv->history, uri);
moo_history_mgr_remove_uri (editor->priv->history, uri);
g_free (filename);
@ -643,7 +645,7 @@ create_recent_menu (GtkAction *action)
g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), NULL);
editor = moo_editor_instance ();
menu = md_history_mgr_create_menu (editor->priv->history,
menu = moo_history_mgr_create_menu (editor->priv->history,
recent_item_activated,
window, NULL);
moo_bind_bool_property (action,
@ -685,7 +687,7 @@ action_recent_dialog (MooEditWindow *window)
editor = moo_editor_instance ();
g_return_if_fail (MOO_IS_EDITOR (editor));
dialog = md_history_mgr_create_dialog (editor->priv->history,
dialog = moo_history_mgr_create_dialog (editor->priv->history,
recent_item_activated,
window, NULL);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
@ -869,7 +871,7 @@ update_history_item_for_doc (MooEditor *editor,
gboolean add)
{
char *uri;
MdHistoryItem *item;
MooHistoryItem *item;
int line;
const char *enc;
@ -879,7 +881,7 @@ update_history_item_for_doc (MooEditor *editor,
if (!(uri = moo_edit_get_uri (doc)))
return;
item = md_history_item_new (uri, NULL);
item = moo_history_item_new (uri, NULL);
line = moo_text_view_get_cursor_line (MOO_TEXT_VIEW (doc));
if (line != 0)
@ -890,11 +892,11 @@ update_history_item_for_doc (MooEditor *editor,
_moo_edit_history_item_set_encoding (item, enc);
if (add)
md_history_mgr_add_file (editor->priv->history, item);
moo_history_mgr_add_file (editor->priv->history, item);
else
md_history_mgr_update_file (editor->priv->history, item);
moo_history_mgr_update_file (editor->priv->history, item);
md_history_item_free (item);
moo_history_item_free (item);
g_free (uri);
}
@ -948,7 +950,7 @@ moo_editor_load_file (MooEditor *editor,
if (!fenc->encoding)
{
MdHistoryItem *hist_item = md_history_mgr_find_uri (editor->priv->history, uri);
MooHistoryItem *hist_item = moo_history_mgr_find_uri (editor->priv->history, uri);
if (hist_item)
recent_encoding = _moo_edit_history_item_get_encoding (hist_item);
}
@ -969,11 +971,11 @@ moo_editor_load_file (MooEditor *editor,
}
else
{
MdHistoryItem *hist_item;
MooHistoryItem *hist_item;
if (line < 0)
{
hist_item = md_history_mgr_find_uri (editor->priv->history, uri);
hist_item = moo_history_mgr_find_uri (editor->priv->history, uri);
if (hist_item)
line = _moo_edit_history_item_get_line (hist_item);
}

View File

@ -2,8 +2,8 @@ moo_sources += \
mooutils/mooarray.h \
mooutils/mooutils-thread.c \
mooutils/mooutils-thread.h \
mooutils/mdhistorymgr.c \
mooutils/mdhistorymgr.h \
mooutils/moohistorymgr.c \
mooutils/moohistorymgr.h \
mooutils/moo-environ.h \
mooutils/mooaccel.c \
mooutils/mooaccel.h \

View File

@ -1,99 +0,0 @@
/*
* mdhistorymgr.h
*
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@sourceforge.net>
*
* 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 MD_HISTORY_MGR_H
#define MD_HISTORY_MGR_H
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define MD_HISTORY_MGR_PARSE_ERROR (md_history_mgr_parse_error_quark ())
enum {
MD_HISTORY_MGR_PARSE_ERROR_INVALID_CONTENT
};
#define MD_TYPE_HISTORY_MGR (md_history_mgr_get_type ())
#define MD_HISTORY_MGR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MD_TYPE_HISTORY_MGR, MdHistoryMgr))
#define MD_HISTORY_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MD_TYPE_HISTORY_MGR, MdHistoryMgrClass))
#define MD_IS_HISTORY_MGR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MD_TYPE_HISTORY_MGR))
#define MD_IS_HISTORY_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MD_TYPE_HISTORY_MGR))
#define MD_HISTORY_MGR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MD_TYPE_HISTORY_MGR, MdHistoryMgrClass))
typedef struct MdHistoryItem MdHistoryItem;
typedef struct MdHistoryMgr MdHistoryMgr;
typedef struct MdHistoryMgrClass MdHistoryMgrClass;
typedef struct MdHistoryMgrPrivate MdHistoryMgrPrivate;
struct MdHistoryMgr {
GObject base;
MdHistoryMgrPrivate *priv;
};
struct MdHistoryMgrClass {
GObjectClass base_class;
};
typedef void (*MdHistoryCallback) (GSList *items,
gpointer data);
GQuark md_history_mgr_parse_error_quark (void) G_GNUC_CONST;
GType md_history_mgr_get_type (void) G_GNUC_CONST;
void md_history_mgr_add_file (MdHistoryMgr *mgr,
MdHistoryItem *item);
void md_history_mgr_update_file (MdHistoryMgr *mgr,
MdHistoryItem *item);
void md_history_mgr_add_uri (MdHistoryMgr *mgr,
const char *uri);
void md_history_mgr_remove_uri (MdHistoryMgr *mgr,
const char *uri);
MdHistoryItem *md_history_mgr_find_uri (MdHistoryMgr *mgr,
const char *uri);
void md_history_mgr_shutdown (MdHistoryMgr *mgr);
guint md_history_mgr_get_n_items (MdHistoryMgr *mgr);
GtkWidget *md_history_mgr_create_menu (MdHistoryMgr *mgr,
MdHistoryCallback callback,
gpointer data,
GDestroyNotify notify);
GtkWidget *md_history_mgr_create_dialog (MdHistoryMgr *mgr,
MdHistoryCallback callback,
gpointer data,
GDestroyNotify notify);
MdHistoryItem *md_history_item_new (const char *uri,
const char *first_key,
...);
MdHistoryItem *md_history_item_copy (MdHistoryItem *item);
void md_history_item_free (MdHistoryItem *item);
void md_history_item_set (MdHistoryItem *item,
const char *key,
const char *value);
const char *md_history_item_get (MdHistoryItem *item,
const char *key);
const char *md_history_item_get_uri (MdHistoryItem *item);
void md_history_item_foreach (MdHistoryItem *item,
GDataForeachFunc func,
gpointer user_data);
char *_md_history_mgr_get_filename (MdHistoryMgr *mgr);
G_END_DECLS
#endif /* MD_HISTORY_MGR_H */

View File

@ -346,7 +346,7 @@ default_sort_func (GtkTreeModel *model,
GtkTreeIter *a,
GtkTreeIter *b)
{
MooHistoryItem *e1 = NULL, *e2 = NULL;
MooHistoryListItem *e1 = NULL, *e2 = NULL;
int result;
/* XXX 0 is not good */
@ -364,8 +364,8 @@ default_sort_func (GtkTreeModel *model,
else
result = strcmp (e1->data, e2->data);
moo_history_item_free (e1);
moo_history_item_free (e2);
moo_history_list_item_free (e1);
moo_history_list_item_free (e2);
return result;
}
@ -454,7 +454,7 @@ default_filter_func (const char *entry_text,
G_GNUC_UNUSED gpointer data)
{
gboolean visible;
MooHistoryItem *e = NULL;
MooHistoryListItem *e = NULL;
gtk_tree_model_get (model, iter, 0, &e, -1);
@ -470,7 +470,7 @@ default_filter_func (const char *entry_text,
visible = TRUE;
}
moo_history_item_free (e);
moo_history_list_item_free (e);
return visible ? TRUE : FALSE;
}
@ -507,7 +507,7 @@ moo_history_combo_commit (MooHistoryCombo *combo)
{
GtkTreeIter iter;
const char *text;
MooHistoryItem *freeme = NULL;
MooHistoryListItem *freeme = NULL;
g_return_if_fail (MOO_IS_HISTORY_COMBO (combo));
@ -525,7 +525,7 @@ moo_history_combo_commit (MooHistoryCombo *combo)
moo_history_combo_add_text (combo, text);
if (freeme)
moo_history_item_free (freeme);
moo_history_list_item_free (freeme);
}
@ -580,14 +580,14 @@ cell_data_func (G_GNUC_UNUSED GtkCellLayout *cell_layout,
GtkTreeModel *model,
GtkTreeIter *iter)
{
MooHistoryItem *e = NULL;
MooHistoryListItem *e = NULL;
gtk_tree_model_get (model, iter, 0, &e, -1);
if (e)
{
g_object_set (cell, "text", e->display, NULL);
moo_history_item_free (e);
moo_history_list_item_free (e);
}
}
@ -598,10 +598,10 @@ row_separator_func (GtkTreeModel *model,
G_GNUC_UNUSED gpointer data)
{
gboolean separator;
MooHistoryItem *item = NULL;
MooHistoryListItem *item = NULL;
gtk_tree_model_get (model, iter, 0, &item, -1);
separator = item == NULL;
moo_history_item_free (item);
moo_history_list_item_free (item);
return separator;
}
@ -611,7 +611,7 @@ get_text_func (GtkTreeModel *model,
GtkTreeIter *iter,
G_GNUC_UNUSED gpointer data)
{
MooHistoryItem *e = NULL;
MooHistoryListItem *e = NULL;
char *text;
gtk_tree_model_get (model, iter, 0, &e, -1);
@ -620,6 +620,6 @@ get_text_func (GtkTreeModel *model,
g_return_val_if_fail (g_utf8_validate (e->data, -1, NULL), NULL);
text = g_strdup (e->data);
moo_history_item_free (e);
moo_history_list_item_free (e);
return text;
}

View File

@ -22,7 +22,7 @@
#define MAX_NUM_HISTORY_ITEMS 10
typedef MooHistoryItem Item;
typedef MooHistoryListItem Item;
struct _MooHistoryListPrivate {
GtkTreeModel *model;
@ -47,7 +47,7 @@ struct _MooHistoryListPrivate {
gboolean allow_empty;
};
MOO_DEFINE_BOXED_TYPE_C (MooHistoryItem, moo_history_item)
MOO_DEFINE_BOXED_TYPE_C (MooHistoryListItem, moo_history_list_item)
static GHashTable *named_lists;
@ -81,7 +81,7 @@ static void _list_delete_last (MooHistoryList *list);
static void list_save_recent (MooHistoryList *list);
static void menu_item_activated (MooHistoryList *list,
MooHistoryItem *entry,
MooHistoryListItem *entry,
gpointer menu_data);
@ -239,11 +239,11 @@ moo_history_list_finalize (GObject *object)
}
MooHistoryItem *
MooHistoryListItem *
moo_history_list_get_item (MooHistoryList *list,
GtkTreeIter *iter)
{
MooHistoryItem *item = NULL;
MooHistoryListItem *item = NULL;
gtk_tree_model_get (list->priv->model, iter, 0, &item, -1);
return item;
}
@ -266,11 +266,11 @@ moo_history_list_find (MooHistoryList *list,
if (entry && list->priv->compare_func (text, entry, list->priv->compare_data))
{
moo_history_item_free (entry);
moo_history_list_item_free (entry);
return TRUE;
}
moo_history_item_free (entry);
moo_history_list_item_free (entry);
}
while (gtk_tree_model_iter_next (list->priv->model, iter));
}
@ -291,9 +291,9 @@ default_compare_func (const char *text,
Item*
moo_history_item_new (const char *data,
const char *display,
gboolean builtin)
moo_history_list_item_new (const char *data,
const char *display,
gboolean builtin)
{
Item *item;
@ -311,17 +311,17 @@ moo_history_item_new (const char *data,
Item*
moo_history_item_copy (const Item *item)
moo_history_list_item_copy (const Item *item)
{
g_return_val_if_fail (item != NULL, NULL);
return moo_history_item_new (item->data,
item->display,
item->builtin);
return moo_history_list_item_new (item->data,
item->display,
item->builtin);
}
void
moo_history_item_free (Item *item)
moo_history_list_item_free (Item *item)
{
if (item)
{
@ -373,7 +373,7 @@ moo_history_list_add_builtin (MooHistoryList *list,
g_return_if_fail (MOO_IS_HISTORY_LIST (list));
new_item = moo_history_item_new (item, display_item, TRUE);
new_item = moo_history_list_item_new (item, display_item, TRUE);
g_return_if_fail (new_item != NULL);
if (moo_history_list_find (list, item, &iter))
@ -381,7 +381,7 @@ moo_history_list_add_builtin (MooHistoryList *list,
Item *old = moo_history_list_get_item (list, &iter);
if (!old->builtin)
_list_remove (list, &iter);
moo_history_item_free (old);
moo_history_list_item_free (old);
}
_list_insert (list, list->priv->num_builtin++, new_item);
@ -471,11 +471,11 @@ moo_history_list_add_full (MooHistoryList *list,
g_signal_emit (list, signals[CHANGED], 0);
}
moo_history_item_free (old);
moo_history_list_item_free (old);
return;
}
new_entry = moo_history_item_new (entry, display_entry, FALSE);
new_entry = moo_history_list_item_new (entry, display_entry, FALSE);
g_return_if_fail (new_entry != NULL);
if (list->priv->num_builtin &&
@ -503,7 +503,7 @@ moo_history_list_add_full (MooHistoryList *list,
if (was_empty)
g_object_notify (G_OBJECT (list), "empty");
moo_history_item_free (new_entry);
moo_history_list_item_free (new_entry);
}
@ -528,7 +528,7 @@ moo_history_list_get_last_item (MooHistoryList *list)
data = item->data;
item->data = NULL;
moo_history_item_free (item);
moo_history_list_item_free (item);
return data;
}
@ -570,7 +570,7 @@ moo_history_list_remove (MooHistoryList *list,
if (moo_history_list_is_empty (list))
g_object_notify (G_OBJECT (list), "empty");
moo_history_item_free (item);
moo_history_list_item_free (item);
return;
}
@ -744,9 +744,9 @@ moo_history_list_get_model (MooHistoryList *list)
*/
static void
menu_item_activated (MooHistoryList *list,
MooHistoryItem *entry,
gpointer menu_data)
menu_item_activated (MooHistoryList *list,
MooHistoryListItem *entry,
gpointer menu_data)
{
g_signal_emit (list, signals[ACTIVATE_ITEM], 0, entry, menu_data);
}
@ -794,8 +794,8 @@ _list_insert (MooHistoryList *list,
moo_menu_mgr_insert (list->priv->mgr,
NULL, index, NULL,
entry->display, tip, MOO_MENU_ITEM_ACTIVATABLE,
moo_history_item_copy (entry),
(GDestroyNotify) moo_history_item_free);
moo_history_list_item_copy (entry),
(GDestroyNotify) moo_history_list_item_free);
}
else
{
@ -833,15 +833,15 @@ _list_move_on_top (MooHistoryList *list,
moo_menu_mgr_insert (list->priv->mgr,
NULL, new_index, NULL,
entry->display, tip, MOO_MENU_ITEM_ACTIVATABLE,
moo_history_item_copy (entry),
(GDestroyNotify) moo_history_item_free);
moo_history_list_item_copy (entry),
(GDestroyNotify) moo_history_list_item_free);
else
moo_menu_mgr_insert_separator (list->priv->mgr, NULL, new_index);
gtk_list_store_remove (list->priv->store, iter);
gtk_list_store_insert (list->priv->store, iter, new_index);
gtk_list_store_set (list->priv->store, iter, 0, entry, -1);
moo_history_item_free (entry);
moo_history_list_item_free (entry);
g_free (tip);
}
@ -939,7 +939,7 @@ save_one (GtkTreeModel *model,
if (!item->builtin)
moo_markup_create_text_element (root, ELEMENT_ITEM, item->data);
moo_history_item_free (item);
moo_history_list_item_free (item);
return FALSE;
}

View File

@ -22,7 +22,7 @@
G_BEGIN_DECLS
#define MOO_TYPE_HISTORY_ITEM (moo_history_item_get_type ())
#define MOO_TYPE_HISTORY_ITEM (moo_history_list_item_get_type ())
#define MOO_TYPE_HISTORY_LIST (moo_history_list_get_type ())
#define MOO_HISTORY_LIST(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), MOO_TYPE_HISTORY_LIST, MooHistoryList))
#define MOO_HISTORY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_HISTORY_LIST, MooHistoryListClass))
@ -30,18 +30,18 @@ G_BEGIN_DECLS
#define MOO_IS_HISTORY_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_HISTORY_LIST))
#define MOO_HISTORY_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_HISTORY_LIST, MooHistoryListClass))
typedef struct _MooHistoryItem MooHistoryItem;
typedef struct _MooHistoryListItem MooHistoryListItem;
typedef struct _MooHistoryList MooHistoryList;
typedef struct _MooHistoryListPrivate MooHistoryListPrivate;
typedef struct _MooHistoryListClass MooHistoryListClass;
typedef char *(*MooHistoryDisplayFunc) (const char *item,
gpointer data);
typedef gboolean (*MooHistoryCompareFunc) (const char *text,
MooHistoryItem *item,
gpointer data);
typedef char *(*MooHistoryDisplayFunc) (const char *item,
gpointer data);
typedef gboolean (*MooHistoryCompareFunc) (const char *text,
MooHistoryListItem *item,
gpointer data);
struct _MooHistoryItem
struct _MooHistoryListItem
{
char *data;
char *display;
@ -59,16 +59,16 @@ struct _MooHistoryListClass
{
GObjectClass parent_class;
void (*activate_item) (MooHistoryList *list,
MooHistoryItem *item,
gpointer menu_data);
void (*activate_item) (MooHistoryList *list,
MooHistoryListItem *item,
gpointer menu_data);
void (*changed) (MooHistoryList *list);
};
GType moo_history_list_get_type (void) G_GNUC_CONST;
GType moo_history_item_get_type (void) G_GNUC_CONST;
GType moo_history_list_item_get_type (void) G_GNUC_CONST;
MooHistoryList *moo_history_list_new (const char *user_id);
MooHistoryList *moo_history_list_get (const char *user_id);
@ -103,7 +103,7 @@ char *moo_history_list_display_filename (const char *entry,
gpointer data);
/* must free the result */
MooHistoryItem *moo_history_list_get_item (MooHistoryList *list,
MooHistoryListItem *moo_history_list_get_item (MooHistoryList *list,
GtkTreeIter *iter);
gboolean moo_history_list_find (MooHistoryList *list,
const char *text,
@ -123,11 +123,11 @@ void moo_history_list_add_builtin (MooHistoryList *list,
MooMenuMgr *moo_history_list_get_menu_mgr (MooHistoryList *list);
MooHistoryItem *moo_history_item_new (const char *data,
MooHistoryListItem *moo_history_list_item_new (const char *data,
const char *display,
gboolean builtin);
MooHistoryItem *moo_history_item_copy (const MooHistoryItem *item);
void moo_history_item_free (MooHistoryItem *item);
MooHistoryListItem *moo_history_list_item_copy (const MooHistoryListItem *item);
void moo_history_list_item_free (MooHistoryListItem *item);
G_END_DECLS

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
/*
* moohistorymgr.h
*
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@sourceforge.net>
*
* 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_HISTORY_MGR_H
#define MOO_HISTORY_MGR_H
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define MOO_HISTORY_MGR_PARSE_ERROR (moo_history_mgr_parse_error_quark ())
enum {
MOO_HISTORY_MGR_PARSE_ERROR_INVALID_CONTENT
};
#define MOO_TYPE_HISTORY_MGR (moo_history_mgr_get_type ())
#define MOO_HISTORY_MGR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MOO_TYPE_HISTORY_MGR, MooHistoryMgr))
#define MOO_HISTORY_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MOO_TYPE_HISTORY_MGR, MooHistoryMgrClass))
#define MOO_IS_HISTORY_MGR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MOO_TYPE_HISTORY_MGR))
#define MOO_IS_HISTORY_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MOO_TYPE_HISTORY_MGR))
#define MOO_HISTORY_MGR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MOO_TYPE_HISTORY_MGR, MooHistoryMgrClass))
typedef struct _MooHistoryItem MooHistoryItem;
typedef struct _MooHistoryMgr MooHistoryMgr;
typedef struct _MooHistoryMgrClass MooHistoryMgrClass;
typedef struct _MooHistoryMgrPrivate MooHistoryMgrPrivate;
struct _MooHistoryMgr {
GObject base;
MooHistoryMgrPrivate *priv;
};
struct _MooHistoryMgrClass {
GObjectClass base_class;
};
typedef void (*MooHistoryCallback) (GSList *items,
gpointer data);
GQuark moo_history_mgr_parse_error_quark (void) G_GNUC_CONST;
GType moo_history_mgr_get_type (void) G_GNUC_CONST;
void moo_history_mgr_add_file (MooHistoryMgr *mgr,
MooHistoryItem *item);
void moo_history_mgr_update_file (MooHistoryMgr *mgr,
MooHistoryItem *item);
void moo_history_mgr_add_uri (MooHistoryMgr *mgr,
const char *uri);
void moo_history_mgr_remove_uri (MooHistoryMgr *mgr,
const char *uri);
MooHistoryItem *moo_history_mgr_find_uri (MooHistoryMgr *mgr,
const char *uri);
void moo_history_mgr_shutdown (MooHistoryMgr *mgr);
guint moo_history_mgr_get_n_items (MooHistoryMgr *mgr);
GtkWidget *moo_history_mgr_create_menu (MooHistoryMgr *mgr,
MooHistoryCallback callback,
gpointer data,
GDestroyNotify notify);
GtkWidget *moo_history_mgr_create_dialog (MooHistoryMgr *mgr,
MooHistoryCallback callback,
gpointer data,
GDestroyNotify notify);
MooHistoryItem *moo_history_item_new (const char *uri,
const char *first_key,
...);
MooHistoryItem *moo_history_item_copy (MooHistoryItem *item);
void moo_history_item_free (MooHistoryItem *item);
void moo_history_item_set (MooHistoryItem *item,
const char *key,
const char *value);
const char *moo_history_item_get (MooHistoryItem *item,
const char *key);
const char *moo_history_item_get_uri (MooHistoryItem *item);
void moo_history_item_foreach (MooHistoryItem *item,
GDataForeachFunc func,
gpointer user_data);
char *_moo_history_mgr_get_filename (MooHistoryMgr *mgr);
G_END_DECLS
#endif /* MOO_HISTORY_MGR_H */