-
Notifications
You must be signed in to change notification settings - Fork 0
/
qappindicator.cc
141 lines (129 loc) · 3.85 KB
/
qappindicator.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#include "qappindicator.h"
QAppIndicator::QAppIndicator(QString id, QString iconName, AppIndicatorCategory category, QString iconThemePath)
{
init(id, iconName, category, iconThemePath);
}
QAppIndicator::QAppIndicator(QString id, QString iconName, AppIndicatorCategory category)
{
init(id, iconName, category, QStringLiteral(""));
}
void QAppIndicator::init(QString id, QString iconName, AppIndicatorCategory category, QString iconThemePath)
{
::gtk_init_check(NULL, NULL);
if (iconThemePath.isEmpty())
{
self_ = ::app_indicator_new(id.toStdString().c_str(), iconName.toStdString().c_str(),
category);
}
else
{
self_ = ::app_indicator_new_with_path(id.toStdString().c_str(), iconName.toStdString().c_str(),
category, iconThemePath.toStdString().c_str());
}
}
QString QAppIndicator::id()
{
return QString::fromUtf8(::app_indicator_get_id(self_));
}
AppIndicatorCategory QAppIndicator::category()
{
return ::app_indicator_get_category(self_);
}
void QAppIndicator::setStatus(AppIndicatorStatus status)
{
::app_indicator_set_status(self_, status);
}
AppIndicatorStatus QAppIndicator::status()
{
return ::app_indicator_get_status(self_);
}
void QAppIndicator::setMenu(GtkMenu *menu)
{
::gtk_widget_show_all(GTK_WIDGET(menu));
::app_indicator_set_menu(self_, menu);
}
GtkMenu* QAppIndicator::menu()
{
return ::app_indicator_get_menu(self_);
}
void QAppIndicator::setAttentionIcon(QString iconName)
{
::app_indicator_set_attention_icon(self_, iconName.toStdString().c_str());
}
void QAppIndicator::setAttentionIconFull(QString iconName, QString iconDesc)
{
::app_indicator_set_attention_icon_full(self_, iconName.toStdString().c_str(), iconDesc.toStdString().c_str());
}
QString QAppIndicator::attentionIcon()
{
return QString::fromUtf8(::app_indicator_get_attention_icon(self_));
}
QString QAppIndicator::attentionIconDesc()
{
return QString::fromUtf8(::app_indicator_get_attention_icon_desc(self_));
}
void QAppIndicator::setIcon(QString iconName)
{
::app_indicator_set_icon(self_, iconName.toStdString().c_str());
}
void QAppIndicator::setIconFull(QString iconName, QString iconDesc)
{
::app_indicator_set_icon_full(self_, iconName.toStdString().c_str(), iconDesc.toStdString().c_str());
}
void QAppIndicator::setIconThemePath(QString iconThemePath)
{
::app_indicator_set_icon_theme_path(self_, iconThemePath.toStdString().c_str());
}
QString QAppIndicator::icon()
{
return QString::fromUtf8(::app_indicator_get_icon(self_));
}
QString QAppIndicator::iconDesc()
{
return QString::fromUtf8(::app_indicator_get_icon_desc(self_));
}
QString QAppIndicator::iconThemePath()
{
return QString::fromUtf8(::app_indicator_get_icon_theme_path(self_));
}
void QAppIndicator::setLabel(QString label, QString guide)
{
::app_indicator_set_label(self_, label.toStdString().c_str(), guide.toStdString().c_str());
}
QString QAppIndicator::label()
{
return QString::fromUtf8(::app_indicator_get_label(self_));
}
QString QAppIndicator::labelGuide()
{
return QString::fromUtf8(::app_indicator_get_label_guide(self_));
}
void QAppIndicator::setTitle(QString title)
{
::app_indicator_set_title(self_, title.toStdString().c_str());
}
QString QAppIndicator::title()
{
return QString::fromUtf8(::app_indicator_get_title(self_));
}
void QAppIndicator::setOrderingIndex(quint32 orderingIndex)
{
::app_indicator_set_ordering_index(self_, orderingIndex);
}
quint32 QAppIndicator::orderingIndex()
{
return ::app_indicator_get_ordering_index(self_);
}
void QAppIndicator::setSecondaryActivateTarget(GtkWidget *menuitem)
{
::app_indicator_set_secondary_activate_target(self_, menuitem);
}
GtkWidget *QAppIndicator::secondaryActivateTarget()
{
return ::app_indicator_get_secondary_activate_target(self_);
}
void QAppIndicator::buildMenuFromDesktop(QString desktopFile, QString desktopProfile)
{
::app_indicator_build_menu_from_desktop(self_, desktopFile.toStdString().c_str(),
desktopProfile.toStdString().c_str());
}