~ubuntu-branches/ubuntu/natty/java-gnome/natty

« back to all changes in this revision

Viewing changes to src/bindings/org/gnome/gtk/GtkAssistantOverride.c

  • Committer: Bazaar Package Importer
  • Author(s): Guillaume Mazoyer
  • Date: 2011-02-18 17:46:52 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20110218174652-mk7ajkt790es0jwr
Tags: 4.0.19-0ubuntu1
* New upstream release. (LP: #596252) (Forwarded: Debian: 588943)
* debian/control
  - Update dependencies version according to the upstream configure file.
  - Update Standards-Version to 3.9.1.
  - Sync JNI and JAR packages.
* debian/copyright
  - Update copyright to 2011.
* debian/patches/01_take_screenshots.diff
  - Fix patch to make doc screenshots works.
* debian/patches/02_javadoc_workaround.patch
  - Fix javadoc generation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * java-gnome, a UI library for writing GTK and GNOME programs from Java!
 
3
 *
 
4
 * Copyright © 2010 Operational Dynamics Consulting, Pty Ltd and Others
 
5
 *
 
6
 * The code in this file, and the program it is a part of, is made available
 
7
 * to you by its authors as open source software: you can redistribute it
 
8
 * and/or modify it under the terms of the GNU General Public License version
 
9
 * 2 ("GPL") as published by the Free Software Foundation.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful, but WITHOUT
 
12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
13
 * FITNESS FOR A PARTICULAR PURPOSE. See the GPL for more details.
 
14
 *
 
15
 * You should have received a copy of the GPL along with this program. If not,
 
16
 * see http://www.gnu.org/licenses/. The authors of this program may be
 
17
 * contacted through http://java-gnome.sourceforge.net/.
 
18
 *
 
19
 * Linking this library statically or dynamically with other modules is making
 
20
 * a combined work based on this library. Thus, the terms and conditions of
 
21
 * the GPL cover the whole combination. As a special exception (the
 
22
 * "Claspath Exception"), the copyright holders of this library give you
 
23
 * permission to link this library with independent modules to produce an
 
24
 * executable, regardless of the license terms of these independent modules,
 
25
 * and to copy and distribute the resulting executable under terms of your
 
26
 * choice, provided that you also meet, for each linked independent module,
 
27
 * the terms and conditions of the license of that module. An independent
 
28
 * module is a module which is not derived from or based on this library. If
 
29
 * you modify this library, you may extend the Classpath Exception to your
 
30
 * version of the library, but you are not obligated to do so. If you do not
 
31
 * wish to do so, delete this exception statement from your version.
 
32
 */
 
33
 
 
34
#include <jni.h>
 
35
#include <gtk/gtk.h>
 
36
#include "bindings_java.h"
 
37
#include "org_gnome_gtk_GtkAssistantOverride.h"
 
38
#include <gtk/gtkmarshal.h>
 
39
 
 
40
static guint signalID = 0;
 
41
static GtkAssistant* source;
 
42
 
 
43
/*
 
44
 * Meets the signature requirement of (*GtkAssistantPageFunc) in
 
45
 * order to be the second parameter to the call to 
 
46
 * gtk_assistant_set_forward_page_func() below.
 
47
 */
 
48
static gint
 
49
emit_forward
 
50
(
 
51
        const gint current_page,
 
52
        gpointer user_data
 
53
)
 
54
{
 
55
        gint result;
 
56
 
 
57
        g_signal_emit_by_name(source, "forward", current_page, &result);
 
58
 
 
59
        return result;
 
60
}
 
61
 
 
62
/**
 
63
 * called from
 
64
 *   org.gnome.gtk.GtkAssistantOverride.emitForward()
 
65
 * called from
 
66
 *   org.gnome.gtk.Assistant.emitForwardPage()
 
67
 */
 
68
JNIEXPORT jint JNICALL
 
69
Java_org_gnome_gtk_GtkAssistantOverride_gtk_1assistant_1emit_1forward
 
70
(
 
71
        JNIEnv* env,
 
72
        jclass cls,
 
73
        jlong _self,
 
74
        jint _current
 
75
)
 
76
{
 
77
        GtkAssistant* self;
 
78
        jint current;
 
79
        gint result;
 
80
        jint _result;
 
81
 
 
82
        // convert parameters
 
83
        self = (GtkAssistant*) _self;
 
84
        current = (gint) _current;
 
85
 
 
86
        // emit the signal
 
87
        g_signal_emit_by_name(self, "forward", current, &result);
 
88
 
 
89
        // translate return value to JNI type
 
90
        _result = (jint) result;
 
91
 
 
92
        // finally, return signal result
 
93
        return _result;
 
94
}
 
95
 
 
96
/**
 
97
 * called from
 
98
 *   org.gnome.gtk.GtkAssistantOverride.setForwardFunc()
 
99
 * called from
 
100
 *   org.gnome.gtk.Assistant.setForwardPageCallback()
 
101
 */
 
102
JNIEXPORT void JNICALL
 
103
Java_org_gnome_gtk_GtkAssistantOverride_gtk_1assistant_1set_1forward_1page_1func
 
104
(
 
105
        JNIEnv* env,
 
106
        jclass cls,
 
107
        jlong _self
 
108
)
 
109
{
 
110
        // convert parameter self
 
111
        source = (GtkAssistant*) _self;
 
112
 
 
113
        if (signalID == 0) {
 
114
                signalID = g_signal_new("forward",
 
115
                                        GTK_TYPE_ASSISTANT,
 
116
                                        G_SIGNAL_ACTION,
 
117
                                        0,
 
118
                                        NULL,
 
119
                                        NULL, 
 
120
                                        NULL,
 
121
                                        G_TYPE_INT,
 
122
                                        1,
 
123
                                        G_TYPE_INT);
 
124
        }
 
125
 
 
126
        // call function
 
127
        gtk_assistant_set_forward_page_func(source, emit_forward, NULL, NULL);
 
128
}