~cyphermox/ethos/debian

« back to all changes in this revision

Viewing changes to examples/simple-ui/simple-ui.c

  • Committer: Mathieu Trudel-Lapierre
  • Date: 2011-07-27 00:48:52 UTC
  • Revision ID: mathieu-tl@ubuntu.com-20110727004852-t7bz3ye3ugttb9aq
Clean tree to get to a merge-mode package tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <gtk/gtk.h>
2
 
#include <ethos/ethos.h>
3
 
#include <ethos/ethos-ui.h>
4
 
 
5
 
/* This example shows how you can use a widget to turn on and off lugins.
6
 
 * However, it doesn't really show the plugins connecting to the user
7
 
 * interface in any way.  To do that, you want to create a new interface
8
 
 * that provides your UI hooking methods.  Then check to see if the plugin
9
 
 * implements that interface, and if so, call its hook methods.
10
 
 */
11
 
 
12
 
int
13
 
main (int   argc,
14
 
      char *argv[])
15
 
{
16
 
        GtkWidget    *window,
17
 
                     *manager_widget;
18
 
        EthosManager *manager;
19
 
        gchar        *plugins[] = { "../../tests/manager-dep/", NULL };
20
 
 
21
 
        gtk_init (&argc, &argv);
22
 
 
23
 
        manager = ethos_manager_new ();
24
 
        ethos_manager_set_app_name (manager, "Test");
25
 
        ethos_manager_set_plugin_dirs (manager, plugins);
26
 
        ethos_manager_initialize (manager);
27
 
 
28
 
        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
29
 
        gtk_window_set_title (GTK_WINDOW (window), "Ethos UI");
30
 
        gtk_window_set_default_size (GTK_WINDOW (window), 400, 500);
31
 
        gtk_container_set_border_width (GTK_CONTAINER (window), 12);
32
 
        gtk_widget_show (window);
33
 
 
34
 
        manager_widget = ethos_ui_manager_widget_new ();
35
 
        ethos_ui_manager_widget_set_manager (
36
 
                        ETHOS_UI_MANAGER_WIDGET (manager_widget),
37
 
                        manager);
38
 
        gtk_container_add (GTK_CONTAINER (window), manager_widget);
39
 
        gtk_widget_show (manager_widget);
40
 
 
41
 
        g_signal_connect (G_OBJECT (window),
42
 
                          "destroy",
43
 
                          G_CALLBACK (gtk_main_quit),
44
 
                          NULL);
45
 
 
46
 
        gtk_main ();
47
 
 
48
 
        return 0;
49
 
}