switch glibmm/giomm to 2.18

git-svn-id: svn://localhost/ardour2/branches/3.0@5306 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-07-02 16:00:45 +00:00
parent e6c240a691
commit a73d15e989
423 changed files with 142369 additions and 23979 deletions

View file

@ -0,0 +1,473 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# gio/src/Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# Built files
pkgdatadir = $(datadir)/glibmm
pkglibdir = $(libdir)/glibmm
pkgincludedir = $(includedir)/glibmm
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-unknown-linux-gnu
host_triplet = x86_64-unknown-linux-gnu
DIST_COMMON = $(srcdir)/../src/Makefile_list_of_hg.am_fragment \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment \
$(top_srcdir)/build_shared/Makefile_gensrc.am_fragment \
$(top_srcdir)/tools/Makefile_list_of_sources.am_fragment \
$(top_srcdir)/tools/m4/Makefile_list_of_sources.am_fragment \
$(top_srcdir)/tools/pm/Makefile_list_of_sources.am_fragment
subdir = gio/src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/scripts/c_std.m4 \
$(top_srcdir)/scripts/cxx.m4 $(top_srcdir)/scripts/cxx_std.m4 \
$(top_srcdir)/scripts/dk-feature.m4 \
$(top_srcdir)/scripts/docgen.m4 \
$(top_srcdir)/scripts/glibmm_check_perl.m4 \
$(top_srcdir)/scripts/macros.m4 \
$(top_srcdir)/scripts/reduced.m4 $(top_srcdir)/scripts/sun.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h \
$(top_builddir)/glib/glibmmconfig.h \
$(top_builddir)/gio/giommconfig.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} /tmp/glibmm-2.18.2/scripts/missing --run aclocal-1.10 -I ./scripts
AMTAR = ${SHELL} /tmp/glibmm-2.18.2/scripts/missing --run tar
AR = ar
AS = as
AUTOCONF = ${SHELL} /tmp/glibmm-2.18.2/scripts/missing --run autoconf
AUTOHEADER = :
AUTOMAKE = ${SHELL} /tmp/glibmm-2.18.2/scripts/missing --run automake-1.10
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = gcc -E
CPPFLAGS =
CXX = g++
CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -g -O2 -Wall -Wno-long-long
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DISABLE_DEPRECATED_API_CFLAGS =
DISABLE_DEPRECATED_CFLAGS =
DLLTOOL = dlltool
DSYMUTIL =
ECHO = echo
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /bin/grep -E
EXEEXT =
F77 = gfortran
FFLAGS = -g -O2
GIOMM_CFLAGS = -I/usr/include/sigc++-2.0 -I/usr/lib64/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/gio-unix-2.0/
GIOMM_LIBS = -Wl,--export-dynamic -lsigc-2.0 -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0
GLIBMM_CFLAGS = -I/usr/include/sigc++-2.0 -I/usr/lib64/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
GLIBMM_LIBS = -Wl,--export-dynamic -lsigc-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0
GLIBMM_MAJOR_VERSION = 2
GLIBMM_MICRO_VERSION = 2
GLIBMM_MINOR_VERSION = 18
GLIBMM_RELEASE = 2.18
GLIBMM_VERSION = 2.18.2
GMMPROC_DIR = ${exec_prefix}/lib/glibmm-2.4/proc
GREP = /bin/grep
GTHREAD_CFLAGS = -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
GTHREAD_LIBS = -pthread -lgthread-2.0 -lrt -lglib-2.0
GTKMMPROC_MERGECDOCS =
GTKMM_DOXYGEN_INPUT = /tmp/glibmm-2.18.2/glib/glibmm/ /tmp/glibmm-2.18.2/gio/giomm/
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LDFLAGS =
LIBGLIBMM_SO_VERSION = 3:0:2
LIBOBJS =
LIBS =
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LN_S = ln -s
LTLIBOBJS =
M4 = m4
MAINT = #
MAKEINFO = ${SHELL} /tmp/glibmm-2.18.2/scripts/missing --run makeinfo
MKDIR_P = /bin/mkdir -p
NMEDIT =
OBJDUMP = objdump
OBJEXT = o
PACKAGE = glibmm
PACKAGE_BUGREPORT = gtkmm-list@gnome.org
PACKAGE_NAME = glibmm
PACKAGE_STRING = glibmm 2.18.2
PACKAGE_TARNAME = glibmm
PACKAGE_VERSION = 2.18.2
PATH_SEPARATOR = :
PERL_PATH = /usr/bin/perl
PKG_CONFIG = /usr/bin/pkg-config
RANLIB = ranlib
SED = /bin/sed
SET_MAKE =
SHELL = /bin/sh
STRIP = strip
VERSION = 2.18.2
abs_builddir = /tmp/glibmm-2.18.2/gio/src
abs_srcdir = /tmp/glibmm-2.18.2/gio/src
abs_top_builddir = /tmp/glibmm-2.18.2
abs_top_srcdir = /tmp/glibmm-2.18.2
ac_ct_CC = gcc
ac_ct_CXX = g++
ac_ct_F77 = gfortran
am__include = include
am__leading_dot = .
am__quote =
am__tar = ${AMTAR} chof - "$$tardir"
am__untar = ${AMTAR} xf -
bindir = ${exec_prefix}/bin
build = x86_64-unknown-linux-gnu
build_alias =
build_cpu = x86_64
build_os = linux-gnu
build_vendor = unknown
builddir = .
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
dvidir = ${docdir}
exec_prefix = ${prefix}
host = x86_64-unknown-linux-gnu
host_alias =
host_cpu = x86_64
host_os = linux-gnu
host_vendor = unknown
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = $(SHELL) /tmp/glibmm-2.18.2/scripts/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
mkdir_p = /bin/mkdir -p
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
target_alias =
top_build_prefix = ../../
top_builddir = ../..
top_srcdir = ../..
sublib_name = giomm
sublib_namespace = Gio
sublib_parentdir = giomm
files_defs = gio.defs gio_methods.defs gio_signals.defs gio_enums.defs \
gio_docs.xml gio_docs_override.xml gio_vfuncs.defs gio_others.defs
tools_dir = $(top_srcdir)/tools
tools_dir_m4 = $(top_srcdir)/tools/m4
tools_dir_pm = $(top_srcdir)/tools/pm
gensrc_destdir = $(srcdir)/../$(sublib_name)
stamp_dir = $(srcdir)/.stamps
files_tools_m4 = base.m4 class_shared.m4 class_boxedtype.m4 class_boxedtype_static.m4 \
class_generic.m4 class_gobject.m4 class_gtkobject.m4 \
class_interface.m4 class_opaque_refcounted.m4 class_opaque_copyable.m4 \
gerror.m4 \
compare.m4 convert.m4 convert_base.m4 convert_gtkmm.m4 convert_atk.m4 convert_gdk.m4 \
convert_glib.m4 convert_gio.m4 convert_gtk.m4 convert_pango.m4 ctor.m4 doc.m4 enum.m4 list.m4 member.m4 \
method.m4 property.m4 signal.m4 vfunc.m4
files_tools_pm = DocsParser.pm GtkDefs.pm Enum.pm Function.pm FunctionBase.pm Object.pm Output.pm Property.pm Util.pm WrapParser.pm
files_tools_genwrap = generate_wrap_init.pl
files_tools_perl = $(files_tools_genwrap) gmmproc.in
tools_m4 = $(files_tools_m4:%.m4=$(tools_dir_m4)/%.m4)
files_posix_hg = unixinputstream.hg unixoutputstream.hg desktopappinfo.hg
files_win32_hg =
files_general_hg = appinfo.hg asyncresult.hg cancellable.hg drive.hg error.hg file.hg fileattributeinfo.hg \
fileattributeinfolist.hg fileenumerator.hg fileicon.hg fileinfo.hg fileinputstream.hg fileoutputstream.hg \
filemonitor.hg filterinputstream.hg filteroutputstream.hg filenamecompleter.hg \
icon.hg inputstream.hg loadableicon.hg mount.hg mountoperation.hg outputstream.hg \
seekable.hg volume.hg volumemonitor.hg bufferedinputstream.hg \
bufferedoutputstream.hg datainputstream.hg dataoutputstream.hg enums.hg \
memoryinputstream.hg themedicon.hg
files_all_hg = \
$(files_posix_hg) \
$(files_win32_hg) \
$(files_general_hg) \
$(files_general_deprecated_hg)
files_hg = $(files_general_hg) $(files_posix_hg) $(files_general_deprecated_hg)
#files_hg = $(files_general_hg) $(files_win32_hg) $(files_general_deprecated_hg)
files_built_cc = $(files_hg:.hg=.cc) wrap_init.cc
files_built_h = $(files_hg:.hg=.h)
files_all_built_cc = $(files_all_hg:.hg=.cc) wrap_init.cc
files_all_built_h = $(files_all_hg:.hg=.h)
# Extra files
files_all_extra_cc = \
$(sublib_files_extra_posix_cc) \
$(sublib_files_extra_win32_cc) \
$(sublib_files_extra_general_cc) \
$(sublib_files_extra_general_deprecated_cc)
files_all_extra_h = $(sublib_files_extra_posix_h) \
$(sublib_files_extra_win32_h) $(sublib_files_extra_general_h) \
$(sublib_files_extra_general_deprecated_h) wrap_init.h
files_extra_cc = \
$(sublib_files_extra_posix_cc) \
$(sublib_files_extra_general_cc)
#files_extra_cc = \
# $(sublib_files_extra_win32_cc) \
# $(sublib_files_extra_general_cc)
files_extra_h = $(sublib_files_extra_posix_h) \
$(sublib_files_extra_general_h) wrap_init.h
#files_extra_h = $(sublib_files_extra_win32_h) \
# $(sublib_files_extra_general_h) wrap_init.h
# tools_pm = $(files_tools_pm:%.pm=$(tools_dir_pm)/%.pm)
files_all_ccg = $(files_all_hg:%.hg=%.ccg)
files_h = $(files_all_hg:%.hg=$(gensrc_destdir)/%.h)
files_cc = $(files_all_hg:%.hg=$(gensrc_destdir)/%.cc)
files_stamp = $(files_all_hg:%.hg=$(stamp_dir)/stamp-%)
#The gmmproc from this glibmm:
gmmproc_in = $(top_srcdir)/tools/gmmproc.in
gmmproc_path = $(top_builddir)/tools/gmmproc
# We use our own m4 and pm files as well as the ones installed by gtkmm:
# Our override m4 include seems to need to be before the default one.
gmmproc_args = -I $(tools_dir_m4) --defs $(srcdir)
run_gmmproc = $(PERL_PATH) -I$(tools_dir_pm) $(gmmproc_path) $(gmmproc_args)
gen_wrap_init_in = $(top_srcdir)/tools/generate_wrap_init.pl.in
gen_wrap_init_path = $(top_builddir)/tools/generate_wrap_init.pl
gen_wrap_init_args = --namespace=$(sublib_namespace) --parent_dir=$(sublib_parentdir)
run_gen_wrap_init = $(PERL_PATH) $(gen_wrap_init_path) $(gen_wrap_init_args)
EXTRA_DIST = Makefile_list_of_hg.am_fragment \
$(files_defs) $(files_all_hg) $(files_all_ccg)
sublib_srcdir = $(srcdir)/../src
files_hg_with_path = $(patsubst %.hg,$(sublib_srcdir)/%.hg,$(files_all_hg))
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(top_srcdir)/build_shared/Makefile_gensrc.am_fragment $(top_srcdir)/tools/Makefile_list_of_sources.am_fragment $(top_srcdir)/tools/m4/Makefile_list_of_sources.am_fragment $(top_srcdir)/tools/pm/Makefile_list_of_sources.am_fragment $(srcdir)/../src/Makefile_list_of_hg.am_fragment $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gio/src/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu gio/src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: # $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-local:
all-am: Makefile all-local
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic \
maintainer-clean-local
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am all-local check check-am clean clean-generic \
clean-libtool distclean distclean-generic distclean-libtool \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic \
maintainer-clean-local mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
$(stamp_dir)/stamp-%: %.hg %.ccg $(tools_m4) $(files_defs)
$(run_gmmproc) $(notdir $*) $(srcdir) $(gensrc_destdir)
@echo 'timestamp' > $@
$(gensrc_destdir)/wrap_init.cc: $(gen_wrap_init_path) $(files_hg_with_path)
$(run_gen_wrap_init) $(files_all_hg:%.hg=$(srcdir)/%.hg) >$@
create-stamp-dir:
@(test -d $(stamp_dir) || mkdir $(stamp_dir))
#all-local: create-stamp-dir $(files_stamp) $(gensrc_destdir)/wrap_init.cc
maintainer-clean-local:
rm -rf $(stamp_dir)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -0,0 +1,11 @@
## Copyright (c) 2007
## The gtkmm development team.
sublib_name = giomm
sublib_namespace = Gio
sublib_parentdir = giomm
files_defs = gio.defs gio_methods.defs gio_signals.defs gio_enums.defs \
gio_docs.xml gio_docs_override.xml gio_vfuncs.defs gio_others.defs
include $(top_srcdir)/build_shared/Makefile_gensrc.am_fragment

View file

@ -0,0 +1,473 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Built files
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/../src/Makefile_list_of_hg.am_fragment \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment \
$(top_srcdir)/build_shared/Makefile_gensrc.am_fragment \
$(top_srcdir)/tools/Makefile_list_of_sources.am_fragment \
$(top_srcdir)/tools/m4/Makefile_list_of_sources.am_fragment \
$(top_srcdir)/tools/pm/Makefile_list_of_sources.am_fragment
subdir = gio/src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/scripts/c_std.m4 \
$(top_srcdir)/scripts/cxx.m4 $(top_srcdir)/scripts/cxx_std.m4 \
$(top_srcdir)/scripts/dk-feature.m4 \
$(top_srcdir)/scripts/docgen.m4 \
$(top_srcdir)/scripts/glibmm_check_perl.m4 \
$(top_srcdir)/scripts/macros.m4 \
$(top_srcdir)/scripts/reduced.m4 $(top_srcdir)/scripts/sun.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h \
$(top_builddir)/glib/glibmmconfig.h \
$(top_builddir)/gio/giommconfig.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISABLE_DEPRECATED_API_CFLAGS = @DISABLE_DEPRECATED_API_CFLAGS@
DISABLE_DEPRECATED_CFLAGS = @DISABLE_DEPRECATED_CFLAGS@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GIOMM_CFLAGS = @GIOMM_CFLAGS@
GIOMM_LIBS = @GIOMM_LIBS@
GLIBMM_CFLAGS = @GLIBMM_CFLAGS@
GLIBMM_LIBS = @GLIBMM_LIBS@
GLIBMM_MAJOR_VERSION = @GLIBMM_MAJOR_VERSION@
GLIBMM_MICRO_VERSION = @GLIBMM_MICRO_VERSION@
GLIBMM_MINOR_VERSION = @GLIBMM_MINOR_VERSION@
GLIBMM_RELEASE = @GLIBMM_RELEASE@
GLIBMM_VERSION = @GLIBMM_VERSION@
GMMPROC_DIR = @GMMPROC_DIR@
GREP = @GREP@
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
GTHREAD_LIBS = @GTHREAD_LIBS@
GTKMMPROC_MERGECDOCS = @GTKMMPROC_MERGECDOCS@
GTKMM_DOXYGEN_INPUT = @GTKMM_DOXYGEN_INPUT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBGLIBMM_SO_VERSION = @LIBGLIBMM_SO_VERSION@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL_PATH = @PERL_PATH@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
sublib_name = giomm
sublib_namespace = Gio
sublib_parentdir = giomm
files_defs = gio.defs gio_methods.defs gio_signals.defs gio_enums.defs \
gio_docs.xml gio_docs_override.xml gio_vfuncs.defs gio_others.defs
tools_dir = $(top_srcdir)/tools
tools_dir_m4 = $(top_srcdir)/tools/m4
tools_dir_pm = $(top_srcdir)/tools/pm
gensrc_destdir = $(srcdir)/../$(sublib_name)
stamp_dir = $(srcdir)/.stamps
files_tools_m4 = base.m4 class_shared.m4 class_boxedtype.m4 class_boxedtype_static.m4 \
class_generic.m4 class_gobject.m4 class_gtkobject.m4 \
class_interface.m4 class_opaque_refcounted.m4 class_opaque_copyable.m4 \
gerror.m4 \
compare.m4 convert.m4 convert_base.m4 convert_gtkmm.m4 convert_atk.m4 convert_gdk.m4 \
convert_glib.m4 convert_gio.m4 convert_gtk.m4 convert_pango.m4 ctor.m4 doc.m4 enum.m4 list.m4 member.m4 \
method.m4 property.m4 signal.m4 vfunc.m4
files_tools_pm = DocsParser.pm GtkDefs.pm Enum.pm Function.pm FunctionBase.pm Object.pm Output.pm Property.pm Util.pm WrapParser.pm
files_tools_genwrap = generate_wrap_init.pl
files_tools_perl = $(files_tools_genwrap) gmmproc.in
tools_m4 = $(files_tools_m4:%.m4=$(tools_dir_m4)/%.m4)
files_posix_hg = unixinputstream.hg unixoutputstream.hg desktopappinfo.hg
files_win32_hg =
files_general_hg = appinfo.hg asyncresult.hg cancellable.hg drive.hg error.hg file.hg fileattributeinfo.hg \
fileattributeinfolist.hg fileenumerator.hg fileicon.hg fileinfo.hg fileinputstream.hg fileoutputstream.hg \
filemonitor.hg filterinputstream.hg filteroutputstream.hg filenamecompleter.hg \
icon.hg inputstream.hg loadableicon.hg mount.hg mountoperation.hg outputstream.hg \
seekable.hg volume.hg volumemonitor.hg bufferedinputstream.hg \
bufferedoutputstream.hg datainputstream.hg dataoutputstream.hg enums.hg \
memoryinputstream.hg themedicon.hg
files_all_hg = \
$(files_posix_hg) \
$(files_win32_hg) \
$(files_general_hg) \
$(files_general_deprecated_hg)
@OS_WIN32_FALSE@files_hg = $(files_general_hg) $(files_posix_hg) $(files_general_deprecated_hg)
@OS_WIN32_TRUE@files_hg = $(files_general_hg) $(files_win32_hg) $(files_general_deprecated_hg)
files_built_cc = $(files_hg:.hg=.cc) wrap_init.cc
files_built_h = $(files_hg:.hg=.h)
files_all_built_cc = $(files_all_hg:.hg=.cc) wrap_init.cc
files_all_built_h = $(files_all_hg:.hg=.h)
# Extra files
files_all_extra_cc = \
$(sublib_files_extra_posix_cc) \
$(sublib_files_extra_win32_cc) \
$(sublib_files_extra_general_cc) \
$(sublib_files_extra_general_deprecated_cc)
files_all_extra_h = $(sublib_files_extra_posix_h) \
$(sublib_files_extra_win32_h) $(sublib_files_extra_general_h) \
$(sublib_files_extra_general_deprecated_h) wrap_init.h
@OS_WIN32_FALSE@files_extra_cc = \
@OS_WIN32_FALSE@ $(sublib_files_extra_posix_cc) \
@OS_WIN32_FALSE@ $(sublib_files_extra_general_cc)
@OS_WIN32_TRUE@files_extra_cc = \
@OS_WIN32_TRUE@ $(sublib_files_extra_win32_cc) \
@OS_WIN32_TRUE@ $(sublib_files_extra_general_cc)
@OS_WIN32_FALSE@files_extra_h = $(sublib_files_extra_posix_h) \
@OS_WIN32_FALSE@ $(sublib_files_extra_general_h) wrap_init.h
@OS_WIN32_TRUE@files_extra_h = $(sublib_files_extra_win32_h) \
@OS_WIN32_TRUE@ $(sublib_files_extra_general_h) wrap_init.h
# tools_pm = $(files_tools_pm:%.pm=$(tools_dir_pm)/%.pm)
files_all_ccg = $(files_all_hg:%.hg=%.ccg)
files_h = $(files_all_hg:%.hg=$(gensrc_destdir)/%.h)
files_cc = $(files_all_hg:%.hg=$(gensrc_destdir)/%.cc)
files_stamp = $(files_all_hg:%.hg=$(stamp_dir)/stamp-%)
#The gmmproc from this glibmm:
gmmproc_in = $(top_srcdir)/tools/gmmproc.in
gmmproc_path = $(top_builddir)/tools/gmmproc
# We use our own m4 and pm files as well as the ones installed by gtkmm:
# Our override m4 include seems to need to be before the default one.
gmmproc_args = -I $(tools_dir_m4) --defs $(srcdir)
run_gmmproc = $(PERL_PATH) -I$(tools_dir_pm) $(gmmproc_path) $(gmmproc_args)
gen_wrap_init_in = $(top_srcdir)/tools/generate_wrap_init.pl.in
gen_wrap_init_path = $(top_builddir)/tools/generate_wrap_init.pl
gen_wrap_init_args = --namespace=$(sublib_namespace) --parent_dir=$(sublib_parentdir)
run_gen_wrap_init = $(PERL_PATH) $(gen_wrap_init_path) $(gen_wrap_init_args)
EXTRA_DIST = Makefile_list_of_hg.am_fragment \
$(files_defs) $(files_all_hg) $(files_all_ccg)
sublib_srcdir = $(srcdir)/../src
files_hg_with_path = $(patsubst %.hg,$(sublib_srcdir)/%.hg,$(files_all_hg))
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/build_shared/Makefile_gensrc.am_fragment $(top_srcdir)/tools/Makefile_list_of_sources.am_fragment $(top_srcdir)/tools/m4/Makefile_list_of_sources.am_fragment $(top_srcdir)/tools/pm/Makefile_list_of_sources.am_fragment $(srcdir)/../src/Makefile_list_of_hg.am_fragment $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu gio/src/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu gio/src/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
@MAINTAINER_MODE_FALSE@all-local:
all-am: Makefile all-local
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic \
maintainer-clean-local
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am all-local check check-am clean clean-generic \
clean-libtool distclean distclean-generic distclean-libtool \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic \
maintainer-clean-local mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
$(stamp_dir)/stamp-%: %.hg %.ccg $(tools_m4) $(files_defs)
$(run_gmmproc) $(notdir $*) $(srcdir) $(gensrc_destdir)
@echo 'timestamp' > $@
$(gensrc_destdir)/wrap_init.cc: $(gen_wrap_init_path) $(files_hg_with_path)
$(run_gen_wrap_init) $(files_all_hg:%.hg=$(srcdir)/%.hg) >$@
create-stamp-dir:
@(test -d $(stamp_dir) || mkdir $(stamp_dir))
@MAINTAINER_MODE_TRUE@all-local: create-stamp-dir $(files_stamp) $(gensrc_destdir)/wrap_init.cc
maintainer-clean-local:
rm -rf $(stamp_dir)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -0,0 +1,17 @@
## This file is include by other Makefile.am files, using the automake
## include feature. The include happens in Makefile.am, not Makefile.in
## or Makefile, so it's like copy-and-pasting this into each of those
## Makefile.am files.
files_posix_hg = unixinputstream.hg unixoutputstream.hg desktopappinfo.hg
files_win32_hg =
files_general_hg = appinfo.hg asyncresult.hg cancellable.hg drive.hg error.hg file.hg fileattributeinfo.hg \
fileattributeinfolist.hg fileenumerator.hg fileicon.hg fileinfo.hg fileinputstream.hg fileoutputstream.hg \
filemonitor.hg filterinputstream.hg filteroutputstream.hg filenamecompleter.hg \
icon.hg inputstream.hg loadableicon.hg mount.hg mountoperation.hg outputstream.hg \
seekable.hg volume.hg volumemonitor.hg bufferedinputstream.hg \
bufferedoutputstream.hg datainputstream.hg dataoutputstream.hg enums.hg \
memoryinputstream.hg themedicon.hg
include $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment

View file

@ -0,0 +1,84 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include <giomm/file.h>
namespace Gio
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<AppInfo>
AppInfo::create_from_commandline(const std::string& commandline,
const std::string& application_name,
AppInfoCreateFlags flags)
#else
Glib::RefPtr<AppInfo>
AppInfo::create_from_commandline(const std::string& commandline,
const std::string& application_name,
AppInfoCreateFlags flags,
std::auto_ptr<Glib::Error>& error)
#endif // GLIBMM_EXCEPTIONS_ENABLED
{
GAppInfo* capp_info = 0;
GError* gerror = 0;
capp_info = g_app_info_create_from_commandline(commandline.c_str(),
application_name.c_str(),
static_cast<GAppInfoCreateFlags>(flags),
&gerror);
if (gerror)
#ifdef GLIBMM_EXCEPTIONS_ENABLED
::Glib::Error::throw_exception(gerror);
#else
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return Glib::wrap(capp_info);
}
Glib::ListHandle< Glib::RefPtr<AppInfo> > AppInfo::get_all()
{
return Glib::ListHandle< Glib::RefPtr<AppInfo> >(g_app_info_get_all(), Glib::OWNERSHIP_SHALLOW);
}
Glib::ListHandle< Glib::RefPtr<AppInfo> > AppInfo::get_all_for_type(const std::string& content_type)
{
return Glib::ListHandle< Glib::RefPtr<AppInfo> >(
g_app_info_get_all_for_type(content_type.c_str()), Glib::OWNERSHIP_SHALLOW);
}
Glib::RefPtr<AppInfo> AppInfo::get_default_for_type(const std::string& content_type,
bool must_support_uris)
{
GAppInfo* cinfo = 0;
cinfo = g_app_info_get_default_for_type(content_type.c_str(),
static_cast<gboolean>(must_support_uris));
return Glib::wrap(cinfo);
}
Glib::RefPtr<AppInfo> AppInfo::get_default_for_uri_scheme(const std::string& uri_scheme)
{
GAppInfo* cinfo = 0;
cinfo = g_app_info_get_default_for_uri_scheme(uri_scheme.c_str());
return Glib::wrap(cinfo);
}
} // namespace Gio

