Skip to content

Commit

Permalink
Fixed icon path lookup for panel context menu
Browse files Browse the repository at this point in the history
  • Loading branch information
clefebvre committed Jul 26, 2012
1 parent 7806158 commit 6822c61
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
1 change: 1 addition & 0 deletions debian/control
Expand Up @@ -36,6 +36,7 @@ Build-Depends: cdbs,
libstartup-notification0-dev (>= 0.11),
libmuffin-dev (>= 1.0.5),
librsvg2-dev,
libsoup2.4-dev,
libwnck-dev,
libclutter-1.0-dev (>= 1.7.5),
libxfixes-dev (>= 1:5.0),
Expand Down
Expand Up @@ -8,7 +8,6 @@ const PopupMenu = imports.ui.popupMenu;
const Util = imports.misc.util;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;

function ConfirmDialog(){
this._init();
Expand All @@ -26,9 +25,7 @@ MyApplet.prototype = {

try {
this.set_applet_icon_symbolic_name("go-up");
this.set_applet_tooltip(_("Settings"));

Gtk.IconTheme.get_default().append_search_path("/usr/lib/cinnamon-settings/data/icons/");
this.set_applet_tooltip(_("Settings"));
this.menuManager = new PopupMenu.PopupMenuManager(this);
this._buildMenu(orientation);

Expand Down
33 changes: 23 additions & 10 deletions js/ui/panel.js
Expand Up @@ -15,6 +15,7 @@ const DND = imports.ui.dnd;
const AppletManager = imports.ui.appletManager;
const Util = imports.misc.util;
const ModalDialog = imports.ui.modalDialog;
const Gtk = imports.gi.Gtk;

const BUTTON_DND_ACTIVATION_TIMEOUT = 250;

Expand Down Expand Up @@ -407,7 +408,7 @@ SettingsLauncher.prototype = {
PopupMenu.PopupBaseMenuItem.prototype._init.call(this, {});

this._menu = menu;
this._keyword = keyword;
this._keyword = keyword;
this.label = new St.Label({ text: label });
this.addActor(this.label);
this._icon = new St.Icon({icon_name: icon, icon_size: 22, icon_type: St.IconType.FULLCOLOR });
Expand All @@ -416,7 +417,7 @@ SettingsLauncher.prototype = {

activate: function (event) {
this._menu.actor.hide();
Util.spawnCommandLine("cinnamon-settings " + this._keyword);
Util.spawnCommandLine("cinnamon-settings " + this._keyword);
return true;
}

Expand Down Expand Up @@ -600,6 +601,8 @@ function Panel(bottomPosition) {
Panel.prototype = {
_init : function(bottomPosition) {

Gtk.IconTheme.get_default().append_search_path("/usr/lib/cinnamon-settings/data/icons/");

this.bottomPosition = bottomPosition;

this._hidden = false;
Expand Down Expand Up @@ -676,16 +679,20 @@ Panel.prototype = {
global.settings.connect("changed::panel-show-delay", Lang.bind(this, this._onPanelShowDelayChanged));
global.settings.connect("changed::panel-hide-delay", Lang.bind(this, this._onPanelHideDelayChanged));

//let orientation = St.Side.TOP;
//if (bottomPosition) {
// orientation = St.Side.BOTTOM;
//}
let orientation = St.Side.TOP;
if (bottomPosition) {
orientation = St.Side.BOTTOM;
}

//this._context_menu = new PanelContextMenu(this, orientation);
//this._menus.addMenu(this._context_menu);
//this._context_menu.addMenuItem(new PopupMenu.PopupMenuItem(_("Add applet")));
this._context_menu = new PanelContextMenu(this, orientation);
this._menus.addMenu(this._context_menu);

//this.actor.connect('button-release-event', Lang.bind(this, this._onButtonReleaseEvent));
this._context_menu._boxPointer._container.connect('allocate', Lang.bind(this._context_menu._boxPointer, function(actor, box, flags){
this._xPosition = this._xpos;
this._shiftActor();
}));

this.actor.connect('button-release-event', Lang.bind(this, this._onButtonReleaseEvent));

this._setDNDstyle();
global.settings.connect("changed::panel-edit-mode", Lang.bind(this, this._setDNDstyle));
Expand Down Expand Up @@ -713,6 +720,8 @@ Panel.prototype = {
}
}
if (event.get_button()==3){
global.log("3");
try {
let [x, y] = event.get_coords();
let target = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
if (this._context_menu._getMenuItems().length > 0 && target.get_parent() == this.actor) {
Expand All @@ -738,6 +747,10 @@ Panel.prototype = {
this._context_menu._boxPointer._shiftActor();
}
}
catch(e) {
global.log(e);
}
}
return;
},

Expand Down

0 comments on commit 6822c61

Please sign in to comment.