diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | abrt.spec | 1 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | icons/48/Makefile.am | 11 | ||||
-rw-r--r-- | icons/48/abrt00.png | bin | 0 -> 2791 bytes | |||
-rw-r--r-- | icons/48/abrt01.png | bin | 0 -> 2791 bytes | |||
-rw-r--r-- | icons/48/abrt02.png | bin | 0 -> 2800 bytes | |||
-rw-r--r-- | icons/48/abrt03.png | bin | 0 -> 2707 bytes | |||
-rw-r--r-- | icons/48/abrt04.png | bin | 0 -> 2709 bytes | |||
-rw-r--r-- | icons/48/abrt05.png | bin | 0 -> 2729 bytes | |||
-rw-r--r-- | icons/Makefile.am | 1 | ||||
-rw-r--r-- | src/Applet/CCApplet.cpp | 65 | ||||
-rw-r--r-- | src/Applet/CCApplet.h | 20 | ||||
-rw-r--r-- | src/Applet/Makefile.am | 1 |
14 files changed, 99 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am index 521271fd..a934526c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = lib src inc po +SUBDIRS = lib src inc po icons EXTRA_DIST = doc/CodingStyle abrt.spec @@ -313,6 +313,7 @@ fi %{_datadir}/%{name} %{_datadir}/applications/fedora-%{name}.desktop %{_datadir}/pixmaps/abrt.png +%{_datadir}/icons/hicolor/48x48/apps/*.png %{_bindir}/%{name}-applet %{_sysconfdir}/xdg/autostart/%{name}-applet.desktop diff --git a/configure.ac b/configure.ac index 39fb6dee..4d11eae4 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,8 @@ AC_CONFIG_FILES([ src/CLI/Makefile inc/Makefile po/Makefile.in + icons/Makefile + icons/48/Makefile ]) AC_OUTPUT diff --git a/icons/48/Makefile.am b/icons/48/Makefile.am new file mode 100644 index 00000000..999f2258 --- /dev/null +++ b/icons/48/Makefile.am @@ -0,0 +1,11 @@ +icondir=${datadir}/icons/hicolor/48x48/apps +icon_DATA = \ + abrt00.png \ + abrt01.png \ + abrt02.png \ + abrt03.png \ + abrt04.png \ + abrt05.png + +EXTRA_DIST = $(icon_DATA) + diff --git a/icons/48/abrt00.png b/icons/48/abrt00.png Binary files differnew file mode 100644 index 00000000..dc24865e --- /dev/null +++ b/icons/48/abrt00.png diff --git a/icons/48/abrt01.png b/icons/48/abrt01.png Binary files differnew file mode 100644 index 00000000..dc24865e --- /dev/null +++ b/icons/48/abrt01.png diff --git a/icons/48/abrt02.png b/icons/48/abrt02.png Binary files differnew file mode 100644 index 00000000..14955826 --- /dev/null +++ b/icons/48/abrt02.png diff --git a/icons/48/abrt03.png b/icons/48/abrt03.png Binary files differnew file mode 100644 index 00000000..cf97a562 --- /dev/null +++ b/icons/48/abrt03.png diff --git a/icons/48/abrt04.png b/icons/48/abrt04.png Binary files differnew file mode 100644 index 00000000..caa6b33b --- /dev/null +++ b/icons/48/abrt04.png diff --git a/icons/48/abrt05.png b/icons/48/abrt05.png Binary files differnew file mode 100644 index 00000000..49c442e5 --- /dev/null +++ b/icons/48/abrt05.png diff --git a/icons/Makefile.am b/icons/Makefile.am new file mode 100644 index 00000000..06e11378 --- /dev/null +++ b/icons/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = 48
\ No newline at end of file diff --git a/src/Applet/CCApplet.cpp b/src/Applet/CCApplet.cpp index c2300510..228c6b9c 100644 --- a/src/Applet/CCApplet.cpp +++ b/src/Applet/CCApplet.cpp @@ -108,9 +108,13 @@ You should have received a copy of the GNU General Public License along with thi CApplet::CApplet() { - m_pStatusIcon = gtk_status_icon_new_from_stock(GTK_STOCK_DIALOG_WARNING); m_bDaemonRunning = true; - + /* set-up icon buffers */ + animator = 0; + animation_stage = ICON_DEFAULT; + load_icons(); + /* - animation - */ + m_pStatusIcon = gtk_status_icon_new_from_pixbuf(icon_stages_buff[ICON_DEFAULT]); notify_init("ABRT"); m_pNotification = notify_notification_new_with_status_icon("Warning", NULL, NULL, m_pStatusIcon); notify_notification_set_urgency(m_pNotification, NOTIFY_URGENCY_CRITICAL); @@ -215,18 +219,26 @@ void CApplet::OnMenuPopup_cb(GtkStatusIcon *status_icon, guint activate_time, gpointer user_data) { - if (((CApplet *)user_data)->m_pMenu != NULL) + CApplet *applet = (CApplet *)user_data; + /* stop the animation */ + applet->stop_animate_icon(); + gtk_status_icon_set_from_pixbuf(applet->m_pStatusIcon, applet->icon_stages_buff[ICON_DEFAULT]); + + if (applet->m_pMenu != NULL) { gtk_menu_popup(GTK_MENU(((CApplet *)user_data)->m_pMenu), NULL, NULL, gtk_status_icon_position_menu, status_icon, button, activate_time); } + } void CApplet::ShowIcon() { gtk_status_icon_set_visible(m_pStatusIcon, true); + animate_icon(); + //gtk_status_icon_set_visible(m_pStatusIcon, true); //Active wait for icon to be REALLY visible in status area //while(!gtk_status_icon_is_embedded(m_pStatusIcon)) continue; } @@ -246,6 +258,7 @@ void CApplet::onAbout_cb(GtkMenuItem *menuitem, gpointer dialog) void CApplet::HideIcon() { gtk_status_icon_set_visible(m_pStatusIcon, false); + stop_animate_icon(); } void CApplet::Disable(const char *reason) @@ -279,6 +292,52 @@ void CApplet::Enable(const char *reason) ShowIcon(); } +gboolean CApplet::update_icon(void *applet) +{ + if(((CApplet*)applet)->m_pStatusIcon && ((CApplet*)applet)->animation_stage < ICON_STAGE_LAST){ + gtk_status_icon_set_from_pixbuf(((CApplet*)applet)->m_pStatusIcon, + ((CApplet*)applet)->icon_stages_buff[((CApplet*)applet)->animation_stage++]); + } + else + error_msg("icon is null"); + if(((CApplet*)applet)->animation_stage == ICON_STAGE_LAST){ + ((CApplet*)applet)->animation_stage = 0; + } + return true; +} + +void CApplet::animate_icon() +{ + if(animator == 0) + { + animator = g_timeout_add(100, update_icon, this); + } +} + +void CApplet::stop_animate_icon() +{ + if(animator != 0){ + g_source_remove(animator); + animator = 0; + } +} + +void CApplet::load_icons() +{ + int stage = ICON_DEFAULT; + for(stage = ICON_DEFAULT; stage < ICON_STAGE_LAST; stage++) + { + char *name; + GError *error = NULL; + name = g_strdup_printf(ICON_DIR"/abrt%02d.png", stage); + icon_stages_buff[stage] = gdk_pixbuf_new_from_file(name, &error); + if(error != NULL) + error_msg("Can't load pixbuf from %s\n", name); + g_free(name); + } +} + + //int CApplet::AddEvent(int pUUID, const std::string& pProgname) //{ // m_mapEvents[pUUID] = "pProgname"; diff --git a/src/Applet/CCApplet.h b/src/Applet/CCApplet.h index 3ae8cff9..e13c1d92 100644 --- a/src/Applet/CCApplet.h +++ b/src/Applet/CCApplet.h @@ -39,6 +39,22 @@ class CApplet NotifyNotification *m_pNotification; // std::map<int, std::string> m_mapEvents; bool m_bDaemonRunning; + GtkStatusIcon *tray_icon; + int animation_stage; + guint animator; + + enum ICON_STAGES + { + ICON_DEFAULT, + ICON_STAGE1, + ICON_STAGE2, + ICON_STAGE3, + ICON_STAGE4, + ICON_STAGE5, + /* this must be always the last */ + ICON_STAGE_LAST + } icon_stages; + GdkPixbuf *icon_stages_buff[ICON_STAGE_LAST]; public: CApplet(); @@ -67,6 +83,10 @@ class CApplet gpointer user_data); static void onHide_cb(GtkMenuItem *menuitem, gpointer applet); static void onAbout_cb(GtkMenuItem *menuitem, gpointer applet); + static gboolean update_icon(void *data); + void animate_icon(); + void stop_animate_icon(); + void load_icons(); }; #endif diff --git a/src/Applet/Makefile.am b/src/Applet/Makefile.am index d0980440..6fca43ab 100644 --- a/src/Applet/Makefile.am +++ b/src/Applet/Makefile.am @@ -15,6 +15,7 @@ abrt_applet_CPPFLAGS = \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ + -DICON_DIR=\"${datadir}/icons/hicolor/48x48/apps\" \ $(GTK_CFLAGS) \ $(DBUS_CFLAGS) \ -D_GNU_SOURCE |