Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Icon Library
Icon Library
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 10
    • Issues 10
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 1
    • Merge Requests 1
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • World
  • Design Tooling
  • Icon LibraryIcon Library
  • Merge Requests
  • !5

Merged
Opened Aug 26, 2019 by Bilal Elmoussaoui@bilelmoussaouiOwner

Add a search provider

  • Overview 2
  • Commits 4
  • Pipelines 4
  • Changes 22

This refactors the code a bit to allow having a search provider easily.

Sadly, we can't show the nonsystem icons (the icon dev kit ones) as themed icons, so they are not recolored.

Per the GNOME Shell Provider API v2: the results could contain an icon https://gitlab.gnome.org/GNOME/gnome-shell/blob/master/js/ui/remoteSearch.js#L219-228. As those icons are not available in the user's system, we can't load them with an icon name.


    let gfile = gio::File::new_for_path(icon_path);
    let (gbytes, _) = gfile.load_bytes(gio::NONE_CANCELLABLE).expect("Failed to read icon bytes");
    let gicon = gio::BytesIcon::new(&gbytes);

    let variant = gicon.serialize().unwrap();
    let gbytes = unsafe { // GVariant is not that supported with the current gtk-rs :/
        let bytes_variant = glib_sys::g_variant_get_child_value(variant.to_glib_none().0, 1);
        let bytes: glib::Bytes = from_glib_full(glib_sys::g_variant_get_data_as_bytes(bytes_variant));
        bytes
    };
    let bytes: Vec<u8> = gbytes.to_vec();
    hashmap.insert("icon".to_string(), arg::Variant(Box::new(("bytes".to_string(), arg::Variant(Box::new(bytes))))));

Which gives such results

Screenshot_from_2019-08-26_06-05-01

Screenshot_from_2019-08-26_06-03-44

Screenshot_from_2019-08-26_06-05-20

Closes #6 (closed)

Edited Sep 10, 2019 by Bilal Elmoussaoui
Assignee
Assign to
Reviewer
Request review from
0.0.2
Milestone
0.0.2
Assign milestone
Time tracking
Reference: World/design/icon-library!5
Source branch: search-provider

Revert this merge request

This will create a new commit in order to revert the existing changes.

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.