Skip to content

Commit

Permalink
Merge branch 'master' of github.com:linuxmint/Cinnamon
Browse files Browse the repository at this point in the history
  • Loading branch information
clefebvre committed Dec 21, 2011
2 parents a2ca62c + 8a2232b commit 0dbb0ee
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 2 deletions.
4 changes: 4 additions & 0 deletions js/ui/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const ShowDesktopButton = imports.ui.showDesktopButton;
const WorkspaceSwitcher = imports.ui.workspaceSwitcher;
const MintMenu = imports.ui.mintMenu;
const Meta = imports.gi.Meta;
const PanelLaunchers = imports.ui.panelLaunchers;

const PANEL_ICON_SIZE = 24;

Expand Down Expand Up @@ -947,6 +948,9 @@ Panel.prototype = {

this._showDesktopButton = new ShowDesktopButton.ShowDesktopButton();
this._leftBox.add(this._showDesktopButton.actor);

this._panelLaunchersBox = new PanelLaunchers.PanelLaunchersBox();
this._leftBox.add(this._panelLaunchersBox.actor);

/*this._appMenu = new AppMenuButton();
this._leftBox.add(this._appMenu.actor);
Expand Down
90 changes: 90 additions & 0 deletions js/ui/panelLaunchers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-

const Clutter = imports.gi.Clutter;
const St = imports.gi.St;
const Cinnamon = imports.gi.Cinnamon;
const Lang = imports.lang;

function PanelAppLauncher(app) {
this._init(app);
}

PanelAppLauncher.prototype = {
_init: function(app) {
this.app = app;
this.actor = new St.Bin({ style_class: 'panel-launcher',
reactive: true,
can_focus: true,
x_fill: true,
y_fill: false,
track_hover: true });
this.actor._delegate = this;
this.actor.connect('button-release-event', Lang.bind(this, this._onButtonRelease));

this._iconBox = new Cinnamon.Slicer({ name: 'appMenuIcon' });
this._iconBox.connect('style-changed',
Lang.bind(this, this._onIconBoxStyleChanged));
this._iconBox.connect('notify::allocation',
Lang.bind(this, this._updateIconBoxClip));
this.actor.add_actor(this._iconBox);
this._iconBottomClip = 0;
let icon = this.app.create_icon_texture(16);
this._iconBox.set_child(icon);
},

_onButtonRelease: function(actor, event) {
if ( Cinnamon.get_event_state(event) & Clutter.ModifierType.BUTTON1_MASK ) {
this.app.open_new_window(-1);
}
},

_onIconBoxStyleChanged: function() {
let node = this._iconBox.get_theme_node();
this._iconBottomClip = node.get_length('panel-launcher-bottom-clip');
this._updateIconBoxClip();
},

_updateIconBoxClip: function() {
let allocation = this._iconBox.allocation;
if (this._iconBottomClip > 0)
this._iconBox.set_clip(0, 0, allocation.x2 - allocation.x1, allocation.y2 - allocation.y1 - this._iconBottomClip);
else
this._iconBox.remove_clip();
},
}

function PanelLaunchersBox() {
this._init();
}

PanelLaunchersBox.prototype = {
_init: function() {
this.actor = new St.BoxLayout({ name: 'panel-launchers-box',
style_class: 'panel-launchers-box' });
this.actor._delegate = this;

this.reload();
},

loadApps: function() {
let desktopFiles = ["gnome-terminal.desktop"];
let appSys = Cinnamon.AppSystem.get_default();
let apps = new Array();
for (var i in desktopFiles){
let app = appSys.lookup_app(desktopFiles[i]);
if (app) apps.push(app);
}
return apps;
},

reload: function() {
this.actor.destroy_children();

let apps = this.loadApps();
for (var i in apps){
let app = apps[i];
let launcher = new PanelAppLauncher(app);
this.actor.add(launcher.actor);
}
}
}
7 changes: 5 additions & 2 deletions js/ui/status/volume.js
Original file line number Diff line number Diff line change
Expand Up @@ -772,13 +772,16 @@ Indicator.prototype = {
this._availablePlayers = new Array();
let appsys = Cinnamon.AppSystem.get_default();
let allApps = appsys.get_all();
let listedDesktopFiles = new Array();
for (let y=0; y<allApps.length; y++) {
let app = allApps[y];
let entry = app.get_tree_entry();
let path = entry.get_desktop_file_path();
for (var p=0; p<compatible_players.length; p++) {
if (path.indexOf(compatible_players[p]+".desktop") != -1) {
this._availablePlayers.push(app)
let desktopFile = compatible_players[p]+".desktop";
if (path.indexOf(desktopFile) != -1 && listedDesktopFiles.indexOf(desktopFile) == -1) {
this._availablePlayers.push(app);
listedDesktopFiles.push(desktopFile);
}
}
}
Expand Down

0 comments on commit 0dbb0ee

Please sign in to comment.