示例#1
0
文件: icontainer.c 项目: jcupitt/nip2
static void
icontainer_real_child_add( iContainer *parent, iContainer *child, int pos )
{
	iContainerClass *icontainer_class = ICONTAINER_GET_CLASS( child );

        g_assert( IS_ICONTAINER( parent ) && IS_ICONTAINER( child ) );
        g_assert( child->parent == NULL );

#ifdef DEBUG
	printf( "icontainer_real_child_add:\n\tparent " );
	iobject_print( IOBJECT( parent ) );
	printf( "\tchild " );
	iobject_print( IOBJECT( child ) );
	printf( "\tpos = %d\n", pos );
#endif /*DEBUG*/

	icontainer_link( parent, child, pos ); 

	g_object_ref( G_OBJECT( child ) );
	iobject_sink( IOBJECT( child ) );

	/* Renumber to get all the pos set. 
	 */
        icontainer_pos_renumber( parent );
	iobject_changed( IOBJECT( child ) );

        /* We've made the link ... trigger the parent_add() on the child.
         */
        icontainer_class->parent_add( child );

#ifdef DEBUG_VERBOSE
        printf( "icontainer_real_child_add: " );
	iobject_print( IOBJECT( parent ) );
#endif /*DEBUG_VERBOSE*/
}
示例#2
0
文件: workspace.c 项目: imclab/nip2
static void
workspace_link( Workspace *ws, Workspacegroup *wsg, const char *name )
{
	Workspaceroot *wsr = wsg->wsr;

	Symbol *sym;

#ifdef DEBUG
	printf( "workspace_link: naming ws %p as %s\n", ws, name );
#endif /*DEBUG*/

	sym = symbol_new_defining( wsr->sym->expr->compile, name );

	ws->sym = sym;
	sym->type = SYM_WORKSPACE;
	sym->ws = ws;
	sym->expr = expr_new( sym );
	(void) compile_new( sym->expr );
	symbol_made( sym );
	iobject_set( IOBJECT( ws ), name, NULL );

	ws->local_kitg = toolkitgroup_new( ws->sym );
	g_object_ref( G_OBJECT( ws->local_kitg ) );
	iobject_sink( IOBJECT( ws->local_kitg ) );
}
示例#3
0
文件: workspace.c 项目: imclab/nip2
gboolean
workspace_load_compat( Workspace *ws, int major, int minor )
{
	char pathname[FILENAME_MAX];
	GSList *path;
	int best_major;
	int best_minor;

	if( workspace_have_compat( major, minor, &best_major, &best_minor ) ) {
		/* Make a private toolkitgroup local to this workspace to 
		 * hold the compatibility defs we are planning to load.
		 */
		UNREF( ws->kitg );
		ws->kitg = toolkitgroup_new( ws->sym );
		g_object_ref( G_OBJECT( ws->kitg ) );
		iobject_sink( IOBJECT( ws->kitg ) );

		im_snprintf( pathname, FILENAME_MAX, 
			"$VIPSHOME/share/" PACKAGE "/compat/%d.%d", 
			best_major, best_minor );
		path = path_parse( pathname );
		if( path_map( path, "*.def", 
			(path_map_fn) workspace_load_toolkit, ws->kitg ) ) {
			path_free2( path );
			return( FALSE );
		}
		path_free2( path );

		ws->compat_major = best_major;
		ws->compat_minor = best_minor;
	}
	else {
		/* No compat defs necessary for this ws. 
		 */
		ws->compat_major = 0;
		ws->compat_minor = 0;
	}

	return( TRUE );
}