/* Copyright 2003 libpanelappletmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ namespace Gnome { namespace Panel { AppletOrient Applet::get_orientation() const { PanelAppletOrient c_orient = panel_applet_get_orient(const_cast(gobj())); AppletOrient returncode = APPLET_ORIENT_UP; // Arbitrary value. switch(c_orient) { case PANEL_APPLET_ORIENT_UP: returncode = APPLET_ORIENT_UP; break; case PANEL_APPLET_ORIENT_DOWN: returncode = APPLET_ORIENT_DOWN; break; case PANEL_APPLET_ORIENT_LEFT: returncode = APPLET_ORIENT_LEFT; break; case PANEL_APPLET_ORIENT_RIGHT: returncode = APPLET_ORIENT_RIGHT; break; default: g_warning("Unexpected Orientation Value"); } return returncode; } AppletBackgroundType Applet::get_background(Gdk::Color& color, Glib::RefPtr& pixmap) const { GdkColor cColor; GdkPixmap* cpPixmap = 0; PanelAppletBackgroundType result = panel_applet_get_background(const_cast(gobj()), &cColor, &cpPixmap); //This must be copied, because it is a local instance here that will be automatically deleted. color = Glib::wrap(&cColor, true /* take_copy */); //This seems to come from a gdk_pixmap_new(), in the source code, so it doesn't need an extra ref. //However, the C function is undocumented, and seems to be unused. //Normally the documentation would say whether it should be reffed and/or unreffed by the caller. pixmap = Glib::wrap((GdkPixmapObject*)cpPixmap); //, true /* take_copy */); //We need the cast because the C type is not a real type. return (AppletBackgroundType)result; } void Applet::set_size_hints(const Glib::ArrayHandle& size_hints, int base_size) { panel_applet_set_size_hints(gobj(), size_hints.data(), size_hints.size(), base_size); } void Applet::gconf_set_list(const Glib::ustring& key, const Gnome::Conf::SListHandle_ValueBool& list) { GError *error = 0; panel_applet_gconf_set_list(gobj(), key.c_str(), GCONF_VALUE_BOOL, list.data(), &(error)); if(error) ::Glib::Error::throw_exception(error); } void Applet::gconf_set_list(const Glib::ustring& key, const Gnome::Conf::SListHandle_ValueInt& list) { GError *error = 0; panel_applet_gconf_set_list(gobj(), key.c_str(), GCONF_VALUE_INT, list.data(), &(error)); if(error) ::Glib::Error::throw_exception(error); } void Applet::gconf_set_list(const Glib::ustring& key, const Gnome::Conf::SListHandle_ValueString& list) { GError *error = 0; panel_applet_gconf_set_list(gobj(), key.c_str(), GCONF_VALUE_STRING, list.data(), &(error)); if(error) ::Glib::Error::throw_exception(error); } void Applet::gconf_set_list(const Glib::ustring& key, const Gnome::Conf::SListHandle_ValueFloat& list) { GError *error = 0; panel_applet_gconf_set_list(gobj(), key.c_str(), GCONF_VALUE_FLOAT, list.data(), &(error)); if(error) ::Glib::Error::throw_exception(error); } Gnome::Conf::SListHandle_ValueBool Applet::gconf_get_bool_list(const Glib::ustring& key) const { GError *error = 0; return Gnome::Conf::SListHandle_ValueBool(panel_applet_gconf_get_list(const_cast(gobj()), key.c_str(), GCONF_VALUE_BOOL, &(error)), Glib::OWNERSHIP_NONE); if(error) ::Glib::Error::throw_exception(error); } Gnome::Conf::SListHandle_ValueInt Applet::gconf_get_int_list(const Glib::ustring& key) const { GError *error = 0; return Gnome::Conf::SListHandle_ValueInt(panel_applet_gconf_get_list(const_cast(gobj()), key.c_str(), GCONF_VALUE_INT, &(error)), Glib::OWNERSHIP_NONE); if(error) ::Glib::Error::throw_exception(error); } Gnome::Conf::SListHandle_ValueString Applet::gconf_get_string_list(const Glib::ustring& key) const { GError *error = 0; return Gnome::Conf::SListHandle_ValueString(panel_applet_gconf_get_list(const_cast(gobj()), key.c_str(), GCONF_VALUE_STRING, &(error)), Glib::OWNERSHIP_NONE); if(error) ::Glib::Error::throw_exception(error); } Gnome::Conf::SListHandle_ValueFloat Applet::gconf_get_float_list(const Glib::ustring& key) const { GError *error = 0; return Gnome::Conf::SListHandle_ValueFloat(panel_applet_gconf_get_list(const_cast(gobj()), key.c_str(), GCONF_VALUE_FLOAT, &(error)), Glib::OWNERSHIP_NONE); if(error) ::Glib::Error::throw_exception(error); } } //namespace Panel } //namespace Gnome