summaryrefslogtreecommitdiffstats
path: root/src/Applet/CCApplet.cpp
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2009-12-14 10:41:51 +0100
committerKarel Klic <kklic@redhat.com>2009-12-14 10:41:51 +0100
commita24d2906c51e3740e6e0acf8f0093827b4e35bc3 (patch)
tree1022bf70766a88d45dc71d6ea413ccd0fa14d07c /src/Applet/CCApplet.cpp
parentb7ea0e53e3375de6298b2f510302f75ebef4be4e (diff)
parent42f0375d09931903965b36c87f17f805def956bf (diff)
downloadabrt-a24d2906c51e3740e6e0acf8f0093827b4e35bc3.tar.gz
abrt-a24d2906c51e3740e6e0acf8f0093827b4e35bc3.tar.xz
abrt-a24d2906c51e3740e6e0acf8f0093827b4e35bc3.zip
Merge branch 'master' of git://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src/Applet/CCApplet.cpp')
-rw-r--r--src/Applet/CCApplet.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/Applet/CCApplet.cpp b/src/Applet/CCApplet.cpp
index c91b4e8..5d13ab8 100644
--- a/src/Applet/CCApplet.cpp
+++ b/src/Applet/CCApplet.cpp
@@ -114,7 +114,7 @@ CApplet::CApplet()
m_iAnimationStage = ICON_DEFAULT;
m_bIconsLoaded = load_icons();
/* - animation - */
- if(m_bIconsLoaded == true)
+ if (m_bIconsLoaded == true)
{
m_pStatusIcon = gtk_status_icon_new_from_pixbuf(icon_stages_buff[ICON_DEFAULT]);
}
@@ -244,7 +244,7 @@ void CApplet::ShowIcon()
{
gtk_status_icon_set_visible(m_pStatusIcon, true);
/* only animate if all icons are loaded, use the "gtk-warning" instead */
- if(m_bIconsLoaded)
+ if (m_bIconsLoaded)
animate_icon();
}
@@ -300,30 +300,34 @@ void CApplet::Enable(const char *reason)
gboolean CApplet::update_icon(void *user_data)
{
CApplet* applet = (CApplet*)user_data;
- if(applet->m_pStatusIcon && applet->m_iAnimationStage < ICON_STAGE_LAST){
+ if (applet->m_pStatusIcon && applet->m_iAnimationStage < ICON_STAGE_LAST) {
gtk_status_icon_set_from_pixbuf(applet->m_pStatusIcon,
applet->icon_stages_buff[applet->m_iAnimationStage++]);
}
else
error_msg("icon is null");
- if(applet->m_iAnimationStage == ICON_STAGE_LAST){
+ if (applet->m_iAnimationStage == ICON_STAGE_LAST) {
applet->m_iAnimationStage = 0;
}
+ if (--applet->m_iAnimCountdown == 0) {
+ applet->stop_animate_icon();
+ }
return true;
}
void CApplet::animate_icon()
{
- if(m_iAnimator == 0)
+ if (m_iAnimator == 0)
{
m_iAnimator = g_timeout_add(100, update_icon, this);
+ m_iAnimCountdown = 10 * 60; /* 60 sec */
}
}
void CApplet::stop_animate_icon()
{
/* animator should be 0 if icons are not loaded, so this should be safe */
- if(m_iAnimator != 0){
+ if (m_iAnimator != 0) {
g_source_remove(m_iAnimator);
gtk_status_icon_set_from_pixbuf(m_pStatusIcon, icon_stages_buff[ICON_DEFAULT]);
m_iAnimator = 0;
@@ -333,13 +337,13 @@ void CApplet::stop_animate_icon()
bool CApplet::load_icons()
{
int stage;
- for(stage = ICON_DEFAULT; stage < ICON_STAGE_LAST; stage++)
+ for (stage = ICON_DEFAULT; stage < ICON_STAGE_LAST; stage++)
{
char name[sizeof(ICON_DIR"/abrt%02d.png")];
GError *error = NULL;
- if(snprintf(name, sizeof(ICON_DIR"/abrt%02d.png"),ICON_DIR"/abrt%02d.png", stage) > 0){
+ if (snprintf(name, sizeof(ICON_DIR"/abrt%02d.png"), ICON_DIR"/abrt%02d.png", stage) > 0) {
icon_stages_buff[stage] = gdk_pixbuf_new_from_file(name, &error);
- if(error != NULL){
+ if (error != NULL) {
error_msg("Can't load pixbuf from %s, animation is disabled!", name);
return false;
}
@@ -349,7 +353,7 @@ bool CApplet::load_icons()
}
-//int CApplet::AddEvent(int pUUID, const std::string& pProgname)
+//int CApplet::AddEvent(int pUUID, const char *pProgname)
//{
// m_mapEvents[pUUID] = "pProgname";
// SetIconTooltip(_("Pending events: %i"), m_mapEvents.size());