gtkmm-documentation r28 - in trunk: . examples/book examples/book/comboboxentry/text examples/book/giomm examples/book/giomm/directory_list examples/book/giomm/read_file



Author: murrayc
Date: Wed Jan 23 15:30:42 2008
New Revision: 28
URL: http://svn.gnome.org/viewvc/gtkmm-documentation?rev=28&view=rev

Log:
2008-01-23  Murray Cumming  <murrayc murrayc com>

* configure.in:
* examples/book/Makefile.am:
* examples/book/comboboxentry/text/examplewindow.cc:
* examples/book/giomm/Makefile.am:
* examples/book/giomm/directory_list/Makefile.am:
* examples/book/giomm/directory_list/main.cc:
* examples/book/giomm/read_file/Makefile.am:
* examples/book/giomm/read_file/main.cc: Added two simple giomm 
examples. Let's add some more here.

Added:
   trunk/examples/book/giomm/
   trunk/examples/book/giomm/Makefile.am
   trunk/examples/book/giomm/directory_list/
   trunk/examples/book/giomm/directory_list/Makefile.am
   trunk/examples/book/giomm/directory_list/main.cc
      - copied, changed from r27, /trunk/examples/book/recent_files/main.cc
   trunk/examples/book/giomm/read_file/
   trunk/examples/book/giomm/read_file/Makefile.am
   trunk/examples/book/giomm/read_file/main.cc
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/examples/book/Makefile.am
   trunk/examples/book/comboboxentry/text/examplewindow.cc

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Wed Jan 23 15:30:42 2008
@@ -194,7 +194,7 @@
 #########################################################################
 #  Dependancy checks
 #########################################################################
-PKG_CHECK_MODULES(GTKMMDOCS, gtkmm-2.4 >= 2.10.0 libglademm-2.4 >= 2.6.0})
+PKG_CHECK_MODULES(GTKMMDOCS, gtkmm-2.4 >= 2.10.0 giomm-2.4 >= 2.15.2 libglademm-2.4 >= 2.6.0})
 AC_SUBST(GTKMMDOCS_CFLAGS)
 AC_SUBST(GTKMMDOCS_LIBS)
 
@@ -306,6 +306,9 @@
           examples/book/entry/simple/Makefile
         examples/book/eventbox/Makefile
         examples/book/expander/Makefile
+        examples/book/giomm/Makefile
+          examples/book/giomm/directory_list/Makefile
+          examples/book/giomm/read_file/Makefile
         examples/book/frame/Makefile
         examples/book/helloworld/Makefile
         examples/book/helloworld2/Makefile

Modified: trunk/examples/book/Makefile.am
==============================================================================
--- trunk/examples/book/Makefile.am	(original)
+++ trunk/examples/book/Makefile.am	Wed Jan 23 15:30:42 2008
@@ -4,7 +4,7 @@
 		  entry eventbox expander frame helloworld helloworld2 \
 		  iconview idle input label menus menus_and_toolbars notebook paned printing progressbar \
 		  range_widgets recent_files scrolledwindow signals socket spinbutton statusicon \
-		  table textview timeout toolbar tooltips treeview update_ui libglademm
+		  table textview timeout toolbar tooltips treeview update_ui libglademm giomm
 
 #deprecated: combo
 

Modified: trunk/examples/book/comboboxentry/text/examplewindow.cc
==============================================================================
--- trunk/examples/book/comboboxentry/text/examplewindow.cc	(original)
+++ trunk/examples/book/comboboxentry/text/examplewindow.cc	Wed Jan 23 15:30:42 2008
@@ -35,6 +35,7 @@
   m_Combo.signal_changed().connect(sigc::mem_fun(*this,
               &ExampleWindow::on_combo_changed) );
 
+  m_Combo.property_has_frame() = false;
   show_all_children();
 }
 

Added: trunk/examples/book/giomm/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/examples/book/giomm/Makefile.am	Wed Jan 23 15:30:42 2008
@@ -0,0 +1 @@
+SUBDIRS = directory_list read_file

Added: trunk/examples/book/giomm/directory_list/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/examples/book/giomm/directory_list/Makefile.am	Wed Jan 23 15:30:42 2008
@@ -0,0 +1,6 @@
+include $(top_srcdir)/examples/Makefile.am_fragment
+
+#Build the executable, but don't install it.
+noinst_PROGRAMS = example
+example_SOURCES = main.cc
+

Copied: trunk/examples/book/giomm/directory_list/main.cc (from r27, /trunk/examples/book/recent_files/main.cc)
==============================================================================
--- /trunk/examples/book/recent_files/main.cc	(original)
+++ trunk/examples/book/giomm/directory_list/main.cc	Wed Jan 23 15:30:42 2008
@@ -16,16 +16,38 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
-#include <gtkmm/main.h>
-#include "examplewindow.h"
+#include <giomm.h>
+#include <iostream>
 
-int main(int argc, char *argv[])
+
+int main(int argc, char** argv)
 {
-  Gtk::Main kit(argc, argv);
+  Gio::init();
+
+  try
+  {
+    Glib::RefPtr<Gio::File> directory = Gio::File::create_for_path("/home/murrayc/");
+    if(!directory)
+      std::cerr << "Gio::File::create_for_path() returned an empty RefPtr." << std::endl;
+
+    Glib::RefPtr<Gio::FileEnumerator> enumerator = directory->enumerate_children();
+    if(!enumerator)
+      std::cerr << "Gio::File::enumerate_children() returned an empty RefPtr." << std::endl;
+
+    Glib::RefPtr<Gio::FileInfo> file_info = enumerator->next_file();
+    while(file_info)
+    {
+      std::cout << "file: " << file_info->get_name() << std::endl;
+      file_info = enumerator->next_file();
+    }
+
+  }
+  catch(const Glib::Exception& ex)
+  {
+    std::cerr << "Exception caught: " << ex.what() << std::endl; 
+  }
 
-  ExampleWindow window;
-  //Shows the window and returns when it is closed.
-  Gtk::Main::run(window);
 
   return 0;
 }
+

Added: trunk/examples/book/giomm/read_file/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/examples/book/giomm/read_file/Makefile.am	Wed Jan 23 15:30:42 2008
@@ -0,0 +1,6 @@
+include $(top_srcdir)/examples/Makefile.am_fragment
+
+#Build the executable, but don't install it.
+noinst_PROGRAMS = example
+example_SOURCES = main.cc
+

Added: trunk/examples/book/giomm/read_file/main.cc
==============================================================================
--- (empty file)
+++ trunk/examples/book/giomm/read_file/main.cc	Wed Jan 23 15:30:42 2008
@@ -0,0 +1,55 @@
+//$Id: main.cc 836 2007-05-09 03:02:38Z jjongsma $ -*- c++ -*-
+
+/* gtkmm example Copyright (C) 2002 gtkmm development team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <giomm.h>
+#include <iostream>
+
+
+int main(int argc, char** argv)
+{
+  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 Glib::Exception& ex)
+  {
+    std::cerr << "Exception caught: " << ex.what() << std::endl; 
+  }
+
+
+  return 0;
+}
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]