View file

@ -0,0 +1,167 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
#include <exception>
#endif
#include <string>
#include <glibmm/interface.h>
#include <glibmm/object.h>
//#include <giomm/file.h>
#include <giomm/icon.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
_PINCLUDE(glibmm/private/object_p.h)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GAppInfoIface GAppInfoIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gio
{
_WRAP_ENUM(AppInfoCreateFlags, GAppInfoCreateFlags, NO_GTYPE)
class AppInfo;
class File;
/** This is used to handle, for instance, startup notification and launching of the new application on the same screen as the launching window.
* See also AppInfo.
*
* @newin2p16
*/
class AppLaunchContext : public Glib::Object
{
_CLASS_GOBJECT(AppLaunchContext, GAppLaunchContext, G_APP_LAUNCH_CONTEXT, Glib::Object, GObject)
protected:
_CTOR_DEFAULT()
public:
_WRAP_CREATE()
#m4 _CONVERSION(`const Glib::ListHandle<std::string>&',`GList*',`$3.data()')
_WRAP_METHOD(std::string get_display(const Glib::RefPtr<AppInfo>& info, const Glib::ListHandle< Glib::RefPtr<Gio::File> >& files),
g_app_launch_context_get_display)
_WRAP_METHOD(std::string get_startup_notify_id(const Glib::RefPtr<AppInfo>& info, const Glib::ListHandle< Glib::RefPtr<Gio::File> >& files),
g_app_launch_context_get_startup_notify_id)
_WRAP_METHOD(void launch_failed(const std::string& startup_notify_id),
g_app_launch_context_launch_failed)
};
/** Application information, to describe applications installed on the system,
* and launch them.
* See also AppLaunchContext.
*
* @newin2p16
*/
class AppInfo : public Glib::Interface
{
_CLASS_INTERFACE(AppInfo, GAppInfo, G_APP_INFO, GAppInfoIface)
public:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
static Glib::RefPtr<AppInfo> create_from_commandline(const std::string& commandline,
const std::string& application_name,
AppInfoCreateFlags flags);
#else
static Glib::RefPtr<AppInfo> create_from_commandline(const std::string& commandline,
const std::string& application_name,
AppInfoCreateFlags flags,
std::auto_ptr<Glib::Error>& error);
#endif // GLIBMM_EXCEPTIONS_ENABLED
_IGNORE(g_app_info_dup)
_IGNORE(g_app_info_equal)
// Note that the implementation of equal() is virtual via equal_vfunc().
_WRAP_METHOD(bool equal(const Glib::RefPtr<AppInfo>& other) const, g_app_info_equal)
_WRAP_METHOD(std::string get_id() const, g_app_info_get_id)
_WRAP_METHOD(std::string get_name() const, g_app_info_get_name)
_WRAP_METHOD(std::string get_description() const, g_app_info_get_description)
_WRAP_METHOD(std::string get_executable() const, g_app_info_get_executable)
_WRAP_METHOD(Glib::RefPtr<Icon> get_icon(), g_app_info_get_icon, refreturn)
_WRAP_METHOD(const Glib::RefPtr<const Icon> get_icon() const,
g_app_info_get_icon,
refreturn, constversion)
_WRAP_METHOD(bool launch(const Glib::ListHandle<std::string>& files,
const Glib::RefPtr<AppLaunchContext>& launch_context),
g_app_info_launch,
errthrow)
_WRAP_METHOD(bool supports_uris() const, g_app_info_supports_uris)
_WRAP_METHOD(bool supports_files() const, g_app_info_supports_files)
_WRAP_METHOD(bool launch_uris(const Glib::ListHandle<std::string>& uris,
GAppLaunchContext* launch_context),
g_app_info_launch_uris,
errthrow)
_WRAP_METHOD(bool should_show() const, g_app_info_should_show)
_WRAP_METHOD(bool set_as_default_for_type(const std::string& content_type),
g_app_info_set_as_default_for_type,
errthrow)
_WRAP_METHOD(bool set_as_default_for_extension(const std::string& extension),
g_app_info_set_as_default_for_extension,
errthrow)
_WRAP_METHOD(bool add_supports_type(const std::string& content_type),
g_app_info_add_supports_type,
errthrow)
_WRAP_METHOD(bool can_remove_supports_type() const, g_app_info_can_remove_supports_type)
_WRAP_METHOD(bool remove_supports_type(const std::string& content_type),
g_app_info_remove_supports_type,
errthrow)
static Glib::ListHandle< Glib::RefPtr<AppInfo> > get_all();
static Glib::ListHandle< Glib::RefPtr<AppInfo> > get_all_for_type(const std::string& content_type);
static Glib::RefPtr<AppInfo> get_default_for_type(const std::string& content_type, bool must_support_uris = true);
static Glib::RefPtr<AppInfo> get_default_for_uri_scheme(const std::string& uri_scheme);
protected:
//_WRAP_VFUNC(Glib::RefPtr<AppInfo> dup(), "dup")
//_WRAP_VFUNC(bool equal(const Glib::RefPtr<AppInfo>& appinfo2), "equal")
//_WRAP_VFUNC(std::string get_id() const, "get_id")
//_WRAP_VFUNC(std::string get_name() const, "get_name")
//_WRAP_VFUNC(std::string get_description() const, "get_description")
//_WRAP_VFUNC(std::string get_executable() const, "get_executable")
//_WRAP_VFUNC(Glib::RefPtr<Icon> get_icon() const, "get_icon")
#m4 _CONVERSION(`const Glib::ListHandle<std::string>&',`GList*',`$3.data()')
#m4 _CONVERSION(`GList*',`const Glib::ListHandle<std::string>&',`Glib::ListHandle<std::string>($3, Glib::OWNERSHIP_NONE)')
//_WRAP_VFUNC(bool launch(const Glib::ListHandle<std::string>& filenames, const Glib::RefPtr<AppLaunchContext>& launch_context, GError** error), "launch")
//_WRAP_VFUNC(bool supports_uris() const, "supports_uris")
//_WRAP_VFUNC(bool supports_files() const, "supports_files")
//_WRAP_VFUNC(bool launch_uris(const Glib::ListHandle<std::string>& uris, const Glib::RefPtr<AppLaunchContext>& launch_context, GError** error), "launch_uris")
//_WRAP_VFUNC(bool should_show() const, "should_show")
//_WRAP_VFUNC(bool set_as_default_for_type(const std::string& content_type, GError** error), "set_as_default_for_type")
//_WRAP_VFUNC(bool set_as_default_for_extension(const std::string& extension, GError** error), "set_as_default_for_extension")
//_WRAP_VFUNC(bool add_supports_type(const std::string& content_type, GError** error), "add_supports_type")
//_WRAP_VFUNC(bool can_remove_supports_type() const, "can_remove_supports_type")
//_WRAP_VFUNC(bool remove_supports_type(const std::string& content_type, GError** error), "remove_supports_type")
};
} // namespace Gio

View file

@ -0,0 +1,21 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//#include <gio/gasyncresult.h> //We are not allowed to include individual headers.
#include <gio/gio.h>

View file

@ -0,0 +1,122 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/interface.h>
#include <glibmm/object.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GAsyncResultIface GAsyncResultIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gio
{
class AsyncResult;
/** A function that will be called when an asynchronous operation within GIO has been completed.
* @param result The asynchronous function's results.
*
* For instance,
* @code
* void on_async_ready(Glib::RefPtr<AsyncResult>& result);
* @endcode
*
* @newin2p16
*/
typedef sigc::slot<void, Glib::RefPtr<AsyncResult>& > SlotAsyncReady;
/** Provides a base class for implementing asynchronous function results.
* Asynchronous operations are broken up into two separate operations which are chained together by a SlotAsyncReady.
* To begin an asynchronous operation, provide a SlotAsyncReady to the asynchronous function. This callback will be triggered
* when the operation has completed, and will be passed an AsyncResult instance filled with the details of the operation's success or
* failure, the object the asynchronous function was started for and any error codes returned. The asynchronous callback function is then
* expected to call the corresponding "_finish()" function with the object the function was called for, and the AsyncResult instance.
*
* The purpose of the "_finish()" function is to take the generic result of type AsyncResult and return the specific result that the operation
* in question yields (e.g. a FileEnumerator for an "enumerate children" operation). If the result or error status of the operation is not needed,
* there is no need to call the "_finish()" function and GIO will take care of cleaning up the result and error information after the
* SlotAsyncReady returns. You may also store the AsyncResult and call "_finish()" later.
*
* Example of a typical asynchronous operation flow:
* @code
* void _theoretical_frobnitz_async(const Glib::RefPtr<Theoretical>& t,
* const SlotAsyncReady& slot);
*
* gboolean _theoretical_frobnitz_finish(const Glib::RefPtr<Theoretical>& t,
* const Glib::RefPtr<AsyncResult>& result);
*
* static void
* on_frobnitz_result(Glib::RefPtr<AsyncResult>& result)
* {
*
* Glib::RefPtr<Glib::Object> source_object = result->get_source_object();
* bool success = _theoretical_frobnitz_finish(source_object, res);
*
* if (success)
* std::cout << "Hurray" << std::endl;
* else
* std::cout << "Uh oh!" << std::endl;
*
* ...
* }
*
* int main (int argc, void *argv[])
* {
* ...
*
* _theoretical_frobnitz_async (theoretical_data,
* sigc::ptr_fun(&on_frobnitz_result) );
*
* ...
* }
* @endcode
*
* The async function could also take an optional Glib::Cancellable object, allowing the calling function to cancel the asynchronous operation.
*
* The callback for an asynchronous operation is called only once, and is always called, even in the case of a cancelled operation.
* On cancellation the result is a ERROR_CANCELLED error.
*
* Some ascynchronous operations are implemented using synchronous calls. These are run in a separate GThread, but otherwise they are sent
* to the Main Event Loop and processed in an idle function. So, if you truly need asynchronous operations, make sure to initialize GThread.
*
* @newin2p16
*/
class AsyncResult : public Glib::Interface
{
_CLASS_INTERFACE(AsyncResult, GAsyncResult, G_ASYNC_RESULT, GAsyncResultIface)
public:
_IGNORE(g_async_result_get_user_data)
//Note that this returns a reference, unlike most GTK+ get_*() functions,
//so we don't need to use refreturn.
_WRAP_METHOD(Glib::RefPtr<Glib::Object> get_source_object(),
g_async_result_get_source_object)
_WRAP_METHOD(Glib::RefPtr<const Glib::Object> get_source_object() const,
g_async_result_get_source_object, constversion)
_WRAP_VFUNC(Glib::RefPtr<Glib::Object> get_source_object(),
"get_source_object")
};
} // namespace Gio

View file

