Synchronize AppMenu availability check with Qt
This commit is contained in:
		
							parent
							
								
									a7764f84f0
								
							
						
					
					
						commit
						41d39012d2
					
				
					 1 changed files with 14 additions and 5 deletions
				
			
		| 
						 | 
					@ -238,9 +238,13 @@ QIcon TrayIconGen(int counter, bool muted) {
 | 
				
			||||||
bool IsIndicatorApplication() {
 | 
					bool IsIndicatorApplication() {
 | 
				
			||||||
	// Hack for indicator-application, which doesn't handle icons sent across D-Bus:
 | 
						// Hack for indicator-application, which doesn't handle icons sent across D-Bus:
 | 
				
			||||||
	// save the icon to a temp file and set the icon name to that filename.
 | 
						// save the icon to a temp file and set the icon name to that filename.
 | 
				
			||||||
	static const auto IndicatorApplication = [&] {
 | 
						static const auto IndicatorApplication = [] {
 | 
				
			||||||
		const auto interface = QDBusConnection::sessionBus().interface();
 | 
							const auto interface = QDBusConnection::sessionBus().interface();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (!interface) {
 | 
				
			||||||
 | 
								return false;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		const auto ubuntuIndicator = interface->isServiceRegistered(
 | 
							const auto ubuntuIndicator = interface->isServiceRegistered(
 | 
				
			||||||
			qsl("com.canonical.indicator.application"));
 | 
								qsl("com.canonical.indicator.application"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -338,10 +342,15 @@ quint32 djbStringHash(QString string) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
 | 
					#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
 | 
				
			||||||
bool AppMenuSupported() {
 | 
					bool AppMenuSupported() {
 | 
				
			||||||
	static const auto Available = QDBusInterface(
 | 
						static const auto Available = []() -> bool {
 | 
				
			||||||
		kAppMenuService.utf16(),
 | 
							const auto interface = QDBusConnection::sessionBus().interface();
 | 
				
			||||||
		kAppMenuObjectPath.utf16(),
 | 
					
 | 
				
			||||||
		kAppMenuInterface.utf16()).isValid();
 | 
							if (!interface) {
 | 
				
			||||||
 | 
								return false;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							return interface->isServiceRegistered(kAppMenuService.utf16());
 | 
				
			||||||
 | 
						}();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return Available;
 | 
						return Available;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue