File: sample-container.c

package info (click to toggle)
eog 0.6-6
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,360 kB
  • ctags: 1,172
  • sloc: ansic: 10,973; sh: 7,940; makefile: 441; sed: 93; xml: 47
file content (83 lines) | stat: -rw-r--r-- 1,774 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
 * sample-container.c
 *
 * Authors:
 *   Martin Baulig (baulig@suse.de)
 *
 * Copyright 2000 SuSE GmbH.
 */
#include <config.h>
#include <gnome.h>
#include <liboaf/liboaf.h>
#include <bonobo.h>

#include <eog-util.h>

int
main (int argc, char *argv [])
{
	Bonobo_Unknown x, y, z;
	CORBA_Environment ev;
	CORBA_ORB orb;
	gchar *url;

	CORBA_exception_init (&ev);

	if (argc != 2) {
		g_print ("Usage: %s url\n", argv [0]);
		exit (1);
	}

	gnome_init ("sample-container", "1.0", argc, (char **) argv);

	orb = oaf_init (argc, argv);

	if (bonobo_init (orb, NULL, NULL) == FALSE)
		g_error ("Cannot init bonobo");

	url = g_strdup_printf ("file:%s", argv [1]);
	g_message ("Querying %s", url);

	x = bonobo_get_object (url, "IDL:GNOME/EOG/Image:1.0", &ev);
	if (BONOBO_EX (&ev))
		g_warning ("Failed to get object: %s",
			   bonobo_exception_get_text (&ev));

	g_message ("x = %p", x);
	if (x)
		g_message ("x is a %s", x->object_id);

	g_free (url);

	url = g_strdup_printf ("file:%s!control", argv [1]);
	g_message ("Querying %s", url);

	y = bonobo_get_object (url, "IDL:Bonobo/Control:1.0", &ev);
	if (ev._major != CORBA_NO_EXCEPTION)
		g_warning ("Failed to get object: %s",
			   bonobo_exception_get_text (&ev));

	g_message ("y = %p", y);
	if (y)
		g_message ("y is a %s", y->object_id);

	g_free (url);

	url = g_strdup_printf ("file:%s!embeddable", argv [1]);
	g_message ("Querying %s", url);

	z = bonobo_get_object (url, "IDL:Bonobo/Embeddable:1.0", &ev);
	if (ev._major != CORBA_NO_EXCEPTION)
		g_warning ("Failed to get object: %s",
			   bonobo_exception_get_text (&ev));

	g_message ("z = %p", z);
	if (z)
		g_message ("z is a %s", z->object_id);

	g_free (url);

	return 0;
}