⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bonobo-exam.html

📁 这是一个介绍 linux 编程知识的文章。
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=GB2312">
    <TITLE>Bonobo Program Examination</TITLE>
</HEAD>
<BODY>
<P><A HREF="Bonobo.html">上一页</A>
<A HREF="Gnome-DB.html">下一页</A>
<P><B><FONT SIZE=+3>Container/Embeddable举例</FONT></B><P>
<P><B><FONT SIZE=+2>Makefile</FONT></B><P>
<PRE>
CC = gcc
CFLAGS = -Wall -g
GNOMEPATH = /opt/gnome
ORBIT_INCLUDE_DIR = -I${GNOMEPATH}/share/idl


all: container component

idl: bonobo.h

bonobo.h:
	orbit-idl ${ORBIT_INCLUDE_DIR} bonobo.idl

container: container.o bonobo-skels.o \
	bonobo-common.o bonobo-stubs.o
	${CC} ${CFLAGS} `gnome-config --libs gnorba gnomeui bonobo` \
	container.o bonobo-skels.o bonobo-common.o bonobo-stubs.o \
	-o container
container.o: container.c bonobo.h
	${CC} ${CFLAGS} `gnome-config --cflags gnorba bonobo` \
	-c container.c -o container.o

component: component.o bonobo-skels.o \
	bonobo-common.o bonobo-stubs.o 
	${CC} ${CFLAGS} `gnome-config --libs gnorba gnomeui` \
	component.o bonobo-skels.o bonobo-common.o bonobo-stubs.o \
	-o component
component.o: component.c bonobo.h
	${CC} ${CFLAGS} `gnome-config --cflags gnorba` \
	-c component.c -o component.o

bonobo-skels.o: bonobo-skels.c bonobo.h
	${CC} ${CFLAGS} `orbit-config --cflags server` \
	`gnome-config --cflags gnorba` \
	-c bonobo-skels.c -o bonobo-skels.o 
bonobo-common.o: bonobo.h bonobo-common.c
	${CC} ${CFLAGS} `orbit-config --cflags server` \
	`gnome-config --cflags gnorba` \
	-c bonobo-common.c -o bonobo-common.o 
bonobo-stubs.o: bonobo.h bonobo-stubs.c 
	${CC} ${CFLAGS} `orbit-config --cflags client` \
	`gnome-config --cflags gnorba` \
	-c bonobo-stubs.c -o bonobo-stubs.o 


clean: 
	rm bonobo-stubs.c bonobo.h bonobo-skels.c \
	bonobo-common.c *~ *.o container component \
	test 2>/dev/null
        
</PRE> 
<P><B><FONT SIZE=+2>bonobo.idl</FONT></B><P>
<PRE>
#include <gnome-unknown.idl>
#include <gnome-factory.idl>

module GNOME {
  interface Persist : Unknown {
    enum Status {
      SAVE_OK,
      SAVE_CANCEL,
      SAVE_FAILED
    };
  };
};


module GNOME {
  interface ParseDisplayName : Unknown {
    exception SyntaxError {};
  };

  interface Container : ParseDisplayName {
    typedef sequence<Unknown> ObjectList;
    ObjectList enum_objects ();
    exception NotFound {};
    Unknown get_object (in string item_name, 
                        in boolean only_if_exists)
            raises (SyntaxError, NotFound);
  };

  interface ClientSite : GNOME::Unknown {
    Container get_container ();
    void show_window (in boolean shown);
  };

  interface ViewFrame : GNOME::Unknown {
    ClientSite get_client_site ();
    void view_activated (in boolean state);
    void deactivate_and_undo ();
    void request_resize (in short new_width, 
                         in short new_height);
    void activate_uri (in string uri, 
                       in boolean relative);
  };
};

module GNOME {
  interface View : GNOME::Unknown {
    typedef unsigned long windowid;
    void size_allocate (in short width, 
                        in short height);
    void size_query (out short desired_width, 
                     out short desired_height);
    void set_window (in windowid id);
    void activate (in boolean activated);
    void reactivate_and_undo ();
    void do_verb (in string verb_name);
    void set_zoom_factor (in double zoom);
  };

  interface Embeddable : GNOME::Unknown {
    void set_client_site (in ClientSite client_site);
    ClientSite get_client_site ();

