maemomm TextView doesn't allocate default buffer (not wrapped)



Murray, Johannes,

I installed both hildon-fmmm-dev and hildon-libsmm-dev in my Scratchbox
1.0.7 SDK_X86 and tried to port an application of mine to nokia 800. 

Thanks for the slick manual[1] and reference[2] and .deb packages of
much reduced size. 

1) One typo I ran into Ch.3 'Installation' from Prebuilt Packages is the
command to install both packages: 

$ fakeroot apt-get install libhildon-libsmm-dev libhildon-fmmm-dev

should rather be

$ fakeroot apt-get install hildon-libsmm-dev hildon-fmmm-dev

2) The other thing so far is the Gtk::TextView - it looks like something
is wrong with the TextView not getting allocated the default TextBuffer.
The attached examples illustrate the problem. If executed in the
scratchbox, they would produce the following results:

[sbox-SDK_X86] > textview-bad

textview-bad[11900]: GLIB WARNING ** glibmm - failed to wrap type of
'GtkTextBuffer'
Segmentation fault (core dumped)


[sbox-SDK_X86] > textview-good

works as expected.

Any chance of fixing this? Both packages are at the version 0.9.1-0

thanks for all the work,
--Vlad

[1] <http://maemomm.garage.maemo.org/docs/tutorial/html/index.html>
[2] <http://maemomm.garage.maemo.org/docs/index.html>
## -*- makefile -*-
##
## GNUmakefile.Foo: generated by assa-genesis
##

APP_CFLAGS=`pkg-config hildon-libsmm hildon-fmmm --cflags`
APP_LIBS=`pkg-config hildon-libsmm hildon-fmmm --libs`

GOOD_OBJS = textview-good.o
BAD_OBJS = textview-bad.o

all: textview-good textview-bad 

textview-good: ${GOOD_OBJS}
	g++ -g ${APP_CFLAGS} ${GOOD_OBJS} -o textview-good ${APP_LIBS}

textview-bad: ${BAD_OBJS}
	g++ -g ${APP_CFLAGS} ${BAD_OBJS} -o textview-bad ${APP_LIBS}

.cc.o:
	g++ -g ${APP_CFLAGS} -c $<

clean:	
	-rm -f *.o *~ core core.*

distclean: clean
	-rm textview-good textview-bad


## Dependencies

textview-good.o: textview-good.cc
textview-bad.o: textview-bad.cc

//$Id: examplewindow.h 705 2006-07-19 02:55:32Z 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 <gtkmm/main.h>
#include <gtkmm.h>
#include <hildon-libsmm.h>
#include <iostream>

class ExampleWindow : public Hildon::Window
{
public:
  ExampleWindow();

protected:

  void fill_buffers();
  
  //Signal handlers:
  virtual void on_button_quit() { hide (); }

  //Child widgets:
  Gtk::VBox m_VBox;

  Gtk::ScrolledWindow m_ScrolledWindow;
  Gtk::TextView* m_TextView;
  
  Glib::RefPtr<Gtk::TextBuffer> m_refTextBuffer;

  Gtk::HButtonBox m_ButtonBox;
  Gtk::Button m_Button_Quit;
};


ExampleWindow::ExampleWindow()
:
  m_Button_Quit(Gtk::Stock::QUIT)
{
  set_title("Gtk::TextView example");
  set_border_width(5);
  set_default_size(400, 200);

  m_TextView = Gtk::manage (new Gtk::TextView());

  add(m_VBox);

  //Add the TreeView, inside a ScrolledWindow, with the button underneath:
  m_ScrolledWindow.add(*m_TextView);

  //Only show the scrollbars when they are necessary:
  m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);

  m_VBox.pack_start(m_ScrolledWindow);

  //Add buttons: 
  m_VBox.pack_start(m_ButtonBox, Gtk::PACK_SHRINK);

  m_ButtonBox.pack_start(m_Button_Quit, Gtk::PACK_SHRINK);
  m_ButtonBox.set_border_width(5);
  m_ButtonBox.set_spacing(5);
  m_ButtonBox.set_layout(Gtk::BUTTONBOX_END);
  
  //Connect signals:
  m_Button_Quit.signal_clicked().connect( 
		  	sigc::mem_fun(*this, &ExampleWindow::on_button_quit) );
  fill_buffers();
  show_all_children();
}

void ExampleWindow::fill_buffers()
{
//  m_refTextBuffer = Gtk::TextBuffer::create();
  m_refTextBuffer = m_TextView->get_buffer ();

  m_refTextBuffer->set_text("This is the text from TextBuffer #1.");

}

int main(int argc, char *argv[])
{
  Gtk::Main kit(argc, argv);
  Hildon::libs_init();

  osso_context_t* osso_context;
  osso_context = osso_initialize ("example", "0.0.1", TRUE, NULL);
  if (!osso_context) {
	  std::cerr << "osso_initialize() failed" << std::endl;
  }

  ExampleWindow window;
  Hildon::Program::get_instance ()->add_window (window);

  kit.run (window);

  osso_deinitialize (osso_context);

  return 0;
}
//$Id: examplewindow.h 705 2006-07-19 02:55:32Z jjongsma $ -*- c++ -*-

/* gtkmm example Copyright (C) 2002 gtkmm development team
 */

#include <gtkmm/main.h>
#include <gtkmm.h>
#include <hildon-libsmm.h>
#include <iostream>

class ExampleWindow : public Hildon::Window
{
public:
  ExampleWindow();

private:
  void fill_buffers();
  
  //Signal handlers:
  virtual void on_button_quit() { hide (); }

private: 
  //Child widgets:
  Gtk::VBox m_VBox;
  Gtk::ScrolledWindow m_ScrolledWindow;
  Gtk::HButtonBox m_ButtonBox;
  Gtk::Button m_Button_Quit;

  Gtk::TextView* m_TextView;
  
  Glib::RefPtr<Gtk::TextBuffer> m_refTextBuffer;
};


ExampleWindow::ExampleWindow()
:
  m_Button_Quit(Gtk::Stock::QUIT)
{
  set_title("Gtk::TextView example");
  set_border_width(5);
  set_default_size(400, 200);

  m_TextView = Gtk::manage (new Gtk::TextView());

  add(m_VBox);

  //Add the TreeView, inside a ScrolledWindow, with the button underneath:
  m_ScrolledWindow.add(*m_TextView);

  //Only show the scrollbars when they are necessary:
  m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);

  m_VBox.pack_start(m_ScrolledWindow);

  //Add buttons: 
  m_VBox.pack_start(m_ButtonBox, Gtk::PACK_SHRINK);

  m_ButtonBox.pack_start(m_Button_Quit, Gtk::PACK_SHRINK);
  m_ButtonBox.set_border_width(5);
  m_ButtonBox.set_spacing(5);
  m_ButtonBox.set_layout(Gtk::BUTTONBOX_END);
  
  //Connect signals:
  m_Button_Quit.signal_clicked().connect( 
		  	sigc::mem_fun(*this, &ExampleWindow::on_button_quit) );
  fill_buffers();
  show_all_children();
}

void ExampleWindow::fill_buffers()
{
  m_refTextBuffer = Gtk::TextBuffer::create();
  m_refTextBuffer->set_text("This is the text from TextBuffer #1.");

  m_TextView->set_buffer (m_refTextBuffer);
}

int main(int argc, char *argv[])
{
  Gtk::Main kit(argc, argv);
  Hildon::libs_init();

  osso_context_t* osso_context;
  osso_context = osso_initialize ("example", "0.0.1", TRUE, NULL);
  if (!osso_context) {
	  std::cerr << "osso_initialize() failed" << std::endl;
  }

  ExampleWindow window;
  Hildon::Program::get_instance ()->add_window (window);

  kit.run (window);

  osso_deinitialize (osso_context);

  return 0;
}


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