summaryrefslogtreecommitdiffstats
path: root/src/Applet
diff options
context:
space:
mode:
Diffstat (limited to 'src/Applet')
-rw-r--r--src/Applet/Applet.cpp5
-rw-r--r--src/Applet/CCApplet.cpp24
-rw-r--r--src/Applet/CCApplet.h5
3 files changed, 20 insertions, 14 deletions
diff --git a/src/Applet/Applet.cpp b/src/Applet/Applet.cpp
index 46278c62..eea3ef79 100644
--- a/src/Applet/Applet.cpp
+++ b/src/Applet/Applet.cpp
@@ -135,14 +135,15 @@ static void NameOwnerChanged(DBusMessage* signal)
}
// hide icon if it's visible - as NM and don't show it, if it's not
- if(!new_owner[0])
+ if (!new_owner[0])
applet->HideIcon();
}
static DBusHandlerResult handle_message(DBusConnection* conn, DBusMessage* msg, void* user_data)
{
const char* member = dbus_message_get_member(msg);
- log("%s(member:'%s')", __func__, member);
+
+ VERB1 log("%s(member:'%s')", __func__, member);
int type = dbus_message_get_type(msg);
if (type != DBUS_MESSAGE_TYPE_SIGNAL)
diff --git a/src/Applet/CCApplet.cpp b/src/Applet/CCApplet.cpp
index c91b4e82..5d13ab87 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());
diff --git a/src/Applet/CCApplet.h b/src/Applet/CCApplet.h
index c5396a72..48dbabcc 100644
--- a/src/Applet/CCApplet.h
+++ b/src/Applet/CCApplet.h
@@ -41,6 +41,7 @@ class CApplet
bool m_bDaemonRunning;
int m_iAnimationStage;
guint m_iAnimator;
+ unsigned m_iAnimCountdown;
bool m_bIconsLoaded;
enum ICON_STAGES
@@ -71,12 +72,12 @@ class CApplet
// or ask the daemon every time?
// maybe just events which occured during current session
// map::
-// int AddEvent(int pUUID, const std::string& pProgname);
+// int AddEvent(int pUUID, const char *pProgname);
// int RemoveEvent(int pUUID);
protected:
//@@TODO applet menus
- static void OnAppletActivate_CB(GtkStatusIcon *status_icon,gpointer user_data);
+ static void OnAppletActivate_CB(GtkStatusIcon *status_icon, gpointer user_data);
static void OnMenuPopup_cb(GtkStatusIcon *status_icon,
guint button,
guint activate_time,