Changeset View
Changeset View
Standalone View
Standalone View
gmenu-dbusmenu-proxy/menuproxy.cpp
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 91 | if (QDBusConnection::sessionBus().interface()->isServiceRegistered(s_dbusMenuRegistrar)) { | |||
---|---|---|---|---|---|
93 | init(); | 93 | init(); | ||
94 | } else { | 94 | } else { | ||
95 | qCDebug(DBUSMENUPROXY) << "No global menu service available, waiting for it to start before doing anything"; | 95 | qCDebug(DBUSMENUPROXY) << "No global menu service available, waiting for it to start before doing anything"; | ||
96 | 96 | | |||
97 | // be sure when started to restore gtk menus when there's no dbus menu around in case we crashed | 97 | // be sure when started to restore gtk menus when there's no dbus menu around in case we crashed | ||
98 | enableGtkSettings(false); | 98 | enableGtkSettings(false); | ||
99 | } | 99 | } | ||
100 | 100 | | |||
101 | // kde-gtk-config just deletes and re-creates the gtkrc-2.0, watch this and add out config to it again | 101 | // kde-gtk-config just deletes and re-creates the gtkrc-2.0, watch this and add our config to it again | ||
102 | m_writeGtk2SettingsTimer->setSingleShot(true); | 102 | m_writeGtk2SettingsTimer->setSingleShot(true); | ||
103 | m_writeGtk2SettingsTimer->setInterval(1000); | 103 | m_writeGtk2SettingsTimer->setInterval(1000); | ||
104 | connect(m_writeGtk2SettingsTimer, &QTimer::timeout, this, &MenuProxy::writeGtk2Settings); | 104 | connect(m_writeGtk2SettingsTimer, &QTimer::timeout, this, &MenuProxy::writeGtk2Settings); | ||
105 | 105 | | |||
106 | auto startGtk2SettingsTimer = [this] { | 106 | auto startGtk2SettingsTimer = [this] { | ||
107 | if (!m_writeGtk2SettingsTimer->isActive()) { | 107 | if (!m_writeGtk2SettingsTimer->isActive()) { | ||
108 | m_writeGtk2SettingsTimer->start(); | 108 | m_writeGtk2SettingsTimer->start(); | ||
109 | } | 109 | } | ||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | |||||
173 | 173 | | |||
174 | QString MenuProxy::gtk3SettingsIniPath() | 174 | QString MenuProxy::gtk3SettingsIniPath() | ||
175 | { | 175 | { | ||
176 | return QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1String("/gtk-3.0/settings.ini"); | 176 | return QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1String("/gtk-3.0/settings.ini"); | ||
177 | } | 177 | } | ||
178 | 178 | | |||
179 | void MenuProxy::writeGtk2Settings() | 179 | void MenuProxy::writeGtk2Settings() | ||
180 | { | 180 | { | ||
181 | QFile rcFile(gtkRc2Path()); | ||||
182 | if (!rcFile.exists()) { | ||||
183 | // Don't create it here, that would break writing default GTK-2.0 settings on first login, | ||||
184 | // as the gtkbreeze kconf_update script only does so if it does not exist | ||||
185 | return; | ||||
186 | } | ||||
187 | | ||||
181 | qCDebug(DBUSMENUPROXY) << "Writing gtkrc-2.0 to" << (m_enabled ? "enable" : "disable") << "global menu support"; | 188 | qCDebug(DBUSMENUPROXY) << "Writing gtkrc-2.0 to" << (m_enabled ? "enable" : "disable") << "global menu support"; | ||
182 | 189 | | |||
183 | QFile rcFile(gtkRc2Path()); | | |||
184 | if (!rcFile.open(QIODevice::ReadWrite | QIODevice::Text)) { | 190 | if (!rcFile.open(QIODevice::ReadWrite | QIODevice::Text)) { | ||
185 | return; | 191 | return; | ||
186 | } | 192 | } | ||
187 | 193 | | |||
188 | QByteArray content; | 194 | QByteArray content; | ||
189 | 195 | | |||
190 | QStringList gtkModules; | 196 | QStringList gtkModules; | ||
191 | 197 | | |||
▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines |