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

📄 bonobo-exam.html

📁 这是一个介绍 linux 编程知识的文章。
💻 HTML
📖 第 1 页 / 共 4 页
字号:
   gtk_container_add (GTK_CONTAINER(newservant->wrapper), 
		      newservant->socket);
   gtk_signal_connect (GTK_OBJECT (newservant->wrapper),
		       "button_press_event", 
		       GTK_SIGNAL_FUNC (view_frame_cb),
		       newservant);


   POA_GNOME_ViewFrame__init((PortableServer_Servant) newservant, ev);
   objid = PortableServer_POA_activate_object(poa, newservant, ev);
   CORBA_free(objid);
   retval = newservant;

   return retval;
}

static void
impl_GNOME_ViewFrame__destroy(impl_POA_GNOME_ViewFrame * servant,
			      CORBA_Environment * ev)
{
   PortableServer_ObjectId *objid;

   objid = PortableServer_POA_servant_to_id(servant->poa, servant, ev);
   PortableServer_POA_deactivate_object(servant->poa, objid, ev);
   CORBA_free(objid);

   POA_GNOME_ViewFrame__fini((PortableServer_Servant) servant, ev);
   g_free(servant);
}

static GNOME_ClientSite
impl_GNOME_ViewFrame_get_client_site(impl_POA_GNOME_ViewFrame * servant,
				     CORBA_Environment * ev)
{
   GNOME_ClientSite retval;

   return retval;
}

static void
impl_GNOME_ViewFrame_view_activated(impl_POA_GNOME_ViewFrame * servant,
				    CORBA_boolean state,
				    CORBA_Environment * ev)
{
  servant->activate = state;
  if (state == 1)
  gnome_wrapper_set_covered (GNOME_WRAPPER(servant->wrapper), 
			     0);
  else if (state == 0    )
    gnome_wrapper_set_covered (GNOME_WRAPPER(servant->wrapper), 
			       1);

}

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)
{
  servant->request.width = new_width;
  servant->request.height = new_height;
}

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)
{
   CORBA_Object retval;

   return retval;
}

int main (int argc, char **argv)
{
  CORBA_Environment ev;
  CORBA_ORB orb;
  CORBA_Object root_poa;
  PortableServer_POAManager root_poa_manager;

  CORBA_Object obj;

  CORBA_exception_init (&ev);
  orb = gnome_CORBA_init ("a \"simple\" container", 
			  "1.0", 
			  &argc, 
			  argv, 
			  GNORBA_INIT_SERVER_FUNC, 
			  &ev);

  root_poa = CORBA_ORB_resolve_initial_references (orb, "RootPOA", &ev);

  root_poa_manager = PortableServer_POA__get_the_POAManager (
                     (PortableServer_POA) root_poa, &ev);
  PortableServer_POAManager_activate (root_poa_manager, &ev);

  /* this function will create all the other 
   * needed interfaces
   */
  obj = impl_GNOME_Container__create ((PortableServer_POA)
				      root_poa, 
				      &ev);


  CORBA_exception_free (&ev);
  gtk_main();
  return 0;
}
<PRE>        
 
<P><B><FONT SIZE=+2>component.c</FONT></B><P> 
</PRE>
#include <gnome.h>
#include <libgnorba/gnorba.h>
#include <ORBitservices/CosNaming.h>


#include "bonobo.h"

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

typedef struct
{
   POA_GNOME_Persist servant;
   PortableServer_POA poa;

}
impl_POA_GNOME_Persist;

typedef struct
{
  POA_GNOME_Embeddable servant;
  PortableServer_POA poa;
  
  GNOME_ClientSite client_site;
  gchar data[11];
  GSList *view_servant_list;
  gchar *host_name;
  gchar *uri;
}
impl_POA_GNOME_Embeddable;

typedef struct
{
  POA_GNOME_View servant;
  PortableServer_POA poa;

  impl_POA_GNOME_Embeddable *embeddable_servant;
  GNOME_ViewFrame frame;
  GtkWidget *widget;
  GtkWidget *plug;

}
impl_POA_GNOME_View;



typedef struct
{
   POA_GNOME_EmbeddableFactory servant;
   PortableServer_POA poa;
}
impl_POA_GNOME_EmbeddableFactory;

/*** Implementation stub prototypes ***/


static void impl_GNOME_View__destroy(impl_POA_GNOME_View * servant,
				     CORBA_Environment * ev);

static void
impl_GNOME_View_size_allocate(impl_POA_GNOME_View * servant,
			      CORBA_short width,
			      CORBA_short height, CORBA_Environment * ev);

static void
impl_GNOME_View_size_query(impl_POA_GNOME_View * servant,
			   CORBA_short * desired_width,
			   CORBA_short * desired_height,

			   CORBA_Environment * ev);

static void
impl_GNOME_View_set_window(impl_POA_GNOME_View * servant,
			   GNOME_View_windowid id, 
			   CORBA_Environment * ev);

static void
impl_GNOME_View_activate(impl_POA_GNOME_View * servant,
			 CORBA_boolean activated, 
			 CORBA_Environment * ev);

static void
impl_GNOME_View_reactivate_and_undo(impl_POA_GNOME_View * servant,
				    CORBA_Environment * ev);

static void
impl_GNOME_View_do_verb(impl_POA_GNOME_View * servant,
			CORBA_char * verb_name, 
			CORBA_Environment * ev);

static void
impl_GNOME_View_set_zoom_factor(impl_POA_GNOME_View * servant,
				CORBA_double zoom, 
				CORBA_Environment * ev);

static void
impl_GNOME_View_ref(impl_POA_GNOME_View * servant, 
		    CORBA_Environment * ev);
static void
impl_GNOME_View_unref(impl_POA_GNOME_View * servant, 
		      CORBA_Environment * ev);
static CORBA_Object
impl_GNOME_View_query_interface(impl_POA_GNOME_View * servant,
				CORBA_char * repoid, 
				CORBA_Environment * ev);

static void impl_GNOME_Embeddable__destroy(impl_POA_GNOME_Embeddable *
					   servant, 
					   CORBA_Environment * ev);
static void impl_GNOME_Embeddable_set_client_site(impl_POA_GNOME_Embeddable *
						  servant,
						  GNOME_ClientSite
						  client_site,
						  CORBA_Environment * ev);

static GNOME_ClientSite
impl_GNOME_Embeddable_get_client_site(impl_POA_GNOME_Embeddable * servant,
				      CORBA_Environment * ev);

static void
impl_GNOME_Embeddable_set_host_name(impl_POA_GNOME_Embeddable * servant,
				    CORBA_char * name,
				    CORBA_char * appname,
				    CORBA_Environment * ev);

static void
impl_GNOME_Embeddable_set_uri(impl_POA_GNOME_Embeddable * servant,
			      CORBA_char * uri, 
			      CORBA_Environment * ev);

static void
impl_GNOME_Embeddable_close(impl_POA_GNOME_Embeddable * servant,
			    GNOME_Embeddable_CloseMode mode,
			    CORBA_Environment * ev);

static GNOME_Embeddable_verb_list
   *impl_GNOME_Embeddable_get_verb_list(impl_POA_GNOME_Embeddable * servant,
					CORBA_Environment * ev);

static GNOME_View
impl_GNOME_Embeddable_new_view(impl_POA_GNOME_Embeddable * servant,
			       GNOME_ViewFrame frame, 
			       CORBA_Environment * ev);

static void
impl_GNOME_Embeddable_ref(impl_POA_GNOME_Embeddable * servant,
			  CORBA_Environment * ev);
static void
impl_GNOME_Embeddable_unref(impl_POA_GNOME_Embeddable * servant,
			    CORBA_Environment * ev);
static CORBA_Object
impl_GNOME_Embeddable_query_interface(impl_POA_GNOME_Embeddable * servant,
				      CORBA_char * repoid,
				      CORBA_Environment * ev);

static void
impl_GNOME_EmbeddableFactory__destroy(impl_POA_GNOME_EmbeddableFactory *
				      servant, 
				      CORBA_Environment * ev);
static CORBA_boolean
impl_GNOME_EmbeddableFactory_supports(impl_POA_GNOME_EmbeddableFactory *
				      servant, 
				      CORBA_char * obj_goad_id,
				      CORBA_Environment * ev);
static CORBA_Object
impl_GNOME_EmbeddableFactory_create_object(impl_POA_GNOME_EmbeddableFactory *
					   servant, 
					   CORBA_char * goad_id,
					   GNOME_stringlist * params,
					   CORBA_Environment * ev);

/*** epv structures ***/

static PortableServer_ServantBase__epv impl_GNOME_View_base_epv = {
   NULL,			/* _private data */
   NULL,			/* finalize routine */
   NULL,			/* default_POA routine */
};
static POA_GNOME_View__epv impl_GNOME_View_epv = {
   NULL,			/* _private */

   (gpointer) & impl_GNOME_View_size_allocate,

   (gpointer) & impl_GNOME_View_size_query,

   (gpointer) & impl_GNOME_View_set_window,

   (gpointer) & impl_GNOME_View_activate,

   (gpointer) & impl_GNOME_View_reactivate_and_undo,

   (gpointer) & impl_GNOME_View_do_verb,

   (gpointer) & impl_GNOME_View_set_zoom_factor,

};
static POA_GNOME_Unknown__epv impl_GNOME_View_GNOME_Unknown_epv = {
   NULL,			/* _private */
   (gpointer) & impl_GNOME_View_ref,
   (gpointer) & impl_GNOME_View_unref,
   (gpointer) & impl_GNOME_View_query_interface,
};
static PortableServer_ServantBase__epv impl_GNOME_Embeddable_base_epv = {
   NULL,			/* _private data */
   NULL,			/* finalize routine */
   NULL,			/* default_POA routine */
};
static POA_GNOME_Embeddable__epv impl_GNOME_Embeddable_epv = {
   NULL,			/* _private */
   (gpointer) & impl_GNOME_Embeddable_set_client_site,

   (gpointer) & impl_GNOME_Embeddable_get_client_site,

   (gpointer) & impl_GNOME_Embeddable_set_host_name,

   (gpointer) & impl_GNOME_Embeddable_set_uri,

   (gpointer) & impl_GNOME_Embeddable_close,

   (gpointer) & impl_GNOME_Embeddable_get_verb_list,

   (gpointer) & impl_GNOME_Embeddable_new_view,

};
static POA_GNOME_Unknown__epv impl_GNOME_Embeddable_GNOME_Unknown_epv = {
   NULL,			/* _private */
   (gpointer) & impl_GNOME_Embeddable_ref,
   (gpointer) & impl_GNOME_Embeddable_unref,
   (gpointer) & impl_GNOME_Embeddable_query_interface,
};
static PortableServer_ServantBase__epv impl_GNOME_EmbeddableFactory_base_epv = {
   NULL,			/* _private data */
   NULL,			/* finalize routine */
   NULL,			/* default_POA routine */
};
static POA_GNOME_EmbeddableFactory__epv impl_GNOME_EmbeddableFactory_epv = {
   NULL,			/* _private */
};
static POA_GNOME_GenericFactory__epv
   impl_GNOME_EmbeddableFactory_GNOME_GenericFactory_epv = {
   NULL,			/* _private */
   (gpointer) & impl_GNOME_EmbeddableFactory_supports,
   (gpointer) & impl_GNOME_EmbeddableFactory_create_object,
};

/*** vepv structures ***/

static POA_GNOME_View__vepv impl_GNOME_View_vepv = {
   &impl_GNOME_View_base_epv,
   &impl_GNOME_View_GNOME_Unknown_epv,
   &impl_GNOME_View_epv,
};
static POA_GNOME_Embeddable__vepv impl_GNOME_Embeddable_vepv = {
   &impl_GNOME_Embeddable_base_epv,
   &impl_GNOME_Embeddable_GNOME_Unknown_epv,
   &impl_GNOME_Embeddable_epv,
};
static POA_GNOME_EmbeddableFactory__vepv impl_GNOME_EmbeddableFactory_vepv = {
   &impl_GNOME_EmbeddableFactory_base_epv,
   &impl_GNOME_EmbeddableFactory_GNOME_GenericFactory_epv,
   &impl_GNOME_EmbeddableFactory_epv,
};

/*** Stub implementations ***/



static impl_POA_GNOME_View *
impl_GNOME_View__create(PortableServer_POA poa, 
			GNOME_ViewFrame frame, 
			impl_POA_GNOME_Embeddable *embeddable_servant,
			CORBA_Environment * ev)
{

   impl_POA_GNOME_View *newservant;
   PortableServer_ObjectId *objid;
   
   newservant = g_new0(impl_POA_GNOME_View, 1);
   newservant->servant.vepv = &impl_GNOME_View_vepv;
   newservant->poa = poa;
   newservant->frame = CORBA_Object_duplicate (frame, ev);
   /* this is what will be displayed in the component view ! */
   newservant->embeddable_servant = embeddable_servant;
   newservant->widget = gtk_button_new_with_label (embeddable_servant->data);

   POA_GNOME_View__init((PortableServer_Servant) newservant, ev);
   objid = PortableServer_POA_activate_object(poa, newservant, ev);
   CORBA_free(objid);


   return newservant;
}

static void
impl_GNOME_View__destroy(impl_POA_GNOME_View * servant,
			 CORBA_Environment * ev)
{
   PortableServer_ObjectId *objid;

   objid = PortableServer_POA_servant_to_id(servant->poa, servant, ev);
   PortableServer_POA_deactivate_object(servant->poa, objid, ev);
   CORBA_free(objid);

   POA_GNOME_View__fini((PortableServer_Servant) servant, ev);
   g_free(servant);
}

static void
impl_GNOME_View_size_allocate(impl_POA_GNOME_View * servant,
			      CORBA_short width,
			      CORBA_short height, 
			      CORBA_Environment * ev)
{
}

static void
impl_GNOME_View_size_query(impl_POA_GNOME_View * servant,
			   CORBA_short * desired_width,
			   CORBA_short * desired_height,
			   CORBA_Environment * ev)
{
}

static void
impl_GNOME_View_set_window(impl_POA_GNOME_View * servant,

⌨️ 快捷键说明

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