Skip to content

Commit

Permalink
[linux] Remove <uuid/uuid.h>
Browse files Browse the repository at this point in the history
  • Loading branch information
lijy91 committed Nov 17, 2021
1 parent af50554 commit 017633b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 3 additions & 0 deletions lib/src/tray_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:convert';
import 'dart:io';
import 'dart:ui';
import 'package:path/path.dart' as path;
import 'package:uuid/uuid.dart';

import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
Expand All @@ -28,6 +29,7 @@ class TrayManager {

Map<int, MenuItem> _itemMap = {};
int _lastItemId = 0;
String _id = Uuid().v4();

ObserverList<TrayListener> _listeners = ObserverList<TrayListener>();

Expand Down Expand Up @@ -91,6 +93,7 @@ class TrayManager {
String base64Icon = base64Encode(imageData.buffer.asUint8List());

final Map<String, dynamic> arguments = {
'id': _id,
'iconPath': path.joinAll([
path.dirname(Platform.resolvedExecutable),
'data/flutter_assets',
Expand Down
7 changes: 1 addition & 6 deletions linux/tray_manager_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cstring>
#include <map>
#include <algorithm>
#include <uuid/uuid.h>
#include <libappindicator/app-indicator.h>

#define TRAY_MANAGER_PLUGIN(obj) \
Expand Down Expand Up @@ -101,18 +100,14 @@ static FlMethodResponse *destroy(TrayManagerPlugin *self,
static FlMethodResponse *set_icon(TrayManagerPlugin *self,
FlValue *args)
{
const char *id = fl_value_get_string(fl_value_lookup_string(args, "id"));
const char *icon_path = fl_value_get_string(fl_value_lookup_string(args, "iconPath"));

if (!menu)
menu = gtk_menu_new();

if (!indicator)
{
char id[UUID_STR_LEN] = {0};
uuid_t out;
uuid_generate(out);
uuid_unparse_lower(out, id);

indicator = app_indicator_new(id, icon_path, APP_INDICATOR_CATEGORY_APPLICATION_STATUS);

app_indicator_set_menu(indicator, GTK_MENU(menu));
Expand Down

0 comments on commit 017633b

Please sign in to comment.