    void set_host_name (in string name, 
                        in string appname);
    void set_uri (in string uri);

    exception UserCancelledSave {};
    enum CloseMode {
      SAVE_IF_DIRTY,
      NO_SAVE,
      PROMPT_SAVE
    };
    void close (in CloseMode mode)
         raises (UserCancelledSave);

    struct GnomeVerb {
      string name;
      string label;
      string hint;
    };
    typedef sequence<GnomeVerb> verb_list;
    verb_list get_verb_list ();

    exception MultiViewNotSupported {};
    View new_view (in ViewFrame frame) 
         raises (MultiViewNotSupported);
  };

  interface EmbeddableFactory : GNOME::GenericFactory {
  };
};

<PRE>        
<P><B><FONT SIZE=+2>container.c</FONT></B><P> 
</PRE>

#include <gnome.h>
#include <libgnorba/gnorba.h>
#include <ORBitservices/CosNaming.h>
#include <gdk/gdkx.h>
#include <bonobo/gnome-wrapper.h>

#include "bonobo.h"

/*** App-specific servant structures ***/

typedef struct
{
   POA_GNOME_ParseDisplayName servant;
   PortableServer_POA poa;

}
impl_POA_GNOME_ParseDisplayName;

typedef struct _impl_POA_GNOME_Container impl_POA_GNOME_Container;
typedef struct _impl_POA_GNOME_ClientSite impl_POA_GNOME_ClientSite;
typedef struct _impl_POA_GNOME_ViewFrame impl_POA_GNOME_ViewFrame;

struct _impl_POA_GNOME_Container
{
  POA_GNOME_Container servant;
  PortableServer_POA poa;
  GSList *client_site_list;
  impl_POA_GNOME_ClientSite *active;
  GtkWidget *box;
  gint refcount;
};


struct _impl_POA_GNOME_ClientSite
{
  POA_GNOME_ClientSite servant;
  PortableServer_POA poa;
  impl_POA_GNOME_Container *container_servant;
  impl_POA_GNOME_ViewFrame *active;
  GSList *view_frame_list;

  GNOME_Embeddable embeddable;
  CORBA_boolean show;
};


struct _impl_POA_GNOME_ViewFrame
{
   POA_GNOME_ViewFrame servant;
   PortableServer_POA poa;
   impl_POA_GNOME_ClientSite *client_site_servant;
   GNOME_View view;
   GtkWidget *socket;
   GtkWidget *wrapper;
   gint activate;
   GtkRequisition request;
   GtkAllocation allocation;

};


/*** Implementation stub prototypes ***/

void add_component (GtkWidget *menu_item, 
		    impl_POA_GNOME_Container *container);

void app_quit (void);

static void
impl_GNOME_ParseDisplayName__destroy(impl_POA_GNOME_ParseDisplayName *
				     servant, CORBA_Environment * ev);

static void
impl_GNOME_ParseDisplayName_ref(impl_POA_GNOME_ParseDisplayName * servant,
				CORBA_Environment * ev);
static void
impl_GNOME_ParseDisplayName_unref(impl_POA_GNOME_ParseDisplayName * servant,
				  CORBA_Environment * ev);
static CORBA_Object
impl_GNOME_ParseDisplayName_query_interface(impl_POA_GNOME_ParseDisplayName *
					    servant, CORBA_char * repoid,
					    CORBA_Environment * ev);

static void impl_GNOME_Container__destroy(impl_POA_GNOME_Container * servant,
					  CORBA_Environment * ev);

static GNOME_Container_ObjectList
   *impl_GNOME_Container_enum_objects(impl_POA_GNOME_Container * servant,
				      CORBA_Environment * ev);

static GNOME_Unknown
impl_GNOME_Container_get_object(impl_POA_GNOME_Container * servant,
				CORBA_char * item_name,
				CORBA_boolean only_if_exists,
				CORBA_Environment * ev);

static void
impl_GNOME_Container_ref(impl_POA_GNOME_Container * servant,
			 CORBA_Environment * ev);
static void
impl_GNOME_Container_unref(impl_POA_GNOME_Container * servant,
			   CORBA_Environment * ev);
