mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
refersh icon when gtk icon theme changed
Change-Id: Ice7500f6526dc04d8a920c301dc3f08c9d1eb6b3
This commit is contained in:
parent
85e6450a8d
commit
47bbc404a7
Notes:
Deepin Code Review
2016-08-18 09:23:59 +00:00
Verified+1: Anonymous Coward #1000004 Verified+1: Anonymous Coward #1000426 Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Thu, 18 Aug 2016 09:23:59 +0000 Reviewed-on: https://cr.deepin.io/15333 Project: dde/dde-dock Branch: refs/heads/master
@ -37,6 +37,12 @@ bool DockItemController::itemIsInContainer(DockItem * const item) const
|
||||
return m_containerItem->contains(item);
|
||||
}
|
||||
|
||||
void DockItemController::refershItemsIcon()
|
||||
{
|
||||
for (auto item : m_itemList)
|
||||
item->refershIcon();
|
||||
}
|
||||
|
||||
void DockItemController::updatePluginsItemOrderKey()
|
||||
{
|
||||
Q_ASSERT(sender() == m_updatePluginsOrderTimer);
|
||||
|
@ -31,6 +31,7 @@ signals:
|
||||
void itemManaged(DockItem *item) const;
|
||||
|
||||
public slots:
|
||||
void refershItemsIcon();
|
||||
void updatePluginsItemOrderKey();
|
||||
void itemMove(DockItem * const moveItem, DockItem * const replaceItem);
|
||||
void itemDroppedIntoContainer(DockItem * const item);
|
||||
|
@ -88,6 +88,12 @@ int AppItem::itemBaseWidth()
|
||||
return itemBaseHeight() * 1.4;
|
||||
}
|
||||
|
||||
void AppItem::refershIcon()
|
||||
{
|
||||
updateIcon();
|
||||
update();
|
||||
}
|
||||
|
||||
int AppItem::itemBaseHeight()
|
||||
{
|
||||
if (DockDisplayMode == Efficient)
|
||||
|
@ -21,6 +21,9 @@ public:
|
||||
|
||||
inline ItemType itemType() const {return App;}
|
||||
|
||||
public slots:
|
||||
void refershIcon();
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void mouseReleaseEvent(QMouseEvent *e);
|
||||
|
@ -33,6 +33,9 @@ public:
|
||||
|
||||
inline virtual ItemType itemType() const = 0;
|
||||
|
||||
public slots:
|
||||
virtual void refershIcon() {}
|
||||
|
||||
signals:
|
||||
void dragStarted() const;
|
||||
void itemDropped(QObject *destination) const;
|
||||
|
@ -78,6 +78,12 @@ void PluginsItem::setInContainer(const bool container)
|
||||
m_pluginInter->setItemIsInContainer(m_itemKey, container);
|
||||
}
|
||||
|
||||
void PluginsItem::refershIcon()
|
||||
{
|
||||
// TODO: update theme icon
|
||||
update();
|
||||
}
|
||||
|
||||
void PluginsItem::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
QWidget::mousePressEvent(e);
|
||||
|
@ -24,6 +24,9 @@ public:
|
||||
|
||||
inline ItemType itemType() const {return Plugins;}
|
||||
|
||||
public slots:
|
||||
void refershIcon();
|
||||
|
||||
private:
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define ICON_SIZE_MEDIUM 36
|
||||
#define ICON_SIZE_SMALL 30
|
||||
#define FASHION_MODE_PADDING 30
|
||||
#define PROP_GTK_ICON_THEME_NAME "gtk-icon-theme-name"
|
||||
|
||||
DockSettings::DockSettings(QWidget *parent)
|
||||
: QObject(parent),
|
||||
@ -106,6 +107,10 @@ DockSettings::DockSettings(QWidget *parent)
|
||||
connect(m_displayInter, &DBusDisplay::ScreenHeightChanged, this, &DockSettings::primaryScreenChanged, Qt::QueuedConnection);
|
||||
connect(m_displayInter, &DBusDisplay::ScreenWidthChanged, this, &DockSettings::primaryScreenChanged, Qt::QueuedConnection);
|
||||
|
||||
// monitor gtk icon theme changed
|
||||
GtkSettings *gs = gtk_settings_get_default();
|
||||
g_signal_connect(gs, "notify::" PROP_GTK_ICON_THEME_NAME, G_CALLBACK(gtkIconThemeChanged), m_itemController);
|
||||
|
||||
calculateWindowConfig();
|
||||
resetFrontendGeometry();
|
||||
}
|
||||
@ -416,3 +421,14 @@ void DockSettings::calculateWindowConfig()
|
||||
|
||||
resetFrontendGeometry();
|
||||
}
|
||||
|
||||
void DockSettings::gtkIconThemeChanged(GtkSettings *gs, GParamSpec *pspec, gpointer udata)
|
||||
{
|
||||
Q_UNUSED(gs)
|
||||
Q_ASSERT(udata);
|
||||
Q_ASSERT(!strcmp(g_param_spec_get_name(pspec), PROP_GTK_ICON_THEME_NAME));
|
||||
|
||||
DockItemController *itemController = static_cast<DockItemController *>(udata);
|
||||
|
||||
itemController->refershItemsIcon();
|
||||
}
|
||||
|
@ -13,6 +13,17 @@
|
||||
#include <QObject>
|
||||
#include <QSize>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#ifdef signals
|
||||
#undef signals
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#undef signals
|
||||
#define signals public
|
||||
}
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
|
||||
using namespace Dock;
|
||||
@ -58,11 +69,11 @@ private slots:
|
||||
void hideStateChanegd();
|
||||
void dockItemCountChanged();
|
||||
void primaryScreenChanged();
|
||||
|
||||
void resetFrontendGeometry();
|
||||
|
||||
private:
|
||||
void calculateWindowConfig();
|
||||
static void gtkIconThemeChanged(GtkSettings *gs, GParamSpec *pspec, gpointer udata);
|
||||
|
||||
private:
|
||||
int m_iconSize;
|
||||
|
Loading…
x
Reference in New Issue
Block a user