2011-05-25 08:05:29 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 12:49:02 -05:00
|
|
|
/*
|
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* A LibreOffice extension to send the menubar structure through DBusMenu
|
|
|
|
*
|
|
|
|
* Copyright 2011 Canonical, Ltd.
|
|
|
|
* Authors:
|
|
|
|
* Alberto Ruiz <alberto.ruiz@codethink.co.uk>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it under
|
|
|
|
* the the GNU Lesser General Public License version 3, as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
|
|
|
|
* SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR PURPOSE. See the applicable
|
|
|
|
* version of the GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-03-31 10:39:38 -05:00
|
|
|
#include "MenuItemInfo.hxx"
|
2011-03-31 12:49:02 -05:00
|
|
|
#include <libdbusmenu-gtk/menuitem.h>
|
|
|
|
|
|
|
|
MenuItemInfo::MenuItemInfo ()
|
|
|
|
{
|
2011-03-31 13:49:27 -05:00
|
|
|
m_label = NULL;
|
|
|
|
m_check_state = DBUSMENU_MENUITEM_TOGGLE_STATE_UNKNOWN;
|
|
|
|
m_check_type = (gchar*)DBUSMENU_MENUITEM_TOGGLE_CHECK;
|
2011-03-31 12:49:02 -05:00
|
|
|
|
2011-03-31 13:49:27 -05:00
|
|
|
m_is_visible = TRUE;
|
|
|
|
m_is_enabled = TRUE;
|
2011-03-31 12:49:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
MenuItemInfo::~MenuItemInfo ()
|
|
|
|
{
|
2011-03-31 13:49:27 -05:00
|
|
|
if (m_label)
|
|
|
|
g_free(m_label);
|
2011-03-31 12:49:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//Setters
|
|
|
|
void
|
|
|
|
MenuItemInfo::setLabel (gchar* label)
|
|
|
|
{
|
2011-03-31 13:49:27 -05:00
|
|
|
this->m_label = g_strdup (label);
|
2011-03-31 12:49:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MenuItemInfo::setEnabled (gboolean is_enabled)
|
|
|
|
{
|
2011-03-31 13:49:27 -05:00
|
|
|
this->m_is_enabled = is_enabled;
|
2011-03-31 12:49:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MenuItemInfo::setCheckState (gint check_state)
|
|
|
|
{
|
2011-03-31 13:49:27 -05:00
|
|
|
this->m_check_state = check_state;
|
2011-03-31 12:49:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MenuItemInfo::setCheckType (const gchar* check_type)
|
|
|
|
{
|
2011-03-31 13:49:27 -05:00
|
|
|
this->m_check_type = (gchar*)check_type;
|
2011-03-31 12:49:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
MenuItemInfo::setVisible (gboolean is_visible)
|
|
|
|
{
|
2011-03-31 13:49:27 -05:00
|
|
|
this->m_is_visible = is_visible;
|
2011-03-31 12:49:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//Getters
|
|
|
|
gchar*
|
2011-05-08 07:31:03 -05:00
|
|
|
MenuItemInfo::getLabel const()
|
2011-03-31 12:49:02 -05:00
|
|
|
{
|
2011-03-31 13:49:27 -05:00
|
|
|
return m_label;
|
2011-03-31 12:49:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2011-05-08 07:31:03 -05:00
|
|
|
MenuItemInfo::getEnabled const()
|
2011-03-31 12:49:02 -05:00
|
|
|
{
|
2011-03-31 13:49:27 -05:00
|
|
|
return m_is_enabled;
|
2011-03-31 12:49:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
2011-05-08 07:31:03 -05:00
|
|
|
MenuItemInfo::getCheckState const()
|
2011-03-31 12:49:02 -05:00
|
|
|
{
|
2011-03-31 13:49:27 -05:00
|
|
|
return m_check_state;
|
2011-03-31 12:49:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
const gchar*
|
2011-05-08 07:31:03 -05:00
|
|
|
MenuItemInfo::getCheckType const()
|
2011-03-31 12:49:02 -05:00
|
|
|
{
|
2011-03-31 13:49:27 -05:00
|
|
|
return m_check_type;
|
2011-03-31 12:49:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
2011-05-08 07:31:03 -05:00
|
|
|
MenuItemInfo::getVisible const()
|
2011-03-31 12:49:02 -05:00
|
|
|
{
|
2011-03-31 13:49:27 -05:00
|
|
|
return m_is_visible;
|
2011-03-31 12:49:02 -05:00
|
|
|
}
|
2011-05-25 08:05:29 -05:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|