static CORBA_Object
impl_GNOME_Container_query_interface(impl_POA_GNOME_Container * servant,
				     CORBA_char * repoid,

				     CORBA_Environment * ev);

/* this signature was modified because 
   the reference_to_servant function is
   not yet implemented by ORBit */
static impl_POA_GNOME_ClientSite *
impl_GNOME_ClientSite__create(PortableServer_POA poa, 
			      GNOME_Embeddable embeddable, 
			      impl_POA_GNOME_Container *container_servant,
			      CORBA_Environment * ev);



static void impl_GNOME_ClientSite__destroy(impl_POA_GNOME_ClientSite *
					   servant, CORBA_Environment * ev);
static GNOME_Container
impl_GNOME_ClientSite_get_container(impl_POA_GNOME_ClientSite * servant,
				    CORBA_Environment * ev);

static void
impl_GNOME_ClientSite_show_window(impl_POA_GNOME_ClientSite * servant,
				  CORBA_boolean shown,

				  CORBA_Environment * ev);

static void
impl_GNOME_ClientSite_ref(impl_POA_GNOME_ClientSite * servant,
			  CORBA_Environment * ev);
static void
impl_GNOME_ClientSite_unref(impl_POA_GNOME_ClientSite * servant,
			    CORBA_Environment * ev);
static CORBA_Object
impl_GNOME_ClientSite_query_interface(impl_POA_GNOME_ClientSite * servant,
				      CORBA_char * repoid,
				      CORBA_Environment * ev);
/* this signature was modified because 
   the reference_to_servant function is
   not yet implemented by ORBit */
static impl_POA_GNOME_ViewFrame *
impl_GNOME_ViewFrame__create(PortableServer_POA poa, 
			     impl_POA_GNOME_ClientSite *client_site_servant, 
			     CORBA_Environment * ev);

static void impl_GNOME_ViewFrame__destroy(impl_POA_GNOME_ViewFrame * servant,
					  CORBA_Environment * ev);
static GNOME_ClientSite
impl_GNOME_ViewFrame_get_client_site(impl_POA_GNOME_ViewFrame * servant,
				     CORBA_Environment * ev);

static void
impl_GNOME_ViewFrame_view_activated(impl_POA_GNOME_ViewFrame * servant,
				    CORBA_boolean state,

				    CORBA_Environment * ev);

static void
impl_GNOME_ViewFrame_deactivate_and_undo(impl_POA_GNOME_ViewFrame * servant,
					 CORBA_Environment * ev);

static void
impl_GNOME_ViewFrame_request_resize(impl_POA_GNOME_ViewFrame * servant,
				    CORBA_short new_width,
				    CORBA_short new_height,
				    CORBA_Environment * ev);

static void
impl_GNOME_ViewFrame_activate_uri(impl_POA_GNOME_ViewFrame * servant,
				  CORBA_char * uri,
				  CORBA_boolean relative,

				  CORBA_Environment * ev);

static void
impl_GNOME_ViewFrame_ref(impl_POA_GNOME_ViewFrame * servant,
			 CORBA_Environment * ev);
static void
impl_GNOME_ViewFrame_unref(impl_POA_GNOME_ViewFrame * servant,
			   CORBA_Environment * ev);
static CORBA_Object
impl_GNOME_ViewFrame_query_interface(impl_POA_GNOME_ViewFrame * servant,
				     CORBA_char * repoid,

				     CORBA_Environment * ev);

/*** epv structures ***/

