mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 03:19:43 +02:00
Systray on Unix needs to write user specific file to /tmp, merge request !92
(cherry picked from commit bbcc02153f
)
This commit is contained in:
parent
9356b3001c
commit
f3b50444bf
@ -149,7 +149,6 @@ type
|
|||||||
to load icons for AppIndicator is through files }
|
to load icons for AppIndicator is through files }
|
||||||
|
|
||||||
const
|
const
|
||||||
IconThemePath = '/tmp/appindicators/';
|
|
||||||
IconType = 'png';
|
IconType = 'png';
|
||||||
|
|
||||||
{ It seems to me, and please tell me otherwise if untrue, that you can only
|
{ It seems to me, and please tell me otherwise if untrue, that you can only
|
||||||
@ -159,6 +158,7 @@ var
|
|||||||
GlobalAppIndicator: PAppIndicator;
|
GlobalAppIndicator: PAppIndicator;
|
||||||
GlobalIcon: Pointer;
|
GlobalIcon: Pointer;
|
||||||
GlobalIconPath: string;
|
GlobalIconPath: string;
|
||||||
|
IconThemePath : string;
|
||||||
|
|
||||||
constructor TUnityTrayIconHandle.Create(TrayIcon: TCustomTrayIcon);
|
constructor TUnityTrayIconHandle.Create(TrayIcon: TCustomTrayIcon);
|
||||||
var
|
var
|
||||||
@ -188,7 +188,7 @@ begin
|
|||||||
if GlobalAppIndicator = nil then
|
if GlobalAppIndicator = nil then
|
||||||
{ It seems that icons can only come from files :( }
|
{ It seems that icons can only come from files :( }
|
||||||
GlobalAppIndicator := app_indicator_new_with_path(PChar(FName), PChar(FIconName),
|
GlobalAppIndicator := app_indicator_new_with_path(PChar(FName), PChar(FIconName),
|
||||||
APP_INDICATOR_CATEGORY_APPLICATION_STATUS, IconThemePath);
|
APP_INDICATOR_CATEGORY_APPLICATION_STATUS, PChar(IconThemePath));
|
||||||
Update;
|
Update;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -342,6 +342,8 @@ end;
|
|||||||
initialization
|
initialization
|
||||||
GlobalAppIndicator := nil;
|
GlobalAppIndicator := nil;
|
||||||
GlobalIconPath := '';
|
GlobalIconPath := '';
|
||||||
|
IconThemePath := '/tmp/appindicators-' + GetEnvironmentVariable('USER') + '/';
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
if FileExists(GlobalIconPath) then
|
if FileExists(GlobalIconPath) then
|
||||||
DeleteFile(GlobalIconPath);
|
DeleteFile(GlobalIconPath);
|
||||||
|
@ -55,7 +55,6 @@ uses gtk3objects; // TGtk3Image
|
|||||||
const
|
const
|
||||||
libappindicator_3 = 'libappindicator3.so.1'; // Unity or Canonical libappindicator3-1
|
libappindicator_3 = 'libappindicator3.so.1'; // Unity or Canonical libappindicator3-1
|
||||||
LibAyatanaAppIndicator = 'libayatana-appindicator3.so.1'; // Ayatana - typically called libayatana-appindicator3-1
|
LibAyatanaAppIndicator = 'libayatana-appindicator3.so.1'; // Ayatana - typically called libayatana-appindicator3-1
|
||||||
IconThemePath = '/tmp/appindicators/'; // We must write our icon to a file.
|
|
||||||
IconType = 'png';
|
IconType = 'png';
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -76,6 +75,7 @@ type
|
|||||||
PAppIndicator = Pointer;
|
PAppIndicator = Pointer;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
IconThemePath : string; // We must write our icon to a file.
|
||||||
{ GlobalAppIndicator creation routines }
|
{ GlobalAppIndicator creation routines }
|
||||||
app_indicator_get_type: function: GType; cdecl;
|
app_indicator_get_type: function: GType; cdecl;
|
||||||
app_indicator_new: function(id, icon_name: PGChar; category: TAppIndicatorCategory): PAppIndicator; cdecl;
|
app_indicator_new: function(id, icon_name: PGChar; category: TAppIndicatorCategory): PAppIndicator; cdecl;
|
||||||
@ -148,7 +148,7 @@ begin
|
|||||||
if GlobalAppIndicator = nil then
|
if GlobalAppIndicator = nil then
|
||||||
{ It seems that icons can only come from files :( }
|
{ It seems that icons can only come from files :( }
|
||||||
GlobalAppIndicator := app_indicator_new_with_path(PChar(FName), PChar(FIconName),
|
GlobalAppIndicator := app_indicator_new_with_path(PChar(FName), PChar(FIconName),
|
||||||
APP_INDICATOR_CATEGORY_APPLICATION_STATUS, IconThemePath);
|
APP_INDICATOR_CATEGORY_APPLICATION_STATUS, PChar(IconThemePath));
|
||||||
Update;
|
Update;
|
||||||
{$ifdef DEBUGAPPIND}
|
{$ifdef DEBUGAPPIND}
|
||||||
case app_indicator_get_status(GlobalAppIndicator) of
|
case app_indicator_get_status(GlobalAppIndicator) of
|
||||||
@ -296,6 +296,8 @@ end;
|
|||||||
initialization
|
initialization
|
||||||
GlobalAppIndicator := nil;
|
GlobalAppIndicator := nil;
|
||||||
GlobalIconPath := '';
|
GlobalIconPath := '';
|
||||||
|
IconThemePath := '/tmp/appindicators-' + GetEnvironmentVariable('USER') + '/';
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
if FileExists(GlobalIconPath) then
|
if FileExists(GlobalIconPath) then
|
||||||
DeleteFile(GlobalIconPath);
|
DeleteFile(GlobalIconPath);
|
||||||
|
Loading…
Reference in New Issue
Block a user