Re: Abiword & Gnome (was: Re: What is GNOME office?)



On 20 Nov 2000, Havoc Pennington wrote:

> 
> Chema Celorio <chema celorio com> writes:  
> > [1* they consider libglade a gnome-only library, since it
> > ships with GNOME but not with gtk. And thus, not want
> > to be a dependency for their *nix version]
> > 
> 
> This is a bit silly. libglade also ships by itself, it doesn't require
> GNOME I don't think. And unlike some parts of GNOME, libglade would be
> trivial to port to any platforms GTK runs on.
> 

It's funny how things turn out. One of the reasons I  started
developing for AbiWord was that I wanted to get enough stature to tell
them what they were doing wrong and why they should change what they're
doing. Using Libglade was one of those reasons. I thought Abi should use
this too.

11 Gtk dialogs later (either implemented or fiddled with including 3
versions of lists) I can see the merits of Abi's pragmatic approach. 

The first thing you have to remember is that Abi is C++ program that uses
straight GTK+. There is no support in Libglade for this approach.

Next I regularly use glade to design a dialog then generate C code from
that and tweak the hell out of the resulting code. Next I find actually
generating the GUI to be the easy part of creating the dialog. I've
implemented a couple of GTK front ends to features that were originally
developed in Windows. These were at most 10 hours work.

Next the issue of GTK version vs straight Gnome version. Implementing a 
Gnome version of dialog by hand takes about 0.5 hours. Given
that why not allow our users the choice of GTK or Gnome version?  
You want to see the extra code needed for the gnome version of List
dialog? (Which is about the most sophisticated we have to date). Here it
is minus the GPL license which takes up about 1/3 the space of the
code.

The Gnome version inherits the methods implemented in the GTK version and
just subclasses the couple of methods it needs to make a Gnome dialog.

The methods used in the GTK version would have to be written anyway. It's
not hard to write the GTK version so that the gnome version is this
simple.

Sorry text wrapping in pine screws up the indentation in some places.

Cheers

Martin
----------------------------------------------------------------------

#include <gnome.h>
#include <stdlib.h>
#include <string.h>
#include "ut_string.h"
#include "ut_assert.h"
#include "ut_debugmsg.h"
#include "ut_dialogHelper.h"

#include "xap_Dialog_Id.h"
#include "xap_UnixApp.h"
#include "xap_UnixFrame.h"

#include "ap_Strings.h"
#include "ap_Dialog_Id.h"
#include "ap_Dialog_Lists.h"
#include "ap_UnixGnomeDialog_Lists.h"

/*****************************************************************/
XAP_Dialog *
AP_UnixGnomeDialog_Lists::static_constructor(XAP_DialogFactory * pFactory, 
							  XAP_Dialog_Id id)
{
	AP_UnixGnomeDialog_Lists * p = new AP_UnixGnomeDialog_Lists(pFactory,id);
	return p;
}

AP_UnixGnomeDialog_Lists::AP_UnixGnomeDialog_Lists(XAP_DialogFactory *
pDlgFactory,
						   XAP_Dialog_Id id)
  : AP_UnixDialog_Lists(pDlgFactory, id)
{
}

AP_UnixGnomeDialog_Lists::~AP_UnixGnomeDialog_Lists(void)
{
}

GtkWidget * AP_UnixGnomeDialog_Lists::_constructWindow(void)
{
	ConstructWindowName();
	m_wMainWindow = gnome_dialog_new (m_WindowName, NULL);

	gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (m_wMainWindow)->vbox),
			    _constructWindowContents (), TRUE, TRUE, 0);

	// apply button
	gnome_dialog_append_button(GNOME_DIALOG(m_wMainWindow), 
				   GNOME_STOCK_BUTTON_APPLY);
	m_wApply = GTK_WIDGET (g_list_last (GNOME_DIALOG (m_wMainWindow)->buttons)->data);
        gtk_widget_show (m_wApply);

	// close button
	gnome_dialog_append_button(GNOME_DIALOG(m_wMainWindow), 
				   GNOME_STOCK_BUTTON_CLOSE);
	m_wClose = GTK_WIDGET (g_list_last (GNOME_DIALOG (m_wMainWindow)->buttons)->data);
        gtk_widget_show (m_wClose);

	_connectSignals();

	return (m_wMainWindow);
}






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