summaryrefslogtreecommitdiffstats
path: root/xparts/mozilla/kmozilla_ext.c
blob: 151951362471de811cd5a1876989879271363bea (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include "kmozilla_ext.h"

#include <gdk/gdkx.h>

#include <dcopc/util.h>
#include <dcopc/marshal.h>
#include <dcopc/dcopc.h>

#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>

typedef struct _GtkKmozillaExtensionPrivate GtkKmozillaExtensionPrivate;

struct _GtkKmozillaExtensionPrivate {
    GtkKmozilla *moz;
};

#define P ((GtkKmozillaExtensionPrivate *)(ext->data))
#define CLASS(obj) GTK_KMOZILLAEXTENSION_CLASS(GTK_OBJECT(obj)->klass)


/* class and instance initialization */

static void
gtk_kmozilla_extension_class_init(GtkKmozillaExtensionClass *klass);

static void
gtk_kmozilla_extension_init(GtkKmozillaExtension *part);

static void 
gtk_kmozilla_extension_destroy( GtkObject *obj );

/* virtual functions */
static const char * save_state( GtkXBrowserExtension *ext );
static void restore_state ( GtkXBrowserExtension *ext, const char *state, unsigned int size );

static GtkXBrowserExtensionClass *parent_class = 0;

/* --------------------------- implementations --------------------------------------- */

/* type information */
GtkType
gtk_kmozilla_extension_get_type(void)
{
  static GtkType part_type = 0;
  if (!part_type)
  {
    static const GtkTypeInfo part_info =
    {
      "GtkKmozillaExtension",
      sizeof(GtkKmozillaExtension),
      sizeof(GtkKmozillaExtensionClass),
      (GtkClassInitFunc)gtk_kmozilla_extension_class_init,
      (GtkObjectInitFunc)gtk_kmozilla_extension_init,
      0,
      0,
      0
    };
    part_type = gtk_type_unique(GTK_TYPE_XBROWSEREXTENSION, &part_info);
  }
  return part_type;
}

/* class and instance initialization */
static void
gtk_kmozilla_extension_class_init(GtkKmozillaExtensionClass *klass)
{
    GtkObjectClass     *object_class = (GtkObjectClass *)klass;
    DcopObjectClass *dcop_class = DCOP_OBJECT_CLASS(klass);
    GtkXBrowserExtensionClass *be_class = GTK_XBROWSEREXTENSION_CLASS(klass);
    
    parent_class = (GtkXBrowserExtensionClass *)gtk_type_class(gtk_xbrowserextension_get_type());

    object_class->destroy = gtk_kmozilla_extension_destroy;

    be_class->save_state = save_state;
    be_class->restore_state = restore_state;

    g_message( "gtk_kmozillaextension_class_init\n" );
}

static void
gtk_kmozilla_extension_init(GtkKmozillaExtension *part)
{
    GtkKmozillaExtensionPrivate *d;
    d = g_new( GtkKmozillaExtensionPrivate, 1 );
    part->data = d;

    dcop_object_set_id( DCOP_OBJECT(part), "KmozillaExtensionClient" );

    g_message( "gtk_kmozillaextension_init\n" );
}

GtkKmozillaExtension *gtk_kmozilla_extension_new (void)
{
    return (GtkKmozillaExtension *) gtk_type_new(gtk_kmozilla_extension_get_type());
}


void gtk_kmozilla_extension_destroy( GtkObject *obj )
{
    GtkKmozillaExtension *part = GTK_KMOZILLA_EXTENSION(obj);
    GtkKmozillaExtensionPrivate *d = (GtkKmozillaExtensionPrivate *) part->data;
    g_free( d );
    
    GTK_OBJECT_CLASS(parent_class)->destroy(obj);
}

void kmozilla_extension_set_mozilla( GtkKmozillaExtension *ext, GtkKmozilla *moz )
{
    P->moz = moz;
}

static const char * save_state( GtkXBrowserExtension *ext )
{
    g_warning("Extension::save_state!");
    return 0;
}

static void restore_state ( GtkXBrowserExtension *ext, const char *state, unsigned int size )
{
    g_warning("Extension::restore_state!");
}