summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-05-28 06:57:43 +0000
committerLennart Poettering <lennart@poettering.net>2008-05-28 06:57:43 +0000
commit8b8fafffa37a9748bf76dd86feaac14c8a6f7e4b (patch)
tree611a426879196ea6924e2f784cab06b933aa0a04
parent5a3d4d025392f13210902c99e4747cefd5461491 (diff)
add some preliminary gtk binding
git-svn-id: file:///home/lennart/svn/public/libcanberra/trunk@34 01b60673-d06a-42c0-afdd-89cb8e0f78ac
-rw-r--r--src/canberra-gtk.c67
-rw-r--r--src/canberra-gtk.h34
2 files changed, 101 insertions, 0 deletions
diff --git a/src/canberra-gtk.c b/src/canberra-gtk.c
new file mode 100644
index 0000000..cb38bba
--- /dev/null
+++ b/src/canberra-gtk.c
@@ -0,0 +1,67 @@
+/* $Id$ */
+
+/***
+ This file is part of libcanberra.
+
+ Copyright 2008 Lennart Poettering
+
+ libcanberra is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 2.1 of the
+ License, or (at your option) any later version.
+
+ libcanberra is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with libcanberra. If not, If not, see
+ <http://www.gnu.org/licenses/>.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+static GtkWidget* get_toplevel(GtkWidget *w) {
+ while (w) {
+ if (GTK_WIDGET_TOPLEVEL(w))
+ return w;
+
+ w = gtk_widget_get_parent(w);
+ }
+
+ return NULL;
+};
+
+int ca_gtk_proplist_set_for_window(ca_proplist *p, GtkWidget *w) {
+ int ret;
+ const char *t;
+
+ ca_return_val_if_fail(p, CA_ERROR_INVALID);
+ ca_return_val_if_fail(w, CA_ERROR_INVALID);
+
+ if (!(w = get_toplevel(w)))
+ return CA_ERROR_INVALID;
+
+ if ((t = gtk_window_get_title(w)))
+ if ((ret = ca_proplist_sets(p, CA_PROP_WINDOW_NAME, t)) < 0)
+ return ret;
+
+ if ((t = gtk_window_get_icon_name(w)))
+ if ((ret = ca_proplist_sets(p, CA_PROP_WINDOW_NAME, t)) < 0)
+ return ret;
+
+
+
+}
+
+
+
+
+const char *ca_gtk_window_display(GtkWidget *w) {
+}
+
+const char *ca_gtk_window_xid(GtkWidget *w) {
+}
diff --git a/src/canberra-gtk.h b/src/canberra-gtk.h
new file mode 100644
index 0000000..b5941eb
--- /dev/null
+++ b/src/canberra-gtk.h
@@ -0,0 +1,34 @@
+#ifndef foocanberragtkhfoo
+#define foocanberragtkhfoo
+
+/* $Id$ */
+
+/***
+ This file is part of libcanberra.
+
+ Copyright 2008 Lennart Poettering
+
+ libcanberra is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 2.1 of the
+ License, or (at your option) any later version.
+
+ libcanberra is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with libcanberra. If not, If not, see
+ <http://www.gnu.org/licenses/>.
+***/
+
+#include <canberra.h>
+
+ca_context *ca_gtk_context_get(void);
+
+int ca_gtk_play_for_window(GtkWidget *w, uint32_t id, ...) CA_GCC_SENTINEL;
+
+int ca_gtk_proplist_set_for_window(ca_proplist *p, GtkWidget *w);
+
+#endif