gconftool-2 for getting schemas



attaching testcase for the same issue . 

I have gconf-dbus 2.6.4.15

#include <gconf/gconf-client.h>
#include <gconf/gconf-schema.h>
#define KEY "/Umang/apps/testgconf/inttest"
#define SCHEMAKEY "/schemas/Umang/apps/testgconf/inttest"


int main(int argc, char **argv)
{
  GConfClient *client;
  gboolean status= FALSE ;
  GConfValue *value=NULL;	
  GConfSchema *schema=NULL;
 
  const char *local,*local1;
  const char *long_desc="A LONG DESCRIPTION";
  const char *short_desc="A SHORT DESCRIPTION";
  
  /* create client object */
  g_type_init();
  gconf_init(argc,argv,NULL);
  client = gconf_client_get_default();
  //gconf_client_set_error_handling(client,GCONF_CLIENT_HANDLE_UNRETURNED);

	value = gconf_value_new(GCONF_VALUE_INT);
	gconf_value_set_int(value,100);
			
 schema=gconf_schema_new();
 gconf_schema_set_type(schema,GCONF_VALUE_INT);
 gconf_schema_set_locale(schema,"C");
 gconf_schema_set_short_desc(schema,short_desc);
 gconf_schema_set_long_desc(schema,long_desc);
 gconf_schema_set_owner(schema,"TestingApps");
 gconf_schema_set_default_value(schema,value);

 
 gconf_engine_set_int(client,KEY,100,NULL);
// status=gconf_client_set_schema(client,KEY,schema,NULL);
 status=gconf_client_set_schema(client,SCHEMAKEY,schema,NULL);


 if (status==TRUE)
	printf("\n set schema succeeded") ;
 else 
 	printf("\n set schema fails");	 


 /* finalize client object */	
gconf_schema_free(schema);
//gconf_schema_free(schema1);
g_object_unref(client);
  
  return 0;
}


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