Skip to content

Commit 0f39c14

Browse files
authored
Merge pull request #108 from torikulhabib/master
Fix perform quicklist
2 parents 912a009 + 605e9a7 commit 0f39c14

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

src/CanonicalDbusmenu.vala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ namespace Gabut {
9696
public void event (int id, string event_id, Variant data, uint timestamp) throws GLib.Error {
9797
if (event_id == "clicked") {
9898
if (root != null) {
99-
root.signal_send (id);
99+
Variant name;
100+
GetProperty (id, "label", out name);
101+
root.signal_send (id, name);
100102
}
101103
}
102104
}

src/DbusmenuItem.vala

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,11 @@ namespace Gabut {
6969
}
7070

7171
public void child_reorder (DbusmenuItem child, int position) {
72-
var childrens = new List<DbusmenuItem> ();
72+
child_delete (child);
73+
child.id = position;
74+
menuchildren.insert (child, position - 1);
7375
menuchildren.foreach ((item)=> {
74-
childrens.append (item);
75-
child_delete (item);
76-
});
77-
childrens.foreach ((item)=> {
78-
if (child == item && position != item.id) {
79-
child.id = position;
80-
menuchildren.insert (child, position - 1);
81-
} else {
82-
item.id = (int) menuchildren.length () + 1;
83-
menuchildren.insert (item, item.id);
84-
}
85-
});
86-
menuchildren.foreach ((item)=> {
87-
if (child != item && position == item.id) {
88-
item.id = (int) childrens.length ();
89-
menuchildren.insert (item, (int) childrens.length ());
90-
}
76+
item.id = menuchildren.index (item) + 1;
9177
});
9278
}
9379

@@ -124,6 +110,9 @@ namespace Gabut {
124110
properties["children-display"] = v_s ("submenu");
125111
}
126112
if (!get_exist (child)) {
113+
menuchildren.foreach ((item)=> {
114+
item.id = menuchildren.index (item) + 1;
115+
});
127116
child.id = (int) menuchildren.length () + 1;
128117
menuchildren.append (child);
129118
}
@@ -132,12 +121,15 @@ namespace Gabut {
132121
public void child_delete (DbusmenuItem child) {
133122
if (get_exist (child)) {
134123
menuchildren.remove_link (menuchildren.find (child));
124+
menuchildren.foreach ((item)=> {
125+
item.id = menuchildren.index (item) + 1;
126+
});
135127
}
136128
}
137129

138-
public void signal_send (int mid) {
130+
public void signal_send (int mid, Variant name) {
139131
menuchildren.foreach ((item)=> {
140-
if (mid == item.id) {
132+
if (mid == item.id && name == item.properties.@get ("label")) {
141133
item.item_activated ();
142134
}
143135
});

src/GabutWindow.vala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,9 @@ namespace Gabut {
397397
view_status ();
398398
}
399399
openact++;
400-
append_dbus.begin (((DownloadRow) row).rowbus);
400+
if (!menudbus.get_exist (((DownloadRow) row).rowbus)) {
401+
append_dbus.begin (((DownloadRow) row).rowbus);
402+
}
401403
return;
402404
}
403405
openmode = ((DownloadRow) row).status;
@@ -439,7 +441,9 @@ namespace Gabut {
439441
view_status ();
440442
}
441443
addact++;
442-
append_dbus.begin (((DownloadRow) row).rowbus);
444+
if (!menudbus.get_exist (((DownloadRow) row).rowbus)) {
445+
append_dbus.begin (((DownloadRow) row).rowbus);
446+
}
443447
return;
444448
}
445449
addmode = ((DownloadRow) row).status;

0 commit comments

Comments
 (0)