MakeIcon.module

Post

Posted
Rating:
#1 (In Topic #465)
Banned
Want your apps to make their own launcher?

MakeIcon.module written by Bruce Steers
Have your gambas application create it's own launcher icon as either a desktop launcher or
a menu entry.

Simply add (Import) the MakeIcon.module to your app then you can use the following command…
# MakeIcon.MakeMe(Name, Icon Image, Comment, MenuCats, Prefix, UseRoot)

'Name' is the desktop icon name or the menu entry text and is optional,
    Defaults to Application.Name

'Icon Image' is the icon 'Image' to use, must be a loaded Image object not just a filepath.
    Defaults to the Applications main form icon.

'Comment' is the tooltip shown. Defaults to Application.Name

'MenuCats' Semicolon separated list of categories that define where the menu entry appears
  Eg. Application;AudioVideo;Video
  This property acts as a switch, if supplied it makes a menu entry, if ommited it makes
  a desktop launcher.
  Use the word 'choose' to pop a requester to ask the user to choose categories.

'Prefix' any text to prefix your launcher command, Ie 'pkexec gbr3'
  Defaults to 'gbr3'

'UseRoot', Boolean toggle , If True and your app is running as root the launcher will be added to 'roots'
   desktop or menu. By default the launcher will add to default Users home not root.

Example Usage…

Code

MakeIcon.MakeMe(File.BaseName(Application.Name), FMain.Icon.Image, "MediaPlay TVShow Player")
 Creates a Desktop Icon with apps name (without extension) and icon and sets the descriptive "comment"
  

Code

MakeIcon.MakeMe(,, "MediaPlay TVShow Player", "Application;GNOME;AudioVideo;Video")
Creates a Menu item using app name and app icon with descriptive "comment" in the audio/video section

Code

MakeIcon.MakeMe(,, "MediaPlay TVShow Player", "choose")
Makes menu entry with app name, sets comment and asks user to select menu categories

Code

MakeIcon.MakeMe(, Image.Load("./FunkyIcon.png"))
Makes Desktop launcher with App name, an image from the app dir (comment will be app name)

Code

MakeIcon.MakeMe()
Makes a Desktop launcher with App name, Apps main form icon (comment is App name)

Tested on latest Debian / Ubuntu / Mint
Online now: No Back to the top

Post

Posted
Rating:
#2
Banned
 I found a bug i'd missed after adding some arguments (Prefix and UseRoot)
When using the "choose" option it stored the calling args but i hadn't updated the call to include the additional parameters.

Have fixed it now..
Online now: No Back to the top
1 guest and 0 members have just viewed this.