Fix desktop-id notification edge case (#12216)
* Fix desktop-id notification edge case * Extract-method platform_util::GetDesktopName() This removes duplicated code from libnotify_notifications.cc and atom/common/linux/application_info.cc. * Check for empty case in GetDesktopName(). * Move GetDesktopName() to brightray::util * Remove unnecessary changes in platform_util * Add a brightray::platform_util namespace
This commit is contained in:
parent
86af20ded0
commit
dd2c2660b9
5 changed files with 62 additions and 8 deletions
|
@ -13,6 +13,7 @@
|
|||
#include "atom/common/atom_version.h"
|
||||
#include "base/environment.h"
|
||||
#include "base/logging.h"
|
||||
#include "brightray/common/platform_util.h"
|
||||
#include "chrome/browser/ui/libgtkui/gtk_util.h"
|
||||
|
||||
namespace {
|
||||
|
@ -20,10 +21,8 @@ namespace {
|
|||
GDesktopAppInfo* get_desktop_app_info() {
|
||||
GDesktopAppInfo * ret = nullptr;
|
||||
|
||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||
const std::string desktop_id = libgtkui::GetDesktopName(env.get());
|
||||
const char * libcc_default_id = "chromium-browser.desktop";
|
||||
if (!desktop_id.empty() && (desktop_id != libcc_default_id))
|
||||
std::string desktop_id;
|
||||
if (brightray::platform_util::GetDesktopName(&desktop_id))
|
||||
ret = g_desktop_app_info_new(desktop_id.c_str());
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue