Another rename
This commit is contained in:
parent
ff873222dc
commit
834c77b5e7
@ -66,14 +66,14 @@ public:
|
||||
|
||||
Object* release()
|
||||
{
|
||||
auto* tmp = get();
|
||||
auto* tmp = gobj();
|
||||
m_ref._set_gobj(nullptr);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
auto* tmp = get();
|
||||
auto* tmp = gobj();
|
||||
if (tmp)
|
||||
{
|
||||
m_ref._set_gobj(nullptr);
|
||||
@ -86,24 +86,24 @@ public:
|
||||
// FooObject* tmp = x->s;
|
||||
// x->s = NULL;
|
||||
// g_object_unref (tmp);
|
||||
operator const Object* () const { return get(); }
|
||||
operator const Object* () const { return gobj(); }
|
||||
operator ref_type*() const { return m_ref.self(); }
|
||||
ref_type* operator->() const { return m_ref.self(); }
|
||||
ref_type& operator*() const { return m_ref; }
|
||||
|
||||
Object* get() const { return m_ref.gobj(); }
|
||||
Object* gobj() const { return m_ref.gobj(); }
|
||||
|
||||
template<typename Super>
|
||||
Super* get() const
|
||||
Super* gobj() const
|
||||
{
|
||||
return gobj_is_subclass<Object, Super>::down_cast(m_ref.gobj());
|
||||
}
|
||||
|
||||
template<typename Super>
|
||||
operator const Super* () const { return get<Super>(); }
|
||||
operator const Super* () const { return gobj<Super>(); }
|
||||
|
||||
operator bool() const { return get() != nullptr; }
|
||||
bool operator!() const { return get() == nullptr; }
|
||||
operator bool() const { return gobj() != nullptr; }
|
||||
bool operator!() const { return gobj() == nullptr; }
|
||||
|
||||
gobj_ptr_impl(const gobj_ptr_impl& other) = delete;
|
||||
gobj_ptr_impl& operator=(const gobj_ptr_impl& other) = delete;
|
||||
@ -111,7 +111,7 @@ public:
|
||||
gobj_ptr_impl(gobj_ptr_impl&& other)
|
||||
: gobj_ptr_impl()
|
||||
{
|
||||
m_ref._set_gobj(other.get());
|
||||
m_ref._set_gobj(other.gobj());
|
||||
other.m_ref._set_gobj(nullptr);
|
||||
}
|
||||
|
||||
@ -133,9 +133,9 @@ public:
|
||||
|
||||
gobj_ptr_impl& operator=(gobj_ptr_impl&& other)
|
||||
{
|
||||
if (get() != other.get())
|
||||
if (gobj() != other.gobj())
|
||||
{
|
||||
assign(other.get(), ref_transfer::take_ownership);
|
||||
assign(other.gobj(), ref_transfer::take_ownership);
|
||||
other.m_ref._set_gobj(nullptr);
|
||||
}
|
||||
|
||||
@ -145,9 +145,9 @@ public:
|
||||
private:
|
||||
void assign(Object* obj, ref_transfer policy)
|
||||
{
|
||||
if (get() != obj)
|
||||
if (gobj() != obj)
|
||||
{
|
||||
Object* tmp = get();
|
||||
Object* tmp = gobj();
|
||||
m_ref._set_gobj(obj);
|
||||
|
||||
if (obj)
|
||||
@ -239,43 +239,43 @@ void g_free(const gobj_ptr<X>&);
|
||||
template<typename X>
|
||||
inline bool operator==(const moo::gobj_ptr<X>& p, const nullptr_t&)
|
||||
{
|
||||
return p.get() == nullptr;
|
||||
return p.gobj() == nullptr;
|
||||
}
|
||||
|
||||
template<typename X>
|
||||
inline bool operator==(const nullptr_t&, const moo::gobj_ptr<X>& p)
|
||||
{
|
||||
return p.get() == nullptr;
|
||||
return p.gobj() == nullptr;
|
||||
}
|
||||
|
||||
template<typename X, typename Y>
|
||||
inline bool operator==(const moo::gobj_ptr<X>& p1, const moo::gobj_ptr<Y>& p2)
|
||||
{
|
||||
return p1.get() == p2.get();
|
||||
return p1.gobj() == p2.gobj();
|
||||
}
|
||||
|
||||
template<typename X, typename Y>
|
||||
inline bool operator==(const moo::gobj_ptr<X>& p1, const Y* p2)
|
||||
{
|
||||
return p1.get() == p2;
|
||||
return p1.gobj() == p2;
|
||||
}
|
||||
|
||||
template<typename X, typename Y>
|
||||
inline bool operator==(const X* p1, const moo::gobj_ptr<Y>& p2)
|
||||
{
|
||||
return p1 == p2.get();
|
||||
return p1 == p2.gobj();
|
||||
}
|
||||
|
||||
template<typename X, typename Y>
|
||||
inline bool operator==(const moo::gobj_ptr<X>& p1, const moo::gobj_raw_ptr<Y>& p2)
|
||||
{
|
||||
return p1.get() == p2.get();
|
||||
return p1.gobj() == p2.gobj();
|
||||
}
|
||||
|
||||
template<typename X, typename Y>
|
||||
inline bool operator==(const moo::gobj_raw_ptr<Y>& p1, const moo::gobj_ptr<X>& p2)
|
||||
{
|
||||
return p1.get() == p2.get();
|
||||
return p1.gobj() == p2.gobj();
|
||||
}
|
||||
|
||||
template<typename X, typename Y>
|
||||
|
@ -46,155 +46,155 @@ FilePtr File::parse_name(const char* parse_name)
|
||||
|
||||
FilePtr File::dup() const
|
||||
{
|
||||
return FilePtr::wrap_new(g_file_dup(g()));
|
||||
return FilePtr::wrap_new(g_file_dup(nc_gobj()));
|
||||
}
|
||||
|
||||
bool File::equal(GFile* file2) const
|
||||
{
|
||||
return g_file_equal(g(), file2);
|
||||
return g_file_equal(nc_gobj(), file2);
|
||||
}
|
||||
|
||||
gstr File::get_basename() const
|
||||
{
|
||||
return gstr::wrap_new(g_file_get_basename(g()));
|
||||
return gstr::wrap_new(g_file_get_basename(nc_gobj()));
|
||||
}
|
||||
|
||||
gstr File::get_path() const
|
||||
{
|
||||
return gstr::wrap_new(g_file_get_path(g()));
|
||||
return gstr::wrap_new(g_file_get_path(nc_gobj()));
|
||||
}
|
||||
|
||||
gstr File::get_uri() const
|
||||
{
|
||||
return gstr::wrap_new(g_file_get_uri(g()));
|
||||
return gstr::wrap_new(g_file_get_uri(nc_gobj()));
|
||||
}
|
||||
|
||||
gstr File::get_parse_name() const
|
||||
{
|
||||
return gstr::wrap_new(g_file_get_parse_name(g()));
|
||||
return gstr::wrap_new(g_file_get_parse_name(nc_gobj()));
|
||||
}
|
||||
|
||||
FilePtr File::get_parent() const
|
||||
{
|
||||
return FilePtr::wrap_new(g_file_get_parent(g()));
|
||||
return FilePtr::wrap_new(g_file_get_parent(nc_gobj()));
|
||||
}
|
||||
|
||||
bool File::has_parent(GFile* parent) const
|
||||
{
|
||||
return g_file_has_parent(g(), parent);
|
||||
return g_file_has_parent(nc_gobj(), parent);
|
||||
}
|
||||
|
||||
FilePtr File::get_child(const char* name) const
|
||||
{
|
||||
return FilePtr::wrap_new(g_file_get_child(g(), name));
|
||||
return FilePtr::wrap_new(g_file_get_child(nc_gobj(), name));
|
||||
}
|
||||
|
||||
FilePtr File::get_child_for_display_name(const char* display_name, GError** error) const
|
||||
{
|
||||
return FilePtr::wrap_new(g_file_get_child_for_display_name(g(), display_name, error));
|
||||
return FilePtr::wrap_new(g_file_get_child_for_display_name(nc_gobj(), display_name, error));
|
||||
}
|
||||
|
||||
bool File::has_prefix(GFile* prefix) const
|
||||
{
|
||||
return g_file_has_prefix(g(), prefix);
|
||||
return g_file_has_prefix(nc_gobj(), prefix);
|
||||
}
|
||||
|
||||
gstr File::get_relative_path(GFile* descendant) const
|
||||
{
|
||||
return gstr::wrap_new(g_file_get_relative_path(g(), descendant));
|
||||
return gstr::wrap_new(g_file_get_relative_path(nc_gobj(), descendant));
|
||||
}
|
||||
|
||||
FilePtr File::resolve_relative_path(const char *relative_path) const
|
||||
{
|
||||
return FilePtr::wrap_new(g_file_resolve_relative_path(g(), relative_path));
|
||||
return FilePtr::wrap_new(g_file_resolve_relative_path(nc_gobj(), relative_path));
|
||||
}
|
||||
|
||||
bool File::is_native() const
|
||||
{
|
||||
return g_file_is_native(g());
|
||||
return g_file_is_native(nc_gobj());
|
||||
}
|
||||
|
||||
bool File::has_uri_scheme(const char *uri_scheme) const
|
||||
{
|
||||
return g_file_has_uri_scheme(g(), uri_scheme);
|
||||
return g_file_has_uri_scheme(nc_gobj(), uri_scheme);
|
||||
}
|
||||
|
||||
gstr File::get_uri_scheme() const
|
||||
{
|
||||
return gstr::wrap_new(g_file_get_uri_scheme(g()));
|
||||
return gstr::wrap_new(g_file_get_uri_scheme(nc_gobj()));
|
||||
}
|
||||
|
||||
bool File::query_exists(GCancellable* cancellable) const
|
||||
{
|
||||
return g_file_query_exists(g(), cancellable);
|
||||
return g_file_query_exists(nc_gobj(), cancellable);
|
||||
}
|
||||
|
||||
GFileType File::query_file_type(GFileQueryInfoFlags flags, GCancellable* cancellable) const
|
||||
{
|
||||
return g_file_query_file_type(g(), flags, cancellable);
|
||||
return g_file_query_file_type(nc_gobj(), flags, cancellable);
|
||||
}
|
||||
|
||||
GFileInfo* File::query_info(const char *attributes, GFileQueryInfoFlags flags, GCancellable* cancellable, GError** error) const
|
||||
{
|
||||
return g_file_query_info(g(), attributes, flags, cancellable, error);
|
||||
return g_file_query_info(nc_gobj(), attributes, flags, cancellable, error);
|
||||
}
|
||||
|
||||
GFileInfo* File::query_filesystem_info(const char *attributes, GCancellable* cancellable, GError** error) const
|
||||
{
|
||||
return g_file_query_filesystem_info(g(), attributes, cancellable, error);
|
||||
return g_file_query_filesystem_info(nc_gobj(), attributes, cancellable, error);
|
||||
}
|
||||
|
||||
GFileEnumerator* File::enumerate_children(const char *attributes, GFileQueryInfoFlags flags, GCancellable* cancellable, GError** error) const
|
||||
{
|
||||
return g_file_enumerate_children(g(), attributes, flags, cancellable, error);
|
||||
return g_file_enumerate_children(nc_gobj(), attributes, flags, cancellable, error);
|
||||
}
|
||||
|
||||
FilePtr File::set_display_name(const char* display_name, GCancellable* cancellable, GError** error) const
|
||||
{
|
||||
return FilePtr::wrap_new(g_file_set_display_name(g(), display_name, cancellable, error));
|
||||
return FilePtr::wrap_new(g_file_set_display_name(nc_gobj(), display_name, cancellable, error));
|
||||
}
|
||||
|
||||
bool File::delete_(GCancellable* cancellable, GError** error) const
|
||||
{
|
||||
return g_file_delete(g(), cancellable, error);
|
||||
return g_file_delete(nc_gobj(), cancellable, error);
|
||||
}
|
||||
|
||||
bool File::trash(GCancellable* cancellable, GError** error) const
|
||||
{
|
||||
return g_file_trash(g(), cancellable, error);
|
||||
return g_file_trash(nc_gobj(), cancellable, error);
|
||||
}
|
||||
|
||||
bool File::copy(GFile* destination, GFileCopyFlags flags, GCancellable* cancellable, GFileProgressCallback progress_callback, gpointer progress_callback_data, GError** error) const
|
||||
{
|
||||
return g_file_copy(g(), destination, flags, cancellable, progress_callback, progress_callback_data, error);
|
||||
return g_file_copy(nc_gobj(), destination, flags, cancellable, progress_callback, progress_callback_data, error);
|
||||
}
|
||||
|
||||
bool File::move(GFile* destination, GFileCopyFlags flags, GCancellable* cancellable, GFileProgressCallback progress_callback, gpointer progress_callback_data, GError** error) const
|
||||
{
|
||||
return g_file_move(g(), destination, flags, cancellable, progress_callback, progress_callback_data, error);
|
||||
return g_file_move(nc_gobj(), destination, flags, cancellable, progress_callback, progress_callback_data, error);
|
||||
}
|
||||
|
||||
bool File::make_directory(GCancellable* cancellable, GError** error) const
|
||||
{
|
||||
return g_file_make_directory(g(), cancellable, error);
|
||||
return g_file_make_directory(nc_gobj(), cancellable, error);
|
||||
}
|
||||
|
||||
bool File::make_directory_with_parents(GCancellable* cancellable, GError** error) const
|
||||
{
|
||||
return g_file_make_directory_with_parents(g(), cancellable, error);
|
||||
return g_file_make_directory_with_parents(nc_gobj(), cancellable, error);
|
||||
}
|
||||
|
||||
bool File::make_symbolic_link(const char *symlink_value, GCancellable* cancellable, GError** error) const
|
||||
{
|
||||
return g_file_make_symbolic_link(g(), symlink_value, cancellable, error);
|
||||
return g_file_make_symbolic_link(nc_gobj(), symlink_value, cancellable, error);
|
||||
}
|
||||
|
||||
bool File::load_contents(GCancellable* cancellable, char** contents, gsize* length, char** etag_out, GError** error) const
|
||||
{
|
||||
return g_file_load_contents(g(), cancellable, contents, length, etag_out, error);
|
||||
return g_file_load_contents(nc_gobj(), cancellable, contents, length, etag_out, error);
|
||||
}
|
||||
|
||||
bool File::replace_contents(const char* contents, gsize length, const char* etag, gboolean make_backup, GFileCreateFlags flags, char** new_etag, GCancellable* cancellable, GError** error) const
|
||||
{
|
||||
return g_file_replace_contents(g(), contents, length, etag, make_backup, flags, new_etag, cancellable, error);
|
||||
return g_file_replace_contents(nc_gobj(), contents, length, etag, make_backup, flags, new_etag, cancellable, error);
|
||||
}
|
||||
|
@ -32,6 +32,11 @@ class gobj_ref<GFile> : public gobj_ref_parent<GFile>
|
||||
public:
|
||||
MOO_DEFINE_GOBJREF_METHODS(GFile)
|
||||
|
||||
static gobj_ptr<GFile> new_for_path (const char* path);
|
||||
static gobj_ptr<GFile> new_for_uri (const char* uri);
|
||||
static gobj_ptr<GFile> new_for_commandline_arg (const char* arg);
|
||||
static gobj_ptr<GFile> parse_name (const char* parse_name);
|
||||
|
||||
gobj_ptr<GFile> dup () const;
|
||||
|
||||
bool equal (GFile* file2) const;
|
||||
@ -127,23 +132,6 @@ public:
|
||||
char** new_etag,
|
||||
GCancellable* cancellable,
|
||||
GError** error) const;
|
||||
|
||||
static gobj_ptr<GFile> new_for_path (const char* path);
|
||||
static gobj_ptr<GFile> new_for_uri (const char* uri);
|
||||
static gobj_ptr<GFile> new_for_commandline_arg (const char* arg);
|
||||
static gobj_ptr<GFile> parse_name (const char* parse_name);
|
||||
};
|
||||
|
||||
template<>
|
||||
class gobj_ptr<GFile> : public gobj_ptr_impl<GFile>
|
||||
{
|
||||
public:
|
||||
MOO_DEFINE_GOBJPTR_METHODS(GFile)
|
||||
|
||||
static gobj_ptr new_for_path(const char* path) { return ref_type::new_for_path(path); }
|
||||
static gobj_ptr new_for_uri(const char* uri) { return ref_type::new_for_uri(uri); }
|
||||
static gobj_ptr new_for_commandline_arg(const char* arg) { return ref_type::new_for_commandline_arg(arg); }
|
||||
static gobj_ptr parse_name(const char* parse_name) { return ref_type::parse_name(parse_name); }
|
||||
};
|
||||
|
||||
namespace g {
|
||||
|
@ -49,12 +49,6 @@ public:
|
||||
void thaw_notify ();
|
||||
};
|
||||
|
||||
template<>
|
||||
class gobj_ptr<GObject> : public gobj_ptr_impl<GObject>
|
||||
{
|
||||
static gobj_ptr<GObject> wrap_new(GObject*);
|
||||
};
|
||||
|
||||
namespace g {
|
||||
|
||||
#define MOO_GOBJ_TYPEDEFS(CppObject, CObject) \
|
||||
|
@ -26,10 +26,10 @@ void test()
|
||||
GtkObject* o1 = r.gobj();
|
||||
GtkObject* o2 = p->gobj();
|
||||
g_assert(o1 == o2);
|
||||
GObject* o = p.get<GObject>();
|
||||
GObject* o = p.gobj<GObject>();
|
||||
g_assert(o == nullptr);
|
||||
GtkObject* x = p.get<GtkObject>();
|
||||
GObject* y = p.get<GObject>();
|
||||
GtkObject* x = p.gobj<GtkObject>();
|
||||
GObject* y = p.gobj<GObject>();
|
||||
g_assert((void*) x == (void*) y);
|
||||
const GObject* c1 = p;
|
||||
const GtkObject* c2 = p;
|
||||
@ -42,10 +42,10 @@ void test()
|
||||
GtkWidget* o1 = r.gobj();
|
||||
GtkWidget* o2 = p->gobj();
|
||||
g_assert(o1 == o2);
|
||||
GtkWidget* x = p.get<GtkWidget>();
|
||||
GtkWidget* y = p.get();
|
||||
GtkObject* z = p.get<GtkObject>();
|
||||
GObject* t = p.get<GObject>();
|
||||
GtkWidget* x = p.gobj<GtkWidget>();
|
||||
GtkWidget* y = p.gobj();
|
||||
GtkObject* z = p.gobj<GtkObject>();
|
||||
GObject* t = p.gobj<GObject>();
|
||||
g_assert((void*) x == (void*) y);
|
||||
g_assert((void*) z == (void*) t);
|
||||
const GObject* c1 = p;
|
||||
@ -54,11 +54,11 @@ void test()
|
||||
g_assert((void*) c1 == (void*) c2);
|
||||
g_assert((void*) c1 == (void*) c3);
|
||||
|
||||
gobj_ref<GtkWidget> or(*p.get());
|
||||
gobj_ref<GtkWidget> or(*p.gobj());
|
||||
or.freeze_notify();
|
||||
p->freeze_notify();
|
||||
|
||||
gobj_raw_ptr<GtkWidget> rp = p.get();
|
||||
gobj_raw_ptr<GtkWidget> rp = p.gobj();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,19 +32,19 @@ class gobj_raw_ptr
|
||||
public:
|
||||
gobj_raw_ptr(Object* obj = nullptr) { m_ref._set_gobj(obj); }
|
||||
|
||||
operator Object*() const { return get(); }
|
||||
operator GTypeInstance*() const { return reinterpret_cast<GTypeInstance*>(get()); }
|
||||
operator gpointer() const { return get(); }
|
||||
operator Object*() const { return gobj(); }
|
||||
operator GTypeInstance*() const { return reinterpret_cast<GTypeInstance*>(gobj()); }
|
||||
operator gpointer() const { return gobj(); }
|
||||
operator gobj_ref<Object>*() const { return m_ref.self(); }
|
||||
|
||||
ref_type* operator->() const { return m_ref.self(); }
|
||||
ref_type& operator*() const { return m_ref; }
|
||||
|
||||
Object* get() const { return m_ref.gobj(); }
|
||||
Object* gobj() const { return m_ref.gobj(); }
|
||||
void set(Object* p) { m_ref._set_gobj(p); }
|
||||
|
||||
template<typename Super>
|
||||
Super* get() const
|
||||
Super* gobj() const
|
||||
{
|
||||
return gobj_is_subclass<Object, Super>::down_cast(m_ref.gobj());
|
||||
}
|
||||
@ -55,21 +55,21 @@ public:
|
||||
set(gobj_is_subclass<Subclass, Object>::down_cast(p));
|
||||
}
|
||||
|
||||
operator bool() const { return get() != nullptr; }
|
||||
bool operator!() const { return get() == nullptr; }
|
||||
operator bool() const { return gobj() != nullptr; }
|
||||
bool operator!() const { return gobj() == nullptr; }
|
||||
|
||||
gobj_raw_ptr(const gobj_raw_ptr& other) = default;
|
||||
gobj_raw_ptr& operator=(const gobj_raw_ptr& other) = default;
|
||||
|
||||
gobj_raw_ptr(gobj_raw_ptr&& other)
|
||||
: m_ref(other.get())
|
||||
: m_ref(other.gobj())
|
||||
{
|
||||
other = nullptr;
|
||||
}
|
||||
|
||||
gobj_raw_ptr& operator=(gobj_raw_ptr&& other)
|
||||
{
|
||||
m_ref._set_gobj(other.get());
|
||||
m_ref._set_gobj(other.gobj());
|
||||
other.m_ref._set_gobj(nullptr);
|
||||
return *this;
|
||||
}
|
||||
@ -93,19 +93,19 @@ class gobj_raw_ptr<const Object>
|
||||
public:
|
||||
gobj_raw_ptr(const Object* obj = nullptr) { m_ref._set_gobj(const_cast<Object*>(obj)); }
|
||||
|
||||
operator const Object*() const { return get(); }
|
||||
operator const GTypeInstance*() const { return reinterpret_cast<GTypeInstance*>(get()); }
|
||||
operator const void*() const { return get(); }
|
||||
operator const Object*() const { return gobj(); }
|
||||
operator const GTypeInstance*() const { return reinterpret_cast<GTypeInstance*>(gobj()); }
|
||||
operator const void*() const { return gobj(); }
|
||||
operator const gobj_ref<Object>*() const { return m_ref.self(); }
|
||||
|
||||
const ref_type* operator->() const { return m_ref.self(); }
|
||||
const ref_type& operator*() const { return m_ref; }
|
||||
|
||||
const Object* get() const { return m_ref.gobj(); }
|
||||
const Object* gobj() const { return m_ref.gobj(); }
|
||||
void set(const Object* p) { m_ref._set_gobj(p); }
|
||||
|
||||
template<typename Super>
|
||||
const Super* get() const
|
||||
const Super* gobj() const
|
||||
{
|
||||
return gobj_is_subclass<Object, Super>::down_cast(m_ref.gobj());
|
||||
}
|
||||
@ -116,21 +116,21 @@ public:
|
||||
set(gobj_is_subclass<Subclass, Object>::down_cast(p));
|
||||
}
|
||||
|
||||
operator bool() const { return get() != nullptr; }
|
||||
bool operator!() const { return get() == nullptr; }
|
||||
operator bool() const { return gobj() != nullptr; }
|
||||
bool operator!() const { return gobj() == nullptr; }
|
||||
|
||||
gobj_raw_ptr(const gobj_raw_ptr& other) = default;
|
||||
gobj_raw_ptr& operator=(const gobj_raw_ptr& other) = default;
|
||||
|
||||
gobj_raw_ptr(gobj_raw_ptr&& other)
|
||||
: m_ref(other.get())
|
||||
: m_ref(other.gobj())
|
||||
{
|
||||
other = nullptr;
|
||||
}
|
||||
|
||||
gobj_raw_ptr& operator=(gobj_raw_ptr&& other)
|
||||
{
|
||||
m_ref._set_gobj(other.get());
|
||||
m_ref._set_gobj(other.gobj());
|
||||
other.m_ref._set_gobj(nullptr);
|
||||
return *this;
|
||||
}
|
||||
@ -151,31 +151,31 @@ private:
|
||||
template<typename X>
|
||||
inline bool operator==(const moo::gobj_raw_ptr<X>& p, const nullptr_t&)
|
||||
{
|
||||
return p.get() == nullptr;
|
||||
return p.gobj() == nullptr;
|
||||
}
|
||||
|
||||
template<typename X>
|
||||
inline bool operator==(const nullptr_t&, const moo::gobj_raw_ptr<X>& p)
|
||||
{
|
||||
return p.get() == nullptr;
|
||||
return p.gobj() == nullptr;
|
||||
}
|
||||
|
||||
template<typename X, typename Y>
|
||||
inline bool operator==(const moo::gobj_raw_ptr<X>& p1, const moo::gobj_raw_ptr<Y>& p2)
|
||||
{
|
||||
return p1.get() == p2.get();
|
||||
return p1.gobj() == p2.gobj();
|
||||
}
|
||||
|
||||
template<typename X, typename Y>
|
||||
inline bool operator==(const moo::gobj_raw_ptr<X>& p1, const Y* p2)
|
||||
{
|
||||
return p1.get() == p2;
|
||||
return p1.gobj() == p2;
|
||||
}
|
||||
|
||||
template<typename X, typename Y>
|
||||
inline bool operator==(const X* p1, const moo::gobj_raw_ptr<Y>& p2)
|
||||
{
|
||||
return p1 == p2.get();
|
||||
return p1 == p2.gobj();
|
||||
}
|
||||
|
||||
template<typename X, typename Y>
|
||||
|
@ -112,22 +112,22 @@ public:
|
||||
template<typename X> \
|
||||
X* gobj() \
|
||||
{ \
|
||||
return g<X>(); \
|
||||
return nc_gobj<X>(); \
|
||||
} \
|
||||
\
|
||||
template<typename X> \
|
||||
const X* gobj() const \
|
||||
{ \
|
||||
return g<X>(); \
|
||||
return nc_gobj<X>(); \
|
||||
} \
|
||||
\
|
||||
object_type* g() const \
|
||||
object_type* nc_gobj() const \
|
||||
{ \
|
||||
return const_cast<object_type*>(gobj()); \
|
||||
} \
|
||||
\
|
||||
template<typename X> \
|
||||
X* g() const \
|
||||
X* nc_gobj() const \
|
||||
{ \
|
||||
object_type* o = const_cast<object_type*>(gobj()); \
|
||||
return gobj_is_subclass<Object, X>::down_cast(o); \
|
||||
@ -138,8 +138,8 @@ public:
|
||||
\
|
||||
operator object_type&() { return *gobj(); } \
|
||||
operator const object_type&() const { return *gobj(); } \
|
||||
gobj_raw_ptr<object_type> operator&() { return g(); } \
|
||||
gobj_raw_ptr<const object_type> operator&() const { return g(); } \
|
||||
gobj_raw_ptr<object_type> operator&() { return nc_gobj(); } \
|
||||
gobj_raw_ptr<const object_type> operator&() const { return nc_gobj(); } \
|
||||
\
|
||||
gobj_ref(const gobj_ref&) = default; \
|
||||
gobj_ref& operator=(const gobj_ref&) = default; \
|
||||
|
@ -95,29 +95,29 @@ public:
|
||||
// FooObject* tmp = x->s;
|
||||
// x->s = NULL;
|
||||
// g_object_unref (tmp);
|
||||
operator const Object* () const { return get(); }
|
||||
Object* get() const { return m_p; }
|
||||
Object& operator*() const { return *get(); }
|
||||
Object* operator->() const { return get(); }
|
||||
operator const Object* () const { return gobj(); }
|
||||
Object* gobj() const { return m_p; }
|
||||
Object& operator*() const { return *gobj(); }
|
||||
Object* operator->() const { return gobj(); }
|
||||
|
||||
// Explicitly forbid other pointer conversions. This way it's still possible to implement
|
||||
// implicit conversions in subclasses, like that to GTypeInstance in gobj_ptr.
|
||||
template<typename T>
|
||||
operator T*() const = delete;
|
||||
|
||||
operator bool() const { return get() != nullptr; }
|
||||
bool operator!() const { return get() == nullptr; }
|
||||
operator bool() const { return gobj() != nullptr; }
|
||||
bool operator!() const { return gobj() == nullptr; }
|
||||
|
||||
template<typename X>
|
||||
bool operator==(X* other) const
|
||||
{
|
||||
return get() == other;
|
||||
return gobj() == other;
|
||||
}
|
||||
|
||||
template<typename X, typename Y>
|
||||
bool operator==(const grefptr<X, Y>& other) const
|
||||
{
|
||||
return get() == other.get();
|
||||
return gobj() == other.gobj();
|
||||
}
|
||||
|
||||
template<typename X>
|
||||
@ -127,7 +127,7 @@ public:
|
||||
}
|
||||
|
||||
grefptr(const grefptr& other)
|
||||
: grefptr(other.get(), ref_transfer::make_copy)
|
||||
: grefptr(other.gobj(), ref_transfer::make_copy)
|
||||
{
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ public:
|
||||
|
||||
grefptr& operator=(const grefptr& other)
|
||||
{
|
||||
assign(other.get(), ref_transfer::make_copy);
|
||||
assign(other.gobj(), ref_transfer::make_copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ public:
|
||||
|
||||
grefptr& operator=(grefptr&& other)
|
||||
{
|
||||
if (get() != other.get())
|
||||
if (gobj() != other.gobj())
|
||||
{
|
||||
assign(other.m_p, ref_transfer::take_ownership);
|
||||
other.m_p = nullptr;
|
||||
@ -174,9 +174,9 @@ public:
|
||||
private:
|
||||
void assign(Object* obj, ref_transfer policy)
|
||||
{
|
||||
if (get() != obj)
|
||||
if (gobj() != obj)
|
||||
{
|
||||
Object* tmp = get();
|
||||
Object* tmp = gobj();
|
||||
m_p = obj;
|
||||
if (obj && (policy == ref_transfer::make_copy))
|
||||
ObjRefUnref::ref(obj);
|
||||
|
@ -656,7 +656,7 @@ static bool do_write(const g::File& file,
|
||||
|
||||
writer_flags = (flags & MOO_EDIT_SAVE_BACKUP) ? MOO_FILE_WRITER_SAVE_BACKUP : (MooFileWriterFlags) 0;
|
||||
|
||||
if ((writer = moo_file_writer_new_for_file (file.g(), writer_flags, error)))
|
||||
if ((writer = moo_file_writer_new_for_file (file.nc_gobj(), writer_flags, error)))
|
||||
{
|
||||
success = TRUE;
|
||||
if (success && len1 > 0)
|
||||
|
@ -46,24 +46,24 @@ MOO_DEFINE_FLAGS(MooEditSaveFlags)
|
||||
|
||||
GQuark _moo_edit_file_error_quark (void) G_GNUC_CONST;
|
||||
|
||||
bool _moo_is_file_error_cancelled (GError* error);
|
||||
bool _moo_is_file_error_cancelled (GError* error);
|
||||
|
||||
bool _moo_edit_file_is_new (const moo::gobj_ref<GFile>& file);
|
||||
bool _moo_edit_load_file (Edit& edit,
|
||||
const moo::gobj_ref<GFile>& file,
|
||||
const moo::gstr& init_encoding,
|
||||
const moo::gstr& init_cached_encoding,
|
||||
GError** error);
|
||||
bool _moo_edit_reload_file (Edit edit,
|
||||
const char* encoding,
|
||||
GError** error);
|
||||
bool _moo_edit_save_file (Edit& edit,
|
||||
const moo::gobj_ref<GFile>& floc,
|
||||
const char* encoding,
|
||||
MooEditSaveFlags flags,
|
||||
GError** error);
|
||||
bool _moo_edit_save_file_copy (Edit edit,
|
||||
const moo::gobj_ref<GFile>& file,
|
||||
const char* encoding,
|
||||
MooEditSaveFlags flags,
|
||||
GError** error);
|
||||
bool _moo_edit_file_is_new (const moo::g::File& file);
|
||||
bool _moo_edit_load_file (Edit& edit,
|
||||
const moo::g::File& file,
|
||||
const moo::gstr& init_encoding,
|
||||
const moo::gstr& init_cached_encoding,
|
||||
GError** error);
|
||||
bool _moo_edit_reload_file (Edit edit,
|
||||
const char* encoding,
|
||||
GError** error);
|
||||
bool _moo_edit_save_file (Edit& edit,
|
||||
const moo::g::File& floc,
|
||||
const char* encoding,
|
||||
MooEditSaveFlags flags,
|
||||
GError** error);
|
||||
bool _moo_edit_save_file_copy (Edit edit,
|
||||
const moo::g::File& file,
|
||||
const char* encoding,
|
||||
MooEditSaveFlags flags,
|
||||
GError** error);
|
||||
|
@ -356,7 +356,7 @@ void Edit::_closed()
|
||||
_moo_edit_instances = moo_edit_list_remove (_moo_edit_instances, gobj());
|
||||
|
||||
while (!priv.views.empty())
|
||||
gtk_widget_destroy (priv.views[0].get<GtkWidget>());
|
||||
gtk_widget_destroy (priv.views[0].gobj<GtkWidget>());
|
||||
|
||||
if (get_config())
|
||||
{
|
||||
@ -870,7 +870,7 @@ moo_edit_get_view (MooEdit *doc)
|
||||
|
||||
if (!doc->priv->active_view)
|
||||
if (!doc->priv->views.empty())
|
||||
doc->priv->active_view = doc->priv->views.back().get();
|
||||
doc->priv->active_view = doc->priv->views.back().gobj();
|
||||
|
||||
return doc->priv->active_view;
|
||||
}
|
||||
@ -888,7 +888,7 @@ moo_edit_get_views (MooEdit *doc)
|
||||
MooEditViewArray *ret = moo_edit_view_array_new ();
|
||||
moo_edit_view_array_reserve (ret, doc->priv->views.size ());
|
||||
for (const auto& view: doc->priv->views)
|
||||
moo_edit_view_array_append (ret, view.get());
|
||||
moo_edit_view_array_append (ret, view.gobj());
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -922,7 +922,7 @@ GtkTextBuffer *
|
||||
moo_edit_get_buffer (MooEdit *doc)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_EDIT (doc), NULL);
|
||||
return doc->priv->buffer.get();
|
||||
return doc->priv->buffer.gobj();
|
||||
}
|
||||
|
||||
|
||||
@ -1174,7 +1174,7 @@ moo_edit_get_lang (MooEdit *doc)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_EDIT (doc), NULL);
|
||||
moo_assert (!doc->priv->in_recheck_config);
|
||||
return moo_text_buffer_get_lang (MOO_TEXT_BUFFER (doc->priv->buffer.get()));
|
||||
return moo_text_buffer_get_lang (MOO_TEXT_BUFFER (doc->priv->buffer.gobj()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1270,7 +1270,7 @@ moo_edit_apply_config (MooEdit *doc)
|
||||
MooLangMgr *mgr = moo_lang_mgr_default ();
|
||||
MooLang *lang = lang_id ? _moo_lang_mgr_find_lang (mgr, lang_id) : NULL;
|
||||
|
||||
moo_text_buffer_set_lang (MOO_TEXT_BUFFER (doc->priv->buffer.get()), lang);
|
||||
moo_text_buffer_set_lang (MOO_TEXT_BUFFER (doc->priv->buffer.gobj()), lang);
|
||||
|
||||
g_object_notify (G_OBJECT (doc), "has-comments");
|
||||
g_object_notify (G_OBJECT (doc), "lang");
|
||||
@ -1353,7 +1353,7 @@ moo_edit_apply_prefs (MooEdit *edit)
|
||||
moo_edit_freeze_notify (edit);
|
||||
|
||||
for (const auto& view: edit->priv->views)
|
||||
_moo_edit_view_apply_prefs (view.get());
|
||||
_moo_edit_view_apply_prefs (view.gobj());
|
||||
|
||||
moo_edit_thaw_notify (edit);
|
||||
}
|
||||
@ -1465,7 +1465,7 @@ moo_edit_save_copy (MooEdit *doc,
|
||||
|
||||
bool Edit::_is_busy() const
|
||||
{
|
||||
return _moo_edit_get_state(g()) != MOO_EDIT_STATE_NORMAL;
|
||||
return _moo_edit_get_state(nc_gobj()) != MOO_EDIT_STATE_NORMAL;
|
||||
}
|
||||
|
||||
MooEditState
|
||||
@ -1507,7 +1507,7 @@ _moo_edit_set_state (MooEdit *doc,
|
||||
doc->priv->state = state;
|
||||
|
||||
for (const auto& view: doc->priv->views)
|
||||
gtk_text_view_set_editable (view.get<GtkTextView>(), !state);
|
||||
gtk_text_view_set_editable (view.gobj<GtkTextView>(), !state);
|
||||
|
||||
tab = moo_edit_get_tab (doc);
|
||||
|
||||
@ -1838,7 +1838,7 @@ void Edit::_ensure_newline()
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter;
|
||||
|
||||
buffer = moo_edit_get_buffer (g());
|
||||
buffer = moo_edit_get_buffer (gobj());
|
||||
gtk_text_buffer_get_end_iter (buffer, &iter);
|
||||
|
||||
if (!gtk_text_iter_starts_line (&iter))
|
||||
@ -1850,7 +1850,7 @@ void Edit::_strip_whitespace()
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter;
|
||||
|
||||
buffer = moo_edit_get_buffer (g());
|
||||
buffer = moo_edit_get_buffer (gobj());
|
||||
gtk_text_buffer_begin_user_action (buffer);
|
||||
|
||||
for (gtk_text_buffer_get_start_iter (buffer, &iter);
|
||||
|
@ -541,7 +541,7 @@ GtkActionGroup *
|
||||
moo_edit_get_actions (MooEdit *edit)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_EDIT (edit), NULL);
|
||||
return moo_action_collection_get_group (edit->priv->actions.get(), NULL);
|
||||
return moo_action_collection_get_group (edit->priv->actions.gobj(), NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -575,7 +575,7 @@ add_action (const char *id,
|
||||
|
||||
void Edit::_add_class_actions()
|
||||
{
|
||||
GType type = G_OBJECT_TYPE (g());
|
||||
GType type = G_OBJECT_TYPE (gobj());
|
||||
|
||||
while (true)
|
||||
{
|
||||
@ -584,7 +584,7 @@ void Edit::_add_class_actions()
|
||||
actions = get_actions_hash (type);
|
||||
|
||||
if (actions)
|
||||
g_hash_table_foreach (actions, (GHFunc) add_action, g());
|
||||
g_hash_table_foreach (actions, (GHFunc) add_action, gobj());
|
||||
|
||||
if (type == MOO_TYPE_EDIT)
|
||||
break;
|
||||
|
@ -375,7 +375,7 @@ void Edit::_delete_bookmarks(bool in_destroy)
|
||||
disconnect_bookmark (MOO_EDIT_BOOKMARK (bookmarks->data));
|
||||
|
||||
if (!in_destroy)
|
||||
moo_text_buffer_delete_line_mark (get_moo_buffer (g()),
|
||||
moo_text_buffer_delete_line_mark (get_moo_buffer (gobj()),
|
||||
MOO_LINE_MARK (bookmarks->data));
|
||||
|
||||
::g_object_unref (bookmarks->data);
|
||||
@ -383,7 +383,7 @@ void Edit::_delete_bookmarks(bool in_destroy)
|
||||
}
|
||||
|
||||
if (!in_destroy)
|
||||
bookmarks_changed(g());
|
||||
bookmarks_changed(gobj());
|
||||
}
|
||||
}
|
||||
|
||||
@ -483,9 +483,9 @@ void Edit::_update_bookmarks_style()
|
||||
const GSList *bookmarks;
|
||||
const char *color;
|
||||
|
||||
color = get_bookmark_color (g());
|
||||
color = get_bookmark_color (gobj());
|
||||
|
||||
bookmarks = moo_edit_list_bookmarks (g());
|
||||
bookmarks = moo_edit_list_bookmarks (gobj());
|
||||
while (bookmarks)
|
||||
{
|
||||
moo_line_mark_set_background (MOO_LINE_MARK (bookmarks->data), color);
|
||||
|
@ -54,8 +54,8 @@ struct MooEditBookmarkClass
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
using MooEditBookmarkPtr = moo::gobj_ptr<MooEditBookmark>;
|
||||
using MooEditBookmarkRef = moo::gobj_ref<MooEditBookmark>;
|
||||
using EditBookmarkPtr = moo::gobj_ptr<MooEditBookmark>;
|
||||
using EditBookmark = moo::gobj_ref<MooEditBookmark>;
|
||||
#endif
|
||||
|
||||
GType moo_edit_bookmark_get_type (void) G_GNUC_CONST;
|
||||
|
@ -57,7 +57,7 @@ _moo_edit_open_dialog (GtkWidget *widget,
|
||||
start.take(moo_prefs_get_file(moo_edit_setting(MOO_EDIT_PREFS_LAST_DIR)));
|
||||
|
||||
dialog = moo_file_dialog_new (MOO_FILE_DIALOG_OPEN, widget,
|
||||
TRUE, GTK_STOCK_OPEN, start.get(),
|
||||
TRUE, GTK_STOCK_OPEN, start.gobj(),
|
||||
NULL);
|
||||
g_object_set (dialog, "enable-encodings", TRUE, NULL);
|
||||
moo_file_dialog_set_help_id (dialog, "dialog-open");
|
||||
@ -80,7 +80,7 @@ _moo_edit_open_dialog (GtkWidget *widget,
|
||||
moo_open_info_array_take (info_array, moo_open_info_new_file (files->elms[i], encoding, -1, MOO_OPEN_FLAGS_NONE));
|
||||
|
||||
start.take(g_file_get_parent (files->elms[0]));
|
||||
moo_prefs_set_file (moo_edit_setting (MOO_EDIT_PREFS_LAST_DIR), start.get());
|
||||
moo_prefs_set_file (moo_edit_setting (MOO_EDIT_PREFS_LAST_DIR), start.gobj());
|
||||
}
|
||||
|
||||
g_object_unref (dialog);
|
||||
@ -479,9 +479,9 @@ bool _moo_edit_save_error_enc_dialog(Edit& doc,
|
||||
|
||||
|
||||
MooEditTryEncodingResponse
|
||||
_moo_edit_try_encoding_dialog (const gobj_ref<GFile>& file,
|
||||
const char* encoding,
|
||||
/*out*/ gstr& new_encoding)
|
||||
_moo_edit_try_encoding_dialog (const g::File& file,
|
||||
const char* encoding,
|
||||
/*out*/ gstr& new_encoding)
|
||||
{
|
||||
MooEditWindow *window;
|
||||
GtkWidget *dialog;
|
||||
|
@ -38,3 +38,7 @@ struct MooSaveInfoClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
MOO_GOBJ_TYPEDEFS(OpenInfo, MooOpenInfo);
|
||||
MOO_GOBJ_TYPEDEFS(ReloadInfo, MooReloadInfo);
|
||||
MOO_GOBJ_TYPEDEFS(SaveInfo, MooSaveInfo);
|
||||
|
@ -53,15 +53,15 @@ moo_open_info_new_file (GFile *file,
|
||||
{
|
||||
g_return_val_if_fail (G_IS_FILE (file), nullptr);
|
||||
|
||||
MooOpenInfo *info = MOO_OPEN_INFO (g_object_new (MOO_TYPE_OPEN_INFO, nullptr));
|
||||
OpenInfoPtr info = wrap_new(MOO_OPEN_INFO(g_object_new(MOO_TYPE_OPEN_INFO, nullptr)));
|
||||
new(info)(MooOpenInfo);
|
||||
|
||||
info->file = wrap_new(g_file_dup(file));
|
||||
info->encoding = gstr::make_copy(encoding);
|
||||
info->line = line;
|
||||
info->flags = flags;
|
||||
info->gobj()->file = wrap_new(g_file_dup(file));
|
||||
info->gobj()->encoding = gstr::make_copy(encoding);
|
||||
info->gobj()->line = line;
|
||||
info->gobj()->flags = flags;
|
||||
|
||||
return info;
|
||||
return info.release();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,10 +80,8 @@ moo_open_info_new (const char *path,
|
||||
int line,
|
||||
MooOpenFlags flags)
|
||||
{
|
||||
GFile *file = g_file_new_for_path (path);
|
||||
MooOpenInfo *info = moo_open_info_new_file (file, encoding, line, flags);
|
||||
g_object_unref (file);
|
||||
return info;
|
||||
g::FilePtr file = g::File::new_for_path(path);
|
||||
return moo_open_info_new_file (file.gobj(), encoding, line, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -102,10 +100,8 @@ moo_open_info_new_uri (const char *uri,
|
||||
int line,
|
||||
MooOpenFlags flags)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (uri);
|
||||
MooOpenInfo *info = moo_open_info_new_file (file, encoding, line, flags);
|
||||
g_object_unref (file);
|
||||
return info;
|
||||
g::FilePtr file = g::File::new_for_uri(uri);
|
||||
return moo_open_info_new_file (file.gobj(), encoding, line, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,23 +112,12 @@ moo_open_info_new_uri (const char *uri,
|
||||
MooOpenInfo *
|
||||
moo_open_info_dup (MooOpenInfo *info)
|
||||
{
|
||||
MooOpenInfo *copy;
|
||||
|
||||
g_return_val_if_fail (info != NULL, NULL);
|
||||
|
||||
copy = moo_open_info_new_file (info->file.get(), info->encoding, info->line, info->flags);
|
||||
g_return_val_if_fail (copy != NULL, NULL);
|
||||
|
||||
g_return_val_if_fail(info != nullptr, nullptr);
|
||||
MooOpenInfo *copy = moo_open_info_new_file(info->file.gobj(), info->encoding, info->line, info->flags);
|
||||
g_return_val_if_fail(copy != nullptr, nullptr);
|
||||
return copy;
|
||||
}
|
||||
|
||||
void
|
||||
moo_open_info_free (MooOpenInfo *info)
|
||||
{
|
||||
if (info)
|
||||
g_object_unref (info);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* moo_open_info_get_filename: (moo.private 1)
|
||||
@ -288,15 +273,15 @@ MooSaveInfo *
|
||||
moo_save_info_new_file(GFile *file,
|
||||
const char *encoding)
|
||||
{
|
||||
g_return_val_if_fail(G_IS_FILE(file), NULL);
|
||||
g_return_val_if_fail(G_IS_FILE(file), nullptr);
|
||||
|
||||
MooSaveInfo *info = MOO_SAVE_INFO(g_object_new(MOO_TYPE_SAVE_INFO, NULL));
|
||||
SaveInfoPtr info = wrap_new(MOO_SAVE_INFO(g_object_new(MOO_TYPE_SAVE_INFO, nullptr)));
|
||||
new(info)(MooSaveInfo);
|
||||
|
||||
info->file.wrap_new(g_file_dup(file));
|
||||
info->encoding.copy(encoding);
|
||||
info.gobj()->file.wrap_new(g_file_dup(file));
|
||||
info.gobj()->encoding.copy(encoding);
|
||||
|
||||
return info;
|
||||
return info.release();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -311,8 +296,8 @@ MooSaveInfo *
|
||||
moo_save_info_new(const char *path,
|
||||
const char *encoding)
|
||||
{
|
||||
auto file = gobj_ptr<GFile>::new_for_path(path);
|
||||
MooSaveInfo *info = moo_save_info_new_file(file.get(), encoding);
|
||||
auto file = g::File::new_for_path(path);
|
||||
MooSaveInfo *info = moo_save_info_new_file(file.gobj(), encoding);
|
||||
return info;
|
||||
}
|
||||
|
||||
@ -328,9 +313,8 @@ MooSaveInfo *
|
||||
moo_save_info_new_uri (const char *uri,
|
||||
const char *encoding)
|
||||
{
|
||||
GFile *file = g_file_new_for_uri (uri);
|
||||
MooSaveInfo *info = moo_save_info_new_file (file, encoding);
|
||||
g_object_unref (file);
|
||||
auto file = g::File::new_for_uri(uri);
|
||||
MooSaveInfo *info = moo_save_info_new_file(file.gobj(), encoding);
|
||||
return info;
|
||||
}
|
||||
|
||||
@ -342,23 +326,12 @@ moo_save_info_new_uri (const char *uri,
|
||||
MooSaveInfo *
|
||||
moo_save_info_dup (MooSaveInfo *info)
|
||||
{
|
||||
MooSaveInfo *copy;
|
||||
|
||||
g_return_val_if_fail (info != NULL, NULL);
|
||||
|
||||
copy = moo_save_info_new_file (info->file.get(), info->encoding);
|
||||
g_return_val_if_fail (copy != NULL, NULL);
|
||||
|
||||
g_return_val_if_fail(info != nullptr, nullptr);
|
||||
MooSaveInfo *copy = moo_save_info_new_file(info->file.gobj(), info->encoding);
|
||||
g_return_val_if_fail(copy != nullptr, nullptr);
|
||||
return copy;
|
||||
}
|
||||
|
||||
void
|
||||
moo_save_info_free (MooSaveInfo *info)
|
||||
{
|
||||
if (info)
|
||||
g_object_unref (info);
|
||||
}
|
||||
|
||||
static void
|
||||
moo_save_info_finalize (GObject *object)
|
||||
{
|
||||
@ -389,13 +362,13 @@ MooReloadInfo *
|
||||
moo_reload_info_new (const char *encoding,
|
||||
int line)
|
||||
{
|
||||
MooReloadInfo *info = MOO_RELOAD_INFO (g_object_new (MOO_TYPE_RELOAD_INFO, NULL));
|
||||
ReloadInfoPtr info = wrap_new(MOO_RELOAD_INFO(g_object_new(MOO_TYPE_RELOAD_INFO, nullptr)));
|
||||
new(info)(MooReloadInfo);
|
||||
|
||||
info->encoding.copy(encoding);
|
||||
info->line = line;
|
||||
info.gobj()->encoding.copy(encoding);
|
||||
info.gobj()->line = line;
|
||||
|
||||
return info;
|
||||
return info.release();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -406,24 +379,12 @@ moo_reload_info_new (const char *encoding,
|
||||
MooReloadInfo *
|
||||
moo_reload_info_dup (MooReloadInfo *info)
|
||||
{
|
||||
MooReloadInfo *copy;
|
||||
|
||||
g_return_val_if_fail (info != NULL, NULL);
|
||||
|
||||
copy = moo_reload_info_new (info->encoding, info->line);
|
||||
g_return_val_if_fail (copy != NULL, NULL);
|
||||
|
||||
g_return_val_if_fail (info != nullptr, nullptr);
|
||||
MooReloadInfo *copy = moo_reload_info_new (info->encoding, info->line);
|
||||
g_return_val_if_fail (copy != nullptr, nullptr);
|
||||
return copy;
|
||||
}
|
||||
|
||||
void
|
||||
moo_reload_info_free (MooReloadInfo *info)
|
||||
{
|
||||
if (info)
|
||||
g_object_unref (info);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* moo_reload_info_get_line:
|
||||
*
|
||||
|
@ -63,7 +63,6 @@ MooOpenInfo *moo_open_info_new_uri (const char *uri,
|
||||
int line,
|
||||
MooOpenFlags flags);
|
||||
MooOpenInfo *moo_open_info_dup (MooOpenInfo *info);
|
||||
void moo_open_info_free (MooOpenInfo *info);
|
||||
|
||||
char *moo_open_info_get_filename (MooOpenInfo *info);
|
||||
char *moo_open_info_get_uri (MooOpenInfo *info);
|
||||
@ -84,7 +83,6 @@ void moo_open_info_add_flags (MooOpenInfo *info,
|
||||
MooReloadInfo *moo_reload_info_new (const char *encoding,
|
||||
int line);
|
||||
MooReloadInfo *moo_reload_info_dup (MooReloadInfo *info);
|
||||
void moo_reload_info_free (MooReloadInfo *info);
|
||||
|
||||
int moo_reload_info_get_line (MooReloadInfo *info);
|
||||
void moo_reload_info_set_line (MooReloadInfo *info,
|
||||
@ -97,7 +95,6 @@ MooSaveInfo *moo_save_info_new_file (GFile *file,
|
||||
MooSaveInfo *moo_save_info_new_uri (const char *uri,
|
||||
const char *encoding);
|
||||
MooSaveInfo *moo_save_info_dup (MooSaveInfo *info);
|
||||
void moo_save_info_free (MooSaveInfo *info);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -380,11 +380,11 @@ moo_editor_constructor (GType type,
|
||||
_moo_stock_init ();
|
||||
|
||||
editor->priv->doc_ui_xml.take(moo_ui_xml_new());
|
||||
moo_ui_xml_add_ui_from_string (editor->priv->doc_ui_xml.get(),
|
||||
moo_ui_xml_add_ui_from_string (editor->priv->doc_ui_xml.gobj(),
|
||||
mooedit_ui_xml, -1);
|
||||
|
||||
editor->priv->lang_mgr.ref(moo_lang_mgr_default());
|
||||
g_signal_connect_swapped (editor->priv->lang_mgr.get(), "loaded",
|
||||
g_signal_connect_swapped (editor->priv->lang_mgr.gobj(), "loaded",
|
||||
G_CALLBACK (_moo_editor_apply_prefs),
|
||||
editor);
|
||||
|
||||
@ -494,7 +494,7 @@ _moo_editor_get_file_watch (MooEditor *editor)
|
||||
if (!editor->priv->file_watch)
|
||||
editor->priv->file_watch = MooFileWatch::create(nullptr);
|
||||
|
||||
return editor->priv->file_watch.get();
|
||||
return editor->priv->file_watch.gobj();
|
||||
}
|
||||
|
||||
|
||||
@ -627,10 +627,10 @@ moo_editor_get_ui_xml (MooEditor *editor)
|
||||
if (!editor->priv->ui_xml)
|
||||
{
|
||||
editor->priv->ui_xml.take(moo_ui_xml_new ());
|
||||
moo_ui_xml_add_ui_from_string (editor->priv->ui_xml.get(), medit_ui_xml, -1);
|
||||
moo_ui_xml_add_ui_from_string (editor->priv->ui_xml.gobj(), medit_ui_xml, -1);
|
||||
}
|
||||
|
||||
return editor->priv->ui_xml.get();
|
||||
return editor->priv->ui_xml.gobj();
|
||||
}
|
||||
|
||||
|
||||
@ -641,7 +641,7 @@ MooUiXml *
|
||||
moo_editor_get_doc_ui_xml (MooEditor *editor)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_EDITOR (editor), NULL);
|
||||
return editor->priv->doc_ui_xml.get();
|
||||
return editor->priv->doc_ui_xml.gobj();
|
||||
}
|
||||
|
||||
|
||||
@ -661,7 +661,7 @@ moo_editor_set_ui_xml (MooEditor *editor,
|
||||
editor->priv->ui_xml.ref(xml);
|
||||
|
||||
for (const auto& window: editor->priv->windows)
|
||||
moo_window_set_ui_xml (MOO_WINDOW (window), editor->priv->ui_xml.get());
|
||||
moo_window_set_ui_xml (MOO_WINDOW (window), editor->priv->ui_xml.gobj());
|
||||
}
|
||||
|
||||
|
||||
@ -669,7 +669,7 @@ MooHistoryMgr *
|
||||
_moo_editor_get_history_mgr (MooEditor *editor)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_EDITOR (editor), NULL);
|
||||
return editor->priv->history.get();
|
||||
return editor->priv->history.gobj();
|
||||
}
|
||||
|
||||
// static void
|
||||
@ -702,7 +702,7 @@ recent_item_activated (GSList *items,
|
||||
|
||||
encoding = _moo_edit_history_item_get_encoding (item);
|
||||
if (!moo_editor_open_uri (editor, uri, encoding, -1, window))
|
||||
moo_history_mgr_remove_uri (editor->priv->history.get(), uri);
|
||||
moo_history_mgr_remove_uri (editor->priv->history.gobj(), uri);
|
||||
|
||||
g_free (filename);
|
||||
|
||||
@ -722,11 +722,11 @@ create_recent_menu (GtkAction *action)
|
||||
g_return_val_if_fail (MOO_IS_EDIT_WINDOW (window), NULL);
|
||||
|
||||
editor = moo_editor_instance ();
|
||||
menu = moo_history_mgr_create_menu (editor->priv->history.get(),
|
||||
menu = moo_history_mgr_create_menu (editor->priv->history.gobj(),
|
||||
recent_item_activated,
|
||||
window, NULL);
|
||||
moo_bind_bool_property (action,
|
||||
"sensitive", editor->priv->history.get(),
|
||||
"sensitive", editor->priv->history.gobj(),
|
||||
"empty", TRUE);
|
||||
|
||||
item = gtk_separator_menu_item_new ();
|
||||
@ -764,7 +764,7 @@ action_recent_dialog (MooEditWindow *window)
|
||||
editor = moo_editor_instance ();
|
||||
g_return_if_fail (MOO_IS_EDITOR (editor));
|
||||
|
||||
dialog = moo_history_mgr_create_dialog (editor->priv->history.get(),
|
||||
dialog = moo_history_mgr_create_dialog (editor->priv->history.gobj(),
|
||||
recent_item_activated,
|
||||
window, NULL);
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
|
||||
@ -936,9 +936,9 @@ update_history_item_for_doc (MooEditor *editor,
|
||||
_moo_edit_history_item_set_encoding (item, enc);
|
||||
|
||||
if (add)
|
||||
moo_history_mgr_add_file (editor->priv->history.get(), item);
|
||||
moo_history_mgr_add_file (editor->priv->history.gobj(), item);
|
||||
else
|
||||
moo_history_mgr_update_file (editor->priv->history.get(), item);
|
||||
moo_history_mgr_update_file (editor->priv->history.gobj(), item);
|
||||
|
||||
moo_history_item_free (item);
|
||||
g_free (uri);
|
||||
@ -967,7 +967,7 @@ moo_editor_load_file(MooEditor *editor,
|
||||
gstr uri = info->file->get_uri();
|
||||
gstr filename = info->file->get_path();
|
||||
int line = info->line;
|
||||
EditPtr doc = wrap(moo_editor_get_doc_for_file(editor, info->file.get()));
|
||||
EditPtr doc = wrap(moo_editor_get_doc_for_file(editor, info->file.gobj()));
|
||||
|
||||
if (filename.empty())
|
||||
{
|
||||
@ -988,7 +988,7 @@ moo_editor_load_file(MooEditor *editor,
|
||||
{
|
||||
doc = wrap (moo_edit_window_get_active_doc (window));
|
||||
|
||||
if (doc && !moo_edit_is_empty (doc.get()))
|
||||
if (doc && !moo_edit_is_empty (doc.gobj()))
|
||||
doc = NULL;
|
||||
}
|
||||
}
|
||||
@ -1001,14 +1001,14 @@ moo_editor_load_file(MooEditor *editor,
|
||||
|
||||
if (success)
|
||||
{
|
||||
view = moo_edit_get_view (doc.get());
|
||||
view = moo_edit_get_view (doc.gobj());
|
||||
|
||||
if (!new_doc && line < 0 && (info->flags & MOO_OPEN_FLAG_RELOAD) != MOO_OPEN_FLAGS_NONE)
|
||||
line = moo_text_view_get_cursor_line (GTK_TEXT_VIEW (view));
|
||||
|
||||
if (info->encoding.empty())
|
||||
{
|
||||
MooHistoryItem *hist_item = moo_history_mgr_find_uri (editor->priv->history.get(), uri);
|
||||
MooHistoryItem *hist_item = moo_history_mgr_find_uri (editor->priv->history.gobj(), uri);
|
||||
if (hist_item)
|
||||
recent_encoding = _moo_edit_history_item_get_encoding (hist_item);
|
||||
}
|
||||
@ -1019,7 +1019,7 @@ moo_editor_load_file(MooEditor *editor,
|
||||
if ((info->flags & MOO_OPEN_FLAG_CREATE_NEW) && _moo_edit_file_is_new(*info->file))
|
||||
{
|
||||
doc->_set_status(MOO_EDIT_STATUS_NEW);
|
||||
doc->_set_file(info->file.get(), info->encoding);
|
||||
doc->_set_file(info->file.gobj(), info->encoding);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1039,7 +1039,7 @@ moo_editor_load_file(MooEditor *editor,
|
||||
window = moo_editor_get_active_window (editor);
|
||||
if (!parent && window)
|
||||
parent = GTK_WIDGET (window);
|
||||
_moo_edit_open_error_dialog(parent, info->file.get(), error_here);
|
||||
_moo_edit_open_error_dialog(parent, info->file.gobj(), error_here);
|
||||
}
|
||||
|
||||
g_propagate_error (error, error_here);
|
||||
@ -1052,7 +1052,7 @@ moo_editor_load_file(MooEditor *editor,
|
||||
if (!success)
|
||||
{
|
||||
if (!silent && !_moo_is_file_error_cancelled (error_here))
|
||||
_moo_edit_reload_error_dialog (doc.get(), error_here);
|
||||
_moo_edit_reload_error_dialog (doc.gobj(), error_here);
|
||||
g_propagate_error (error, error_here);
|
||||
error_here = NULL;
|
||||
}
|
||||
@ -1063,7 +1063,7 @@ moo_editor_load_file(MooEditor *editor,
|
||||
if (!window || (info->flags & MOO_OPEN_FLAG_NEW_WINDOW))
|
||||
window = create_window (editor);
|
||||
|
||||
_moo_edit_window_insert_doc (window, doc.get(), NULL);
|
||||
_moo_edit_window_insert_doc (window, doc.gobj(), NULL);
|
||||
}
|
||||
|
||||
if (success)
|
||||
@ -1072,7 +1072,7 @@ moo_editor_load_file(MooEditor *editor,
|
||||
|
||||
if (line < 0 && new_doc)
|
||||
{
|
||||
hist_item = moo_history_mgr_find_uri (editor->priv->history.get(), uri);
|
||||
hist_item = moo_history_mgr_find_uri (editor->priv->history.gobj(), uri);
|
||||
if (hist_item)
|
||||
line = _moo_edit_history_item_get_line (hist_item);
|
||||
}
|
||||
@ -1082,11 +1082,11 @@ moo_editor_load_file(MooEditor *editor,
|
||||
}
|
||||
|
||||
if (success && add_history)
|
||||
update_history_item_for_doc (editor, doc.get(), TRUE);
|
||||
update_history_item_for_doc (editor, doc.gobj(), TRUE);
|
||||
|
||||
if (success)
|
||||
{
|
||||
moo_editor_set_active_doc (editor, doc.get());
|
||||
moo_editor_set_active_doc (editor, doc.gobj());
|
||||
gtk_widget_grab_focus (GTK_WIDGET (view));
|
||||
}
|
||||
|
||||
@ -1235,9 +1235,9 @@ _moo_editor_open_files (MooEditor *editor,
|
||||
|
||||
if (doc)
|
||||
{
|
||||
parent = GTK_WIDGET (moo_edit_get_view (doc.get()));
|
||||
bring_to_front = doc.get();
|
||||
moo_edit_array_append (docs, doc.get());
|
||||
parent = GTK_WIDGET (moo_edit_get_view (doc.gobj()));
|
||||
bring_to_front = doc.gobj();
|
||||
moo_edit_array_append (docs, doc.gobj());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1749,7 +1749,7 @@ load_doc_session (MooEditor *editor,
|
||||
const char *encoding = moo_markup_get_prop (elm, "encoding");
|
||||
gobj_ptr<MooOpenInfo> info = wrap_new(moo_open_info_new_uri(uri, encoding, -1, MOO_OPEN_FLAGS_NONE));
|
||||
|
||||
return moo_editor_load_file(editor, info.get(), window, GTK_WIDGET(window), TRUE, FALSE, NULL);
|
||||
return moo_editor_load_file(editor, info.gobj(), window, GTK_WIDGET(window), TRUE, FALSE, NULL);
|
||||
}
|
||||
|
||||
static MooMarkupNode *
|
||||
@ -1797,7 +1797,7 @@ load_window_session (MooEditor *editor,
|
||||
EditPtr doc = load_doc_session (editor, window, node, file_is_uri);
|
||||
|
||||
if (doc && moo_markup_bool_prop (node, "active", FALSE))
|
||||
active_doc = doc.get();
|
||||
active_doc = doc.gobj();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2619,14 +2619,14 @@ moo_editor_save_as (MooEditor *editor,
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (info.get()->encoding.empty())
|
||||
else if (info.gobj()->encoding.empty())
|
||||
{
|
||||
info = wrap_new(moo_save_info_new_file(info.get()->file.get(), moo_edit_get_encoding(doc)));
|
||||
info = wrap_new(moo_save_info_new_file(info.gobj()->file.gobj(), moo_edit_get_encoding(doc)));
|
||||
}
|
||||
|
||||
update_history_item_for_doc(editor, doc, FALSE);
|
||||
|
||||
return do_save(*editor, *doc, *info.get()->file, info.get()->encoding, error);
|
||||
return do_save(*editor, *doc, *info.gobj()->file, info.gobj()->encoding, error);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2681,11 +2681,11 @@ doc_array_find_norm_name (MooEditArray *docs,
|
||||
//
|
||||
// for (const auto& doc: docs)
|
||||
// {
|
||||
// char *doc_norm_name = _moo_edit_get_normalized_name (doc.get());
|
||||
// char *doc_norm_name = _moo_edit_get_normalized_name (doc.gobj());
|
||||
// gboolean this_doc = doc_norm_name != NULL && strcmp (doc_norm_name, norm_name) == 0;
|
||||
// g_free (doc_norm_name);
|
||||
// if (this_doc)
|
||||
// return doc.get();
|
||||
// return doc.gobj();
|
||||
// }
|
||||
//
|
||||
// return NULL;
|
||||
@ -2814,7 +2814,7 @@ _moo_editor_apply_prefs (MooEditor *editor)
|
||||
color_scheme = moo_prefs_get_string (moo_edit_setting (MOO_EDIT_PREFS_COLOR_SCHEME));
|
||||
|
||||
if (color_scheme)
|
||||
_moo_lang_mgr_set_active_scheme (editor->priv->lang_mgr.get(), color_scheme);
|
||||
_moo_lang_mgr_set_active_scheme (editor->priv->lang_mgr.gobj(), color_scheme);
|
||||
|
||||
backups = moo_prefs_get_bool (moo_edit_setting (MOO_EDIT_PREFS_MAKE_BACKUPS));
|
||||
|
||||
|
@ -74,7 +74,7 @@ moo_edit_progress_class_init (MooEditProgressClass *klass)
|
||||
G_OBJECT_CLASS(klass)->dispose = moo_edit_progress_dispose;
|
||||
}
|
||||
|
||||
MooEditProgressPtr
|
||||
EditProgressPtr
|
||||
_moo_edit_progress_new (void)
|
||||
{
|
||||
return moo::wrap_new(MOO_EDIT_PROGRESS(g_object_new(MOO_TYPE_EDIT_PROGRESS, NULL)));
|
||||
|
@ -9,18 +9,18 @@ typedef struct MooEditProgress MooEditProgress;
|
||||
|
||||
#include <moocpp/gobjptrtypes.h>
|
||||
|
||||
using MooEditProgressPtr = moo::gobj_ptr<MooEditProgress>;
|
||||
using MooEditProgressRef = moo::gobj_ref<MooEditProgress>;
|
||||
using EditProgressPtr = moo::gobj_ptr<MooEditProgress>;
|
||||
using EditProgress = moo::gobj_ref<MooEditProgress>;
|
||||
|
||||
MooEditProgressPtr _moo_edit_progress_new (void);
|
||||
void _moo_edit_progress_start (MooEditProgress& progress,
|
||||
const char* text,
|
||||
GDestroyNotify cancel_func,
|
||||
gpointer cancel_func_data);
|
||||
void _moo_edit_progress_set_cancel_func (MooEditProgress& progress,
|
||||
GDestroyNotify cancel_func,
|
||||
gpointer cancel_func_data);
|
||||
void _moo_edit_progress_set_text (MooEditProgress& progress,
|
||||
const char* text);
|
||||
EditProgressPtr _moo_edit_progress_new (void);
|
||||
void _moo_edit_progress_start (MooEditProgress& progress,
|
||||
const char* text,
|
||||
GDestroyNotify cancel_func,
|
||||
gpointer cancel_func_data);
|
||||
void _moo_edit_progress_set_cancel_func (MooEditProgress& progress,
|
||||
GDestroyNotify cancel_func,
|
||||
gpointer cancel_func_data);
|
||||
void _moo_edit_progress_set_text (MooEditProgress& progress,
|
||||
const char* text);
|
||||
|
||||
#endif __cplusplus
|
||||
|
@ -135,7 +135,7 @@ MooEdit *
|
||||
moo_edit_tab_get_doc (MooEditTab *tab)
|
||||
{
|
||||
g_return_val_if_fail (MOO_IS_EDIT_TAB (tab), NULL);
|
||||
return tab->doc.get();
|
||||
return tab->doc.gobj();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -449,8 +449,8 @@ _moo_edit_tab_create_progress (MooEditTab *tab)
|
||||
g_return_val_if_fail (MOO_IS_EDIT_TAB (tab), NULL);
|
||||
g_return_val_if_fail (!tab->progress, tab->progress);
|
||||
|
||||
MooEditProgressPtr progress = _moo_edit_progress_new();
|
||||
tab->progress = progress.get();
|
||||
EditProgressPtr progress = _moo_edit_progress_new();
|
||||
tab->progress = progress.gobj();
|
||||
gtk_box_pack_start (GTK_BOX (tab), GTK_WIDGET (tab->progress), FALSE, FALSE, 0);
|
||||
gtk_box_reorder_child (GTK_BOX (tab), GTK_WIDGET (tab->progress), 0);
|
||||
|
||||
|
@ -102,7 +102,7 @@ EditViewPtr EditViewPtr::_create(Edit doc)
|
||||
g_assert (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)) == moo_edit_get_buffer (&doc));
|
||||
|
||||
auto indent = moo::wrap_new (moo_indenter_new (&doc));
|
||||
moo_text_view_set_indenter (MOO_TEXT_VIEW (view), indent.get());
|
||||
moo_text_view_set_indenter (MOO_TEXT_VIEW (view), indent.gobj());
|
||||
|
||||
doc._add_view (*view);
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "marshals.h"
|
||||
#include "mooutils/moo-mime.h"
|
||||
#include "moocpp/gobjectutils.h"
|
||||
#include "moocpp/gobjptrtypes-gio.h"
|
||||
#include <string.h>
|
||||
|
||||
using namespace moo;
|
||||
@ -370,8 +371,8 @@ file_blacklisted (MooLangMgr* mgr,
|
||||
|
||||
|
||||
MooLang *
|
||||
moo_lang_mgr_get_lang_for_file (MooLangMgr* mgr,
|
||||
const moo::gobj_ref<GFile>& file)
|
||||
moo_lang_mgr_get_lang_for_file (MooLangMgr* mgr,
|
||||
const g::File& file)
|
||||
{
|
||||
MooLang *lang = NULL;
|
||||
const char *mime_type;
|
||||
|
@ -39,48 +39,48 @@ GType moo_lang_mgr_get_type (void) G_GNUC_CONST;
|
||||
MooLangMgr *moo_lang_mgr_new (void);
|
||||
MooLangMgr *moo_lang_mgr_default (void);
|
||||
|
||||
MooLang *moo_lang_mgr_get_lang (MooLangMgr *mgr,
|
||||
const char *lang_id);
|
||||
MooLang *moo_lang_mgr_get_lang (MooLangMgr* mgr,
|
||||
const char* lang_id);
|
||||
#ifdef __cplusplus
|
||||
MooLang *moo_lang_mgr_get_lang_for_file (MooLangMgr* mgr,
|
||||
const moo::gobj_ref<GFile>& file);
|
||||
MooLang *moo_lang_mgr_get_lang_for_file (MooLangMgr* mgr,
|
||||
const moo::g::File& file);
|
||||
#endif // __cplusplus
|
||||
|
||||
/* list must be freed, content unref'ed */
|
||||
GSList *moo_lang_mgr_get_available_langs (MooLangMgr *mgr);
|
||||
GSList *moo_lang_mgr_get_available_langs (MooLangMgr* mgr);
|
||||
/* list must be freed together with content */
|
||||
GSList *moo_lang_mgr_get_sections (MooLangMgr *mgr);
|
||||
GSList *moo_lang_mgr_get_sections (MooLangMgr* mgr);
|
||||
|
||||
MooLang *_moo_lang_mgr_find_lang (MooLangMgr *mgr,
|
||||
const char *name);
|
||||
MooLang *_moo_lang_mgr_find_lang (MooLangMgr* mgr,
|
||||
const char* name);
|
||||
|
||||
MooTextStyleScheme *moo_lang_mgr_get_active_scheme (MooLangMgr *mgr);
|
||||
void _moo_lang_mgr_set_active_scheme (MooLangMgr *mgr,
|
||||
const char *scheme_name);
|
||||
MooTextStyleScheme *moo_lang_mgr_get_active_scheme (MooLangMgr* mgr);
|
||||
void _moo_lang_mgr_set_active_scheme (MooLangMgr* mgr,
|
||||
const char* scheme_name);
|
||||
/* list must be freed, content unref'ed */
|
||||
GSList *moo_lang_mgr_list_schemes (MooLangMgr *mgr);
|
||||
GSList *moo_lang_mgr_list_schemes (MooLangMgr* mgr);
|
||||
|
||||
/* list must be freed together with content */
|
||||
GSList *_moo_lang_mgr_get_globs (MooLangMgr *mgr,
|
||||
const char *lang_id);
|
||||
GSList *_moo_lang_mgr_get_globs (MooLangMgr* mgr,
|
||||
const char* lang_id);
|
||||
/* list must be freed together with content */
|
||||
GSList *_moo_lang_mgr_get_mime_types (MooLangMgr *mgr,
|
||||
const char *lang_id);
|
||||
void _moo_lang_mgr_set_mime_types (MooLangMgr *mgr,
|
||||
const char *lang_id,
|
||||
const char *mime);
|
||||
void _moo_lang_mgr_set_globs (MooLangMgr *mgr,
|
||||
const char *lang_id,
|
||||
const char *globs);
|
||||
const char *_moo_lang_mgr_get_config (MooLangMgr *mgr,
|
||||
const char *lang_id);
|
||||
void _moo_lang_mgr_set_config (MooLangMgr *mgr,
|
||||
const char *lang_id,
|
||||
const char *config);
|
||||
void _moo_lang_mgr_update_config (MooLangMgr *mgr,
|
||||
MooEditConfig *config,
|
||||
const char *lang_id);
|
||||
void _moo_lang_mgr_save_config (MooLangMgr *mgr);
|
||||
GSList *_moo_lang_mgr_get_mime_types (MooLangMgr* mgr,
|
||||
const char* lang_id);
|
||||
void _moo_lang_mgr_set_mime_types (MooLangMgr* mgr,
|
||||
const char* lang_id,
|
||||
const char* mime);
|
||||
void _moo_lang_mgr_set_globs (MooLangMgr* mgr,
|
||||
const char* lang_id,
|
||||
const char* globs);
|
||||
const char *_moo_lang_mgr_get_config (MooLangMgr* mgr,
|
||||
const char* lang_id);
|
||||
void _moo_lang_mgr_set_config (MooLangMgr* mgr,
|
||||
const char* lang_id,
|
||||
const char* config);
|
||||
void _moo_lang_mgr_update_config (MooLangMgr* mgr,
|
||||
MooEditConfig* config,
|
||||
const char* lang_id);
|
||||
void _moo_lang_mgr_save_config (MooLangMgr* mgr);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -15,9 +15,9 @@ moo_file_get_display_name (GFile *file)
|
||||
}
|
||||
|
||||
gstr
|
||||
moo_file_get_display_name(const gobj_ref<GFile>& file)
|
||||
moo_file_get_display_name(const g::File& file)
|
||||
{
|
||||
return gstr::wrap_new(moo_file_get_display_name(file.g()));
|
||||
return gstr::wrap_new(moo_file_get_display_name(file.nc_gobj()));
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -25,6 +25,6 @@ G_END_DECLS
|
||||
#include <moocpp/strutils.h>
|
||||
#include <moocpp/gobjptrtypes-gio.h>
|
||||
|
||||
moo::gstr moo_file_get_display_name (const moo::gobj_ref<GFile>& file);
|
||||
moo::gstr moo_file_get_display_name (const moo::g::File& file);
|
||||
|
||||
#endif // __cplusplus
|
||||
|
@ -190,7 +190,8 @@ save_input_file (MooEdit *doc)
|
||||
file = NULL;
|
||||
}
|
||||
|
||||
moo_save_info_free (info);
|
||||
if (info)
|
||||
g_object_unref (info);
|
||||
return file;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user