
322 changed files with 24747 additions and 13048 deletions
File diff suppressed because it is too large
Before Width: | Height: | Size: 611 B |
Before Width: | Height: | Size: 727 B |
Before Width: | Height: | Size: 539 B |
@ -1,37 +0,0 @@ |
|||
Running ./create-do.py will parse JS code in js/ui/ into html documentation. |
|||
|
|||
The html files will be created in Cinnamon/doc/output-html/ |
|||
|
|||
Format of Documentation |
|||
======================= |
|||
Functions |
|||
--------- |
|||
/** |
|||
* function_name: |
|||
* @agrument_one (ArgumentType): argument description |
|||
* @agrument_two (ArgumentType): argument description |
|||
* |
|||
* How the function works. Long description (capitalize first letter) |
|||
* |
|||
* Returns (ReturnType): what the function returns |
|||
*/ |
|||
|
|||
Objects |
|||
------- |
|||
/** |
|||
* #ObjectName: |
|||
* @variable1_of_object (VarType): variable description |
|||
* @variable2_of_object (VarType): variable description |
|||
* |
|||
* Description of object |
|||
*/ |
|||
|
|||
File |
|||
---- |
|||
/** |
|||
* FILE:filename.js |
|||
* |
|||
* Description of file |
|||
*/ |
|||
|
|||
|
@ -1,64 +0,0 @@ |
|||
#!/usr/bin/env python |
|||
#-*- indent-tabs-mode: nil-*- |
|||
|
|||
import sys |
|||
import os |
|||
import shutil |
|||
import jstoxml |
|||
import xmltohtml |
|||
|
|||
CURRDIR = os.path.abspath(os.path.dirname(sys.argv[0])) + "/" |
|||
JS_DIR = CURRDIR + "../js/ui/" |
|||
XML_DIR = CURRDIR + "output-xml/" |
|||
HTML_DIR = CURRDIR + "output-html/" |
|||
|
|||
if __name__ == "__main__": |
|||
files = os.listdir(JS_DIR) |
|||
files.sort() |
|||
try: |
|||
os.mkdir(XML_DIR) |
|||
except Exception: |
|||
pass |
|||
|
|||
try: |
|||
os.mkdir(HTML_DIR) |
|||
except Exception: |
|||
pass |
|||
|
|||
errors = [] # Store the files that failed to parse |
|||
# Removing them in loop will break the loop |
|||
for _file in files: |
|||
print "Parsing " + _file |
|||
__file = _file[:-3] |
|||
|
|||
try: |
|||
xml = jstoxml.convertJStoXML(JS_DIR + __file + ".js") |
|||
xml.write(XML_DIR + __file + ".xml") |
|||
|
|||
html = xmltohtml.convertXMLtoHTML(XML_DIR + __file + ".xml") |
|||
open(HTML_DIR + __file + ".html", "w").write(html) |
|||
except: |
|||
print "Error parsing " + _file + ". Skipping" |
|||
errors.append(_file) |
|||
|
|||
shutil.copy2('style.css', HTML_DIR) |
|||
|
|||
html = [] |
|||
html.extend(["<!DOCTYPE html>", |
|||
"<html>", |
|||
"<head>", |
|||
"<title>Cinnamon Documentation Index</title>", |
|||
"<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />\n</head>", |
|||
"<body>", |
|||
"<p class=\"page-header\">Cinnamon JS Documentation</p>", |
|||
"<ul class=\"index-page-list\">"]) |
|||
|
|||
for _file in files: |
|||
if _file not in errors: |
|||
html.extend(["<li><a href=\"%s.html\">%s</a></li>" % (_file[:-3], _file)]) |
|||
|
|||
html.extend(["</ul>", |
|||
"</body>", |
|||
"</html>"]) |
|||
open(HTML_DIR + "index.html", "w").write("\n".join(html)) |
|||
|
@ -1,250 +0,0 @@ |
|||
#!/usr/bin/env python |
|||
#-*- indent-tabs-mode: nil-*- |
|||
|
|||
|
|||
import sys |
|||
import io |
|||
import os |
|||
import xml.etree.ElementTree as ET |
|||
|
|||
# Constant objects |
|||
ITEM_TYPE_OBJECT = 0 |
|||
ITEM_TYPE_FUNCTION = 1 |
|||
ITEM_TYPE_FILE = 2 |
|||
|
|||
# Reads a file and return the lines (as an array) |
|||
def readFile(filename): |
|||
_file = open(filename, "r") |
|||
content = _file.readlines() |
|||
_file.close() |
|||
return content |
|||
|
|||
# Gets a "function block", i.e. those starting and ending with "{" and "}", |
|||
# e.g. a function/prototype declaration |
|||
# |
|||
# Returns [start, end], where "start" and "end" are the line numbers of the start and end of the block |
|||
def getFunctionBlock(lines, init_line = 0): |
|||
brackets = 0 # Number of "{" - Number of "}" |
|||
start = 0 # Starting line number of the block |
|||
end = 0 # Ending line number of the block |
|||
|
|||
i = init_line |
|||
try: |
|||
while "{" not in lines[i]: |
|||
i = i + 1 |
|||
# Now we are at the first line of the block |
|||
start = i |
|||
brackets = brackets + lines[i].count("{") - lines[i].count("}") |
|||
except: |
|||
start = i-1 |
|||
|
|||
try: |
|||
while brackets > 0: |
|||
i = i + 1 |
|||
brackets = brackets + lines[i].count("{") - lines[i].count("}") |
|||
end = i |
|||
except: |
|||
end = i - 1 |
|||
|
|||
return [start,end] |
|||
|
|||
def getCommentBlock(lines, init_line = 0): |
|||
i = init_line |
|||
try: |
|||
while "/**" not in lines[i]: |
|||
i = i + 1 |
|||
except: |
|||
i = i - 1 |
|||
|
|||
start = i |
|||
try: |
|||
while "*/" not in lines[i]: |
|||
i = i + 1 |
|||
except: |
|||
i = i - 1 |
|||
|
|||
end = i |
|||
return [start,end] |
|||
|
|||
def parseCommentBlock(lines): |
|||
try: |
|||
del lines[0], lines[-1] # Strip first and last line |
|||
|
|||
itemType = None |
|||
itemName = "" |
|||
itemProps = [] |
|||
itemDescription = "" |
|||
|
|||
# Parse the file |
|||
# Strip the " * " part |
|||
for i in range(len(lines)): |
|||
lines[i] = lines[i].lstrip() |
|||
lines[i] = lines[i][1:] |
|||
lines[i] = lines[i].lstrip() |
|||
lines[i] = lines[i].replace("\n", "") |
|||
|
|||
nameLine = lines[0].strip() |
|||
if nameLine.find("#") == 0: |
|||
itemType = ITEM_TYPE_OBJECT |
|||
itemName = nameLine[1:] |
|||
elif nameLine.find("FILE:") == 0: |
|||
itemType = ITEM_TYPE_FILE |
|||
itemName = nameLine[5:].lstrip() |
|||
else: |
|||
itemType = ITEM_TYPE_FUNCTION |
|||
itemName = nameLine |
|||
|
|||
itemName = itemName.replace(":","") # Remove the : at the end of definition |
|||
|
|||
del lines[0] |
|||
|
|||
# Item properties |
|||
propName = "" |
|||
i = 0 |
|||
while len(lines) > 0 and len(lines[0].strip()) != 0: |
|||
line = lines[0] |
|||
if ("@" in line): |
|||
line = line[1:] # Strip "@" sign |
|||
propName = line[:line.find(":")].encode() |
|||
line = line[line.find(":")+1:] |
|||
itemProps.append([propName, ""]) |
|||
itemProps[-1][1] = itemProps[-1][1] + line + " " |
|||
del lines[0] |
|||
|
|||
# Item description |
|||
if len(lines) > 0: |
|||
del lines[0] # Remove separating linebreak |
|||
|
|||
while len(lines) > 0 and lines[0].find("Returns") == -1: |
|||
itemDescription = itemDescription + " " + lines[0].strip() |
|||
del lines[0] |
|||
|
|||
itemDescription = itemDescription.replace(" ", "\n\n") |
|||
|
|||
# Return data |
|||
returnData = " ".join(lines) |
|||
if len(returnData.strip()) > 0: |
|||
returnData = returnData.strip()[7:] # Strip "Returns" |
|||
returnData = returnData.split(":") # Split into return type and |
|||
returnData[0] = returnData[0].strip() # Strip whitespaces again |
|||
returnData[0] = returnData[0][1:-1] # Remove brackets |
|||
|
|||
returnData[1] = returnData[1].strip() # Strip whitespaces |
|||
else: |
|||
returnData = ["void", None] |
|||
|
|||
|
|||
return [itemType, itemName, itemProps, itemDescription, returnData] |
|||
except Exception: |
|||
return [None, None, None, None, None] |
|||
|
|||
def addVariables(element, variables): |
|||
for i in variables: |
|||
_name = i[0] |
|||
_desc = i[1] |
|||
hasType = "(" in _name |
|||
if hasType: |
|||
propName = _name[:_name.find("(")].strip() |
|||
propType = _name[_name.find("(") + 1: _name.rfind(")")] |
|||
else: |
|||
propName = _name |
|||
propType = "" |
|||
prop = ET.SubElement(element, 'prop', {'name': propName, 'type': propType}) |
|||
prop.text = _desc |
|||
|
|||
def createFunctionElement(element, itemName, itemProps, itemDescription, itemReturn): |
|||
name = ET.SubElement(element, 'name') |
|||
name.text = itemName |
|||
|
|||
desc = ET.SubElement(element, 'description') |
|||
desc.text = itemDescription |
|||
|
|||
addVariables(element, itemProps) |
|||
|
|||
# Set the return |
|||
ret = ET.SubElement(element, 'return', {'type': itemReturn[0]}) |
|||
if itemReturn[1]: |
|||
ret.text = itemReturn[1] |
|||
|
|||
return element |
|||
|
|||
def convertJStoXML(filename): |
|||
lines = readFile(filename) |
|||
shortFileName = filename[filename.rfind("/")+1:] |
|||
root = ET.Element('file') |
|||
name = ET.SubElement(root, 'name') |
|||
name.text = shortFileName |
|||
|
|||
xmlTree = ET.ElementTree(root) |
|||
|
|||
while (len(lines)> 0): |
|||
[start, end] = getCommentBlock(lines) |
|||
if start == end: |
|||
break |
|||
newlines = lines[start:end+1] |
|||
|
|||
[itemType, itemName, itemProps, itemDescription, itemReturn] = parseCommentBlock(newlines) |
|||
if itemType == ITEM_TYPE_FILE: |
|||
# Check that this refers to the current file |
|||
if itemName != shortFileName: |
|||
del lines[:end] |
|||
continue; |
|||
|
|||
desc = ET.SubElement(root, 'description') |
|||
desc.text = itemDescription |
|||
|
|||
addVariables(root, itemProps) |
|||
if itemType == ITEM_TYPE_FUNCTION: |
|||
# Check that this refers to the correct function |
|||
_start = end |
|||
[_start, _end] = getFunctionBlock(lines, _start) |
|||
if "function" + itemName + "(" not in lines[_start].replace(" ",""): |
|||
del lines[:_end] |
|||
continue |
|||
|
|||
element = ET.SubElement(root, 'function') |
|||
createFunctionElement(element, itemName, itemProps, itemDescription, itemReturn) |
|||
|
|||
|
|||
if itemType == ITEM_TYPE_OBJECT: |
|||
element = ET.SubElement(root, 'object') |
|||
|
|||
name = ET.SubElement(element, 'name') |
|||
name.text = itemName |
|||
|
|||
desc = ET.SubElement(element, 'description') |
|||
desc.text = itemDescription |
|||
|
|||
addVariables(element, itemProps) |
|||
|
|||
# Find range of object declaration |
|||
_start = end |
|||
[_start, _end] = getFunctionBlock(lines, _start) |
|||
|
|||
while lines[_start].strip().find(itemName + ".prototype") != 0: |
|||
_start = _end |
|||
[_start, _end] = getFunctionBlock(lines, _start) |
|||
|
|||
inlines = lines[_start:_end+1] |
|||
end = _end |
|||
|
|||
# Parse the functions inside |
|||
while len(inlines) > 0: |
|||
[inStart, inEnd] = getCommentBlock(inlines) |
|||
if inStart == inEnd: |
|||
break |
|||
newLines = inlines[inStart:inEnd+1] |
|||
[itemType, itemName, itemProps, itemDescription, itemReturn] = parseCommentBlock(newLines) |
|||
if itemType == ITEM_TYPE_FUNCTION: |
|||
__start = inStart |
|||
[__start, __end] = getFunctionBlock(inlines, __start) |
|||
if itemName + ":function(" not in inlines[__start].replace(" ", ""): |
|||
del inlines[:__end] |
|||
continue |
|||
subelement = ET.SubElement(element, 'function') |
|||
createFunctionElement(subelement, itemName, itemProps, itemDescription, itemReturn) |
|||
|
|||
del inlines[:inEnd] |
|||
del lines[:end] |
|||
|
|||
return xmlTree |
@ -1,82 +0,0 @@ |
|||
body { |
|||
} |
|||
.page-header { |
|||
font-size: 180%; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
h2 { |
|||
font-family: Cantarell, 'Droid Sans', Ubuntu, 'DejaVu Sans', Arial, sans-serif; |
|||
color: #0489b7; |
|||
} |
|||
.index-page-list { |
|||
} |
|||
|
|||
.description{ |
|||
} |
|||
|
|||
.prop-prop-separator { |
|||
color: #babdb6; |
|||
background: #babdb6; |
|||
border: none 0px; |
|||
height: 1px; |
|||
clear: both; |
|||
} |
|||
|
|||
.obj-obj-separator { |
|||
} |
|||
|
|||
.prop-table{ |
|||
background: #eeeeee; |
|||
border: solid 1px #babdb6; |
|||
padding: 0.5em; |
|||
} |
|||
|
|||
.prop-table-return { |
|||
} |
|||
|
|||
.prop-table-name { |
|||
padding-left: 50px; |
|||
} |
|||
|
|||
.prop-table-arg { |
|||
padding-left: 50px; |
|||
} |
|||
|
|||
.prop-table-arg-type { |
|||
color: #666; |
|||
} |
|||
|
|||
.prop-table-arg-name { |
|||
} |
|||
|
|||
.prop-table-line-break { |
|||
height: 5px; |
|||
} |
|||
|
|||
.prop-arg-table { |
|||
padding-left: 50px; |
|||
} |
|||
|
|||
.prop-arg-name { |
|||
background-color: #e5e5e5; |
|||
padding: 2px 5px; |
|||
} |
|||
|
|||
.prop-arg-description { |
|||
padding-left: 5px; |
|||
} |
|||
n |
|||
.prop-return-name { |
|||
background-color: #ccc; |
|||
padding: 2px 5px; |
|||
} |
|||
|
|||
.prop-return-description { |
|||
padding-left: 5px; |
|||
} |
|||
|
|||
.individual-prop-header { |
|||
font-size: 110%; |
|||
font-weight: bold; |
|||
} |
@ -1,189 +0,0 @@ |
|||
#!/usr/bin/env python |
|||
#-*- indent-tabs-mode: nil-*- |
|||
|
|||
import sys |
|||
import io |
|||
import os |
|||
import xml.etree.ElementTree as ET |
|||
|
|||
def loadVarRow(item, elementName, link): |
|||
html = [] |
|||
html.extend(["<tr>", |
|||
"<td><code class=\"prop-table-type\">%s</code></td>" % item[1], |
|||
"<td>"]) |
|||
if link: |
|||
html.extend(["<a href=\"#%s.%s\">" % (elementName, item[0])]) |
|||
|
|||
html.extend(["<code class=\"prop-table-name\">%s</code>" % item[0]]) |
|||
|
|||
if link: |
|||
html.extend(["</a>"]) |
|||
html.extend(["</td>", |
|||
"</tr>"]) |
|||
return html |
|||
|
|||
def loadFunctionRow(item, elementName, link): |
|||
html = [] |
|||
html.extend(["<tr>", |
|||
"<td><code class=\"prop-table-return\">%s</code></td>" % item[3].get("type"), |
|||
"<td>"]) |
|||
if link: |
|||
html.extend(["<a href=\"#%s.%s\">" % (elementName, item[0])]) |
|||
|
|||
html.extend(["<code class=\"prop-table-name\">%s</code>" % item[0]]) |
|||
|
|||
if link: |
|||
html.extend(["</a>"]) |
|||
|
|||
html.extend(["</td>", |
|||
"<td class=\"prop-table-arg\">("]) |
|||
|
|||
for prop in item[2]: |
|||
html.extend(["<code class=\"prop-table-arg-type\">%s</code>" % prop.get("type"), |
|||
"<code class=\"prop-table-arg-name\">%s,</code>"% prop.get("name"), |
|||
"</td></tr><tr><td /><td /><td class=\"prop-table-arg\"> "]) |
|||
if len(item[2]) > 0: |
|||
del html[-1] # Delete the previous end line |
|||
html[-1] = html[-1].replace(",", "") # Delete the comma |
|||
html.extend([")</td>", |
|||
"</tr>"]) |
|||
|
|||
return html |
|||
|
|||
def loadElement(element, elementName): |
|||
html = [] |
|||
|
|||
# Load short description |
|||
for child in element: |
|||
if child.tag == "short-description": |
|||
if child.text: |
|||
html.extend(["<p class=\"short-description\">", |
|||
child.text.replace("\n", "<br />"), |
|||
"</p>"]) |
|||
|
|||
# Load function and variable lists |
|||
var_list = [] |
|||
for child in element: |
|||
if child.tag == "prop": |
|||
var_list.append([child.get("name"), child.get("type"), child.text]) |
|||
|
|||
functions_list = [] |
|||
for child in element: |
|||
if child.tag == "function": |
|||
functions_list.append([child.findtext("name"), child.findtext("description").replace("\n", "<br />"), child.findall("prop"), child.find("return")]) |
|||
|
|||
|
|||
# Load synopsis |
|||
if len(functions_list) > 0 or len(var_list) > 0: |
|||
html.extend(["<h2>Synopsis</h2>"]); |
|||
html.extend(["<table class=\"prop-table\">"]) |
|||
for item in functions_list: |
|||
html.extend(loadFunctionRow(item, elementName, True)) |
|||
html.extend(["<tr class=\"prop-table-line-break\" />"]) |
|||
for item in var_list: |
|||
html.extend(loadVarRow(item, elementName, True)) |
|||
html.extend(["<tr class=\"prop-table-line-break\" />"]) |
|||
html.extend(["</table>"]) |
|||
|
|||
# Load long description |
|||
for child in element: |
|||
if child.tag == "description": |
|||
if child.text: |
|||
html.extend(["<h2>Description</h2>"]); |
|||
html.extend(["<p class=\"description\">", |
|||
child.text.replace("\n", "<br />"), |
|||
"</p>"]) |
|||
break |
|||
|
|||
# Load individual functions |
|||
if len(functions_list) > 0: |
|||
html.extend(["<h2>Details</h2>"]) |
|||
for item in functions_list: |
|||
# Header |
|||
html.extend(["<br /><a id=\"%s.%s\" class=\"individual-prop-header\">%s ()</a>" % (elementName, item[0], item[0])]) |
|||
|
|||
# Table showing format of function (similar to that in function list) |
|||
html.extend(["<table class=\"prop-table\">"]) |
|||
html.extend(loadFunctionRow(item, elementName, False)) |
|||
html.extend(["</table>"]) |
|||
|
|||
# Description of the function |
|||
html.extend(["<p class=\"prop-description\">%s</p>" % item[1]]) |
|||
|
|||
# List arguments and relevant descriptions |
|||
html.extend(["<table class=\"prop-arg-table\">"]) |
|||
if len(item[2]) > 0: |
|||
for prop in item[2]: |
|||
html.extend(["<tr>", |
|||
"<td class=\"prop-arg-name\">", |
|||
prop.get("name"), |
|||
"</td><td class=\"prop-arg-description\">", |
|||
prop.text, |
|||
"</td></tr>"]) |
|||
if item[3].text: |
|||
html.extend(["<tr>", |
|||
"<td class=\"prop-return-name\">", |
|||
"Return", |
|||
"</td><td class=\"prop-return-description\">", |
|||
item[3].text, |
|||
"</td></tr>"]) |
|||
html.extend(["</table>"]) |
|||
|
|||
# Add separator |
|||
html.extend(["<hr class=\"prop-prop-separator\" />"]) |
|||
|
|||
for item in var_list: |
|||
html.extend(["<br /><a id=\"%s.%s\" class=\"individual-prop-header\">%s</a>" % (elementName, item[0], item[0])]) |
|||
|
|||
# Table showing the variable (similar to that in function list) |
|||
html.extend(["<table class=\"prop-table\">"]) |
|||
html.extend(loadVarRow(item, elementName, False)) |
|||
html.extend(["</table>"]) |
|||
|
|||
# Description of the variable |
|||
html.extend(["<p class=\"prop-description\">%s</p>" % item[2]]) |
|||
|
|||
# Add separator |
|||
html.extend(["<hr class=\"prop-prop-separator\" />"]) |
|||
|
|||
# Remove last separator |
|||
del html[-1] |
|||
|
|||
return html |
|||
|
|||
def convertXMLtoHTML(xml): |
|||
tree = ET.parse(xml) |
|||
root = tree.getroot() |
|||
|
|||
html = [] |
|||
_name = root.find("name").text |
|||
name = _name[0].upper() + _name[1:-3] |
|||
|
|||
# Standard HTML heading |
|||
html.extend(["<!DOCTYPE html>", |
|||
"<html>", |
|||
"<head>", |
|||
"<title>%s</title>" % name, |
|||
"<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />\n</head>", |
|||
"<body>", |
|||
"<p class=\"page-header\">%s</p>" % name]) |
|||
|
|||
html.extend(loadElement(root, name)) |
|||
|
|||
objects_list = [] |
|||
for child in root: |
|||
if child.tag == "object": |
|||
objects_list.append(child) |
|||
|
|||
for item in objects_list: |
|||
# Add separator |
|||
html.extend(["<hr class=\"obj-obj-separator\" />"]) |
|||
# Show header |
|||
html.extend(["<h2>%s.%s</h2>" % (name, item.findtext("name"))]) |
|||
html.extend(loadElement(item, name + "." + item.findtext("name"))) |
|||
|
|||
# Standard HTML ending |
|||
html.extend(["</body>", |
|||
"</html>"]) |
|||
|
|||
return "\n".join(html) |
@ -0,0 +1 @@ |
|||
SUBDIRS = reference |
@ -0,0 +1,488 @@ |
|||
const Lang = imports.lang; |
|||
const Applet = imports.ui.applet; |
|||
const GLib = imports.gi.GLib; |
|||
const Gtk = imports.gi.Gtk; |
|||
const Gio = imports.gi.Gio; |
|||
const Util = imports.misc.util; |
|||
const Gettext = imports.gettext.domain('cinnamon-applets'); |
|||
const PopupMenu = imports.ui.popupMenu; |
|||
const St = imports.gi.St; |
|||
const Mainloop = imports.mainloop; |
|||
const Cinnamon = imports.gi.Cinnamon; |
|||
const Main = imports.ui.main; |
|||
const Settings = imports.ui.settings; |
|||
const _ = Gettext.gettext; |
|||
const SearchProviderManager = imports.ui.searchProviderManager; |
|||
const Clutter = imports.gi.Clutter; |
|||
|
|||
const RESULT_TYPES_LABELS = |
|||
{ |
|||
software: _("Software"), |
|||
pictures: _("Pictures"), |
|||
videos: _("Videos"), |
|||
music: _("Music"), |
|||
folders: _("Folders"), |
|||
files: _("Other Files"), |
|||
provider: _("Other Results") |
|||
} |
|||
|
|||
function SearchProviderResultButton(applet, provider, result) { |
|||
this._init(applet, provider, result); |
|||
} |
|||
|
|||
SearchProviderResultButton.prototype = { |
|||
__proto__: PopupMenu.PopupBaseMenuItem.prototype, |
|||
|
|||
_init: function(applet, provider, result) { |
|||
this.provider = provider; |
|||
this.result = result; |
|||
this._applet = applet; |
|||
|
|||
PopupMenu.PopupBaseMenuItem.prototype._init.call(this, {focusOnHover: false}); |
|||
|
|||
this.icon = null; |
|||
if (result.icon){ |
|||
this.icon = result.icon; |
|||
}else if (result.icon_app){ |
|||
this.icon = result.icon_app.create_icon_texture(16); |
|||
}else if (result.icon_filename){ |
|||
this.icon = new St.Icon({gicon: new Gio.FileIcon({file: Gio.file_new_for_path(result.icon_filename)}), icon_size: 16}); |
|||
} |
|||
|
|||
if (this.icon){ |
|||
this.addActor(this.icon); |
|||
} |
|||
|
|||
this.label = new St.Label({ text: result.label }); |
|||
this.addActor(this.label); |
|||
if (this.icon) { |
|||
this.icon.realize(); |
|||
} |
|||
this.label.realize(); |
|||
|
|||
this.connect('activate', Lang.bind(this, this._on_activate)); |
|||
}, |
|||
|
|||
_onButtonReleaseEvent: function (actor, event) { |
|||
if (event.get_button() == 1){ |
|||
this.activate(event); |
|||
} |
|||
return true; |
|||
}, |
|||
|
|||
_on_activate: function(event) { |
|||
try{ |
|||
this.provider.on_result_selected(this.result); |
|||
this._applet._search_menu.close(); |
|||
} |
|||
catch(e) |
|||
{ |
|||
global.logError(e); |
|||
} |
|||
} |
|||
} |
|||
|
|||
function ApplicationResultButton(applet, app) |
|||
{ |
|||
this._init(applet, app); |
|||
} |
|||
|
|||
ApplicationResultButton.prototype = |
|||
{ |
|||
__proto__: PopupMenu.PopupBaseMenuItem.prototype, |
|||
|
|||
_init: function(applet, app) |
|||
{ |
|||
PopupMenu.PopupBaseMenuItem.prototype._init.call(this, {focusOnHover: false}); |
|||
|
|||
this._app = app; |
|||
this._applet = applet; |
|||
|
|||
this.icon = this._app.create_icon_texture(16); |
|||
this.addActor(this.icon); |
|||
this.name = this._app.get_name(); |
|||
this.label = new St.Label( |
|||
{ |
|||
text: this.name |
|||
}); |
|||
this.label.set_style("width: 180px;"); |
|||
this.addActor(this.label); |
|||
this.icon.realize(); |
|||
this.label. |