2
#include "Nux/BaseWindow.h"
4
#include "BamfLauncherIcon.h"
6
#include "PluginAdapter.h"
8
#include <gio/gdesktopappinfo.h>
10
BamfLauncherIcon::BamfLauncherIcon (Launcher* IconManager, BamfApplication *app, CompScreen *screen, NUX_FILE_LINE_DECL)
11
: SimpleLauncherIcon(IconManager)
15
char *icon_name = bamf_view_get_icon (BAMF_VIEW (m_App));
17
SetTooltipText (bamf_view_get_name (BAMF_VIEW (app)));
18
SetIconName (icon_name);
20
if (bamf_view_is_sticky (BAMF_VIEW (m_App)))
23
SetVisible (bamf_view_user_visible (BAMF_VIEW (m_App)));
25
SetActive (bamf_view_is_active (BAMF_VIEW (m_App)));
26
SetRunning (bamf_view_is_running (BAMF_VIEW (m_App)));
30
g_signal_connect (app, "running-changed", (GCallback) &BamfLauncherIcon::OnRunningChanged, this);
31
g_signal_connect (app, "active-changed", (GCallback) &BamfLauncherIcon::OnActiveChanged, this);
32
g_signal_connect (app, "user-visible-changed", (GCallback) &BamfLauncherIcon::OnUserVisibleChanged, this);
33
g_signal_connect (app, "closed", (GCallback) &BamfLauncherIcon::OnClosed, this);
36
BamfLauncherIcon::~BamfLauncherIcon()
41
BamfLauncherIcon::OnMouseClick ()
46
GDesktopAppInfo *appInfo;
48
children = bamf_view_get_children (BAMF_VIEW (m_App));
49
active = bamf_view_is_active (BAMF_VIEW (m_App));
50
running = bamf_view_is_running (BAMF_VIEW (m_App));
54
appInfo = g_desktop_app_info_new_from_filename (bamf_application_get_desktop_file (BAMF_APPLICATION (m_App)));
55
g_app_info_launch (G_APP_INFO (appInfo), NULL, NULL, NULL);
56
g_object_unref (appInfo);
62
std::list<Window> windowList;
63
for (l = children; l; l = l->next)
65
view = (BamfView *) l->data;
67
if (BAMF_IS_WINDOW (view))
69
guint32 xid = bamf_window_get_xid (BAMF_WINDOW (view));
71
windowList.push_back ((Window) xid);
75
if (windowList.size () > 1)
77
std::string *match = PluginAdapter::Default ()->MatchStringForXids (&windowList);
78
PluginAdapter::Default ()->InitiateScale (match);
84
for (l = children; l; l = l->next)
86
view = (BamfView *) l->data;
88
if (BAMF_IS_WINDOW (view))
90
guint32 xid = bamf_window_get_xid (BAMF_WINDOW (view));
92
CompWindow *window = m_Screen->findWindow ((Window) xid);
102
BamfLauncherIcon::OnClosed (BamfView *view, gpointer data)
104
BamfLauncherIcon *self = (BamfLauncherIcon *) data;
106
if (!bamf_view_is_sticky (BAMF_VIEW (self->m_App)))
111
BamfLauncherIcon::OnUserVisibleChanged (BamfView *view, gboolean visible, gpointer data)
113
BamfLauncherIcon *self = (BamfLauncherIcon *) data;
115
if (!bamf_view_is_sticky (BAMF_VIEW (self->m_App)))
116
self->SetVisible (visible);
120
BamfLauncherIcon::OnRunningChanged (BamfView *view, gboolean running, gpointer data)
122
BamfLauncherIcon *self = (BamfLauncherIcon *) data;
123
self->SetRunning (running);
127
BamfLauncherIcon::OnActiveChanged (BamfView *view, gboolean active, gpointer data)
129
BamfLauncherIcon *self = (BamfLauncherIcon *) data;
130
self->SetActive (active);