From 8b8fafffa37a9748bf76dd86feaac14c8a6f7e4b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 28 May 2008 06:57:43 +0000 Subject: add some preliminary gtk binding git-svn-id: file:///home/lennart/svn/public/libcanberra/trunk@34 01b60673-d06a-42c0-afdd-89cb8e0f78ac --- src/canberra-gtk.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/canberra-gtk.h | 34 +++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 src/canberra-gtk.c create mode 100644 src/canberra-gtk.h (limited to 'src') 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 + . +***/ + +#ifdef HAVE_CONFIG_H +#include +#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 + . +***/ + +#include + +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 -- cgit