@ -0,0 +1,105 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2008 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include "slot_async.h"
namespace Gio
{
Glib::RefPtr<BufferedInputStream> BufferedInputStream::create_sized(const Glib::RefPtr<InputStream>& base_stream, gsize size)
{
return Glib::RefPtr<Gio::BufferedInputStream>(new BufferedInputStream(base_stream, size));
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize BufferedInputStream::fill(gssize count)
#else
gssize BufferedInputStream::fill(gssize count, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gssize retvalue = g_buffered_input_stream_fill(const_cast<GBufferedInputStream*>(gobj()), count, NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
void BufferedInputStream::fill_async(const SlotAsyncReady& slot,
gssize count,
const Glib::RefPtr<Cancellable>& cancellable,
int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_buffered_input_stream_fill_async(gobj(),
count,
io_priority,
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void BufferedInputStream::fill_async(const SlotAsyncReady& slot,
gssize count,
int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_buffered_input_stream_fill_async(gobj(),
count,
io_priority,
NULL,
&SignalProxy_async_callback,
slot_copy);
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
int BufferedInputStream::read_byte()
#else
int BufferedInputStream::read_byte(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
int retvalue = g_buffered_input_stream_read_byte(gobj(), NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
} // namespace Gio

View file

@ -0,0 +1,116 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2008 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/filterinputstream.h>
#include <glibmm/object.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/filterinputstream_p.h)
namespace Gio
{
/** @defgroup Streams Stream Classes
*
*/
/** The buffered input stream implements FilterInputStream and provides for buffered reads.
* By default, BufferedInputStream's buffer size is set at 4 kilobytes, but you can specify
* this to the constructor.
*
* To get the size of a buffer within a buffered input stream, use get_buffer_size().
* To change the size of a buffered input stream's buffer, use set_buffer_size().
* Note that the buffer's size cannot be reduced below the size of the data within the buffer.
*
* @ingroup Streams
*
* @newin2p16
*/
class BufferedInputStream : public Gio::FilterInputStream
{
_CLASS_GOBJECT(BufferedInputStream, GBufferedInputStream, G_BUFFERED_INPUT_STREAM, Gio::FilterInputStream, GFilterInputStream)
protected:
_WRAP_CTOR(BufferedInputStream(const Glib::RefPtr<InputStream>& base_stream), g_buffered_input_stream_new)
_WRAP_CTOR(BufferedInputStream(const Glib::RefPtr<InputStream>& base_stream, gsize size), g_buffered_input_stream_new_sized)
public:
_WRAP_CREATE(const Glib::RefPtr<InputStream>& base_stream)
static Glib::RefPtr<BufferedInputStream> create_sized(const Glib::RefPtr<InputStream>& base_stream, gsize size);
_WRAP_METHOD(gsize get_buffer_size() const, g_buffered_input_stream_get_buffer_size)
_WRAP_METHOD(void set_buffer_size(gsize size), g_buffered_input_stream_set_buffer_size)
_WRAP_METHOD(gsize get_available() const, g_buffered_input_stream_get_available)
_WRAP_METHOD(gsize peek(void* buffer, gsize offset, gsize count) const, g_buffered_input_stream_peek)
_WRAP_METHOD(const void* peek_buffer(gsize& count) const, g_buffered_input_stream_peek_buffer)
_WRAP_METHOD(gssize fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable), g_buffered_input_stream_fill, errthrow)
/** non-cancellable version of fill()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize fill(gssize count);
#else
gssize fill(gssize count, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_IGNORE(g_buffered_input_stream_fill_async)
/** Reads data into the stream's buffer asynchronously, up to @a count size.
* @a io_priority can be used to prioritize reads. For the synchronous version of
* this function, see fill().
*
* @param slot A AsyncReadyCallback.
* @param count The number of bytes to read.
* @param cancellable Cancellable object.
* @param io_priority the I/O priority of the request.
*/
void fill_async(const SlotAsyncReady& slot,
gssize count,
const Glib::RefPtr<Cancellable>& cancellable,
int io_priority = Glib::PRIORITY_DEFAULT);
/** Reads data into the stream's buffer asynchronously, up to @a count size.
* @a io_priority can be used to prioritize reads. For the synchronous version of
* this function, see fill().
*
* @param slot A AsyncReadyCallback.
* @param count The number of bytes to read.
* @param io_priority the I/O priority of the request.
*/
void fill_async(const SlotAsyncReady& slot,
gssize count,
int io_priority = Glib::PRIORITY_DEFAULT);
_WRAP_METHOD(gssize fill_finish(const Glib::RefPtr<AsyncResult>& result), g_buffered_input_stream_fill_finish, errthrow)
_WRAP_METHOD(int read_byte(const Glib::RefPtr<Cancellable>& cancellable), g_buffered_input_stream_read_byte, errthrow)
/** Non-cancellable version of read_byte.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
int read_byte();
#else
int read_byte(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
protected:
#m4 _CONVERSION(`GCancellable*', `const Glib::RefPtr<Cancellable>&', `Glib::wrap($3, true)')
//_WRAP_VFUNC(gssize fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable, GError** error), "fill")
};
} // namespace Gio

View file

@ -0,0 +1,30 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2008 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include "slot_async.h"
namespace Gio
{
Glib::RefPtr<BufferedOutputStream> BufferedOutputStream::create_sized(const Glib::RefPtr<OutputStream>& base_stream, gsize size)
{
return Glib::RefPtr<Gio::BufferedOutputStream>(new BufferedOutputStream(base_stream, size));
}
} // namespace Gio

View file

@ -0,0 +1,58 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2008 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/filteroutputstream.h>
#include <glibmm/object.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/filteroutputstream_p.h)
namespace Gio
{
/** The buffered output stream implements FilterOutputStream and provides for buffered writes.
* By default, BufferedOutputStream's buffer size is set at 4 kilobytes, but you
* can specify this to the constructor.
*
* To get the size of a buffer within a buffered input stream, use get_buffer_size().
* To change the size of a buffered output stream's buffer, use set_buffer_size().
* Note that the buffer's size cannot be reduced below the size of the data within the buffer.
*
* @ingroup Streams
*
* @newin2p16
*/
class BufferedOutputStream : public Gio::FilterOutputStream
{
_CLASS_GOBJECT(BufferedOutputStream, GBufferedOutputStream, G_BUFFERED_OUTPUT_STREAM, Gio::FilterOutputStream, GFilterOutputStream)
protected:
_WRAP_CTOR(BufferedOutputStream(const Glib::RefPtr<OutputStream>& base_stream), g_buffered_output_stream_new)
_WRAP_CTOR(BufferedOutputStream(const Glib::RefPtr<OutputStream>& base_stream, gsize size), g_buffered_output_stream_new_sized)
public:
_WRAP_CREATE(const Glib::RefPtr<OutputStream>& base_stream)
static Glib::RefPtr<BufferedOutputStream> create_sized(const Glib::RefPtr<OutputStream>& base_stream, gsize size);
_WRAP_METHOD(gsize get_buffer_size() const, g_buffered_output_stream_get_buffer_size)
_WRAP_METHOD(void set_buffer_size(gsize size), g_buffered_output_stream_set_buffer_size)
_WRAP_METHOD(void set_auto_grow(bool auto_grow=true), g_buffered_output_stream_set_auto_grow)
_WRAP_METHOD(bool get_auto_grow() const, g_buffered_output_stream_get_auto_grow)
};
} // namespace Gio

View file

@ -0,0 +1,25 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
namespace Gio {
} // namespace Gio

View file

@ -0,0 +1,66 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
namespace Gio
{
/** Allows actions to be cancelled.
* Cancellable is a thread-safe operation cancellation stack used throughout GIO to allow for cancellation of synchronous and asynchronous operations.
*
* @newin2p16
*/
class Cancellable : public Glib::Object
{
_CLASS_GOBJECT(Cancellable, GCancellable, G_CANCELLABLE, Glib::Object, GObject)
protected:
_CTOR_DEFAULT
public:
_WRAP_CREATE()
_WRAP_METHOD(bool is_cancelled() const, g_cancellable_is_cancelled)
_IGNORE(g_cancellable_set_error_if_cancelled)
//May return -1 if fds not supported, or on errors .
_WRAP_METHOD(int get_fd() const, g_cancellable_get_fd)
//This is safe to call from another thread.
_WRAP_METHOD(void cancel(), g_cancellable_cancel)
_WRAP_METHOD(static Glib::RefPtr<Cancellable> get_current(), g_cancellable_get_current, refreturn)
_WRAP_METHOD(void push_current(),
g_cancellable_push_current)
_WRAP_METHOD(void pop_current(),
g_cancellable_pop_current)
_WRAP_METHOD(void reset(), g_cancellable_reset)
_WRAP_SIGNAL(void cancelled(), cancelled)
};
} // namespace Gio

View file

@ -0,0 +1,272 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include "slot_async.h"
namespace Gio
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
guchar DataInputStream::read_byte()
#else
guchar DataInputStream::read_byte(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
guchar retvalue = g_data_input_stream_read_byte(gobj(), NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gint16 DataInputStream::read_int16()
#else
gint16 DataInputStream::read_int16(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gint16 retvalue = g_data_input_stream_read_int16(gobj(), NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
guint16 DataInputStream::read_uint16()
#else
guint16 DataInputStream::read_uint16(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
guint16 retvalue = g_data_input_stream_read_uint16(gobj(), NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gint32 DataInputStream::read_int32()
#else
gint32 DataInputStream::read_int32(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gint32 retvalue = g_data_input_stream_read_int32(gobj(), NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
guint32 DataInputStream::read_uint32()
#else
guint32 DataInputStream::read_uint32(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
guint32 retvalue = g_data_input_stream_read_uint32(gobj(), NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gint64 DataInputStream::read_int64()
#else
gint64 DataInputStream::read_int64(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gint64 retvalue = g_data_input_stream_read_int64(gobj(), NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
guint64 DataInputStream::read_uint64()
#else
guint64 DataInputStream::read_uint64(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
guint64 retvalue = g_data_input_stream_read_uint64(gobj(), NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DataInputStream::read_line(std::string& line, const Glib::RefPtr<Cancellable>& cancellable)
#else
bool DataInputStream::read_line(std::string& line, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
char* c_line = g_data_input_stream_read_line(gobj(),
NULL, // pass NULL since we can easily determine the length from the returned std::string
cancellable->gobj(),
&gerror);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
if (c_line) {
line = c_line;
g_free (c_line);
return true;
}
// end of stream reached, return failure status
return false;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DataInputStream::read_line(std::string& line)
#else
bool DataInputStream::read_line(std::string& line, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
char* c_line = g_data_input_stream_read_line(gobj(),
NULL, // pass NULL since we can easily determine the length from the returned std::string
NULL,
&gerror);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
if (c_line) {
line = c_line;
g_free(c_line);
return true;
}
// end of stream reached, return failure status
return false;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DataInputStream::read_until(std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable)
#else
bool DataInputStream::read_until(std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
char* c_str = g_data_input_stream_read_until(gobj(),
stop_chars.c_str(),
NULL, // pass NULL since we can easily determine the length from the returned std::string
cancellable->gobj(),
&gerror);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
if (c_str) {
data = c_str;
g_free (c_str);
return true;
}
// end of stream reached, return failure status
return false;
}
/** non-cancellable version of read_until()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DataInputStream::read_until(std::string& data, const std::string& stop_chars)
#else
bool DataInputStream::read_until(std::string& data, const std::string& stop_chars, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
char* c_str = g_data_input_stream_read_until(gobj(),
stop_chars.c_str(),
NULL, // pass NULL since we can easily determine the length from the returned std::string
NULL,
&gerror);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
if (c_str) {
data = c_str;
g_free (c_str);
return true;
}
// end of stream reached, return failure status
return false;
}
} // namespace Gio

View file

@ -0,0 +1,160 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/bufferedinputstream.h>
#include <giomm/enums.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/bufferedinputstream_p.h)
namespace Gio
{
/**
* An implementation of BufferedInputStream that allows for high-level data
* manipulation of arbitrary data (including binary operations).
*
* @ingroup Streams
*
* @newin2p16
*/
class DataInputStream : public Gio::BufferedInputStream
{
_CLASS_GOBJECT(DataInputStream, GDataInputStream, G_DATA_INPUT_STREAM, Gio::BufferedInputStream, GBufferedInputStream)
protected:
_WRAP_CTOR(DataInputStream(const Glib::RefPtr<InputStream>& base_stream), g_data_input_stream_new)
public:
_WRAP_CREATE(const Glib::RefPtr<InputStream>& base_stream)
_WRAP_METHOD(void set_byte_order(DataStreamByteOrder order), g_data_input_stream_set_byte_order)
_WRAP_METHOD(DataStreamByteOrder get_byte_order() const, g_data_input_stream_get_byte_order)
_WRAP_METHOD(void set_newline_type(DataStreamNewlineType type), g_data_input_stream_set_newline_type)
_WRAP_METHOD(DataStreamNewlineType get_newline_type() const, g_data_input_stream_get_newline_type)
_WRAP_METHOD(guchar read_byte(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_byte, errthrow)
/** non-cancellable version of read_byte()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
guchar read_byte();
#else
guchar read_byte(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(gint16 read_int16(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_int16, errthrow)
/** non-cancellable version of read_int16()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gint16 read_int16();
#else
gint16 read_int16(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(guint16 read_uint16(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_uint16, errthrow)
//TODO: Real documentation:
/** non-cancellable version of read_uint16()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
guint16 read_uint16();
#else
guint16 read_uint16(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(gint32 read_int32(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_int32, errthrow)
/** non-cancellable version of read_int32()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gint32 read_int32();
#else
gint32 read_int32(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(guint32 read_uint32(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_uint32, errthrow)
/** non-cancellable version of read_uint32()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
guint32 read_uint32();
#else
guint32 read_uint32(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(gint64 read_int64(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_int64, errthrow)
/** non-cancellable version of read_int64()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gint64 read_int64();
#else
gint64 read_int64(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(guint64 read_uint64(const Glib::RefPtr<Cancellable>& cancellable), g_data_input_stream_read_uint64, errthrow)
/** non-cancellable version of read_uint64()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
guint64 read_uint64();
#else
guint64 read_uint64(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_IGNORE(g_data_input_stream_read_line)
// FIXME: In C, these functions return NULL if there is an error (i.e. end of
// stream reached), but if we use std::string, we don't have a way to tell an
// empty string from NULL. Perhaps we should use raw pointers as in C, but
// that would mean we need to worry about freeing the C string...
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool read_line(std::string& line, const Glib::RefPtr<Cancellable>& cancellable);
#else
bool read_line(std::string& line, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** non-cancellable version of read_line()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool read_line(std::string& line);
#else
bool read_line(std::string& line, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_IGNORE(g_data_input_stream_read_until)
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool read_until(std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable);
#else
bool read_until(std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** non-cancellable version of read_until()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool read_until(std::string& data, const std::string& stop_chars);
#else
bool read_until(std::string& data, const std::string& stop_chars, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
};
} // namespace Gio

View file

@ -0,0 +1,180 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
namespace Gio
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DataOutputStream::put_byte(guchar data)
#else
bool DataOutputStream::put_byte(guchar data, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
guchar retvalue = g_data_output_stream_put_byte(gobj(), data, NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DataOutputStream::put_int16(gint16 data)
#else
bool DataOutputStream::put_int16(gint16 data, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gint16 retvalue = g_data_output_stream_put_int16(gobj(), data, NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DataOutputStream::put_uint16(guint16 data)
#else
bool DataOutputStream::put_uint16(guint16 data, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
guint16 retvalue = g_data_output_stream_put_uint16(gobj(), data, NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DataOutputStream::put_int32(gint32 data)
#else
bool DataOutputStream::put_int32(gint32 data, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gint32 retvalue = g_data_output_stream_put_int32(gobj(), data, NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DataOutputStream::put_uint32(guint32 data)
#else
bool DataOutputStream::put_uint32(guint32 data, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
guint32 retvalue = g_data_output_stream_put_uint32(gobj(), data, NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DataOutputStream::put_int64(gint64 data)
#else
bool DataOutputStream::put_int64(gint64 data, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gint64 retvalue = g_data_output_stream_put_int64(gobj(), data, NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DataOutputStream::put_uint64(guint64 data)
#else
bool DataOutputStream::put_uint64(guint64 data, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
guint64 retvalue = g_data_output_stream_put_uint64(gobj(), data, NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool DataOutputStream::put_string(std::string str)
#else
bool DataOutputStream::put_string(std::string str, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
bool retval = g_data_output_stream_put_string(gobj(),
str.c_str (),
NULL,
&gerror);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retval;
}
} // namespace Gio

View file

@ -0,0 +1,130 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/bufferedoutputstream.h>
#include <giomm/enums.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/bufferedoutputstream_p.h)
namespace Gio
{
/**
* An implementation of BufferedOutputStream that allows for high-level data
* manipulation of arbitrary data (including binary operations).
*
* @ingroup Streams
*
* @newin2p16
*/
class DataOutputStream : public Gio::BufferedOutputStream
{
_CLASS_GOBJECT(DataOutputStream, GDataOutputStream, G_DATA_OUTPUT_STREAM, Gio::BufferedOutputStream, GBufferedOutputStream)
protected:
_WRAP_CTOR(DataOutputStream(const Glib::RefPtr<OutputStream>& base_stream), g_data_output_stream_new)
public:
_WRAP_CREATE(const Glib::RefPtr<OutputStream>& base_stream)
_WRAP_METHOD(void set_byte_order(DataStreamByteOrder order), g_data_output_stream_set_byte_order)
_WRAP_METHOD(DataStreamByteOrder get_byte_order() const, g_data_output_stream_get_byte_order)
_WRAP_METHOD(bool put_byte(guchar data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_byte, errthrow)
/** non-cancellable version of put_byte()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool put_byte(guchar data);
#else
bool put_byte(guchar data, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool put_int16(gint16 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_int16, errthrow)
/** non-cancellable version of put_int16()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool put_int16(gint16 data);
#else
bool put_int16(gint16 data, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool put_uint16(guint16 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_uint16, errthrow)
/** non-cancellable version of put_uint16()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool put_uint16(guint16 data);
#else
bool put_uint16(guint16 data, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool put_int32(gint32 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_int32, errthrow)
/** non-cancellable version of put_int32()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool put_int32(gint32 data);
#else
bool put_int32(gint32 data, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool put_uint32(guint32 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_uint32, errthrow)
/** non-cancellable version of put_uint32()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool put_uint32(guint32 data);
#else
bool put_uint32(guint32 data, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool put_int64(gint64 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_int64, errthrow)
/** non-cancellable version of put_int64()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool put_int64(gint64 data);
#else
bool put_int64(gint64 data, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool put_uint64(guint64 data, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_uint64, errthrow)
/** non-cancellable version of put_uint64()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool put_uint64(guint64 data);
#else
bool put_uint64(guint64 data, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool put_string(std::string str, const Glib::RefPtr<Cancellable>& cancellable), g_data_output_stream_put_string, errthrow)
/** non-cancellable version of put_string()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool put_string(std::string str);
#else
bool put_string(std::string str, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
};
} // namespace Gio

View file

@ -0,0 +1,21 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include <gio/gdesktopappinfo.h>

View file

@ -0,0 +1,55 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <giomm/appinfo.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
namespace Gio
{
/**
* DesktopAppInfo is an implementation of AppInfo based on desktop files.
*
* @newin2p16
*/
class DesktopAppInfo
: public Glib::Object,
public AppInfo
{
_CLASS_GOBJECT(DesktopAppInfo, GDesktopAppInfo, G_DESKTOP_APP_INFO, Glib::Object, GObject)
_IMPLEMENTS_INTERFACE(AppInfo)
_GTKMMPROC_WIN32_NO_WRAP
protected:
_WRAP_CTOR(DesktopAppInfo(const std::string& desktop_id), g_desktop_app_info_new)
public:
_WRAP_CREATE(const std::string& desktop_id)
//TODO: Use _WRAP_CREATE(), but how do we override the constructor for this? murrayc.
_WRAP_METHOD(static Glib::RefPtr<DesktopAppInfo> create_from_filename(const std::string& filename), g_desktop_app_info_new_from_filename)
_WRAP_METHOD(bool is_hidden() const, g_desktop_app_info_get_is_hidden)
_WRAP_METHOD(static void set_desktop_env(const std::string& desktop_env), g_desktop_app_info_set_desktop_env)
};
} // namespace Gio

View file

@ -0,0 +1,100 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include <glibmm/error.h>
#include <glibmm/exceptionhandler.h>
#include "slot_async.h"
namespace Gio
{
void Drive::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_drive_eject(gobj(),
static_cast<GMountUnmountFlags>(flags),
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void Drive::eject(const SlotAsyncReady& slot, MountUnmountFlags flags)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_drive_eject(gobj(),
static_cast<GMountUnmountFlags>(flags),
NULL, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
void Drive::eject(MountUnmountFlags flags)
{
g_drive_eject(gobj(),
static_cast<GMountUnmountFlags>(flags),
NULL, // cancellable
NULL,
NULL);
}
void Drive::poll_for_media(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_drive_poll_for_media(gobj(),
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void Drive::poll_for_media(const SlotAsyncReady& slot)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_drive_poll_for_media(gobj(),
NULL, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
void Drive::poll_for_media()
{
g_drive_poll_for_media(gobj(),
NULL, // cancellable
NULL,
NULL);
}
} // namespace Gio

View file

@ -0,0 +1,161 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/mount.h>
#include <giomm/icon.h>
//#include <giomm/mountoperation.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GDriveIface GDriveIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gio
{
/** Virtual File System drive management.
*
* This represent a piece of hardware connected to the machine. It's generally only created for removable hardware or hardware with removable media.
* Gio::Drive is a container class for Gio::Volume objects that stem from the same piece of media. As such, Gio::Drive abstracts a drive with
* (or without) removable media and provides operations for querying whether media is available, determing whether media change is automatically
* detected and ejecting the media.
*
* If the Gio::Drive reports that media isn't automatically detected, one can poll for media; typically one should not do this periodically as a
* poll for media operation is potententially expensive and may spin up the drive, creating noise.
*
* @newin2p16
*/
class Drive : public Glib::Interface
{
_CLASS_INTERFACE(Drive, GDrive, G_DRIVE, GDriveIface)
public:
_WRAP_METHOD(Glib::ustring get_name() const, g_drive_get_name)
_WRAP_METHOD(Glib::RefPtr<Icon> get_icon(), g_drive_get_icon, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Icon> get_icon() const, g_drive_get_icon, refreturn, constversion)
_WRAP_METHOD(bool has_volumes() const, g_drive_has_volumes)
#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Volume> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
_WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Volume> > get_volumes(), g_drive_get_volumes)
_WRAP_METHOD(bool is_media_removable() const, g_drive_is_media_removable)
_WRAP_METHOD(bool has_media() const, g_drive_has_media)
_WRAP_METHOD(bool is_media_check_automatic() const, g_drive_is_media_check_automatic)
_WRAP_METHOD(bool can_poll_for_media() const, g_drive_can_poll_for_media)
_WRAP_METHOD(bool can_eject() const, g_drive_can_eject)
/** Ejects the drive.
* @param slot A callback which will be called when the eject is completed or canceled.
* @param flags Flags affecting the unmount if required for eject.
* @param cancellable A cancellable object which can be used to cancel the eject.
*/
void eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
/** Ejects the drive.
* @param slot A callback which will be called when the eject is completed.
* @param flags Flags affecting the unmount if required for eject.
*/
void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
_IGNORE(g_drive_eject)
/** Ejects the drive.
* @param slot A callback which will be called when the eject is completed.
* @param flags Flags affecting the unmount if required for eject.
*/
void eject(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
_WRAP_METHOD(bool eject_finish(const Glib::RefPtr<AsyncResult>& result),
g_drive_eject_finish,
errthrow)
/** Polls drive to see if media has been inserted or removed.
* @param slot A callback which will be called when the poll is completed.
* @param cancellable A cancellable object which can be used to cancel the operation.
*/
void poll_for_media(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
/** Polls drive to see if media has been inserted or removed.
* @param slot A callback which will be called when the poll is completed.
*/
void poll_for_media(const SlotAsyncReady& slot);
/** Polls drive to see if media has been inserted or removed.
*/
void poll_for_media();
_IGNORE(g_drive_poll_for_media)
_WRAP_METHOD(bool poll_for_media_finish(const Glib::RefPtr<AsyncResult>& result),
g_drive_poll_for_media_finish,
errthrow)
_WRAP_METHOD(std::string get_identifier(const std::string& kind) const, g_drive_get_identifier)
_WRAP_METHOD(Glib::StringArrayHandle enumerate_identifiers() const, g_drive_enumerate_identifiers)
//_WRAP_VFUNC(Glib::ustring get_name() const, get_name)
//Careful of ref-counting: //_WRAP_VFUNC(Glib::RefPtr<Icon> get_icon() const, get_icon)
//_WRAP_VFUNC(bool has_volumes() const, has_volumes)
};
} // namespace Gio
namespace Glib
{
//Pre-declare this so we can use it in TypeTrait:
Glib::RefPtr<Gio::Drive> wrap(GDrive* object, bool take_copy);
namespace Container_Helpers
{
/** This specialization of TypeTraits exists
* because the default use of Glib::wrap(GObject*),
* instead of a specific Glib::wrap(GSomeInterface*),
* would not return a wrapper for an interface.
*/
template <>
struct TypeTraits< Glib::RefPtr<Gio::Drive> >
{
typedef Glib::RefPtr<Gio::Drive> CppType;
typedef GDrive* CType;
typedef GDrive* CTypeNonConst;
static CType to_c_type (const CppType& item)
{ return Glib::unwrap (item); }
static CppType to_cpp_type (const CType& item)
{
//Use a specific Glib::wrap() function,
//because CType has the specific type (not just GObject):
return Glib::wrap(item, true /* take_copy */);
}
static void release_c_type (CType item)
{
GLIBMM_DEBUG_UNREFERENCE(0, item);
g_object_unref(item);
}
};
} // Container_Helpers
} // Glib

View file

@ -0,0 +1,19 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

View file

@ -0,0 +1,31 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
_DEFS(giomm,gio)
namespace Gio
{
_WRAP_ENUM(DataStreamByteOrder, GDataStreamByteOrder, NO_GTYPE)
_WRAP_ENUM(DataStreamNewlineType, GDataStreamNewlineType, NO_GTYPE)
} // namespace Gio

View file

@ -0,0 +1,25 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
namespace Gio
{
} // namespace Gio

View file

@ -0,0 +1,52 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/interface.h>
// There have been issues with other libraries defining HOST_NOT_FOUND (e.g.
// netdb.h). As a workaround, we added the alternate name HOST_WAS_NOT_FOUND.
// Portable code should not use HOST_NOT_FOUND. Undefining it here (and
// restoring it below) will allow programs to compile even if they include
// netdb.h. See Bug #529496
#ifdef HOST_NOT_FOUND
#define GIOMM_SAVED_HOST_NOT_FOUND HOST_NOT_FOUND
#undef HOST_NOT_FOUND
#endif // HOST_NOT_FOUND
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
namespace Gio
{
//Note that GIOErrorEnum is not named GIOError in gio because there is already a GIOError in glib,
//But we can have both Glib::Error and Gio::Error in C++.
/** Exception class for giomm errors.
*/
_WRAP_GERROR(Error, GIOErrorEnum, G_IO_ERROR, NO_GTYPE)
} // namespace Gio
#ifdef GIOMM_SAVED_HOST_NOT_FOUND
// restore the previously-defined HOST_NOT_FOUND macro
#define HOST_NOT_FOUND GIOMM_SAVED_HOST_NOT_FOUND
#undef GIOMM_SAVED_HOST_NOT_FOUND
#endif // GIOMM_SAVED_HOST_NOT_FOUND

File diff suppressed because it is too large Load diff

2107
libs/glibmm2/gio/src/file.hg Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,70 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
namespace Gio
{
FileAttributeInfo::FileAttributeInfo(const GFileAttributeInfo* ginfo)
:
m_name(ginfo->name ? ginfo->name : ""),
m_type(static_cast<FileAttributeType>(ginfo->type)),
m_flags(static_cast<FileAttributeInfoFlags>(ginfo->flags))
{
}
FileAttributeInfo::FileAttributeInfo(const FileAttributeInfo& other)
{
*this = other;
}
FileAttributeInfo&
FileAttributeInfo::operator=(const FileAttributeInfo& other)
{
m_name = other.m_name;
m_type = other.m_type;
m_flags = other.m_flags;
return *this;
}
FileAttributeInfo::~FileAttributeInfo()
{
}
std::string
FileAttributeInfo::get_name() const
{
return m_name;
}
FileAttributeType
FileAttributeInfo::get_type() const
{
return m_type;
}
FileAttributeInfoFlags
FileAttributeInfo::get_flags() const
{
return m_flags;
}
} // namespace Gio

View file

@ -0,0 +1,62 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string>
#include <gio/gio.h> //TODO: avoid this include
#include <glibmm/object.h>
_DEFS(giomm,gio)
namespace Gio
{
//TODO: Fix the need for NO_GTYPE.
//It guesses gfile_attribute_type_get_type() instead of g_file_attribute_type_get_type(). murrayc.
_WRAP_ENUM(FileAttributeType, GFileAttributeType, NO_GTYPE)
_WRAP_ENUM(FileAttributeInfoFlags, GFileAttributeInfoFlags, NO_GTYPE)
_WRAP_ENUM(FileAttributeStatus, GFileAttributeStatus, NO_GTYPE)
/** Information about a specific attribute - see FileAttributeInfoList.
*
* @newin2p16
*/
class FileAttributeInfo
{
_CLASS_GENERIC(FileAttributeInfo, GFileAttributeInfo)
public:
explicit FileAttributeInfo(const GFileAttributeInfo* ginfo);
FileAttributeInfo(const FileAttributeInfo& other);
FileAttributeInfo& operator=(const FileAttributeInfo& other);
~FileAttributeInfo();
std::string get_name() const;
FileAttributeType get_type() const;
FileAttributeInfoFlags get_flags() const;
protected:
std::string m_name;
FileAttributeType m_type;
FileAttributeInfoFlags m_flags;
};
} // namespace Gio

View file

@ -0,0 +1,46 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
namespace Gio
{
FileAttributeInfoList::operator bool() const
{
return !empty();
}
bool FileAttributeInfoList::empty() const
{
return gobj() == 0;
}
FileAttributeInfo
FileAttributeInfoList::lookup(const std::string& name) const
{
GFileAttributeInfoList* cobject = const_cast<GFileAttributeInfoList*>(gobj());
const GFileAttributeInfo* cinfo =
g_file_attribute_info_list_lookup (cobject, name.c_str());
FileAttributeInfo info(cinfo);
return info;
}
} // namespace Gio

View file

@ -0,0 +1,80 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/fileattributeinfo.h>
_DEFS(giomm,gio)
namespace Gio
{
/** Key-Value paired file attributes.
* File attributes in GIO consist of a list of key-value pairs.
*
* Keys are strings that contain a key namespace and a key name, separated by a colon, e.g. "namespace:keyname".
* Namespaces are included to sort key-value pairs by namespaces for relevance. Keys can be retreived using wildcards,
* e.g. "standard::*" will return all of the keys in the "standard" namespace.
*
* Values are stored within the list in Gio::FileAttributeValue structures. Values can store different types, listed in the enum
* Gio::FileAttributeType. Upon creation of a Gio::FileAttributeValue, the type will be set to Gio::FILE_ATTRIBUTE_TYPE_INVALID.
*
* The list of possible attributes for a filesystem (pointed to by a Gio::File) is availible as a Gio::FileAttributeInfoList.
* This list is queryable by key names as indicated earlier.
*
* Classes that implement Gio::FileIface will create a Gio::FileAttributeInfoList and install default keys and values for their given file
* system, architecture, and other possible implementation details (e.g., on a UNIX system, a file attribute key will be registered for
* the user id for a given file).
*
* See http://library.gnome.org/devel/gio/unstable/gio-GFileAttribute.html for the list of default namespaces and the list of default keys.
*
* @newin2p16
*/
class FileAttributeInfoList
{
_CLASS_OPAQUE_REFCOUNTED(FileAttributeInfoList, GFileAttributeInfoList,
g_file_attribute_info_list_new,
g_file_attribute_info_list_ref,
g_file_attribute_info_list_unref)
_IGNORE(g_file_attribute_info_list_new, g_file_attribute_info_list_ref, g_file_attribute_info_list_unref)
public:
/** Whether the FileAttributeInfoList is valid and non empty.
* @result true if this FileAttributeInfoList is not empty.
*/
operator bool() const;
/** Whether the FileAttributeInfoList is empty or invalid.
* @result true if this FileAttributeInfoList is empty.
*/
bool empty() const;
/** Gets the file attribute with the name name from list.
* @param name The name of the attribute to lookup.
* @result A FileAttributeInfo for the name.
*/
FileAttributeInfo lookup(const std::string& name) const;
_IGNORE(g_file_attribute_info_list_lookup)
_WRAP_METHOD(Glib::RefPtr<FileAttributeInfoList> dup() const, g_file_attribute_info_list_dup)
_WRAP_METHOD(void add(const std::string& name, FileAttributeType type, FileAttributeInfoFlags flags = FILE_ATTRIBUTE_INFO_NONE), g_file_attribute_info_list_add)
};
} // namespace Gio

View file

@ -0,0 +1,132 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include <giomm/file.h>
#include <glibmm/error.h>
#include <glibmm/exceptionhandler.h>
#include "slot_async.h"
namespace Gio
{
void
FileEnumerator::next_files_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int num_files, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_enumerator_next_files_async(gobj(),
num_files,
io_priority,
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void
FileEnumerator::next_files_async(const SlotAsyncReady& slot, int num_files, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_enumerator_next_files_async(gobj(),
num_files,
io_priority,
NULL, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
void
FileEnumerator::close_async(int io_priority,
const Glib::RefPtr<Cancellable>& cancellable,
const SlotAsyncReady& slot)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_enumerator_close_async(gobj(),
io_priority,
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void
FileEnumerator::close_async(int io_priority,
const SlotAsyncReady& slot)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_enumerator_close_async(gobj(),
io_priority,
NULL, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<FileInfo> FileEnumerator::next_file()
#else
Glib::RefPtr<FileInfo> FileEnumerator::next_file(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_enumerator_next_file(gobj(), NULL, &(gerror)));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool FileEnumerator::close()
#else
bool FileEnumerator::close(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
bool retvalue = g_file_enumerator_close(gobj(), NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
} // namespace Gio

View file

@ -0,0 +1,167 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The glibmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <glibmm/arrayhandle.h>
#include <glibmm/listhandle.h>
#include <giomm/asyncresult.h>
#include <giomm/cancellable.h>
#include <giomm/fileinfo.h>
//#include <giomm/file.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
namespace Gio
{
class File;
//TODO: Consider wrapping this like a std::iterator (or at least renaming it), though the asyncness probably makes that unsuitable.
/** Enumerated Files Routines.
* FileEnumerator allows you to operate on a set of Gio::Files, returning a Gio::FileInfo instance for each file enumerated
* (e.g. Gio::File::enumerate_children() will return a FileEnumerator for each of the children within a directory).
*
* To get the next file's information from a Gio::FileEnumerator, use next_file() or its asynchronous version, next_file_async().
* Note that the asynchronous version will return a list of Gio::FileInfos, whereas the synchronous version will only return the next
* file in the enumerator.
*
* To close a Gio::FileEnumerator, use FileEnumerator::close(), or its asynchronous version, close_async(). Once a FileEnumerator is closed,
* no further actions may be performed on it.
*
* @newin2p16
*/
class FileEnumerator : public Glib::Object
{
_CLASS_GOBJECT(FileEnumerator, GFileEnumerator, G_FILE_ENUMERATOR, Glib::Object, GObject)
public:
_WRAP_METHOD(Glib::RefPtr<FileInfo> next_file(const Glib::RefPtr<Cancellable>& cancellable),
g_file_enumerator_next_file,
errthrow)
/**
* @return A FileInfo or an empty RefPtr on error or end of enumerator.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<FileInfo> next_file();
#else
Glib::RefPtr<FileInfo> next_file(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable),
g_file_enumerator_close,
errthrow)
/** Releases all resources used by this enumerator, making the
* enumerator throw a Gio::Error with CLOSED on all calls.
*
* This will be automatically called when the last reference
* is dropped, but you might want to call this method to make sure resources
* are released as early as possible.
* @return #<tt>true</tt> on success or an empty RefPtr on error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool close();
#else
bool close(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Request information for a number of files from the enumerator asynchronously.
* When all I/O for the operation is finished the callback slot will be called with the requested information.
*
* The callback could be called with less than num_files files in case of error or at the end of the enumerator.
* In case of a partial error the callback will be called with any succeeding items and no error, and on the next request the error will be reported.
* If a request is cancelled the callback will be called with ERROR_CANCELLED.
*
* During an async request no other sync and async calls are allowed, and will result in ERROR_PENDING errors.
*
* Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority.
* The default priority is PRIORITY_DEFAULT.
* @param slot A callback to call when the request is satisfied.
* @param cancellable An cancellable object which can be used to cancel the request.
* @param num_files The number of file info objects to request.
* @param io_priority The I/O priority of the request.
*/
void next_files_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int num_files = 1, int io_priority = Glib::PRIORITY_DEFAULT);
/** Request information for a number of files from the enumerator asynchronously.
* When all I/O for the operation is finished the callback slot will be called with the requested information.
*
* The callback could be called with less than num_files files in case of error or at the end of the enumerator.
* In case of a partial error the callback will be called with any succeeding items and no error, and on the next request the error will be reported.
* If a request is cancelled the callback will be called with ERROR_CANCELLED.
*
* During an async request no other sync and async calls are allowed, and will result in ERROR_PENDING errors.
*
* Any outstanding I/O request with higher priority (lower numerical value) will be executed before an outstanding request with lower priority.
* The default priority is PRIORITY_DEFAULT.
* @param slot A callback to call when the request is satisfied.
* @param num_files The number of file info objects to request.
* @param io_priority The I/O priority of the request.
*/
void next_files_async(const SlotAsyncReady& slot, int num_files = 1, int io_priority = Glib::PRIORITY_DEFAULT);
_IGNORE(g_file_enumerator_next_files_async)
#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<FileInfo> >', `$2(($3), Glib::OWNERSHIP_DEEP)')
_WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<FileInfo> > next_files_finish(const Glib::RefPtr<AsyncResult>& result),
g_file_enumerator_next_files_finish,
errthrow)
/** Asynchronously closes the file enumerator.
*
* See close(), which is the synchronous version of this function.
*
* The operation can be cancelled by triggering the cancellable object from another thread.
* If the operation was cancelled, a Gio::Error with CANCELLED will be thrown by close_finish().
*
* @param io_priority The I/O priority of the request.
* @param cancellable A Cancellable object which can be used to cancel the operation.
* @param slot A callback to call when the request is satisfied.
*/
void close_async(int io_priority, const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot);
/** Asynchronously closes the file enumerator.
*
* See close(), which is the synchronous version of this function.
*
* @param io_priority The I/O priority of the request.
* @param slot A callback to call when the request is satisfied.
*/
void close_async(int io_priority, const SlotAsyncReady& slot);
_IGNORE(g_file_enumerator_close_async)
_WRAP_METHOD(bool close_finish(const Glib::RefPtr<AsyncResult>& result),
g_file_enumerator_close_finish,
errthrow)
_WRAP_METHOD(bool is_closed() const, g_file_enumerator_is_closed)
_WRAP_METHOD(bool has_pending() const, g_file_enumerator_has_pending)
_WRAP_METHOD(void set_pending(bool pending = true), g_file_enumerator_set_pending)
_WRAP_METHOD(Glib::RefPtr<File> get_container(), g_file_enumerator_get_container, refreturn)
_WRAP_METHOD(Glib::RefPtr<const File> get_container() const, g_file_enumerator_get_container, refreturn)
};
} // namespace Gio

View file

@ -0,0 +1,20 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>

View file

@ -0,0 +1,54 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <giomm/file.h>
#include <giomm/icon.h>
#include <giomm/loadableicon.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
namespace Gio
{
/** FileIcon specifies an icon by pointing to an image file to be used as icon.
*
* @newin2p16
*/
class FileIcon
: public Glib::Object,
//Already derived by LoadableIcon: public Icon,
public LoadableIcon
{
_CLASS_GOBJECT(FileIcon, GFileIcon, G_FILE_ICON, Glib::Object, GObject)
_IMPLEMENTS_INTERFACE(Icon)
_IMPLEMENTS_INTERFACE(LoadableIcon)
protected:
_CTOR_DEFAULT()
public:
_WRAP_CREATE()
_WRAP_METHOD(Glib::RefPtr<File> get_file(), g_file_icon_get_file, refreturn)
_WRAP_METHOD(Glib::RefPtr<const File> get_file() const, g_file_icon_get_file, refreturn, constversion)
};
} // namespace Gio

View file

@ -0,0 +1,39 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
namespace Gio {
// FileAttributeMatcher
Glib::RefPtr<FileAttributeMatcher>
FileAttributeMatcher::create(const std::string& attributes)
{
return Glib::wrap(g_file_attribute_matcher_new(attributes.c_str()));
}
Glib::TimeVal FileInfo::modification_time() const
{
Glib::TimeVal result;
g_file_info_get_modification_time(const_cast<GFileInfo*>(gobj()), (GTimeVal*)(&result));
return result;
}
} // namespace Gio

View file

@ -0,0 +1,178 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/arrayhandle.h>
#include <glibmm/object.h>
#include <glibmm/timeval.h>
#include <giomm/fileattributeinfolist.h>
#include <giomm/icon.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
namespace Gio
{
// Rename FILE_TYPE_UNKNOWN to FILE_TYPE_NOT_KNOWN because the former is a
// define in a Windows header (winbase.h, included from windows.h).
_WRAP_ENUM(FileType, GFileType, NO_GTYPE, s#FILE_TYPE_UNKNOWN#FILE_TYPE_NOT_KNOWN#)
// Provide FILE_TYPE_UNKNOWN for backwards compatibility.
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#ifndef FILE_TYPE_UNKNOWN
const FileType FILE_TYPE_UNKNOWN = FILE_TYPE_NOT_KNOWN;
#endif
#endif
//TODO: attribute strings
/** FileAttributeMatcher allows for searching through a FileInfo for attributes.
*
* @newin2p16
*/
class FileAttributeMatcher
{
_CLASS_OPAQUE_REFCOUNTED(FileAttributeMatcher, GFileAttributeMatcher,
NONE, g_file_attribute_matcher_ref, g_file_attribute_matcher_unref)
public:
/** Creates a new file attribute matcher, which matches attributes against a given string.
* The attribute string should be formatted with specific keys separated from namespaces with a double colon.
* Several "namespace::key" strings may be concatenated with a single comma (e.g. "standard::type,standard::is-hidden").
* The wildcard "*" may be used to match all keys and namespaces, or "namespace::*" will match all keys in a given namespace.
*
* @param attributes The attributes string.
* @result a new FileAttributeMatcher.
*/
static Glib::RefPtr<FileAttributeMatcher> create(const std::string& attributes = "*");
_WRAP_METHOD(bool matches(const std::string& full_name) const, g_file_attribute_matcher_matches)
_WRAP_METHOD(bool matches_only(const std::string& full_name) const, g_file_attribute_matcher_matches_only)
_WRAP_METHOD(bool enumerate_namespace(const std::string& ns), g_file_attribute_matcher_enumerate_namespace)
_WRAP_METHOD(std::string enumerate_next(), g_file_attribute_matcher_enumerate_next)
};
/** FileInfo implements methods for getting information that all files should contain, and allows for manipulation of extended attributes.
* See FileAttribute for more information on how GIO handles file attributes.
*
* To obtain a FileInfo for a File, use File::query_info() (or its async variant).
* To obtain a FileInfo for a file input or output stream, use FileInput::stream_query_info() or FileOutput::stream_query_info()
* (or their async variants).
*
* FileAttributeMatcher allows for searching through a FileInfo for attributes.
*/
class FileInfo : public Glib::Object
{
_CLASS_GOBJECT(FileInfo, GFileInfo, G_FILE_INFO, Glib::Object, GObject)
public:
_CTOR_DEFAULT()
_WRAP_METHOD(Glib::RefPtr<FileInfo> dup() const,
g_file_info_dup)
_WRAP_METHOD(void copy_into(Glib::RefPtr<FileInfo>& dest) const,
g_file_info_copy_into)
_WRAP_METHOD(bool has_attribute(const std::string& attribute) const,
g_file_info_has_attribute)
_WRAP_METHOD(Glib::StringArrayHandle list_attributes(const std::string& name_space) const,
g_file_info_list_attributes)
_WRAP_METHOD(FileAttributeType get_attribute_type(const std::string& attribute) const,
g_file_info_get_attribute_type)
_WRAP_METHOD(void remove_attribute(const std::string& attribute),
g_file_info_remove_attribute)
_WRAP_METHOD(std::string get_attribute_string(const std::string& attribute) const,
g_file_info_get_attribute_string)
_WRAP_METHOD(Glib::ustring get_attribute_as_string(const std::string& attribute) const,
g_file_info_get_attribute_as_string)
_WRAP_METHOD(std::string get_attribute_byte_string(const std::string& attribute) const,
g_file_info_get_attribute_byte_string)
_WRAP_METHOD(bool get_attribute_boolean(const std::string& attribute) const,
g_file_info_get_attribute_boolean)
_WRAP_METHOD(guint32 get_attribute_uint32(const std::string& attribute) const,
g_file_info_get_attribute_uint32)
_WRAP_METHOD(gint32 get_attribute_int32(const std::string& attribute) const,
g_file_info_get_attribute_int32)
_WRAP_METHOD(guint64 get_attribute_uint64(const std::string& attribute) const,
g_file_info_get_attribute_uint64)
_WRAP_METHOD(gint64 get_attribute_int64(const std::string& attribute) const,
g_file_info_get_attribute_int64)
_WRAP_METHOD(Glib::RefPtr<Glib::Object> get_attribute_object(const std::string& attribute) const,
g_file_info_get_attribute_object)
_WRAP_METHOD(void set_attribute_string(const std::string& attribute, const std::string& value),
g_file_info_set_attribute_string)
_WRAP_METHOD(void set_attribute_byte_string(const std::string& attribute, const std::string& value),
g_file_info_set_attribute_byte_string)
_WRAP_METHOD(void set_attribute_boolean(const std::string& attribute, bool value),
g_file_info_set_attribute_boolean)
_WRAP_METHOD(void set_attribute_uint32(const std::string& attribute, guint32 value),
g_file_info_set_attribute_uint32)
_WRAP_METHOD(void set_attribute_int32(const std::string& attribute, gint32 value),
g_file_info_set_attribute_int32)
_WRAP_METHOD(void set_attribute_uint64(const std::string& attribute, guint64 value),
g_file_info_set_attribute_uint64)
_WRAP_METHOD(void set_attribute_int64(const std::string& attribute, gint64 value),
g_file_info_set_attribute_int64)
_WRAP_METHOD(void set_attribute_object(const std::string& attribute, const Glib::RefPtr<Glib::Object>& object),
g_file_info_set_attribute_object)
_WRAP_METHOD(void clear_status(), g_file_info_clear_status)
// helper getters
_WRAP_METHOD(FileType get_file_type() const, g_file_info_get_file_type)
_WRAP_METHOD(bool is_hidden() const, g_file_info_get_is_hidden)
_WRAP_METHOD(bool is_backup() const, g_file_info_get_is_backup)
_WRAP_METHOD(bool is_symlink() const, g_file_info_get_is_symlink)
_WRAP_METHOD(std::string get_name() const, g_file_info_get_name)
_WRAP_METHOD(std::string get_display_name() const, g_file_info_get_display_name)
_WRAP_METHOD(std::string get_edit_name() const, g_file_info_get_edit_name)
_WRAP_METHOD(Glib::RefPtr<Icon> get_icon(), g_file_info_get_icon, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Icon> get_icon() const, g_file_info_get_icon, refreturn, constversion)
_WRAP_METHOD(std::string get_content_type() const, g_file_info_get_content_type)
_WRAP_METHOD(goffset get_size() const, g_file_info_get_size)
Glib::TimeVal modification_time() const;
_WRAP_METHOD(std::string get_symlink_target() const, g_file_info_get_symlink_target)
_WRAP_METHOD(std::string get_etag() const, g_file_info_get_etag)
_WRAP_METHOD(gint32 get_sort_order() const, g_file_info_get_sort_order)
_WRAP_METHOD(void set_attribute_mask(const Glib::RefPtr<FileAttributeMatcher>& mask),
g_file_info_set_attribute_mask)
_WRAP_METHOD(void unset_attribute_mask(), g_file_info_unset_attribute_mask)
// helper setters
_WRAP_METHOD(void set_file_type(FileType type), g_file_info_set_file_type)
_WRAP_METHOD(void set_is_hidden(bool is_hidden = true), g_file_info_set_is_hidden)
_WRAP_METHOD(void set_is_symlink(bool is_symlink = true), g_file_info_set_is_symlink)
_WRAP_METHOD(void set_name(const std::string& name), g_file_info_set_name)
_WRAP_METHOD(void set_display_name(const std::string& display_name), g_file_info_set_display_name)
_WRAP_METHOD(void set_edit_name(const std::string& edit_name), g_file_info_set_edit_name)
_WRAP_METHOD(void set_icon(const Glib::RefPtr<Icon>& icon), g_file_info_set_icon)
_WRAP_METHOD(void set_content_type(const std::string& content_type), g_file_info_set_content_type)
_WRAP_METHOD(void set_size(goffset size), g_file_info_set_size)
_WRAP_METHOD(void set_modification_time(const Glib::TimeVal& mtime), g_file_info_set_modification_time)
_WRAP_METHOD(void set_symlink_target(const std::string& symlink_target), g_file_info_set_symlink_target)
_WRAP_METHOD(void set_sort_order(gint32 sort_order), g_file_info_set_sort_order)
};
} // namespace Gio

View file

@ -0,0 +1,97 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include "slot_async.h"
#include <glibmm/exceptionhandler.h>
namespace Gio
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<FileInfo> FileInputStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes)
#else
Glib::RefPtr<FileInfo> FileInputStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_input_stream_query_info(gobj(), g_strdup((attributes).c_str()), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<FileInfo> FileInputStream::query_info(const std::string& attributes)
#else
Glib::RefPtr<FileInfo> FileInputStream::query_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_input_stream_query_info(gobj(), g_strdup((attributes).c_str()), NULL, &(gerror)));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
void
FileInputStream::query_info_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_input_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
io_priority,
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void
FileInputStream::query_info_async(const SlotAsyncReady& slot, const std::string& attributes, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_input_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
io_priority,
NULL,
&SignalProxy_async_callback,
slot_copy);
}
} // namespace Gio

View file

@ -0,0 +1,125 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/fileinfo.h>
#include <giomm/inputstream.h>
#include <giomm/seekable.h>
#include <glibmm/iochannel.h>
#include <glibmm/object.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/inputstream_p.h)
namespace Gio
{
/** FileInputStream provides input streams that take their content from a file.
*
* FileInputStream implements Seekable, which allows the input stream to jump to arbitrary positions in the file,
* provided the file system of the file allows it.
* Use the methods of the Seekable base class for seeking and positioning.
*
* @ingroup Streams
*
* @newin2p16
*/
class FileInputStream
: public Gio::InputStream,
public Seekable
{
_CLASS_GOBJECT(FileInputStream, GFileInputStream, G_FILE_INPUT_STREAM, Gio::InputStream, GInputStream)
_IMPLEMENTS_INTERFACE(Seekable)
public:
/** Queries a file input stream the given @a attributes. This function blocks
* while querying the stream. For the asynchronous (non-blocking) version
* of this function, see query_info_async(). While the
* stream is blocked, the stream will set the pending flag internally, and
* any other operations on the stream will throw a Gio::Error with PENDING.
*
* @param attributes A file attribute query string.
* @param cancellable A Cancellable object.
* @return A FileInfo, or an empty RefPtr on error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<FileInfo> query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes = "*");
#else
Glib::RefPtr<FileInfo> query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Queries a file input stream the given @a attributes. This function blocks
* while querying the stream. For the asynchronous (non-blocking) version
* of this function, see query_info_async(). While the
* stream is blocked, the stream will set the pending flag internally, and
* any other operations on the stream will throw a Gio::Error with PENDING.
*
* @param attributes A file attribute query string.
* @return A FileInfo, or an empty RefPtr on error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<FileInfo> query_info(const std::string& attributes = "*");
#else
Glib::RefPtr<FileInfo> query_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_IGNORE(g_file_input_stream_query_info)
/** Queries the stream information asynchronously. For the synchronous version of this function, see query_info().
*
* The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled,
* a Gio::Error with CANCELLED will be thrown.
*
* When the operation is finished, @a slot will be called. You can then call query_info_finish() to get the result of the operation.
*
* @param slot A callback slot which will be called when the request is satisfied.
* @param cancellable A Cancellable object which can be used to cancel the operation.
* @param attributes A file attribute query string.
* @param io_priority The I/O priority of the request.
*/
void query_info_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes = "*", int io_priority = Glib::PRIORITY_DEFAULT);
/** Queries the stream information asynchronously. For the synchronous version of this function, see query_info().
*
* When the operation is finished, @a slot will be called. You can then call query_info_finish() to get the result of the operation.
*
* @param slot A callback slot which will be called when the request is satisfied.
* @param attributes A file attribute query string.
* @param io_priority The I/O priority of the request.
*/
void query_info_async(const SlotAsyncReady& slot, const std::string& attributes = "*", int io_priority = Glib::PRIORITY_DEFAULT);
_IGNORE(g_file_input_stream_query_info_async)
_WRAP_METHOD(Glib::RefPtr<FileInfo> query_info_finish(const Glib::RefPtr<AsyncResult>& result),
g_file_input_stream_query_info_finish,
errthrow)
//These seem to be just C convenience functions - they are already in the Seekable base class:
//See http://bugzilla.gnome.org/show_bug.cgi?id=509990
_IGNORE(g_file_input_stream_tell, g_file_input_stream_can_seek, g_file_input_stream_seek)
// _WRAP_METHOD(goffset tell() const, g_file_input_stream_tell)
// _WRAP_METHOD(bool can_seek() const, g_file_input_stream_can_seek)
// _WRAP_METHOD(bool seek(goffset offset, Glib::SeekType type, const Glib::RefPtr<Cancellable>& cancellable),
// g_file_input_stream_seek,
// errthrow)
};
} // namespace Gio

View file

@ -0,0 +1,26 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/file.h>
#include <gio/gio.h>
namespace Gio {
} // namespace Gio

View file

@ -0,0 +1,67 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//#include <giomm/file.h>
#include <glibmm/object.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
_PINCLUDE(gio/gio.h)
namespace Gio
{
_WRAP_ENUM(FileMonitorEvent, GFileMonitorEvent, NO_GTYPE)
class File;
/** Monitors a file or directory for changes.
* To obtain a FileMonitor for a file or directory, use File::monitor_file() or
* File::monitor_directory().
*
* To get informed about changes to the file or directory you are monitoring,
* connect to signal_changed.
*
* @newin2p16
*/
class FileMonitor : public Glib::Object
{
_CLASS_GOBJECT(FileMonitor, GFileMonitor, G_FILE_MONITOR, Glib::Object, GObject)
protected:
public:
_WRAP_METHOD(bool cancel(), g_file_monitor_cancel)
_WRAP_METHOD(bool is_cancelled() const, g_file_monitor_is_cancelled)
_WRAP_METHOD(void set_rate_limit(int limit_msecs), g_file_monitor_set_rate_limit)
//g_file_monitor_emit_event is for implementations.
_IGNORE(g_file_monitor_emit_event)
#m4 _CONVERSION(`GFile*',`const Glib::RefPtr<File>&',`Glib::wrap($3, true)')
_WRAP_SIGNAL(void changed(const Glib::RefPtr<File>& file, const Glib::RefPtr<File>& other_file, FileMonitorEvent event_type), "changed")
//_WRAP_VFUNC(bool cancel(), cancel);
_WRAP_PROPERTY("rate-limit", int)
_WRAP_PROPERTY("cancelled", bool)
};
} // namespace Gio

View file

@ -0,0 +1,26 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/file.h>
#include <gio/gio.h>
namespace Gio {
} // namespace Gio

View file

@ -0,0 +1,54 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//#include <giomm/file.h>
#include <glibmm/object.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
_PINCLUDE(gio/gio.h)
namespace Gio
{
class File;
/** Completes partial file and directory names given a partial string by looking in the file system for clues.
* Can return a list of possible completion strings for widget implementation.
*
* @newin2p16
*/
class FilenameCompleter : public Glib::Object
{
_CLASS_GOBJECT(FilenameCompleter, GFilenameCompleter, G_FILENAME_COMPLETER, Glib::Object, GObject)
protected:
_CTOR_DEFAULT
_IGNORE(g_filename_completer_new)
public:
_WRAP_CREATE()
_WRAP_METHOD(std::string get_completion_suffix(const std::string& initial_text) const, g_filename_completer_get_completion_suffix)
_WRAP_METHOD(Glib::StringArrayHandle get_completions(const std::string& initial_text) const, g_filename_completer_get_completions)
_WRAP_METHOD(void set_dirs_only(bool dirs_only = true), g_filename_completer_set_dirs_only)
_WRAP_SIGNAL(void got_completion_data(), got_completion_data)
};
} // namespace Gio

View file

@ -0,0 +1,103 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include <glib.h>
#include <glibmm/error.h>
#include <glibmm/exceptionhandler.h>
#include "slot_async.h"
namespace Gio
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<FileInfo> FileOutputStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes)
#else
Glib::RefPtr<FileInfo> FileOutputStream::query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_output_stream_query_info(gobj(), g_strdup((attributes).c_str()), const_cast<GCancellable*>(Glib::unwrap(cancellable)), &(gerror)));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
if(retvalue)
retvalue->reference(); //The function does not do a ref for us.
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<FileInfo> FileOutputStream::query_info(const std::string& attributes)
#else
Glib::RefPtr<FileInfo> FileOutputStream::query_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_output_stream_query_info(gobj(), g_strdup((attributes).c_str()), NULL, &(gerror)));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
if(retvalue)
retvalue->reference(); //The function does not do a ref for us.
return retvalue;
}
void
FileOutputStream::query_info_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_output_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
io_priority,
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void
FileOutputStream::query_info_async(const SlotAsyncReady& slot, const std::string& attributes, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_file_output_stream_query_info_async(gobj(),
const_cast<char*>(attributes.c_str()),
io_priority,
NULL,
&SignalProxy_async_callback,
slot_copy);
}
} // namespace Gio

View file

@ -0,0 +1,166 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/outputstream.h>
#include <giomm/seekable.h>
#include <giomm/fileinfo.h>
#include <glibmm/object.h>
#include <glibmm/iochannel.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/outputstream_p.h)
namespace Gio
{
/** FileOutputStream provides output streams that write their content to a file.
*
* FileOutputStream implements Seekable, which allows the output stream to jump
* to arbitrary positions in the file and to truncate the file, provided the
* file system of the file supports these operations.
* Use the methods of the Seekable base class for seeking and positioning.
*
* @ingroup Streams
*
* @newin2p16
*/
class FileOutputStream
: public OutputStream,
public Seekable
{
_CLASS_GOBJECT(FileOutputStream, GFileOutputStream, G_FILE_OUTPUT_STREAM, Gio::OutputStream, GOutputStream)
_IMPLEMENTS_INTERFACE(Seekable)
public:
/** Queries a file output stream for the given @a attributes .
* This function blocks while querying the stream. For the asynchronous
* version of this function, see query_info_async().
* While the stream is blocked, the stream will set the pending flag
* internally, and any other operations on the stream will throw a Gio::Error with
* PENDING.
*
* Can fail if the stream was already closed (with a
* CLOSED error), the stream has pending operations (with a PENDING error),
* or if querying info is not supported for
* the stream's interface (with a NOT_SUPPORTED error). In
* all cases of failure, an empty RefPtr will be returned.
*
* The operation can be cancelled by triggering the cancellable object from another thread. If the operation
* was cancelled, a Gio::Error with CANCELLED may be thrown, and an empty RefPtr will
* be returned.
*
* @param cancellable A Cancellable object.
* @param attributes A file attribute query string.
* @return A FileInfo for the stream, or an empty RefPtr on error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<FileInfo> query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes = "*");
#else
Glib::RefPtr<FileInfo> query_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Queries a file output stream for the given @a attributes .
* This function blocks while querying the stream. For the asynchronous
* version of this function, see query_info_async().
* While the stream is blocked, the stream will set the pending flag
* internally, and any other operations on the stream will throw a Gio::Error with
* PENDING.
*
* Can fail if the stream was already closed (with a CLOSED error),
* the stream has pending operations (with an PENDING error),
* or if querying info is not supported for
* the stream's interface (with a NOT_SUPPORTED error). In
* all cases of failure, an empty RefPtr will be returned.
*
* The operation can be cancelled by triggering the cancellable object from another thread. If the operation
* was cancelled, a Gio::Error with CANCELLED may be thrown, and an empty RefPtr will
* be returned.
*
* @param cancellable A Cancellable object.
* @param attributes A file attribute query string.
* @return A FileInfo for the stream, or an empty RefPtr on error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<FileInfo> query_info(const std::string& attributes = "*");
#else
Glib::RefPtr<FileInfo> query_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_IGNORE(g_file_output_stream_query_info)
/** Queries the stream information asynchronously.
* When the operation is finished @a slot will be called.
* You can then call query_info_finish()
* to get the result of the operation.
*
* For the synchronous version of this function,
* see query_info().
*
* If @a cancellable is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, a Gio::Error with CANCELLED may be thrown
*
* @param slot Callback to call when the request is satisfied.
* @param cancellable A Cancellable object.
* @param attributes A file attribute query string.
* @param io_priority The <io-priority of the request.
*/
void query_info_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes = "*", int io_priority = Glib::PRIORITY_DEFAULT);
/** Queries the stream information asynchronously.
* When the operation is finished @a slot will be called.
* You can then call query_info_finish()
* to get the result of the operation.
*
* For the synchronous version of this function,
* see query_info().
*
* @param slot Callback to call when the request is satisfied.
* @param attributes A file attribute query string.
* @param io_priority The <io-priority of the request.
*/
void query_info_async(const SlotAsyncReady& slot, const std::string& attributes = "*", int io_priority = Glib::PRIORITY_DEFAULT);
_IGNORE(g_file_input_stream_query_info_async)
_WRAP_METHOD(Glib::RefPtr<FileInfo> query_info_finish(const Glib::RefPtr<AsyncResult>& result),
g_file_output_stream_query_info_finish,
refreturn, errthrow)
_WRAP_METHOD(std::string get_etag() const, g_file_output_stream_get_etag)
//These seem to be just C convenience functions - they are already in the Seekable base class:
//See http://bugzilla.gnome.org/show_bug.cgi?id=509990
_IGNORE(g_file_output_stream_tell, g_file_output_stream_can_seek, g_file_output_stream_seek,
g_file_output_stream_can_truncate, g_file_output_stream_truncate)
// _WRAP_METHOD(goffset tell() const, g_file_output_stream_tell)
// _WRAP_METHOD(bool can_seek() const, g_file_output_stream_can_seek)
// _WRAP_METHOD(bool seek(goffset offset, Glib::SeekType type, const Glib::RefPtr<Cancellable>& cancellable),
// g_file_output_stream_seek,
// errthrow)
// _WRAP_METHOD(bool can_truncate() const, g_file_output_stream_can_truncate)
// _WRAP_METHOD(bool truncate(goffset size, const Glib::RefPtr<Cancellable>& cancellable),
// g_file_output_stream_truncate,
// errthrow)
};
} // namespace Gio

View file

@ -0,0 +1,20 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2008 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>

View file

@ -0,0 +1,52 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2008 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/inputstream.h>
#include <glibmm/object.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/inputstream_p.h)
namespace Gio
{
//TODO: Proper documentation.
/** Filter Input Stream.
*
* @ingroup Streams
*
* @newin2p16
*/
class FilterInputStream : public Gio::InputStream
{
_CLASS_GOBJECT(FilterInputStream, GFilterInputStream, G_FILTER_INPUT_STREAM, Gio::InputStream, GInputStream)
public:
_WRAP_METHOD(Glib::RefPtr<InputStream> get_base_stream(),
g_filter_input_stream_get_base_stream,
refreturn)
_WRAP_METHOD(Glib::RefPtr<const InputStream> get_base_stream() const,
g_filter_input_stream_get_base_stream,
refreturn, constversion)
_WRAP_PROPERTY("base-stream", Glib::RefPtr<InputStream>)
};
} // namespace Gio

View file

@ -0,0 +1,20 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2008 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>

View file

@ -0,0 +1,52 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2008 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/outputstream.h>
#include <glibmm/object.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/outputstream_p.h)
namespace Gio
{
//TODO: Proper documentation:
/** Filter Output Stream.
*
* @ingroup Streams
*
* @newin2p16
*/
class FilterOutputStream : public Gio::OutputStream
{
_CLASS_GOBJECT(FilterOutputStream, GFilterOutputStream, G_FILTER_OUTPUT_STREAM, Gio::OutputStream, GOutputStream)
public:
_WRAP_METHOD(Glib::RefPtr<OutputStream> get_base_stream(),
g_filter_output_stream_get_base_stream,
refreturn)
_WRAP_METHOD(Glib::RefPtr<const OutputStream> get_base_stream() const,
g_filter_output_stream_get_base_stream,
refreturn, constversion)
_WRAP_PROPERTY("base-stream", Glib::RefPtr<InputStream>)
};
} // namespace Gio

View file

@ -0,0 +1,6 @@
(include gio_methods.defs)
(include gio_others.defs)
(include gio_enums.defs)
(include gio_signals.defs)
(include gio_vfuncs.defs)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,251 @@
;; From /home/murrayc/svn/gnome220/glib/gio/gioenums.h
(define-flags-extended AppInfoCreateFlags
(in-module "G")
(c-name "GAppInfoCreateFlags")
(values
'("none" "G_APP_INFO_CREATE_NONE" "0")
'("needs-terminal" "G_APP_INFO_CREATE_NEEDS_TERMINAL" "1 << 0")
'("supports-uris" "G_APP_INFO_CREATE_SUPPORTS_URIS" "1 << 1")
)
)
(define-enum-extended DataStreamByteOrder
(in-module "G")
(c-name "GDataStreamByteOrder")
(values
'("big-endian" "G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN" "0")
'("little-endian" "G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN" "1")
'("host-endian" "G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN" "2")
)
)
(define-enum-extended DataStreamNewlineType
(in-module "G")
(c-name "GDataStreamNewlineType")
(values
'("lf" "G_DATA_STREAM_NEWLINE_TYPE_LF" "0")
'("cr" "G_DATA_STREAM_NEWLINE_TYPE_CR" "1")
'("cr-lf" "G_DATA_STREAM_NEWLINE_TYPE_CR_LF" "2")
'("any" "G_DATA_STREAM_NEWLINE_TYPE_ANY" "3")
)
)
(define-enum-extended FileAttributeType
(in-module "G")
(c-name "GFileAttributeType")
(values
'("invalid" "G_FILE_ATTRIBUTE_TYPE_INVALID" "0")
'("string" "G_FILE_ATTRIBUTE_TYPE_STRING" "1")
'("byte-string" "G_FILE_ATTRIBUTE_TYPE_BYTE_STRING" "2")
'("boolean" "G_FILE_ATTRIBUTE_TYPE_BOOLEAN" "3")
'("uint32" "G_FILE_ATTRIBUTE_TYPE_UINT32" "4")
'("int32" "G_FILE_ATTRIBUTE_TYPE_INT32" "5")
'("uint64" "G_FILE_ATTRIBUTE_TYPE_UINT64" "6")
'("int64" "G_FILE_ATTRIBUTE_TYPE_INT64" "7")
'("object" "G_FILE_ATTRIBUTE_TYPE_OBJECT" "8")
)
)
(define-flags-extended FileAttributeInfoFlags
(in-module "G")
(c-name "GFileAttributeInfoFlags")
(values
'("none" "G_FILE_ATTRIBUTE_INFO_NONE" "0")
'("copy-with-file" "G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE" "1 << 0")
'("copy-when-moved" "G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED" "1 << 1")
)
)
(define-enum-extended FileAttributeStatus
(in-module "G")
(c-name "GFileAttributeStatus")
(values
'("unset" "G_FILE_ATTRIBUTE_STATUS_UNSET" "0")
'("set" "G_FILE_ATTRIBUTE_STATUS_SET" "1")
'("error-setting" "G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING" "2")
)
)
(define-flags-extended FileQueryInfoFlags
(in-module "G")
(c-name "GFileQueryInfoFlags")
(values
'("none" "G_FILE_QUERY_INFO_NONE" "0")
'("nofollow-symlinks" "G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS" "1 << 0")
)
)
(define-flags-extended FileCreateFlags
(in-module "G")
(c-name "GFileCreateFlags")
(values
'("none" "G_FILE_CREATE_NONE" "0")
'("private" "G_FILE_CREATE_PRIVATE" "1 << 0")
)
)
(define-enum-extended MountMountFlags
(in-module "G")
(c-name "GMountMountFlags")
(values
'("e" "G_MOUNT_MOUNT_NONE" "0")
)
)
(define-flags-extended MountUnmountFlags
(in-module "G")
(c-name "GMountUnmountFlags")
(values
'("none" "G_MOUNT_UNMOUNT_NONE" "0")
'("force" "G_MOUNT_UNMOUNT_FORCE" "1 << 0")
)
)
(define-flags-extended FileCopyFlags
(in-module "G")
(c-name "GFileCopyFlags")
(values
'("none" "G_FILE_COPY_NONE" "0")
'("overwrite" "G_FILE_COPY_OVERWRITE" "1 << 0")
'("backup" "G_FILE_COPY_BACKUP" "1 << 1")
'("nofollow-symlinks" "G_FILE_COPY_NOFOLLOW_SYMLINKS" "1 << 2")
'("all-metadata" "G_FILE_COPY_ALL_METADATA" "1 << 3")
'("no-fallback-for-move" "G_FILE_COPY_NO_FALLBACK_FOR_MOVE" "1 << 4")
)
)
(define-flags-extended FileMonitorFlags
(in-module "G")
(c-name "GFileMonitorFlags")
(values
'("none" "G_FILE_MONITOR_NONE" "0")
'("watch-mounts" "G_FILE_MONITOR_WATCH_MOUNTS" "1 << 0")
)
)
(define-enum-extended FileType
(in-module "G")
(c-name "GFileType")
(values
'("unknown" "G_FILE_TYPE_UNKNOWN" "0")
'("regular" "G_FILE_TYPE_REGULAR" "1")
'("directory" "G_FILE_TYPE_DIRECTORY" "2")
'("symbolic-link" "G_FILE_TYPE_SYMBOLIC_LINK" "3")
'("special" "G_FILE_TYPE_SPECIAL" "4")
'("shortcut" "G_FILE_TYPE_SHORTCUT" "5")
'("mountable" "G_FILE_TYPE_MOUNTABLE" "6")
)
)
(define-enum-extended FilesystemPreviewType
(in-module "G")
(c-name "GFilesystemPreviewType")
(values
'("if-always" "G_FILESYSTEM_PREVIEW_TYPE_IF_ALWAYS" "0")
'("if-local" "G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL" "1")
'("never" "G_FILESYSTEM_PREVIEW_TYPE_NEVER" "2")
)
)
(define-enum-extended FileMonitorEvent
(in-module "G")
(c-name "GFileMonitorEvent")
(values
'("changed" "G_FILE_MONITOR_EVENT_CHANGED" "0")
'("changes-done-hint" "G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT" "1")
'("deleted" "G_FILE_MONITOR_EVENT_DELETED" "2")
'("created" "G_FILE_MONITOR_EVENT_CREATED" "3")
'("attribute-changed" "G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED" "4")
'("pre-unmount" "G_FILE_MONITOR_EVENT_PRE_UNMOUNT" "5")
'("unmounted" "G_FILE_MONITOR_EVENT_UNMOUNTED" "6")
)
)
; We added G_IO_ERROR_HOST_WAS_NOT_FOUND and deprecated G_IO_ERROR_HOST_WAS_NOT_FOUND,
; because it clashes with a HOST_NOT_FOUND define in netdb.h.
; http://bugzilla.gnome.org/show_bug.cgi?id=529496
; We need to deprecate HOST_NOT_FOUND, but we don't currently document generated enums
; at all: http://bugzilla.gnome.org/show_bug.cgi?id=544692
; murrayc
(define-enum-extended IOErrorEnum
(in-module "G")
(c-name "GIOErrorEnum")
(values
'("failed" "G_IO_ERROR_FAILED" "0")
'("not-found" "G_IO_ERROR_NOT_FOUND" "1")
'("exists" "G_IO_ERROR_EXISTS" "2")
'("is-directory" "G_IO_ERROR_IS_DIRECTORY" "3")
'("not-directory" "G_IO_ERROR_NOT_DIRECTORY" "4")
'("not-empty" "G_IO_ERROR_NOT_EMPTY" "5")
'("not-regular-file" "G_IO_ERROR_NOT_REGULAR_FILE" "6")
'("not-symbolic-link" "G_IO_ERROR_NOT_SYMBOLIC_LINK" "7")
'("not-mountable-file" "G_IO_ERROR_NOT_MOUNTABLE_FILE" "8")
'("filename-too-long" "G_IO_ERROR_FILENAME_TOO_LONG" "9")
'("invalid-filename" "G_IO_ERROR_INVALID_FILENAME" "10")
'("too-many-links" "G_IO_ERROR_TOO_MANY_LINKS" "11")
'("no-space" "G_IO_ERROR_NO_SPACE" "12")
'("invalid-argument" "G_IO_ERROR_INVALID_ARGUMENT" "13")
'("permission-denied" "G_IO_ERROR_PERMISSION_DENIED" "14")
'("not-supported" "G_IO_ERROR_NOT_SUPPORTED" "15")
'("not-mounted" "G_IO_ERROR_NOT_MOUNTED" "16")
'("already-mounted" "G_IO_ERROR_ALREADY_MOUNTED" "17")
'("closed" "G_IO_ERROR_CLOSED" "18")
'("cancelled" "G_IO_ERROR_CANCELLED" "19")
'("pending" "G_IO_ERROR_PENDING" "20")
'("read-only" "G_IO_ERROR_READ_ONLY" "21")
'("cant-create-backup" "G_IO_ERROR_CANT_CREATE_BACKUP" "22")
'("wrong-etag" "G_IO_ERROR_WRONG_ETAG" "23")
'("timed-out" "G_IO_ERROR_TIMED_OUT" "24")
'("would-recurse" "G_IO_ERROR_WOULD_RECURSE" "25")
'("busy" "G_IO_ERROR_BUSY" "26")
'("would-block" "G_IO_ERROR_WOULD_BLOCK" "27")
'("host-not-found" "G_IO_ERROR_HOST_NOT_FOUND" "28")
'("host-was-not-found" "G_IO_ERROR_HOST_WAS_NOT_FOUND" "28")
'("would-merge" "G_IO_ERROR_WOULD_MERGE" "29")
'("failed-handled" "G_IO_ERROR_FAILED_HANDLED" "30")
)
)
(define-flags-extended AskPasswordFlags
(in-module "G")
(c-name "GAskPasswordFlags")
(values
'("need-password" "G_ASK_PASSWORD_NEED_PASSWORD" "1 << 0")
'("need-username" "G_ASK_PASSWORD_NEED_USERNAME" "1 << 1")
'("need-domain" "G_ASK_PASSWORD_NEED_DOMAIN" "1 << 2")
'("saving-supported" "G_ASK_PASSWORD_SAVING_SUPPORTED" "1 << 3")
'("anonymous-supported" "G_ASK_PASSWORD_ANONYMOUS_SUPPORTED" "1 << 4")
)
)
(define-enum-extended PasswordSave
(in-module "G")
(c-name "GPasswordSave")
(values
'("never" "G_PASSWORD_SAVE_NEVER" "0")
'("for-session" "G_PASSWORD_SAVE_FOR_SESSION" "1")
'("permanently" "G_PASSWORD_SAVE_PERMANENTLY" "2")
)
)
(define-enum-extended MountOperationResult
(in-module "G")
(c-name "GMountOperationResult")
(values
'("handled" "G_MOUNT_OPERATION_HANDLED" "0")
'("aborted" "G_MOUNT_OPERATION_ABORTED" "1")
'("unhandled" "G_MOUNT_OPERATION_UNHANDLED" "2")
)
)
(define-flags-extended OutputStreamSpliceFlags
(in-module "G")
(c-name "GOutputStreamSpliceFlags")
(values
'("none" "G_OUTPUT_STREAM_SPLICE_NONE" "0")
'("close-source" "G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE" "1 << 0")
'("close-target" "G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET" "1 << 1")
)
)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,34 @@
; h2defs.py does not generate this. murrayc.
(define-function g_themed_icon_get_names
(c-name "g_themed_icon_get_names")
(return-type "const-char*const*")
)
; extra_defs does not generate these, for some reason. murrayc:
(define-signal changed
(of-object "GMount")
(return-type "void")
(when "last")
)
(define-signal unmounted
(of-object "GMount")
(return-type "void")
(when "last")
)
; extra_defs does not generate these, for some reason. murrayc:
(define-signal changed
(of-object "GVolume")
(return-type "void")
(when "last")
)
(define-signal removed
(of-object "GVolume")
(return-type "void")
(when "last")
)

View file

@ -0,0 +1,439 @@
;; From GAsyncResult
;; From GCancellable
(define-signal cancelled
(of-object "GCancellable")
(return-type "void")
(when "last")
)
;; From GBufferedInputStream
(define-property base-stream
(of-object "GBufferedInputStream")
(prop-type "GParamObject")
(docs "The underlying base stream the io ops will be done on")
(readable #t)
(writable #t)
(construct-only #t)
)
(define-property buffer-size
(of-object "GBufferedInputStream")
(prop-type "GParamUInt")
(docs "The size of the backend buffer")
(readable #t)
(writable #t)
(construct-only #f)
)
;; From GBufferedOutputStream
(define-property base-stream
(of-object "GBufferedOutputStream")
(prop-type "GParamObject")
(docs "The underlying base stream the io ops will be done on")
(readable #t)
(writable #t)
(construct-only #t)
)
(define-property buffer-size
(of-object "GBufferedOutputStream")
(prop-type "GParamUInt")
(docs "The size of the backend buffer")
(readable #t)
(writable #t)
(construct-only #f)
)
(define-property auto-grow
(of-object "GBufferedOutputStream")
(prop-type "GParamBoolean")
(docs "Whether the buffer should automatically grow")
(readable #t)
(writable #t)
(construct-only #f)
)
;; From GDataInputStream
(define-property base-stream
(of-object "GDataInputStream")
(prop-type "GParamObject")
(docs "The underlying base stream the io ops will be done on")
(readable #t)
(writable #t)
(construct-only #t)
)
(define-property buffer-size
(of-object "GDataInputStream")
(prop-type "GParamUInt")
(docs "The size of the backend buffer")
(readable #t)
(writable #t)
(construct-only #f)
)
(define-property byte-order
(of-object "GDataInputStream")
(prop-type "GParamEnum")
(docs "The byte order")
(readable #t)
(writable #t)
(construct-only #f)
)
(define-property newline-type
(of-object "GDataInputStream")
(prop-type "GParamEnum")
(docs "The accepted types of line ending")
(readable #t)
(writable #t)
(construct-only #f)
)
;; From GDataOutputStream
(define-property base-stream
(of-object "GDataOutputStream")
(prop-type "GParamObject")
(docs "The underlying base stream the io ops will be done on")
(readable #t)
(writable #t)
(construct-only #t)
)
(define-property byte-order
(of-object "GDataOutputStream")
(prop-type "GParamEnum")
(docs "The byte order")
(readable #t)
(writable #t)
(construct-only #f)
)
;; From GDrive
;; From GFile
;; From GFileEnumerator
(define-property container
(of-object "GFileEnumerator")
(prop-type "GParamObject")
(docs "The container that is being enumerated")
(readable #f)
(writable #t)
(construct-only #t)
)
;; From GFileInfo
;; From GFileIcon
;; From GFileMonitor
(define-signal changed
(of-object "GFileMonitor")
(return-type "void")
(when "last")
(parameters
'("GFile*" "p0")
'("GFile*" "p1")
'("GFileMonitorEvent" "p2")
)
)
(define-property rate-limit
(of-object "GFileMonitor")
(prop-type "GParamInt")
(docs "The limit of the monitor to watch for changes, in milliseconds")
(readable #t)
(writable #t)
(construct-only #f)
)
(define-property cancelled
(of-object "GFileMonitor")
(prop-type "GParamBoolean")
(docs "Whether the monitor has been cancelled")
(readable #t)
(writable #f)
(construct-only #f)
)
;; From GFilenameCompleter
(define-signal got-completion-data
(of-object "GFilenameCompleter")
(return-type "void")
(when "last")
)
;; From GFileInputStream
;; From GFileOutputStream
;; From GFilterInputStream
(define-property base-stream
(of-object "GFilterInputStream")
(prop-type "GParamObject")
(docs "The underlying base stream the io ops will be done on")
(readable #t)
(writable #t)
(construct-only #t)
)
;; From GFilterOutputStream
(define-property base-stream
(of-object "GFilterOutputStream")
(prop-type "GParamObject")
(docs "The underlying base stream the io ops will be done on")
(readable #t)
(writable #t)
(construct-only #t)
)
;; From GInputStream
;; From GLoadableIcon
;; From GMemoryInputStream
;; From GMemoryOutputStream
;; From GMount
;; From GMountOperation
(define-signal ask-password
(of-object "GMountOperation")
(return-type "void")
(when "last")
(parameters
'("const-gchar*" "p0")
'("const-gchar*" "p1")
'("const-gchar*" "p2")
'("GAskPasswordFlags" "p3")
)
)
;; p1 is actually a gchar**,
;; but that is equivalent (by typedef) to gchar**,
;; and the declaration in gmountoperation.h adds a const.
;; murrayc
(define-signal ask-question
(of-object "GMountOperation")
(return-type "void")
(when "last")
(parameters
'("const-gchar*" "p0")
'("const-gchar**" "p1")
)
)
(define-signal reply
(of-object "GMountOperation")
(return-type "void")
(when "last")
(parameters
'("GMountOperationResult" "p0")
)
)
(define-property username
(of-object "GMountOperation")
(prop-type "GParamString")
(docs "The user name")
(readable #t)
(writable #t)
(construct-only #f)
)
(define-property password
(of-object "GMountOperation")
(prop-type "GParamString")
(docs "The password")
(readable #t)
(writable #t)
(construct-only #f)
)
(define-property anonymous
(of-object "GMountOperation")
(prop-type "GParamBoolean")
(docs "Whether to use an anonymous user")
(readable #t)
(writable #t)
(construct-only #f)
)
(define-property domain
(of-object "GMountOperation")
(prop-type "GParamString")
(docs "The domain of the mount operation")
(readable #t)
(writable #t)
(construct-only #f)
)
(define-property password-save
(of-object "GMountOperation")
(prop-type "GParamEnum")
(docs "How passwords should be saved")
(readable #t)
(writable #t)
(construct-only #f)
)
(define-property choice
(of-object "GMountOperation")
(prop-type "GParamInt")
(docs "The users choice")
(readable #t)
(writable #t)
(construct-only #f)
)
;; From GSeekable
;; From GSimpleAsyncResult
;; From GThemedIcon
(define-property name
(of-object "GThemedIcon")
(prop-type "GParamString")
(docs "The name of the icon")
(readable #f)
(writable #t)
(construct-only #t)
)
(define-property names
(of-object "GThemedIcon")
(prop-type "GParamBoxed")
(docs "An array containing the icon names")
(readable #t)
(writable #t)
(construct-only #t)
)
(define-property use-default-fallbacks
(of-object "GThemedIcon")
(prop-type "GParamBoolean")
(docs "Whether to use default fallbacks found by shortening the name at '-' characters. Ignores names after the first if multiple names are given.")
(readable #f)
(writable #t)
(construct-only #t)
)
;; From GVolume
;; From GVolumeMonitor
(define-signal volume-added
(of-object "GVolumeMonitor")
(return-type "void")
(when "last")
(parameters
'("GVolume*" "p0")
)
)
(define-signal volume-removed
(of-object "GVolumeMonitor")
(return-type "void")
(when "last")
(parameters
'("GVolume*" "p0")
)
)
(define-signal volume-changed
(of-object "GVolumeMonitor")
(return-type "void")
(when "last")
(parameters
'("GVolume*" "p0")
)
)
(define-signal mount-added
(of-object "GVolumeMonitor")
(return-type "void")
(when "last")
(parameters
'("GMount*" "p0")
)
)
(define-signal mount-removed
(of-object "GVolumeMonitor")
(return-type "void")
(when "last")
(parameters
'("GMount*" "p0")
)
)
(define-signal mount-pre-unmount
(of-object "GVolumeMonitor")
(return-type "void")
(when "last")
(parameters
'("GMount*" "p0")
)
)
(define-signal mount-changed
(of-object "GVolumeMonitor")
(return-type "void")
(when "last")
(parameters
'("GMount*" "p0")
)
)
(define-signal drive-connected
(of-object "GVolumeMonitor")
(return-type "void")
(when "last")
(parameters
'("GDrive*" "p0")
)
)
(define-signal drive-disconnected
(of-object "GVolumeMonitor")
(return-type "void")
(when "last")
(parameters
'("GDrive*" "p0")
)
)
(define-signal drive-changed
(of-object "GVolumeMonitor")
(return-type "void")
(when "last")
(parameters
'("GDrive*" "p0")
)
)
(define-signal drive-eject-button
(of-object "GVolumeMonitor")
(return-type "void")
(when "last")
(parameters
'("GDrive*" "p0")
)
)

View file

@ -0,0 +1,466 @@
;; -*- scheme -*-
; virtual function definitions
; define-vfunc is g*mm-specific
; These are hand-written.
; GAsyncResult
(define-vfunc get_source_object
(of-object "GAsyncResult")
(return-type "GObject*")
)
; GFile
(define-vfunc dup
(of-object "GFile")
(return-type "GFile*")
)
(define-vfunc hash
(of-object "GFile")
(return-type "guint")
)
(define-vfunc get_basename
(of-object "GFile")
(return-type "char*")
)
(define-vfunc get_path
(of-object "GFile")
(return-type "char*")
)
(define-vfunc get_uri
(of-object "GFile")
(return-type "char*")
)
(define-vfunc get_parse_name
(of-object "GFile")
(return-type "char*")
)
(define-vfunc get_parent
(of-object "GFile")
(return-type "GFile*")
)
(define-vfunc get_child_for_display_name
(of-object "GFile")
(return-type "GFile*")
(parameters
'("const-char*" "display_name")
'("GError**" "error")
)
)
(define-vfunc has_prefix
(of-object "GFile")
(return-type "gboolean")
(parameters
'("GFile*" "prefix")
)
)
(define-vfunc get_relative_path
(of-object "GFile")
(return-type "char*")
(parameters
'("GFile*" "descendant")
)
)
(define-vfunc resolve_relative_path
(of-object "GFile")
(return-type "GFile*")
(parameters
'("const-char*" "relative_path")
)
)
(define-vfunc is_native
(of-object "GFile")
(return-type "gboolean")
)
(define-vfunc has_uri_scheme
(of-object "GFile")
(return-type "gboolean")
(parameters
'("const-char*" "uri_scheme")
)
)
; GDrive
(define-vfunc get_name
(of-object "GDrive")
(return-type "char*")
)
(define-vfunc has_volumes
(of-object "GDrive")
(return-type "gboolean")
)
(define-vfunc is_automounted
(of-object "GDrive")
(return-type "gboolean")
)
(define-vfunc can_mount
(of-object "GDrive")
(return-type "gboolean")
)
(define-vfunc can_eject
(of-object "GDrive")
(return-type "gboolean")
)
; GIcon
(define-vfunc hash
(of-object "GIcon")
(return-type "guint")
)
; GLoadableIcon
(define-vfunc load
(of-object "GLoadableIcon")
(return-type "GInputStream*")
(parameters
'("int" "size")
'("char**" "type")
'("GCancellable*" "cancellable")
'("GError**" "error")
)
)
(define-vfunc load_async
(of-object "GLoadableIcon")
(return-type "void")
(parameters
'("int" "size")
'("GCancellable*" "cancellable")
'("GAsyncReadyCallback" "callback")
'("gpointer" "user_data")
)
)
(define-vfunc load_finish
(of-object "GLoadableIcon")
(return-type "GInputStream*")
(parameters
'("GAsyncResult*" "res")
'("char**" "type")
'("GError**" "error")
)
)
; GAppInfo
(define-vfunc dup
(of-object "GAppInfo")
(return-type "GAppInfo*")
)
(define-vfunc equal
(of-object "GAppInfo")
(return-type "gboolean")
(parameters
'("GAppInfo*" "appinfo2")
)
)
(define-vfunc get_id
(of-object "GAppInfo")
(return-type "const-char*")
)
(define-vfunc get_name
(of-object "GAppInfo")
(return-type "const-char*")
)
(define-vfunc get_description
(of-object "GAppInfo")
(return-type "const-char*")
)
(define-vfunc get_executable
(of-object "GAppInfo")
(return-type "const-char*")
)
(define-vfunc get_icon
(of-object "GAppInfo")
(return-type "GIcon*")
)
(define-vfunc launch
(of-object "GAppInfo")
(return-type "gboolean")
(parameters
'("GList*" "filenames")
'("GAppLaunchContext*" "launch_context")
'("GError**" "error")
)
)
(define-vfunc supports_uris
(of-object "GAppInfo")
(return-type "gboolean")
)
(define-vfunc supports_files
(of-object "GAppInfo")
(return-type "gboolean")
)
(define-vfunc launch_uris
(of-object "GAppInfo")
(return-type "gboolean")
(parameters
'("GList*" "uris")
'("GAppLaunchContext*" "launch_context")
'("GError**" "error")
)
)
(define-vfunc should_show
(of-object "GAppInfo")
(return-type "gboolean")
)
(define-vfunc set_as_default_for_type
(of-object "GAppInfo")
(return-type "gboolean")
(parameters
'("const-char*" "content_type")
'("GError**" "error")
)
)
(define-vfunc set_as_default_for_extension
(of-object "GAppInfo")
(return-type "gboolean")
(parameters
'("const-char*" "extension")
'("GError**" "error")
)
)
(define-vfunc add_supports_type
(of-object "GAppInfo")
(return-type "gboolean")
(parameters
'("const-char*" "content_type")
'("GError**" "error")
)
)
(define-vfunc can_remove_supports_type
(of-object "GAppInfo")
(return-type "gboolean")
)
(define-vfunc remove_supports_type
(of-object "GAppInfo")
(return-type "gboolean")
(parameters
'("const-char*" "content_type")
'("GError**" "error")
)
)
; GBufferedInputStream
(define-vfunc fill
(of-object "GBufferedInputStream")
(return-type "gssize")
(parameters
'("gssize" "count")
'("GCancellable*" "cancellable")
'("GError**" "error")
)
)
(define-vfunc fill_async
(of-object "GBufferedInputStream")
(return-type "void")
(parameters
'("gssize" "count")
'("int" "io_priority")
'("GCancellable*" "cancellable")
'("GAsyncReadyCallback" "callback")
'("gpointer" "user_data")
)
)
(define-vfunc fill_finish
(of-object "GBufferedInputStream")
(return-type "gssize")
(parameters
'("GAsyncResult*" "result")
'("GError**" "error")
)
)
; GVolume
(define-vfunc get_name
(of-object "GVolume")
(return-type "char*")
)
(define-vfunc get_icon
(of-object "GVolume")
(return-type "GIcon*")
)
(define-vfunc get_uuid
(of-object "GVolume")
(return-type "char*")
)
(define-vfunc get_drive
(of-object "GVolume")
(return-type "GDrive*")
)
(define-vfunc get_mount
(of-object "GVolume")
(return-type "GMount*")
)
(define-vfunc can_mount
(of-object "GVolume")
(return-type "gboolean")
)
(define-vfunc can_eject
(of-object "GVolume")
(return-type "gboolean")
)
(define-vfunc mount_fn
(of-object "GVolume")
(return-type "void")
(parameters
'("GMountMountFlags" "flags")
'("GMountOperation*" "mount_operation")
'("GCancellable*" "cancellable")
'("GAsyncReadyCallback" "callback")
'("gpointer" "user_data")
)
)
(define-vfunc mount_finish
(of-object "GVolume")
(return-type "gboolean")
(parameters
'("GAsyncResult*" "result")
'("GError**" "error")
)
)
(define-vfunc eject
(of-object "GVolume")
(return-type "void")
(parameters
'("GMountUnmountFlags" "flags")
'("GCancellable*" "cancellable")
'("GAsyncReadyCallback" "callback")
'("gpointer" "user_data")
)
)
(define-vfunc eject_finish
(of-object "GVolume")
(return-type "gboolean")
(parameters
'("GAsyncResult*" "result")
'("GError**" "error")
)
)
(define-vfunc get_identifier
(of-object "GVolume")
(return-type "char*")
(parameters
'("const-char*" "kind")
)
)
(define-vfunc enumerate_identifiers
(of-object "GVolume")
(return-type "char**")
)
(define-vfunc should_automount
(of-object "GVolume")
(return-type "gboolean")
)
; GVolumeMonitor
; This doesn't even take a GVolumeMonitor.
; Maybe it is not a real vfunc. murrayc.
(define-vfunc is_supported
(of-object "GVolumeMonitor")
(return-type "gboolean")
)
(define-vfunc get_connected_drives
(of-object "GVolumeMonitor")
(return-type "GList*")
)
(define-vfunc get_connected_drives
(of-object "GVolumeMonitor")
(return-type "GList*")
)
(define-vfunc get_volumes
(of-object "GVolumeMonitor")
(return-type "GList*")
)
(define-vfunc get_mounts
(of-object "GVolumeMonitor")
(return-type "GList*")
)
(define-vfunc get_volume_for_uuid
(of-object "GVolumeMonitor")
(return-type "GVolume*")
(parameters
'("const-char*" "uuid")
)
)
(define-vfunc get_mount_for_uuid
(of-object "GVolumeMonitor")
(return-type "GMount*")
(parameters
'("const-char*" "uuid")
)
)
; This doesn't take a GVolumeMonitor.
; Maybe it is not a real vfunc. murrayc
(define-vfunc adopt_orphan_mount
(of-object "GVolumeMonitor")
(return-type "GVolume*")
(parameters
'("GMount*" "mount")
)
)

View file

@ -0,0 +1,32 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
namespace Gio {
bool
Icon::equal(const Glib::RefPtr<Icon>& other) const
{
return static_cast<bool>(
g_icon_equal(const_cast<GIcon*>(this->gobj()),
const_cast<GIcon*>(other->gobj())));
}
} // namespace Gio

View file

@ -0,0 +1,62 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/interface.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GIconIface GIconIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gio
{
/** This is a very minimal interface for icons. It provides functions for checking the equality of two icons and hashing of icons.
* Glib::Icon does not provide the actual pixmap for the icon as this is out of GIO's scope. However implementations of Icon may contain the name of an
* icon (see ThemedIcon), or the path to an icon (see LoadableIcon).
*
* To obtain a hash of an Icon instance, see hash().
*
* To check if two Icon instances are equal, see equal().
*
* @newin2p16
*/
class Icon : public Glib::Interface
{
_CLASS_INTERFACE(Icon, GIcon, G_ICON, GIconIface)
public:
_WRAP_METHOD(guint hash() const, g_icon_hash)
_IGNORE(g_icon_equal)
// TODO: should this, and File's equal(), be virtual, in order to
// be available to derived classes?
bool equal(const Glib::RefPtr<Icon>& other) const;
//_WRAP_VFUNC(guint hash() const, "hash")
// TODO: also kind of related to equal() being virtual or not,
// do we need to have equal_vfunc()? Or rather, why would we want
// to have it generally...
};
} // namespace Gio

View file

@ -0,0 +1,202 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include <giomm/asyncresult.h>
#include "slot_async.h"
namespace Gio
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize InputStream::read(void* buffer, gsize count)
#else
gssize InputStream::read(void* buffer, gsize count, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gssize retvalue = g_input_stream_read(gobj(), buffer, count, NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool InputStream::read_all(void* buffer, gsize count, gsize& bytes_read)
#else
bool InputStream::read_all(void* buffer, gsize count, gsize& bytes_read, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
bool retvalue = g_input_stream_read_all(gobj(), buffer, count, &(bytes_read), NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize InputStream::skip(gsize count)
#else
gssize InputStream::skip(gsize count, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gssize retvalue = g_input_stream_skip(gobj(), count, NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool InputStream::close()
#else
bool InputStream::close(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
bool retvalue = g_input_stream_close(gobj(), NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
void
InputStream::read_async(void* buffer, gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_input_stream_read_async(gobj(),
buffer,
count,
io_priority,
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void
InputStream::read_async(void* buffer, gsize count, const SlotAsyncReady& slot, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_input_stream_read_async(gobj(),
buffer,
count,
io_priority,
NULL,
&SignalProxy_async_callback,
slot_copy);
}
void
InputStream::skip_async(gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_input_stream_skip_async(gobj(),
count,
io_priority,
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void
InputStream::skip_async(gsize count, const SlotAsyncReady& slot, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_input_stream_skip_async(gobj(),
count,
io_priority,
NULL,
&SignalProxy_async_callback,
slot_copy);
}
void
InputStream::close_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_input_stream_close_async(gobj(),
io_priority,
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void
InputStream::close_async(const SlotAsyncReady& slot, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_input_stream_close_async(gobj(),
io_priority,
NULL,
&SignalProxy_async_callback,
slot_copy);
}
} // namespace Gio

View file

@ -0,0 +1,336 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <giomm/asyncresult.h>
#include <giomm/cancellable.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
namespace Gio
{
//TODO: Implement operator << and >> for streams?
/** Base class for implementing streaming input.
*
* @ingroup Streams
*
* @newin2p16
*/
class InputStream : public Glib::Object
{
_CLASS_GOBJECT(InputStream, GInputStream, G_INPUT_STREAM, Glib::Object, GObject)
public:
_WRAP_METHOD(gssize read(void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable),
g_input_stream_read,
errthrow)
/** Tries to read @a count bytes from the stream into the buffer starting at
* @a buffer. Will block during this read.
*
* If count is zero returns zero and does nothing. A value of @a count
* larger than MAXSSIZE will cause a Gio::Error with INVALID_ARGUMENT to be thrown.
*
* On success, the number of bytes read into the buffer is returned.
* It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file. Zero is returned on end of file
* (or if @a count is zero), but never otherwise.
*
* On error -1 is returned.
* @param buffer A buffer to read data into (which should be at least count bytes long).
* @param count The number of bytes that will be read from the stream.
* @return Number of bytes read, or -1 on error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize read(void* buffer, gsize count);
#else
gssize read(void* buffer, gsize count, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
//TODO: for glibmm 2.17/18, we should decide whether to provide a read()
// function as below, which would presumably read until EOL, or one with
// an additional size parameter, at the same time taking into account
// what operators >> and << (for OutputStream) will do.
//TODO: gssize read(std::string& buffer, const Glib::RefPtr<Cancellable>& cancellable);
//TODO: gssize read(std::string& buffer);
_WRAP_METHOD(bool read_all(void* buffer, gsize count, gsize& bytes_read, const Glib::RefPtr<Cancellable>& cancellable),
g_input_stream_read_all,
errthrow)
/** Tries to read @a count bytes from the stream into the buffer starting at
* @a buffer. Will block during this read.
*
* This function is similar to read(), except it tries to
* read as many bytes as requested, only stopping on an error or end of stream.
*
* On a successful read of @a count bytes, or if we reached the end of the
* stream, <tt>true</tt> is returned, and @a bytes_read is set to the number of bytes
* read into @a buffer .
*
* If there is an error during the operation <tt>false</tt> is returned and a Gio::Error
* is thrown to indicate the error status, @a bytes_read is updated to contain
* the number of bytes read into @a buffer before the error occured.
* @param buffer A buffer to read data into (which should be at least count bytes long).
* @param count The number of bytes that will be read from the stream.
* @param bytes_read Location to store the number of bytes that was read from the stream.
* @return <tt>true</tt> on success, <tt>false</tt> if there was an error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool read_all(void* buffer, gsize count, gsize& bytes_read);
#else
bool read_all(void* buffer, gsize count, gsize& bytes_read, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
//TODO: bool read_all(std::string& buffer, gsize count, gsize& bytes_read, const Glib::RefPtr<Cancellable>& cancellable);
//TODO: bool read_all(std::string& buffer, gsize count, gsize& bytes_read)
_WRAP_METHOD(gssize skip(gsize count, const Glib::RefPtr<Cancellable>& cancellable),
g_input_stream_skip,
errthrow)
/** Tries to skip @a count bytes from the stream. Will block during the operation.
*
* This is identical to read(), from a behaviour standpoint,
* but the bytes that are skipped are not returned to the user. Some
* streams have an implementation that is more efficient than reading the data.
*
* This function is optional for inherited classes, as the default implementation
* emulates it using read.
*
* @param count The number of bytes that will be skipped from the stream.
* @return Number of bytes skipped, or -1 on error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize skip(gsize count);
#else
gssize skip(gsize count, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable),
g_input_stream_close,
errthrow)
/** Closes the stream, releasing resources related to it.
*
* Once the stream is closed, all other operations will throw a Gio::Error with CLOSED.
* Closing a stream multiple times will not return an error.
*
* Streams will be automatically closed when the last reference
* is dropped, but you might want to call this make sure resources
* are released as early as possible.
*
* Some streams might keep the backing store of the stream (e.g. a file descriptor)
* open after the stream is closed. See the documentation for the individual
* stream for details.
*
* On failure the first error that happened will be reported, but the close
* operation will finish as much as possible. A stream that failed to
* close will still throw a Gio::Error with CLOSED for all operations. Still, it
* is important to check and report the error to the user.
*
* @return <tt>true</tt> on success, <tt>false</tt> on failure.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool close();
#else
bool close(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Request an asynchronous read of @a count bytes from the stream into the buffer
* starting at @a buffer. When the operation is finished @a slot will be called.
* You can then call read_finish() to get the result of the
* operation.
*
* During an async request no other sync and async calls are allowed, and will
* result in Gio::Error with PENDING being thrown.
*
* A value of @a count larger than MAXSSIZE will cause a Gio::Error with INVALID_ARGUMENT to be thrown.
*
* On success, the number of bytes read into the buffer will be passed to the
* @a slot callback. It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file, but generally we try to read
* as many bytes as requested. Zero is returned on end of file
* (or if @a count is zero), but never otherwise.
*
* Any outstanding i/o request with higher priority (lower numerical value) will
* be executed before an outstanding request with lower priority. Default
* priority is PRIORITY_DEFAULT.
*
* The asyncronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
*
* @param buffer A buffer to read data into (which should be at least count bytes long).
* @param count The number of bytes that will be read from the stream.
* @param slot Callback to call when the request is satisfied.
* @param cancellable A Cancellable object.
* @param io_priority The I/O priority of the request.
*/
void read_async(void* buffer, gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
/** Request an asynchronous read of @a count bytes from the stream into the buffer
* starting at @a buffer. When the operation is finished @a slot will be called.
* You can then call read_finish() to get the result of the
* operation.
*
* During an async request no other sync and async calls are allowed, and will
* result in a Gio::Error with PENDING being thrown.
*
* A value of @a count larger than MAXSSIZE will cause a Gio::Error with INVALID_ARGUMENT to be thrown.
*
* On success, the number of bytes read into the buffer will be passed to the
* @a slot callback. It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file, but generally we try to read
* as many bytes as requested. Zero is returned on end of file
* (or if @a count is zero), but never otherwise.
*
* Any outstanding i/o request with higher priority (lower numerical value) will
* be executed before an outstanding request with lower priority. Default
* priority is PRIORITY_DEFAULT.
*
* The asyncronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
*
* @param buffer A buffer to read data into (which should be at least count bytes long).
* @param count The number of bytes that will be read from the stream.
* @param slot Callback to call when the request is satisfied.
* @param io_priority The I/O priority of the request.
*/
void read_async(void* buffer, gsize count, const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT);
_IGNORE(g_input_stream_read_async)
_WRAP_METHOD(gssize read_finish(const Glib::RefPtr<AsyncResult>& result),
g_input_stream_read_finish,
errthrow)
//TODO: Use std::size_type instead of gsize?
/** Request an asynchronous skip of @a count bytes from the stream into the buffer
* starting at @a buffer. When the operation is finished @a slot will be called.
* You can then call skip_finish() to get the result of the operation.
*
* During an async request no other sync and async calls are allowed, and will
* result in Gio::Error with PENDING being thrown.
*
* A value of @a count larger than MAXSSIZE will cause a Gio::Error with INVALID_ARGUMENT to be thrown.
*
* On success, the number of bytes skipped will be passed to the
* callback. It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file, but generally we try to skip
* as many bytes as requested. Zero is returned on end of file
* (or if @a count is zero), but never otherwise.
*
* Any outstanding i/o request with higher priority (lower numerical value) will
* be executed before an outstanding request with lower priority. Default
* priority is PRIORITY_DEFAULT.
*
* The asyncronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
*
* @param count The number of bytes that will be skipped from the stream.
* @param slot Callback to call when the request is satisfied.
* @param cancellable A Cancellable object.
* @param io_priority The I/O priority of the request.
*/
void skip_async(gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
/** Request an asynchronous skip of @a count bytes from the stream into the buffer
* starting at @a buffer. When the operation is finished @a slot will be called.
* You can then call skip_finish() to get the result of the operation.
*
* During an async request no other sync and async calls are allowed, and will
* result in Gio::Error with PENDING being thrown.
*
* A value of @a count larger than MAXSSIZE will cause a Gio::Error with INVALID_ARGUMENT to be thrown.
*
* On success, the number of bytes skipped will be passed to the
* callback. It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file, but generally we try to skip
* as many bytes as requested. Zero is returned on end of file
* (or if @a count is zero), but never otherwise.
*
* Any outstanding i/o request with higher priority (lower numerical value) will
* be executed before an outstanding request with lower priority. Default
* priority is PRIORITY_DEFAULT.
*
* The asyncronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
*
* @param count The number of bytes that will be skipped from the stream.
* @param slot Callback to call when the request is satisfied.
* @param io_priority The I/O priority of the request.
*/
void skip_async(gsize count, const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT);
_IGNORE(g_input_stream_skip_async)
_WRAP_METHOD(gssize skip_finish(const Glib::RefPtr<AsyncResult>& result),
g_input_stream_skip_finish,
errthrow)
/** Requests an asynchronous closes of the stream, releasing resources related to it.
* When the operation is finished @a slot will be called.
* You can then call close_finish() to get the result of the
* operation.
*
* For behaviour details see close().
*
* The asyncronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
*
* @param slot Callback to call when the request is satisfied.
* @param cancellable A Cancellable object.
* @param io_priority The I/O priority of the request.
*/
void close_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
/** Requests an asynchronous closes of the stream, releasing resources related to it.
* When the operation is finished @a slot will be called.
* You can then call close_finish() to get the result of the
* operation.
*
* For behaviour details see close().
*
* The asyncronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
*
* @param slot Callback to call when the request is satisfied.
* @param io_priority The I/O priority of the request.
*/
void close_async(const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT);
_IGNORE(g_input_stream_close_async)
_WRAP_METHOD(gboolean close_finish(const Glib::RefPtr<AsyncResult>& result),
g_input_stream_close_finish,
errthrow)
// These are private inside the module (for implementations)
_IGNORE(g_input_stream_has_pending, g_input_stream_is_closed, g_input_stream_set_pending, g_input_stream_clear_pending)
};
} // namespace Gio

View file

@ -0,0 +1,120 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include <giomm/private/icon_p.h>
#include "slot_async.h"
namespace Gio
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<InputStream>
LoadableIcon::load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable)
#else
Glib::RefPtr<InputStream>
LoadableIcon::load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
char* c_type;
GError* gerror = 0;
Glib::RefPtr<InputStream> retval =
Glib::wrap(g_loadable_icon_load(gobj(),
size,
&c_type,
cancellable->gobj(),
&gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
type = c_type;
g_free(c_type);
if(retval)
retval->reference(); //The function does not do a ref for us.
return retval;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<InputStream>
LoadableIcon::load(int size, Glib::ustring& type)
#else
Glib::RefPtr<InputStream>
LoadableIcon::load(int size, Glib::ustring& type, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
char* c_type;
GError* gerror = 0;
Glib::RefPtr<InputStream> retval =
Glib::wrap(g_loadable_icon_load(gobj(),
size,
&c_type,
NULL,
&gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
type = c_type;
g_free(c_type);
if(retval)
retval->reference(); //The function does not do a ref for us.
return retval;
}
void
LoadableIcon::load_async(int size, const SlotAsyncReady& slot, const
Glib::RefPtr<Cancellable>& cancellable)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_loadable_icon_load_async(gobj(),
size,
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void
LoadableIcon::load_async(int size, const SlotAsyncReady& slot)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_loadable_icon_load_async(gobj(),
size,
NULL,
&SignalProxy_async_callback,
slot_copy);
}
} // namespace Gio

View file

@ -0,0 +1,88 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The giomm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/icon.h>
#include <giomm/inputstream.h>
#include <giomm/icon.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/icon_p.h)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GLoadableIconIface GLoadableIconIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gio
{
/** Extends the Icon interface and adds the ability to load icons from streams.
*
* @newin2p16
*/
class LoadableIcon : public Icon
{
_CLASS_INTERFACE(LoadableIcon, GLoadableIcon, G_LOADABLE_ICON, GLoadableIconIface, Icon, GIcon)
public:
/**
* Loads a loadable icon. For the asynchronous version of this function,
* see load_async().
*
* @param size an integer.
* @param type a location to store the type of the loaded icon
* @param cancellable a Cancellable object
*
* @return a InputStream to read the icon from.
**/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<InputStream> load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable);
#else
Glib::RefPtr<InputStream> load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Non-cancellable version of load()
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
Glib::RefPtr<InputStream> load(int size, Glib::ustring& type);
#else
Glib::RefPtr<InputStream> load(int size, Glib::ustring& type, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
//TODO: 'type' can be NULL as well, but I don't really want to add 2 more
//overloads -- one cancellable, and one not...
/**
* Loads an icon asynchronously. To finish this function, see load_finish().
* For the synchronous, blocking version of this function, see load().
*
* @param size an integer.
* @param cancellable a Cancellable object
* @param slot a function to call when the request is satisfied
**/
void load_async(int size, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
/** Non-cancellable version of load_async()
*/
void load_async(int size, const SlotAsyncReady& slot);
//_WRAP_METHOD(Glib::RefPtr<InputStream> load_finish(const Glib::RefPtr<AsyncResult>& res, Glib::ustring& type), g_loadable_icon_load_finish, errthrow)
protected:
//_WRAP_VFUNC(Glib::RefPtr<InputStream> load(int size, Glib::ustring& type, const Glib::RefPtr<Cancellable>& cancellable), "load")
};
} // namespace Gio

View file

@ -0,0 +1,36 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
namespace Gio
{
void MemoryInputStream::add_data(const std::string& data)
{
g_memory_input_stream_add_data(gobj(), data.c_str(), data.size(), NULL);
}
void MemoryInputStream::add_data(const void* data, gssize len)
{
g_memory_input_stream_add_data(gobj(), data, len, NULL);
}
} // namespace Gio

View file

@ -0,0 +1,64 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/inputstream.h>
#include <giomm/seekable.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/inputstream_p.h)
namespace Gio
{
/** MemoryInputStream implements InputStream for arbitrary memory chunks.
*
* @ingroup Streams
*
* @newin2p16
*/
class MemoryInputStream
: public Gio::InputStream,
public Seekable
{
_CLASS_GOBJECT(MemoryInputStream, GMemoryInputStream, G_MEMORY_INPUT_STREAM, Gio::InputStream, GInputStream)
_IMPLEMENTS_INTERFACE(Seekable)
protected:
_CTOR_DEFAULT
// TODO: *_new_from_data constructor needs to be fixed?
public:
_WRAP_CREATE()
/** Appends to data that can be read from the input stream.
*
* @param data Input data.
*/
void add_data(const std::string& data);
/** Appends to data that can be read from the input stream.
*
* @param data Input data.
* @param len Length of the data, may be -1 if data is a null-terminated string.
*/
void add_data(const void* data, gssize len);
};
} // namespace Gio

View file

@ -0,0 +1,193 @@
// -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/drive.h>
#include <giomm/volume.h>
#include <gio/gio.h>
#include "slot_async.h"
namespace Gio
{
void Mount::unmount(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_mount_unmount(gobj(),
GMountUnmountFlags(flags),
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void Mount::unmount(const SlotAsyncReady& slot, MountUnmountFlags flags)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_mount_unmount(gobj(),
GMountUnmountFlags(flags),
NULL,
&SignalProxy_async_callback,
slot_copy);
}
void Mount::unmount(MountUnmountFlags flags)
{
g_mount_unmount(gobj(),
GMountUnmountFlags(flags),
NULL,
NULL,
NULL);
}
void Mount::remount(const Glib::RefPtr<MountOperation>& operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_mount_remount(gobj(),
static_cast<GMountMountFlags>(flags),
operation->gobj(),
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void Mount::remount(const Glib::RefPtr<MountOperation>& operation, const SlotAsyncReady& slot, MountMountFlags flags)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_mount_remount(gobj(),
static_cast<GMountMountFlags>(flags),
operation->gobj(),
NULL,
&SignalProxy_async_callback,
slot_copy);
}
void Mount::remount(const Glib::RefPtr<MountOperation>& operation, MountMountFlags flags)
{
g_mount_remount(gobj(),
static_cast<GMountMountFlags>(flags),
operation->gobj(),
NULL,
NULL,
NULL);
}
void Mount::remount(MountMountFlags flags)
{
g_mount_remount(gobj(),
static_cast<GMountMountFlags>(flags),
NULL,
NULL,
NULL,
NULL);
}
void Mount::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_mount_eject(gobj(),
GMountUnmountFlags(flags),
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void Mount::eject(const SlotAsyncReady& slot, MountUnmountFlags flags)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_mount_eject(gobj(),
GMountUnmountFlags(flags),
NULL,
&SignalProxy_async_callback,
slot_copy);
}
void Mount::eject(MountUnmountFlags flags)
{
g_mount_eject(gobj(),
GMountUnmountFlags(flags),
NULL,
NULL,
NULL);
}
void Mount::guess_content_type(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_mount_guess_content_type(gobj(),
force_rescan,
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void Mount::guess_content_type(const SlotAsyncReady& slot, bool force_rescan)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_mount_guess_content_type(gobj(),
force_rescan,
NULL,
&SignalProxy_async_callback,
slot_copy);
}
void Mount::guess_content_type(bool force_rescan)
{
g_mount_guess_content_type(gobj(),
force_rescan,
NULL,
NULL,
NULL);
}
} // namespace Gio

View file

@ -0,0 +1,276 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//#include <giomm/drive.h>
#include <giomm/file.h>
#include <giomm/volume.h>
#include <glibmm/interface.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GMountIface GMountIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gio
{
class Drive;
//class Volume;
/** The Mount interface represents user-visible mounts.
* Mount is a "mounted" filesystem that you can access. Mounted is in quotes because it's not the same as a unix mount:
* it might be a gvfs mount, but you can still access the files on it if you use GIO. It might or might not be related to a volume object.
*
* Unmounting a Mount instance is an asynchronous operation. For more information about asynchronous operations, see AsyncReady.
* To unmount a Mount instance, first call unmount(). The callback slot will be called when the operation has resolved (either with success or failure),
* and a AsyncReady structure will be passed to the callback. That callback should then call unmount_finish() with the AsyncReady data to see if the operation was completed successfully.
*
* @ingroup Streams
*
* @newin2p16
*/
class Mount : public Glib::Interface
{
_CLASS_INTERFACE(Mount, GMount, G_MOUNT, GMountIface)
public:
_WRAP_METHOD(Glib::RefPtr<File> get_root(), g_mount_get_root, refreturn)
_WRAP_METHOD(Glib::RefPtr<const File> get_root() const, g_mount_get_root, refreturn, constversion)
_WRAP_METHOD(std::string get_name() const, g_mount_get_name)
_WRAP_METHOD(Glib::RefPtr<Icon> get_icon(), g_mount_get_icon, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Icon> get_icon() const, g_mount_get_icon, refreturn, constversion)
_WRAP_METHOD(std::string get_uuid() const, g_mount_get_uuid)
_WRAP_METHOD(Glib::RefPtr<Volume> get_volume(), g_mount_get_volume, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Volume> get_volume() const, g_mount_get_volume, refreturn, constversion)
_WRAP_METHOD(Glib::RefPtr<Drive> get_drive(), g_mount_get_drive, refreturn)
_WRAP_METHOD(Glib::RefPtr<const Drive> get_drive() const, g_mount_get_drive, refreturn, constversion)
_WRAP_METHOD(bool can_unmount() const, g_mount_can_unmount)
_WRAP_METHOD(bool can_eject() const, g_mount_can_eject)
/** Unmounts a mount.
* This is an asynchronous operation, and is finished by calling unmount_finish() with the AsyncResult data returned in the callback slot.
*
* @param slot A callback which will be called when the operation is completed or canceled.
* @param cancellable A cancellable object which can be used to cancel the operation.
* @param flags Flags affecting the unmount.
*/
void unmount(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
/** Unmounts a mount.
* This is an asynchronous operation, and is finished by calling unmount_finish() with the AsyncResult data returned in the callback slot.
*
* @param slot A callback which will be called when the operation is completed or canceled.
* @param flags Flags affecting the unmount.
*/
void unmount(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
/** Unmounts a mount.
*
* @param cancellable A cancellable object which can be used to cancel the operation.
*/
void unmount(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
_IGNORE(g_mount_unmount)
_WRAP_METHOD(bool unmount_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_unmount_finish, errthrow)
/** Remounts a mount.
* This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot.
*
* Remounting is useful when some setting affecting the operation of the volume has been changed, as this may need a remount
* to take affect. While this is semantically equivalent with unmounting and then remounting, not all backends might need to
* actually be unmounted.
*
* @param operation A mount operation.
* @param slot A callback which will be called when the operation is completed or canceled.
* @param cancellable A cancellable object which can be used to cancel the operation.
*/
void remount(const Glib::RefPtr<MountOperation>& operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags = MOUNT_MOUNT_NONE);
/** Remounts a mount.
* This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot.
*
* Remounting is useful when some setting affecting the operation of the volume has been changed, as this may need a remount
* to take affect. While this is semantically equivalent with unmounting and then remounting, not all backends might need to
* actually be unmounted.
*
* @param operation A mount operation.
* @param slot A callback which will be called when the operation is completed or canceled.
*/
void remount(const Glib::RefPtr<MountOperation>& operation, const SlotAsyncReady& slot, MountMountFlags flags = MOUNT_MOUNT_NONE);
/** Remounts a mount.
*
* Remounting is useful when some setting affecting the operation of the volume has been changed, as this may need a remount
* to take affect. While this is semantically equivalent with unmounting and then remounting, not all backends might need to
* actually be unmounted.
*
* @param operation A mount operation.
*/
void remount(const Glib::RefPtr<MountOperation>& operation, MountMountFlags flags = MOUNT_MOUNT_NONE);
/** Remounts a mount, without user interaction.
*
* Remounting is useful when some setting affecting the operation of the volume has been changed, as this may need a remount
* to take affect. While this is semantically equivalent with unmounting and then remounting, not all backends might need to
* actually be unmounted.
*/
void remount(MountMountFlags flags = MOUNT_MOUNT_NONE);
_IGNORE(g_mount_remount)
_WRAP_METHOD(bool remount_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_remount_finish, errthrow)
/** Ejects a mount.
* This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
*
* @param slot A callback which will be called when the operation is completed or canceled.
* @param cancellable A cancellable object which can be used to cancel the operation.
* @param flags Flags affecting the unmount if required for eject.
*/
void eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
/** Ejects a mount.
* This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
*
* @param slot A callback which will be called when the operation is completed or canceled.
* @param flags Flags affecting the unmount if required for eject.
*/
void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
/** Ejects a mount.
*
* @param flags Flags affecting the unmount if required for eject.
*/
void eject(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
_IGNORE(g_mount_eject)
_WRAP_METHOD(bool eject_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_eject_finish, errthrow)
/** Tries to guess the type of content stored on the mount.
* Returns one or more textual identifiers of well-known content types (typically
* prefixed with "x-content/"), e.g. x-content/image-dcf for camera
* memory cards. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink> specification for more on x-content types.
*
* This is an asynchronous operation, and is finished by calling
* guess_content_type_finish().
*
* @param slot A callback which will be called when the operation is completed or canceled.
* @param cancellable A cancellable object which can be used to cancel the operation.
* @param force_rescan Whether to force a rescan of the content. Otherwise a cached result will be used if available.
*
* @newin2p18
*/
void guess_content_type(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, bool force_rescan = true);
/** Tries to guess the type of content stored on the mount.
* Returns one or more textual identifiers of well-known content types (typically
* prefixed with "x-content/"), e.g. x-content/image-dcf for camera
* memory cards. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink> specification for more on x-content types.
*
* This is an asynchronous operation, and is finished by calling
* guess_content_type_finish().
*
* @param slot A callback which will be called when the operation is completed or canceled.
* @param force_rescan Whether to force a rescan of the content. Otherwise a cached result will be used if available.
*
* @newin2p18
*/
void guess_content_type(const SlotAsyncReady& slot, bool force_rescan = true);
/** Tries to guess the type of content stored on the mount.
* Returns one or more textual identifiers of well-known content types (typically
* prefixed with "x-content/"), e.g. x-content/image-dcf for camera
* memory cards. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink> specification for more on x-content types.
*
* @param force_rescan Whether to force a rescan of the content. Otherwise a cached result will be used if available.
*
* @newin2p18
*/
void guess_content_type(bool force_rescan = true);
_IGNORE(g_mount_guess_content_type)
#m4 _CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)')
//TODO: Correct the documentation:
_WRAP_METHOD(Glib::StringArrayHandle guess_content_type_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_guess_content_type_finish, errthrow)
_WRAP_SIGNAL(void changed(), changed)
_WRAP_SIGNAL(void unmounted(), unmounted)
//There are no properties.
};
} // namespace Gio
namespace Glib
{
//Pre-declare this so we can use it in TypeTrait:
Glib::RefPtr<Gio::Mount> wrap(GMount* object, bool take_copy);
namespace Container_Helpers
{
/** This specialization of TypeTraits exists
* because the default use of Glib::wrap(GObject*),
* instead of a specific Glib::wrap(GSomeInterface*),
* would not return a wrapper for an interface.
*/
template <>
struct TypeTraits< Glib::RefPtr<Gio::Mount> >
{
typedef Glib::RefPtr<Gio::Mount> CppType;
typedef GMount* CType;
typedef GMount* CTypeNonConst;
static CType to_c_type (const CppType& item)
{ return Glib::unwrap (item); }
static CppType to_cpp_type (const CType& item)
{
//Use a specific Glib::wrap() function,
//because CType has the specific type (not just GObject):
return Glib::wrap(item, true /* take_copy */);
}
static void release_c_type (CType item)
{
GLIBMM_DEBUG_UNREFERENCE(0, item);
g_object_unref(item);
}
};
} // Container_Helpers
} // Glib

View file

@ -0,0 +1,20 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>

View file

@ -0,0 +1,99 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
_PINCLUDE(gio/gio.h)
namespace Gio
{
_WRAP_ENUM(AskPasswordFlags, GAskPasswordFlags, NO_GTYPE)
_WRAP_ENUM(PasswordSave, GPasswordSave, NO_GTYPE)
_WRAP_ENUM(MountOperationResult, GMountOperationResult, NO_GTYPE)
/** Authentication methods for mountable locations.
*
* MountOperation provides a mechanism for authenticating mountable operations, such as loop mounting files, hard drive partitions or server locations.
*
* Mounting operations are handed a MountOperation that they can use if they require any privileges or authentication for their volumes to be mounted (e.g.
* a hard disk partition or an encrypted filesystem), or if they are implementing a remote server protocol which requires user credentials such as FTP or
* WebDAV.
*
* Developers should instantiate a subclass of this that implements all the various callbacks to show the required dialogs.
*
* @newin2p16
*/
class MountOperation : public Glib::Object
{
_CLASS_GOBJECT(MountOperation, GMountOperation, G_MOUNT_OPERATION, Glib::Object, GObject)
protected:
_CTOR_DEFAULT
public:
_WRAP_CREATE()
_WRAP_METHOD(Glib::ustring get_username() const,
g_mount_operation_get_username)
_WRAP_METHOD(void set_username(const Glib::ustring& username),
g_mount_operation_set_username)
_WRAP_METHOD(Glib::ustring get_password() const,
g_mount_operation_get_password)
_WRAP_METHOD(void set_password(const Glib::ustring& password),
g_mount_operation_set_password)
_WRAP_METHOD(bool get_anonymous() const,
g_mount_operation_get_anonymous)
_WRAP_METHOD(void set_anonymous(bool anonymous = true),
g_mount_operation_set_anonymous)
_WRAP_METHOD(Glib::ustring get_domain() const,
g_mount_operation_get_domain)
_WRAP_METHOD(void set_domain(const Glib::ustring& domain),
g_mount_operation_set_domain)
_WRAP_METHOD(PasswordSave get_password_save() const,
g_mount_operation_get_password_save)
_WRAP_METHOD(void set_password_save(PasswordSave password_save),
g_mount_operation_set_password_save)
_WRAP_METHOD(int get_choice() const, g_mount_operation_get_choice)
_WRAP_METHOD(void set_choice(int choice), g_mount_operation_set_choice)
_WRAP_METHOD(void reply(MountOperationResult result), g_mount_operation_reply)
#m4 _CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING)
_WRAP_SIGNAL(void ask_password(const Glib::ustring& message, const Glib::ustring& default_user, const Glib::ustring& default_domain, AskPasswordFlags flags), ask_password)
//TODO: We really need some test to make sure that our use of StringArrayHandle is correct. murrayc.
#m4 _CONVERSION(`const Glib::StringArrayHandle&',`const gchar**',`const_cast<const gchar**>(($3).data())')
#m4 _CONVERSION(`const gchar**',`const Glib::StringArrayHandle&',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)')
_WRAP_SIGNAL(void ask_question(const Glib::ustring& message, const Glib::StringArrayHandle& choices), ask_question)
_WRAP_SIGNAL(void reply(MountOperationResult result), reply)
_WRAP_PROPERTY("username", Glib::ustring)
_WRAP_PROPERTY("password", Glib::ustring)
_WRAP_PROPERTY("anonymous", bool)
_WRAP_PROPERTY("domain", Glib::ustring)
_WRAP_PROPERTY("password-save", PasswordSave)
_WRAP_PROPERTY("choice", int)
};
} // namespace Gio

View file

@ -0,0 +1,346 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include <glibmm/error.h>
#include <glibmm/exceptionhandler.h>
#include "slot_async.h"
namespace Gio {
void
OutputStream::write_async(const void* buffer, gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_output_stream_write_async(gobj(),
buffer,
count,
io_priority,
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void
OutputStream::write_async(const void* buffer, gsize count, const SlotAsyncReady& slot, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_output_stream_write_async(gobj(),
buffer,
count,
io_priority,
0,
&SignalProxy_async_callback,
slot_copy);
}
void
OutputStream::splice_async(const Glib::RefPtr<InputStream>& source, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, OutputStreamSpliceFlags flags, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_output_stream_splice_async(gobj(),
source->gobj(),
static_cast<GOutputStreamSpliceFlags>(flags),
io_priority,
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void
OutputStream::splice_async(const Glib::RefPtr<InputStream>& source, const SlotAsyncReady& slot, OutputStreamSpliceFlags flags, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_output_stream_splice_async(gobj(),
source->gobj(),
static_cast<GOutputStreamSpliceFlags>(flags),
io_priority,
0,
&SignalProxy_async_callback,
slot_copy);
}
void
OutputStream::flush_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_output_stream_flush_async(gobj(),
io_priority,
Glib::unwrap(cancellable),
&SignalProxy_async_callback,
slot_copy);
}
void
OutputStream::flush_async(const SlotAsyncReady& slot, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_output_stream_flush_async(gobj(),
io_priority,
0,
&SignalProxy_async_callback,
slot_copy);
}
void
OutputStream::close_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_output_stream_close_async(gobj(),
io_priority,
Glib::unwrap(cancellable),
&SignalProxy_async_callback,
slot_copy);
}
void
OutputStream::close_async(const SlotAsyncReady& slot, int io_priority)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_output_stream_close_async(gobj(),
io_priority,
0,
&SignalProxy_async_callback,
slot_copy);
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize OutputStream::write(const void* buffer, gsize count)
#else
gssize OutputStream::write(const void* buffer, gsize count, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gssize retvalue = g_output_stream_write(gobj(), buffer, count, 0, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize OutputStream::write(const std::string& buffer, const Glib::RefPtr<Cancellable>& cancellable)
#else
gssize OutputStream::write(const std::string& buffer, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gssize retvalue = g_output_stream_write(gobj(), buffer.data(), buffer.size(), Glib::unwrap(cancellable), &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize OutputStream::write(const std::string& buffer)
#else
gssize OutputStream::write(const std::string& buffer, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gssize retvalue = g_output_stream_write(gobj(), buffer.data(), buffer.size(), 0, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool OutputStream::write_all(const void* buffer, gsize count, gsize& bytes_written)
#else
bool OutputStream::write_all(const void* buffer, gsize count, gsize& bytes_written, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
bool retvalue = g_output_stream_write_all(gobj(), buffer, count, &(bytes_written), 0, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool OutputStream::write_all(const std::string& buffer, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable)
#else
bool OutputStream::write_all(const std::string& buffer, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
bool retvalue = g_output_stream_write_all(gobj(), buffer.data(), buffer.size(), &(bytes_written), Glib::unwrap(cancellable), &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool OutputStream::write_all(const std::string& buffer, gsize& bytes_written)
#else
bool OutputStream::write_all(const std::string& buffer, gsize& bytes_written, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
bool retvalue = g_output_stream_write_all(gobj(), buffer.data(), buffer.size(), &(bytes_written), 0, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize OutputStream::splice(const Glib::RefPtr<InputStream>& source, const Glib::RefPtr<Cancellable>& cancellable, OutputStreamSpliceFlags flags)
#else
gssize OutputStream::splice(const Glib::RefPtr<InputStream>& source, const Glib::RefPtr<Cancellable>& cancellable, OutputStreamSpliceFlags flags, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gssize retvalue = g_output_stream_splice(gobj(), Glib::unwrap(source), ((GOutputStreamSpliceFlags)(flags)), Glib::unwrap(cancellable), &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize OutputStream::splice(const Glib::RefPtr<InputStream>& source, OutputStreamSpliceFlags flags)
#else
gssize OutputStream::splice(const Glib::RefPtr<InputStream>& source, OutputStreamSpliceFlags flags, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
gssize retvalue = g_output_stream_splice(gobj(), Glib::unwrap(source), ((GOutputStreamSpliceFlags)(flags)), 0, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool OutputStream::flush()
#else
bool OutputStream::flush(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
bool retvalue = g_output_stream_flush(gobj(), 0, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool OutputStream::close()
#else
bool OutputStream::close(std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
bool retvalue = g_output_stream_close(gobj(), 0, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
} // namespace Gio

View file

@ -0,0 +1,455 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <giomm/asyncresult.h>
#include <giomm/cancellable.h>
#include <giomm/inputstream.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
namespace Gio
{
_WRAP_ENUM(OutputStreamSpliceFlags, GOutputStreamSpliceFlags, NO_GTYPE)
/** Base class for implementing streaming output.
*
* @ingroup Streams
*
* @newin2p16
*/
class OutputStream : public Glib::Object
{
_CLASS_GOBJECT(OutputStream, GOutputStream, G_OUTPUT_STREAM, Glib::Object, GObject)
public:
_WRAP_METHOD(gssize write(const void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable),
g_output_stream_write,
errthrow)
/** Tries to write @a count bytes from @a buffer into the stream. Will block
* during the operation.
*
* If count is zero returns zero and does nothing. A value of @a count
* larger than MAXSSIZE will cause a Gio::Error with INVALID_ARGUMENT to be thrown.
*
* On success, the number of bytes written to the stream is returned.
* It is not an error if this is not the same as the requested size, as it
* can happen e.g. on a partial i/o error, or if the there is not enough
* storage in the stream. All writes either block until at least one byte
* is written, so zero is never returned (unless @a count is zero).
*
* On error -1 is returned.
* @param buffer The buffer containing the data to write.
* @param count The number of bytes to write.
* @return Number of bytes written, or -1 on error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize write(const void* buffer, gsize count);
#else
gssize write(const void* buffer, gsize count, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Tries to write @a count bytes from @a buffer into the stream. Will block
* during the operation.
*
* If count is zero returns zero and does nothing. A value of @a count
* larger than MAXSSIZE will cause a Gio::Error with INVALID_ARGUMENT to be thrown.
*
* On success, the number of bytes written to the stream is returned.
* It is not an error if this is not the same as the requested size, as it
* can happen e.g. on a partial i/o error, or if the there is not enough
* storage in the stream. All writes either block until at least one byte
* is written, so zero is never returned (unless @a count is zero).
*
* On error -1 is returned.
* @param buffer The buffer containing the data to write.
* @param cancellable Cancellable object.
* @return Number of bytes written, or -1 on error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize write(const std::string& buffer, const Glib::RefPtr<Cancellable>& cancellable);
#else
gssize write(const std::string& buffer, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Tries to write @a count bytes from @a buffer into the stream. Will block
* during the operation.
*
* If string that is larger than MAXSSIZE bytes will cause a Gio::Error with INVALID_ARGUMENT to be thrown.
*
* On success, the number of bytes written to the stream is returned.
* It is not an error if this is not the same as the requested size, as it
* can happen e.g. on a partial i/o error, or if the there is not enough
* storage in the stream. All writes either block until at least one byte
* is written, so zero is never returned (unless @a count is zero).
*
* On error -1 is returned.
* @param buffer The buffer containing the data to write.
* @return Number of bytes written, or -1 on error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize write(const std::string& buffer);
#else
gssize write(const std::string& buffer, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool write_all(const void* buffer, gsize count, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable),
g_output_stream_write_all,
errthrow)
/** Tries to write @a count bytes from @a buffer into the stream. Will block
* during the operation.
*
* This function is similar to write(), except it tries to
* write as many bytes as requested, only stopping on an error.
*
* On a successful write of @a count bytes, <tt>true</tt> is returned, and @a bytes_written
* is set to @a count .
*
* If there is an error during the operation <tt>false</tt> is returned and @a error
* is set to indicate the error status, @a bytes_written is updated to contain
* the number of bytes written into the stream before the error occured.
* @param buffer The buffer containing the data to write.
* @param count The number of bytes to write.
* @param bytes_written Location to store the number of bytes that was
* written to the stream.
* @return <tt>true</tt> on success, <tt>false</tt> if there was an error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool write_all(const void* buffer, gsize count, gsize& bytes_written);
#else
bool write_all(const void* buffer, gsize count, gsize& bytes_written, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Tries to write @a count bytes from @a buffer into the stream. Will block
* during the operation.
*
* This function is similar to write(), except it tries to
* write as many bytes as requested, only stopping on an error.
*
* On a successful write of @a count bytes, <tt>true</tt> is returned, and @a bytes_written
* is set to @a count .
*
* If there is an error during the operation <tt>false</tt> is returned and @a error
* is set to indicate the error status, @a bytes_written is updated to contain
* the number of bytes written into the stream before the error occured.
* @param buffer The buffer containing the data to write.
* @param bytes_written Location to store the number of bytes that was
* written to the stream.
* @param cancellable Cancellable object.
* @return <tt>true</tt> on success, <tt>false</tt> if there was an error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool write_all(const std::string& buffer, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable);
#else
bool write_all(const std::string& buffer, gsize& bytes_written, const Glib::RefPtr<Cancellable>& cancellable, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Tries to write @a count bytes from @a buffer into the stream. Will block
* during the operation.
*
* This function is similar to write(), except it tries to
* write as many bytes as requested, only stopping on an error.
*
* On a successful write of @a count bytes, <tt>true</tt> is returned, and @a bytes_written
* is set to @a count .
*
* If there is an error during the operation <tt>false</tt> is returned and @a error
* is set to indicate the error status, @a bytes_written is updated to contain
* the number of bytes written into the stream before the error occured.
* @param buffer The buffer containing the data to write.
* @param bytes_written Location to store the number of bytes that was
* written to the stream.
* @return <tt>true</tt> on success, <tt>false</tt> if there was an error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool write_all(const std::string& buffer, gsize& bytes_written);
#else
bool write_all(const std::string& buffer, gsize& bytes_written, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Splices an input stream into an output stream.
*
* @param source An InputStream.
* @param flags A set of OutputStreamSpliceFlags.
* @param cancellable A Cancellable object.
* ignore.
* @return A #gssize containing the size of the data spliced.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize splice(const Glib::RefPtr<InputStream>& source, const Glib::RefPtr<Cancellable>& cancellable, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE);
#else
gssize splice(const Glib::RefPtr<InputStream>& source, const Glib::RefPtr<Cancellable>& cancellable, OutputStreamSpliceFlags flags, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Splices an input stream into an output stream.
*
* @param source An InputStream.
* @param flags A set of OutputStreamSpliceFlags.
* ignore.
* @return A #gssize containing the size of the data spliced.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
gssize splice(const Glib::RefPtr<InputStream>& source, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE);
#else
gssize splice(const Glib::RefPtr<InputStream>& source, OutputStreamSpliceFlags flags, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_IGNORE(g_output_stream_splice)
_WRAP_METHOD(bool flush(const Glib::RefPtr<Cancellable>& cancellable),
g_output_stream_flush,
errthrow)
/** Flushed any outstanding buffers in the stream. Will block during
* the operation. Closing the stream will implicitly cause a flush.
*
* This function is optional for inherited classes.
*
* The operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, a Gio::Error with CANCELLED will be thrown.
* @param cancellable Optional cancellable object.
* @return <tt>true</tt> on success, <tt>false</tt> on error.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool flush();
#else
bool flush(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable),
g_output_stream_close,
errthrow)
/** Closes the stream, releasing resources related to it.
*
* Once the stream is closed, all other operations will throw a Gio::Error with CLOSED.
* Closing a stream multiple times will not return an error.
*
* Closing a stream will automatically flush any outstanding buffers in the
* stream.
*
* Streams will be automatically closed when the last reference
* is dropped, but you might want to call make sure resources
* are released as early as possible.
*
* Some streams might keep the backing store of the stream (e.g. a file descriptor)
* open after the stream is closed. See the documentation for the individual
* stream for details.
*
* On failure the first error that happened will be reported, but the close
* operation will finish as much as possible. A stream that failed to
* close will still throw a Gio::Error with CLOSED for all operations. Still, it
* is important to check and report the error to the user, otherwise
* there might be a loss of data as all data might not be written.
*
* The operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, a Gio::Error with CANCELLED will be thrown.
* Cancelling a close will still leave the stream closed, but there some streams
* can use a faster close that doesn't block to e.g. check errors. On
* cancellation (as with any error) there is no guarantee that all written
* data will reach the target.
* @param cancellable Optional cancellable object.
* @return <tt>true</tt> on success, <tt>false</tt> on failure.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool close();
#else
bool close(std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Request an asynchronous write of @a count bytes from @a buffer into
* the stream. When the operation is finished @a slot will be called.
* You can then call write_finish() to get the result of the
* operation.
*
* During an async request no other sync and async calls are allowed,
* and will result in Gio::Error with PENDING being thrown.
*
* A value of @a count larger than MAXSSIZE will cause a Gio::Error with
* NVALID_ARGUMENT to be thrown.
*
* On success, the number of bytes written will be passed to the
* callback @a slot. It is not an error if this is not the same as the
* requested size, as it can happen e.g. on a partial I/O error,
* but generally we try to write as many bytes as requested.
*
* Any outstanding I/O request with higher priority (lower numerical
* value) will be executed before an outstanding request with lower
* priority. Default priority is Glib::PRIORITY_DEFAULT.
*
* The asyncronous methods have a default fallback that uses threads
* to implement asynchronicity, so they are optional for inheriting
* classes. However, if you override one you must override all.
*
* For the synchronous, blocking version of this function, see
* write().
*
* @param buffer The buffer containing the data to write.
* @param count The number of bytes to write
* @param slot Callback slot to call when the request is satisfied.
* @param cancellable Cancellable object.
* @param io_priority The io priority of the request.
*/
void write_async(const void* buffer, gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
/** Request an asynchronous write of @a count bytes from @a buffer into
* the stream. When the operation is finished @a slot will be called.
* You can then call write_finish() to get the result of the
* operation.
*
* During an async request no other sync and async calls are allowed,
* and will result in Gio::Error with PENDING being thrown.
*
* A value of @a count larger than MAXSSIZE will cause a Gio::Error with
* INVALID_ARGUMENT to be thrown.
*
* On success, the number of bytes written will be passed to the
* callback @a slot. It is not an error if this is not the same as the
* requested size, as it can happen e.g. on a partial I/O error,
* but generally we try to write as many bytes as requested.
*
* Any outstanding I/O request with higher priority (lower numerical
* value) will be executed before an outstanding request with lower
* priority. Default priority is Glib::PRIORITY_DEFAULT.
*
* The asyncronous methods have a default fallback that uses threads
* to implement asynchronicity, so they are optional for inheriting
* classes. However, if you override one you must override all.
*
* For the synchronous, blocking version of this function, see
* write().
*
* @param buffer The buffer containing the data to write.
* @param count The number of bytes to write
* @param slot Callback slot to call when the request is satisfied.
* @param io_priority The io priority of the request.
*/
void write_async(const void* buffer, gsize count, const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT);
_IGNORE(g_output_stream_write_async)
_WRAP_METHOD(gssize write_finish(const Glib::RefPtr<AsyncResult>& result),
g_output_stream_write_finish,
errthrow)
/** Splices a stream asynchronously.
* When the operation is finished @a slot will be called.
* You can then call splice_finish() to get the result of the
* operation.
*
* For the synchronous, blocking version of this function, see
* splice().
*
* @param source An InputStream.
* @param slot Callback slot to call when the request is satisfied.
* @param cancellable Cancellable object.
* @param io_priority The io priority of the request.
*/
void splice_async(const Glib::RefPtr<InputStream>& source, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE, int io_priority = Glib::PRIORITY_DEFAULT);
/** Splices a stream asynchronously.
* When the operation is finished @a slot will be called.
* You can then call splice_finish() to get the result of the
* operation.
*
* For the synchronous, blocking version of this function, see
* splice().
*
* @param source An InputStream.
* @param slot Callback slot to call when the request is satisfied.
* @param io_priority The io priority of the request.
*/
void splice_async(const Glib::RefPtr<InputStream>& source, const SlotAsyncReady& slot, OutputStreamSpliceFlags flags = OUTPUT_STREAM_SPLICE_NONE, int io_priority = Glib::PRIORITY_DEFAULT);
_IGNORE(g_output_stream_splice_async)
_WRAP_METHOD(gssize splice_finish(const Glib::RefPtr<AsyncResult>& result),
g_output_stream_splice_finish,
errthrow)
/** Flushes a stream asynchronously.
* When the operation is finished the @a slot will be called, giving the results.
* You can then call flush_finish() to get the result of the operation.
* For behaviour details see flush().
*
* @param slot Callback slot to call when the request is satisfied.
* @param cancellable Cancellable object.
* @param io_priority The io priority of the request.
*/
void flush_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
/** Flushes a stream asynchronously.
* When the operation is finished the @a slot will be called, giving the results.
* You can then call flush_finish() to get the result of the operation.
* For behaviour details see flush().
*
* @param slot Callback slot to call when the request is satisfied.
* @param io_priority The io priority of the request.
*/
void flush_async(const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT);
_IGNORE(g_output_stream_flush_async)
_WRAP_METHOD(bool flush_finish(const Glib::RefPtr<AsyncResult>& result),
g_output_stream_flush_finish,
errthrow)
/** Requests an asynchronous close of the stream, releasing resources related to it.
* When the operation is finished the @a slot will be called, giving the results.
* You can then call close_finish() to get the result of the operation.
* For behaviour details see close().
*
* The asyncronous methods have a default fallback that uses threads to implement asynchronicity,
* so they are optional for inheriting classes. However, if you override one you must override all.
*
* @param slot Callback slot to call when the request is satisfied.
* @param cancellable Cancellable object.
* @param io_priority The io priority of the request.
*/
void close_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
/** Requests an asynchronous close of the stream, releasing resources related to it.
* When the operation is finished the @a slot will be called, giving the results.
* You can then call close_finish() to get the result of the operation.
* For behaviour details see close().
*
* The asyncronous methods have a default fallback that uses threads to implement asynchronicity,
* so they are optional for inheriting classes. However, if you override one you must override all.
*
* @param slot Callback slot to call when the request is satisfied.
* @param io_priority The io priority of the request.
*/
void close_async(const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT);
_IGNORE(g_output_stream_close_async)
_WRAP_METHOD(bool close_finish(const Glib::RefPtr<AsyncResult>& result),
g_output_stream_close_finish,
errthrow)
// These are private inside the module (for implementations)
_IGNORE(g_output_stream_has_pending, g_output_stream_is_closed, g_output_stream_set_pending, g_output_stream_clear_pending)
};
} // namespace Gio

View file

@ -0,0 +1,67 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
namespace Gio
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool Seekable::seek(goffset offset, Glib::SeekType type)
#else
bool Seekable::seek(goffset offset, Glib::SeekType type, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
bool retvalue = g_seekable_seek(gobj(), offset, ((GSeekType)(type)), NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool Seekable::truncate(goffset offset)
#else
bool Seekable::truncate(goffset offset, std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
{
GError* gerror = 0;
bool retvalue = g_seekable_truncate(gobj(), offset, NULL, &(gerror));
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
return retvalue;
}
} // namespace Gio

View file

@ -0,0 +1,99 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/cancellable.h>
#include <glibmm/interface.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GSeekableIface GSeekableIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gio
{
/** Stream seeking interface.
* Seekable is implemented by streams (implementations of InputStream or OutputStream) that support seeking.
* To find the position of a stream, use tell(). To find
* out if a stream supports seeking, use can_seek(). To position a
* stream, use seek(). To find out if a stream supports
* truncating, use can_truncate(). To truncate a stream, use
* truncate().
*
* @ingroup Streams
*
* @newin2p16
*/
class Seekable : public Glib::Interface
{
_CLASS_INTERFACE(Seekable, GSeekable, G_SEEKABLE, GSeekableIface)
public:
_WRAP_METHOD(goffset tell() const, g_seekable_tell)
_WRAP_METHOD(bool can_seek() const, g_seekable_can_seek)
_WRAP_METHOD(bool seek(goffset offset, Glib::SeekType type, const Glib::RefPtr<Cancellable>& cancellable), g_seekable_seek, errthrow)
//TODO: Document the exception: http://bugzilla.gnome.org/show_bug.cgi?id=509990
/** Seeks in the stream by the given @a offset, modified by @a type .
*
* @param offset A #goffset.
* @param type A Glib::SeekType.
* @return <tt>true</tt> if successful. If an error
* has occurred, this function will return <tt>false</tt>.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool seek(goffset offset, Glib::SeekType type);
#else
bool seek(goffset offset, Glib::SeekType type, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
_WRAP_METHOD(bool can_truncate() const, g_seekable_can_truncate)
_WRAP_METHOD(bool truncate(goffset offset, const Glib::RefPtr<Cancellable>& cancellable), g_seekable_truncate, errthrow)
//TODO: Document the exception: http://bugzilla.gnome.org/show_bug.cgi?id=509990
/** Truncates a stream with a given #offset.
*
* @param offset A #goffset.
* @return <tt>true</tt> if successful. If an error
* has occured, this function will return <tt>false</tt>.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
bool truncate(goffset offset);
#else
bool truncate(goffset offset, std::auto_ptr<Glib::Error>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
//_WRAP_VFUNC(goffset tell() const, tell)
//_WRAP_VFUNC(goffset can_seek() const, can_seek)
//_WRAP_VFUNC(goffset seek(goffset offset, Glib::SeekType type, const Glib::RefPtr<Cancellable>& cancellable, GError** error), seek)
//_WRAP_VFUNC(goffset can_truncate() const, can_truncate)
//Renamed to truncate() - we don't know why it's called truncate_fn in C.
//_WRAP_VFUNC(goffset truncate(goffset offset, const Glib::RefPtr<Cancellable>& cancellable, GError** error), truncate_fn)
//There are no properties or signals.
};
} // namespace Gio

View file

@ -0,0 +1,31 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
namespace Gio
{
ThemedIcon::ThemedIcon(const std::string& iconname, bool use_default_callbacks)
:
_CONSTRUCT("name", iconname.c_str(), "use-default-fallbacks", gboolean(use_default_callbacks))
{}
} //namespace Gio

View file

@ -0,0 +1,75 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <giomm/file.h>
#include <giomm/icon.h>
#include <giomm/loadableicon.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
namespace Gio
{
/** Icon theming support
* ThemedIcon is an implementation of Gio::Icon that supports icon themes.
* ThemedIcon contains a list of all of the icons present in an icon
* theme, so that icons can be looked up quickly. ThemedIcon does
* not provide actual pixmaps for icons, just the icon names.
* Ideally something like Gtk::IconTheme::choose_icon() should be used to
* resolve the list of names so that fallback icons work nicely with
* themes that inherit other themes.
*
* @newin2p16
*/
class ThemedIcon
: public Glib::Object,
public Icon
{
_CLASS_GOBJECT(ThemedIcon, GThemedIcon, G_THEMED_ICON, Glib::Object, GObject)
_IMPLEMENTS_INTERFACE(Icon)
protected:
//TODO: Documentation:
explicit ThemedIcon(const std::string& iconname, bool use_default_callbacks = false);
_IGNORE(g_themed_icon_new, g_themed_icon_new_with_default_fallbacks)
public:
_WRAP_CREATE(const std::string& iconname, bool use_default_callbacks = false)
//TODO: GIcon *g_themed_icon_new_from_names (char **iconnames, int len);
_WRAP_METHOD(void prepend_name(const std::string& iconname), g_themed_icon_prepend_name)
_WRAP_METHOD(void append_name(const std::string& iconname), g_themed_icon_append_name)
#m4 _CONVERSION(`const char*const*',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)')
//TODO: gmmproc complains about the wrong number of arguments, but I can't see why. murrayc.
//_WRAP_METHOD(Glib::StringArrayHandle get_names() const, g_themed_icon_get_names)
//There are no signals.
//TODO: Remove these when we can break ABI. They are write-only and construct-only.
_WRAP_PROPERTY("name", std::string)
//An array: This is awkward to wrap_WRAP_PROPERTY("names", )
_WRAP_PROPERTY("use-default-fallbacks", bool)
};
} // namespace Gio

View file

@ -0,0 +1,21 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include <gio/gunixinputstream.h>

View file

@ -0,0 +1,50 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/inputstream.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/inputstream_p.h)
namespace Gio
{
/**
* UnixInputStream implements InputStream for reading from a unix file
* descriptor, including asynchronous operations. The file descriptor must be
* selectable, so it doesn't work with opened files.
*
* @ingroup Streams
*
* @newin2p16
*/
class UnixInputStream : public Gio::InputStream
{
_CLASS_GOBJECT(UnixInputStream, GUnixInputStream, G_UNIX_INPUT_STREAM, Gio::InputStream, GInputStream)
_GTKMMPROC_WIN32_NO_WRAP
protected:
_WRAP_CTOR(UnixInputStream(int fd, bool close_fd_at_close), g_unix_input_stream_new)
public:
_WRAP_CREATE(int fd, bool close_fd_at_close)
};
} // namespace Gio

View file

@ -0,0 +1,21 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
#include <gio/gunixoutputstream.h>

View file

@ -0,0 +1,49 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/outputstream.h>
_DEFS(giomm,gio)
_PINCLUDE(giomm/private/outputstream_p.h)
namespace Gio
{
/** UnixOutputStream implements OutputStream for writing to a a unix file
* descriptor, including asynchronous operations. The file descriptor much be
* selectable, so it doesn't work with opened files.
*
* @ingroup Streams
*
* @newin2p16
*/
class UnixOutputStream : public Gio::OutputStream
{
_CLASS_GOBJECT(UnixOutputStream, GUnixOutputStream, G_UNIX_OUTPUT_STREAM, Gio::OutputStream, GOutputStream)
_GTKMMPROC_WIN32_NO_WRAP
protected:
_WRAP_CTOR(UnixOutputStream(int fd, bool close_fd_at_close), g_unix_output_stream_new)
public:
_WRAP_CREATE(int fd, bool close_fd_at_close)
};
} // namespace Gio

View file

@ -0,0 +1,124 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/error.h>
#include <glibmm/exceptionhandler.h>
#include <giomm/file.h>
#include <giomm/drive.h>
#include <gio/gio.h>
#include "slot_async.h"
namespace Gio {
void
Volume::mount(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_volume_mount(gobj(),
static_cast<GMountMountFlags>(flags),
mount_operation->gobj(),
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void
Volume::mount(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, MountMountFlags flags)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_volume_mount(gobj(),
static_cast<GMountMountFlags>(flags),
mount_operation->gobj(),
NULL, // cancellable
&SignalProxy_async_callback,
slot_copy);
}
void
Volume::mount(const Glib::RefPtr<MountOperation>& mount_operation, MountMountFlags flags)
{
g_volume_mount(gobj(),
static_cast<GMountMountFlags>(flags),
mount_operation->gobj(),
NULL, // cancellable
NULL,
NULL);
}
void
Volume::mount(MountMountFlags flags)
{
g_volume_mount(gobj(),
static_cast<GMountMountFlags>(flags),
NULL,
NULL, // cancellable
NULL,
NULL);
}
void Volume::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_volume_eject(gobj(),
static_cast<GMountUnmountFlags>(flags),
cancellable->gobj(),
&SignalProxy_async_callback,
slot_copy);
}
void Volume::eject(const SlotAsyncReady& slot, MountUnmountFlags flags)
{
// Create a copy of the slot.
// A pointer to it will be passed through the callback's data parameter
// and deleted in the callback.
SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
g_volume_eject(gobj(),
static_cast<GMountUnmountFlags>(flags),
NULL,
&SignalProxy_async_callback,
slot_copy);
}
void Volume::eject(MountUnmountFlags flags)
{
g_volume_eject(gobj(),
static_cast<GMountUnmountFlags>(flags),
NULL,
NULL,
NULL);
}
} // namespace Gio

View file

@ -0,0 +1,227 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/file.h>
#include <giomm/mountoperation.h>
//#include <giomm/drive.h>
//#include <giomm/icon.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GVolumeIface GGVolumeIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gio
{
// Making a forward declaration here to avoid circular dependency.
// file.hg already includes volume.h.
class File;
class Drive;
/** The Volume interface represents user-visible objects that can be mounted.
*
* Mounting a Volume instance is an asynchronous operation. For more information about asynchronous operations, see AsyncReady and SimpleAsyncReady. To
* mount a GVolume, first call mount(), optionally providing a MountOperation object and a SlotAsyncReady callback.
*
* Typically, you will not want to provide a MountOperation if automounting all volumes when a desktop session starts since it's not desirable to
* put up a lot of dialogs asking for credentials.
*
* The callback will be fired when the operation has resolved (either with success or failure), and a AsyncReady structure will be passed to the callback.
* That callback should then call g_volume_mount_finish() with the GVolume instance and the GAsyncReady data to see if the operation was completed
* successfully. If an error is present when finish() is called, then it will be filled with any error information.
*
* @newin2p16
*/
class Volume : public Glib::Interface
{
_CLASS_INTERFACE(Volume, GVolume, G_DRIVE, GVolumeIface)
public:
_WRAP_METHOD(std::string get_name() const, g_volume_get_name)
_WRAP_METHOD(std::string get_uuid() const, g_volume_get_uuid)
_WRAP_METHOD(Glib::RefPtr<Icon> get_icon(),
g_volume_get_icon,
refreturn)
_WRAP_METHOD(Glib::RefPtr<const Icon> get_icon() const,
g_volume_get_icon,
refreturn, constversion)
_WRAP_METHOD(Glib::RefPtr<Drive> get_drive(),
g_volume_get_drive,
refreturn)
_WRAP_METHOD(Glib::RefPtr<const Drive> get_drive() const,
g_volume_get_drive,
refreturn, constversion)
_WRAP_METHOD(Glib::RefPtr<Mount> get_mount(),
g_volume_get_mount,
refreturn)
_WRAP_METHOD(Glib::RefPtr<const Mount> get_mount() const,
g_volume_get_mount,
refreturn, constversion)
_WRAP_METHOD(bool can_mount() const, g_volume_can_mount)
_WRAP_METHOD(bool can_eject() const, g_volume_can_eject)
_WRAP_METHOD(bool should_automount() const, g_volume_should_automount)
/** Mounts a volume.
* This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot.
*
* @param slot A callback which will be called when the operation is completed or canceled.
* @param cancellable A cancellable object which can be used to cancel the operation.
* @param mount_operation A mount operation.
*/
void mount(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountMountFlags flags = MOUNT_MOUNT_NONE);
/** Mounts a volume.
* This is an asynchronous operation, and is finished by calling mount_finish() with the AsyncResult data returned in the callback slot.
*
* @param slot A callback which will be called when the operation is completed or canceled.
* @param mount_operation A mount operation.
*/
void mount(const Glib::RefPtr<MountOperation>& mount_operation, const SlotAsyncReady& slot, MountMountFlags flags = MOUNT_MOUNT_NONE);
/** Mounts a volume.
*
* @param mount_operation A mount operation.
*/
void mount(const Glib::RefPtr<MountOperation>& mount_operation, MountMountFlags flags = MOUNT_MOUNT_NONE);
/** Mounts a volume.
*/
void mount(MountMountFlags flags = MOUNT_MOUNT_NONE);
_IGNORE(g_volume_mount)
_WRAP_METHOD(bool mount_finish(const Glib::RefPtr<AsyncResult>& result),
g_volume_mount_finish,
errthrow)
/** Ejects a volume.
* This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
*
* @param slot A callback which will be called when the operation is completed or canceled.
* @param cancellable A cancellable object which can be used to cancel the operation.
* @param flags Flags affecting the unmount if required for eject.
*/
void eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
/** Ejects a volume.
* This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
*
* @param slot A callback which will be called when the operation is completed or canceled.
* @param flags Flags affecting the unmount if required for eject.
*/
void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
/** Ejects a volume.
* This is an asynchronous operation, and is finished by calling eject_finish() with the AsyncResult data returned in the callback slot.
*
* @param flags Flags affecting the unmount if required for eject.
*/
void eject(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
_IGNORE(g_volume_eject)
_WRAP_METHOD(bool eject_finish(const Glib::RefPtr<AsyncResult>& result),
g_volume_eject_finish,
errthrow)
_WRAP_METHOD(std::string get_identifier(const std::string& kind) const,
g_volume_get_identifier)
_WRAP_METHOD(Glib::StringArrayHandle enumerate_identifiers() const,
g_volume_enumerate_identifiers)
_WRAP_METHOD(Glib::RefPtr<File> get_activation_root(), g_volume_get_activation_root)
_WRAP_METHOD(Glib::RefPtr<const File> get_activation_root() const, g_volume_get_activation_root)
_WRAP_SIGNAL(void changed(), changed)
_WRAP_SIGNAL(void removed(), removed)
//_WRAP_VFUNC(std::string get_name(), get_name)
//_WRAP_VFUNC(Glib::RefPtr<Icon> get_icon(), get_icon)
//_WRAP_VFUNC(std::string get_uuid(), get_uuid)
#m4 _CONVERSION(`Glib::RefPtr<Drive>',`GDrive*',__CONVERT_CONST_REFPTR_TO_P)
//_WRAP_VFUNC(Glib::RefPtr<Drive> get_drive(), get_drive)
#m4 _CONVERSION(`Glib::RefPtr<Mount>',`GMount*',__CONVERT_CONST_REFPTR_TO_P)
//_WRAP_VFUNC(Glib::RefPtr<Mount> get_mount(), get_mount)
//_WRAP_VFUNC(bool can_mount(), can_mount)
//_WRAP_VFUNC(bool can_eject(), can_eject)
//_WRAP_VFUNC(void mount_fn(GMountMountFlags flags, GMountOperation* mount_operation, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data), mount_fn) //TODO: Rename to mount()?
//_WRAP_VFUNC(bool mount_finish(GAsyncResult* result, GError** error), mount_finish)
//_WRAP_VFUNC(void eject(GMountUnmountFlags flags, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data), eject)
//_WRAP_VFUNC(bool eject_finish(GAsyncResult* result, GError** error), eject_finish)
//_WRAP_VFUNC(std::string get_identifier(const std::string& kind), get_identifier)
//TODO: Use an ArrayHandle.
//_WRAP_VFUNC(char** enumerate_identifiers(), enumerate_identifiers)
//_WRAP_VFUNC(bool should_automount(), should_automount)
};
} // namespace Gio
namespace Glib
{
//Pre-declare this so we can use it in TypeTrait:
Glib::RefPtr<Gio::Volume> wrap(GVolume* object, bool take_copy);
namespace Container_Helpers
{
/** This specialization of TypeTraits exists
* because the default use of Glib::wrap(GObject*),
* instead of a specific Glib::wrap(GSomeInterface*),
* would not return a wrapper for an interface.
*/
template <>
struct TypeTraits< Glib::RefPtr<Gio::Volume> >
{
typedef Glib::RefPtr<Gio::Volume> CppType;
typedef GVolume* CType;
typedef GVolume* CTypeNonConst;
static CType to_c_type (const CppType& item)
{ return Glib::unwrap (item); }
static CppType to_cpp_type (const CType& item)
{
//Use a specific Glib::wrap() function,
//because CType has the specific type (not just GObject):
return Glib::wrap(item, true /* take_copy */);
}
static void release_c_type (CType item)
{
GLIBMM_DEBUG_UNREFERENCE(0, item);
g_object_unref(item);
}
};
} // Container_Helpers
} // Glib

View file

@ -0,0 +1,25 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gio/gio.h>
namespace Gio {
} // namespace Gio

View file

@ -0,0 +1,96 @@
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* Copyright (C) 2007 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <giomm/drive.h>
#include <giomm/volume.h>
#include <giomm/mount.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
namespace Gio
{
/** Monitors a file or directory for changes.
* VolumeMonitor is for listing the user-interesting devices and volumes on the
* computer. In other words, what a file selector or file manager would show in
* a sidebar.
*
* @newin2p16
*/
class VolumeMonitor : public Glib::Object
{
_CLASS_GOBJECT(VolumeMonitor, GVolumeMonitor, G_VOLUME_MONITOR, Glib::Object, GObject)
protected:
public:
_WRAP_METHOD(static Glib::RefPtr<VolumeMonitor> get(), g_volume_monitor_get)
#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Drive> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
_WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Drive> > get_connected_drives(), g_volume_monitor_get_connected_drives)
#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Volume> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
_WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Volume> > get_volumes(), g_volume_monitor_get_volumes)
#m4 _CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Mount> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
_WRAP_METHOD(Glib::ListHandle< Glib::RefPtr<Mount> > get_mounts(), g_volume_monitor_get_mounts)
_WRAP_METHOD(Glib::RefPtr<Volume> get_volume_for_uuid(const std::string& uuid), g_volume_monitor_get_volume_for_uuid, refreturn)
_WRAP_METHOD(Glib::RefPtr<Mount> get_mount_for_uuid(const std::string& uuid), g_volume_monitor_get_mount_for_uuid, refreturn)
_WRAP_METHOD(static Glib::RefPtr<Volume> adopt_orphan_mount(const Glib::RefPtr<Mount>& mount), g_volume_monitor_adopt_orphan_mount)
#m4 _CONVERSION(`GVolume*',`const Glib::RefPtr<Volume>&',`Glib::wrap($3, true)')
_WRAP_SIGNAL(void volume_added(const Glib::RefPtr<Volume>& volume), volume_added)
_WRAP_SIGNAL(void volume_removed(const Glib::RefPtr<Volume>& volume), volume_removed)
_WRAP_SIGNAL(void volume_changed(const Glib::RefPtr<Volume>& volume), volume_changed)
#m4 _CONVERSION(`GMount*',`const Glib::RefPtr<Mount>&',`Glib::wrap($3, true)')
_WRAP_SIGNAL(void mount_added(const Glib::RefPtr<Mount>& mount), mount_added)
_WRAP_SIGNAL(void mount_removed(const Glib::RefPtr<Mount>& mount), mount_removed)
_WRAP_SIGNAL(void mount_pre_unmount(const Glib::RefPtr<Mount>& mount), mount_pre_unmount)
_WRAP_SIGNAL(void mount_changed(const Glib::RefPtr<Mount>& mount), mount_changed)
#m4 _CONVERSION(`GDrive*',`const Glib::RefPtr<Drive>&',`Glib::wrap($3, true)')
_WRAP_SIGNAL(void drive_connected(const Glib::RefPtr<Drive>& drive), drive_connected)
_WRAP_SIGNAL(void drive_disconnected(const Glib::RefPtr<Drive>& drive), drive_disconnected)
_WRAP_SIGNAL(void drive_changed(const Glib::RefPtr<Drive>& drive), drive_changed)
//TODO: Remove no_default_handler when we can break ABI:
_WRAP_SIGNAL(void drive_eject_button(const Glib::RefPtr<Drive>& drive), drive_eject_button, no_default_handler)
gboolean (*is_supported) (void);
//TODO: Use ListHandle?
//_WRAP_VFUNC(GList* get_volumes(), get_volumes)
//_WRAP_VFUNC(GList* get_mounts(), get_mounts)
#m4 _CONVERSION(`Glib::RefPtr<Volume>',`GVolume*',__CONVERT_CONST_REFPTR_TO_P)
//_WRAP_VFUNC(Glib::RefPtr<Volume> get_volume_for_uuid(const std::string& uuid), get_volume_for_uuid)
#m4 _CONVERSION(`Glib::RefPtr<Mount>',`GMount*',__CONVERT_CONST_REFPTR_TO_P)
//_WRAP_VFUNC(Glib::RefPtr<Mount> get_mount_for_uuid(const std::string& uuid), get_mount_for_uuid)
//There are no properties.
};
} // namespace Gio