static PortableServer_ServantBase__epv impl_GNOME_ParseDisplayName_base_epv = {
   NULL,			/* _private data */
   NULL,			/* finalize routine */
   NULL,			/* default_POA routine */
};
static POA_GNOME_ParseDisplayName__epv impl_GNOME_ParseDisplayName_epv = {
   NULL,			/* _private */

};
static POA_GNOME_Unknown__epv impl_GNOME_ParseDisplayName_GNOME_Unknown_epv = {
   NULL,			/* _private */
   (gpointer) & impl_GNOME_ParseDisplayName_ref,
   (gpointer) & impl_GNOME_ParseDisplayName_unref,
   (gpointer) & impl_GNOME_ParseDisplayName_query_interface,
};
static PortableServer_ServantBase__epv impl_GNOME_Container_base_epv = {
   NULL,			/* _private data */
   NULL,			/* finalize routine */
   NULL,			/* default_POA routine */
};
static POA_GNOME_Container__epv impl_GNOME_Container_epv = {
   NULL,			/* _private */

   (gpointer) & impl_GNOME_Container_enum_objects,

   (gpointer) & impl_GNOME_Container_get_object,

};
static POA_GNOME_Unknown__epv impl_GNOME_Container_GNOME_Unknown_epv = {
   NULL,			/* _private */
   (gpointer) & impl_GNOME_Container_ref,
   (gpointer) & impl_GNOME_Container_unref,
   (gpointer) & impl_GNOME_Container_query_interface,
};
static POA_GNOME_ParseDisplayName__epv
   impl_GNOME_Container_GNOME_ParseDisplayName_epv = {
   NULL,			/* _private */
};
static PortableServer_ServantBase__epv impl_GNOME_ClientSite_base_epv = {
   NULL,			/* _private data */
   NULL,			/* finalize routine */
   NULL,			/* default_POA routine */
};
static POA_GNOME_ClientSite__epv impl_GNOME_ClientSite_epv = {
   NULL,			/* _private */
   (gpointer) & impl_GNOME_ClientSite_get_container,

   (gpointer) & impl_GNOME_ClientSite_show_window,

};
static POA_GNOME_Unknown__epv impl_GNOME_ClientSite_GNOME_Unknown_epv = {
   NULL,			/* _private */
   (gpointer) & impl_GNOME_ClientSite_ref,
   (gpointer) & impl_GNOME_ClientSite_unref,
   (gpointer) & impl_GNOME_ClientSite_query_interface,
};
static PortableServer_ServantBase__epv impl_GNOME_ViewFrame_base_epv = {
   NULL,			/* _private data */
   NULL,			/* finalize routine */
   NULL,			/* default_POA routine */
};
static POA_GNOME_ViewFrame__epv impl_GNOME_ViewFrame_epv = {
   NULL,			/* _private */
   (gpointer) & impl_GNOME_ViewFrame_get_client_site,

   (gpointer) & impl_GNOME_ViewFrame_view_activated,

   (gpointer) & impl_GNOME_ViewFrame_deactivate_and_undo,

   (gpointer) & impl_GNOME_ViewFrame_request_resize,

   (gpointer) & impl_GNOME_ViewFrame_activate_uri,

};
static POA_GNOME_Unknown__epv impl_GNOME_ViewFrame_GNOME_Unknown_epv = {
   NULL,			/* _private */
   (gpointer) & impl_GNOME_ViewFrame_ref,
   (gpointer) & impl_GNOME_ViewFrame_unref,
   (gpointer) & impl_GNOME_ViewFrame_query_interface,
};

/*** vepv structures ***/

static POA_GNOME_ParseDisplayName__vepv impl_GNOME_ParseDisplayName_vepv = {
   &impl_GNOME_ParseDisplayName_base_epv,
   &impl_GNOME_ParseDisplayName_GNOME_Unknown_epv,
   &impl_GNOME_ParseDisplayName_epv,
};
static POA_GNOME_Container__vepv impl_GNOME_Container_vepv = {
   &impl_GNOME_Container_base_epv,
   &impl_GNOME_Container_GNOME_Unknown_epv,
   &impl_GNOME_Container_GNOME_ParseDisplayName_epv,
   &impl_GNOME_Container_epv,
};
static POA_GNOME_ClientSite__vepv impl_GNOME_ClientSite_vepv = {
   &impl_GNOME_ClientSite_base_epv,
   &impl_GNOME_ClientSite_GNOME_Unknown_epv,
   &impl_GNOME_ClientSite_epv,
};
static POA_GNOME_ViewFrame__vepv impl_GNOME_ViewFrame_vepv = {
   &impl_GNOME_ViewFrame_base_epv,
   &impl_GNOME_ViewFrame_GNOME_Unknown_epv,
   &impl_GNOME_ViewFrame_epv,
};

/*** Stub implementations ***/
void add_component_view (GtkWidget *menu_item, 
			 impl_POA_GNOME_Container *container_servant)
{
  CORBA_Environment ev;
  PortableServer_Servant poa = container_servant->poa;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -