Skip to content

Commit

Permalink
Gnome 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
sciancio committed Sep 1, 2014
1 parent f42810f commit 7a265ed
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 63 deletions.
4 changes: 2 additions & 2 deletions connmgr.py
Expand Up @@ -36,7 +36,7 @@
import re
import sys

VERSION = '0.8.2'
VERSION = '0.8.3'

supportedTerms = ["Gnome Terminal", "Terminator", "Guake", "TMux", "urxvt", "urxvt256c", "LilyTerm"]
supportedTermsCmd = ["gnome-terminal", "terminator", "guake", "tmux", "urxvt", "urxvt256c", "lilyterm"]
Expand Down Expand Up @@ -390,7 +390,7 @@ def __init__(self):

# About Label
about = Gtk.VBox(False, spacing=2)
label_about = Gtk.Label('<span size="30000">ConnectionManager 3</span>\n<span>Version: '+VERSION+'\n\nSimple GUI app for Gnome 3 that provides\n a menu for initiating SSH/Telnet/Custom Apps connections.\n\nCopyright 2012 Stefano Ciancio</span>')
label_about = Gtk.Label('<span size="30000">ConnectionManager 3</span>\n<span>Version: '+VERSION+'\n\nSimple GUI app for Gnome 3 that provides\n a menu for initiating SSH/Telnet/Custom Apps connections.\n\nCopyright 2012-2014 Stefano Ciancio</span>')
label_about.set_justify(2)
label_about.set_use_markup(True)
button_about = Gtk.LinkButton("https://github.com/sciancio/connectionmanager", "Visit GitHub Project Homepage")
Expand Down
38 changes: 20 additions & 18 deletions extension.js
Expand Up @@ -72,7 +72,13 @@ const ConnectionManager = new Lang.Class({
this._searchProvider = null;
this._sshList = [];
this._searchProvider = new Search.SshSearchProvider('CONNECTION MANAGER');
Main.overview.addSearchProvider(this._searchProvider);

if( typeof Main.overview.viewSelector === "object" &&
typeof Main.overview.viewSelector._searchResults === "object" &&
typeof Main.overview.viewSelector._searchResults._searchSystem === "object" &&
typeof Main.overview.viewSelector._searchResults._searchSystem.addProvider === "function") {
Main.overview.viewSelector._searchResults._searchSystem.addProvider(this._searchProvider);
}

this._readConf();
},
Expand Down Expand Up @@ -181,12 +187,12 @@ const ConnectionManager = new Lang.Class({

// Add ssh entry in search array
this._sshList.push(
[
child.Type,
this.TermCmd.get_terminal(),
child.Name+' - '+child.Host,
command
]
{
'type': child.Type,
'terminal': this.TermCmd.get_terminal(),
'name': child.Name+' - '+child.Host,
'command': command
}
);
}

Expand Down Expand Up @@ -223,12 +229,13 @@ const ConnectionManager = new Lang.Class({

// Add ssh entry in search array
this._sshList.push(
[
child.Type,
this.TermCmd.get_terminal(),
child.Name+' - '+child.Host,
command
]
{
'type': child.Type,
'terminal': this.TermCmd.get_terminal(),
'name': child.Name+' - '+child.Host,
'command': command
}

);
}

Expand Down Expand Up @@ -321,11 +328,6 @@ function enable() {
}

function disable() {

if(cm._searchProvider!=null) {
Main.overview.removeSearchProvider(cm._searchProvider);
cm._searchProvider = null;
}
cm.monitor.cancel();
cm.destroy();
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
@@ -1,5 +1,5 @@
{
"shell-version": ["3.10"],
"shell-version": ["3.12"],
"version": "0.8.3",
"uuid": "connectionmanager2@ciancio.net",
"name": "Connection Manager",
Expand Down
72 changes: 30 additions & 42 deletions search.js
Expand Up @@ -27,8 +27,7 @@ const SshSearchProvider = new Lang.Class({
Name: 'SshSearchProvider',

_init: function(title) {
this.title = title;
this.searchSystem = null;
this.id = title;
this.sshNames = [];
},

Expand All @@ -45,69 +44,58 @@ const SshSearchProvider = new Lang.Class({
return null;
},

getInitialResultSet: function(terms) {
getInitialResultSet: function(terms, callback) {
let searching = [];

for (var i=0; i<this.sshNames.length; i++) {
for (var j=0; j<terms.length; j++) {
let pattern = new RegExp(terms[j],"gi");
if (this.sshNames[i][2].match(pattern)) {
searching.push ({
'type': this.sshNames[i][0],
'terminal': this.sshNames[i][1],
'name': this.sshNames[i][2],
'command': this.sshNames[i][3]
});
if (this.sshNames[i].name.match(pattern)) {
searching.push(i);
}
}
}

this.searchSystem.setResults(this, searching);
if (typeof callback === "function") {
callback(searching);
}
},

getSubsearchResultSet: function(previousResults, terms) {
this.getInitialResultSet(terms);
getSubsearchResultSet: function(previousResults, terms, callback) {
this.getInitialResultSet(terms, callback);
},

getResultMetas: function(resultIds, callback) {
let metas = [];

for (let i=0; i<resultIds.length; i++) {
let appSys = Shell.AppSystem.get_default();
let app = appSys.lookup_app('gnome-session-properties.desktop');
switch (resultIds[i].type) {
case '__app__':
app = appSys.lookup_app('gnome-session-properties.desktop');
break;
case '__item__':
app = appSys.lookup_app(resultIds[i].terminal + '.desktop');
break;
}
let result = this.sshNames[resultIds[i]]
let appSys = Shell.AppSystem.get_default();

switch (result.type) {
case '__app__':
app = appSys.lookup_app('gnome-session-properties.desktop');
break;
case '__item__':
app = appSys.lookup_app(result.terminal + '.desktop');
break;
}

metas.push( {
'id': resultIds[i].command,
'name': resultIds[i].name,
metas.push({
'id': resultIds[i],
'name': result.name,
'createIcon': function(size) {
let icon = null;
if (app) icon = app.create_icon_texture(size);
return icon;
}
});
let icon = null;
if (app) icon = app.create_icon_texture(size);
return icon;
}
})
}

callback(metas);

},

activateResult: function(command) {
Util.spawnCommandLine(command);
activateResult: function(id) {
Util.spawnCommandLine(this.sshNames[id].command);
},

createResultActor: function (resultMeta, terms) {
return null;
}

});


0 comments on commit 7a265ed

Please sign in to comment.