summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2008-07-25 14:28:32 +0000
committerMurray Cumming <murrayc@src.gnome.org>2008-07-25 14:28:32 +0000
commit97ad951eb06384660e18a203347a733e82bb69e2 (patch)
tree2d9fc1901112d9d57a6937265877cbd1425df6df
parent7e9168e5f2a788959e2802f44a91d49b85605739 (diff)
downloadglibmm-97ad951eb06384660e18a203347a733e82bb69e2.tar.gz
Added the drive_eject_button signal.
2008-07-25 Murray Cumming <murrayc@murrayc.com> * gio/src/volumemonitor.hg: Added the drive_eject_button signal. 2008-07-25 Murray Cumming <murrayc@murrayc.com> * gio/src/gio_enums.defs: Hacked in a replacement enum for Gio::Error::HOST_NOT_FOUND as Gio::Error::HOST_WAS_NOT_FOUND, to avoid a clash with a netdb.h define. Bug #529496. * configure.in: * tests/Makefile.am: * tests/giomm_ioerror/Makefile.am: * tests/giomm_ioerror/main.cc: Added a test to make sure that our hacked-in enum value stays hacked in. svn path=/trunk/; revision=695
-rw-r--r--ChangeLog17
-rw-r--r--configure.in1
-rw-r--r--gio/src/gio_enums.defs7
-rw-r--r--gio/src/volumemonitor.hg3
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/giomm_ioerror/Makefile.am7
-rw-r--r--tests/giomm_ioerror/main.cc50
7 files changed, 86 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2a976aa1..16cdec1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2008-07-25 Murray Cumming <murrayc@murrayc.com>
+ * gio/src/volumemonitor.hg: Added the drive_eject_button signal.
+
+2008-07-25 Murray Cumming <murrayc@murrayc.com>
+
+ * gio/src/gio_enums.defs: Hacked in a replacement
+ enum for Gio::Error::HOST_NOT_FOUND as
+ Gio::Error::HOST_WAS_NOT_FOUND, to avoid a clash with
+ a netdb.h define.
+ Bug #529496.
+ * configure.in:
+ * tests/Makefile.am:
+ * tests/giomm_ioerror/Makefile.am:
+ * tests/giomm_ioerror/main.cc: Added a test to make sure
+ that our hacked-in enum value stays hacked in.
+
+2008-07-25 Murray Cumming <murrayc@murrayc.com>
+
* gio/src/gio_enums.defs:
* gio/src/gio_methods.defs:
* gio/src/gio_signals.defs: Regenerated.
diff --git a/configure.in b/configure.in
index 7ea9e5cd..b4ddfcff 100644
--- a/configure.in
+++ b/configure.in
@@ -304,6 +304,7 @@ AC_CONFIG_FILES([
tests/glibmm_value/Makefile
tests/glibmm_tree/Makefile
tests/giomm_simple/Makefile
+ tests/giomm_ioerror/Makefile
tests/glibmm_date/Makefile
examples/Makefile
diff --git a/gio/src/gio_enums.defs b/gio/src/gio_enums.defs
index c33a5573..3ca652f6 100644
--- a/gio/src/gio_enums.defs
+++ b/gio/src/gio_enums.defs
@@ -162,6 +162,12 @@
)
)
+; 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")
@@ -195,6 +201,7 @@
'("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")
)
diff --git a/gio/src/volumemonitor.hg b/gio/src/volumemonitor.hg
index f1d099e1..cbc84bf8 100644
--- a/gio/src/volumemonitor.hg
+++ b/gio/src/volumemonitor.hg
@@ -73,6 +73,9 @@ public:
_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?
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4e7e9260..6cf92878 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,4 @@
-test_dirs = glibmm_value glibmm_tree glibmm_date giomm_simple
+test_dirs = glibmm_value glibmm_tree glibmm_date giomm_simple giomm_ioerror
SUBDIRS = $(test_dirs)
EXTRA_DIST = Makefile.am_fragment
diff --git a/tests/giomm_ioerror/Makefile.am b/tests/giomm_ioerror/Makefile.am
new file mode 100644
index 00000000..d0e58bd4
--- /dev/null
+++ b/tests/giomm_ioerror/Makefile.am
@@ -0,0 +1,7 @@
+include $(top_srcdir)/tests/Makefile.am_fragment
+
+noinst_PROGRAMS = test
+test_SOURCES = main.cc
+
+
+
diff --git a/tests/giomm_ioerror/main.cc b/tests/giomm_ioerror/main.cc
new file mode 100644
index 00000000..f1ebf33f
--- /dev/null
+++ b/tests/giomm_ioerror/main.cc
@@ -0,0 +1,50 @@
+#include <giomm.h>
+#include <iostream>
+#include <string.h>
+
+int main(int argc, char** argv)
+{
+ Glib::init();
+ Gio::init();
+
+ try
+ {
+ Glib::RefPtr<Gio::File> file = Gio::File::create_for_path("/home/murrayc/test.txt");
+ if(!file)
+ std::cerr << "Gio::File::create_for_path() returned an empty RefPtr." << std::endl;
+
+ Glib::RefPtr<Gio::FileInputStream> stream = file->read();
+ if(!stream)
+ std::cerr << "Gio::File::read() returned an empty RefPtr." << std::endl;
+
+ gchar buffer[1000]; //TODO: This is unpleasant.
+ memset(buffer, 0, 1000);
+ const gsize bytes_read = stream->read(buffer, 1000);
+
+ if(bytes_read)
+ std::cout << "File contents read: " << buffer << std::endl;
+ else
+ std::cerr << "Gio::InputStream::read() read 0 bytes." << std::endl;
+
+ }
+ catch(const Gio::Error& ex)
+ {
+ //This is just here to check that HOST_WAS_NOT_FOUND is still in our API,
+ //because we hack it into our gio_enums.defs file and there is a risk of
+ //losing it when we regenerate that file. murrayc.
+ if(ex.code() == Gio::Error::HOST_WAS_NOT_FOUND)
+ {
+ std::cerr << "Host was not found." << std::endl;
+ }
+ else
+ std::cerr << "Gio::Error exception caught: " << ex.what() << std::endl;
+ }
+ catch(const Glib::Exception& ex)
+ {
+ std::cerr << "Exception caught: " << ex.what() << std::endl;
+ }
+
+
+ return 0;
+}
+