Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.75 KB | None | 0 0
  1. diff --git a/data/Makefile.am b/data/Makefile.am
  2. index 8c04198..d8cb906 100644
  3. --- a/data/Makefile.am
  4. +++ b/data/Makefile.am
  5. @@ -27,6 +27,7 @@ dist_theme_DATA = \
  6. theme/corner-ripple.png \
  7. theme/dash-placeholder.svg \
  8. theme/dialog-error.svg \
  9. + theme/filter-selected.svg \
  10. theme/gnome-shell.css \
  11. theme/mosaic-view-active.svg \
  12. theme/mosaic-view.svg \
  13. diff --git a/data/gs-applications.menu b/data/gs-applications.menu
  14. index 1d0bfdc..494902b 100644
  15. --- a/data/gs-applications.menu
  16. +++ b/data/gs-applications.menu
  17. @@ -1,13 +1,28 @@
  18. <Menu>
  19. <DefaultLayout>
  20. - <Menuname>Apps</Menuname>
  21. - <Menuname>Games</Menuname>
  22. - <Menuname>Tools</Menuname>
  23. - </DefaultLayout>
  24. + <Menuname>Accessories</Menuname>
  25. + <Menuname>Games</Menuname>
  26. + <Menuname>Graphics</Menuname>
  27. + <Menuname>Internet</Menuname>
  28. + <Menuname>Multimedia</Menuname>
  29. + <Menuname>Office</Menuname>
  30. + <Menuname>Other</Menuname>
  31. + </DefaultLayout>
  32. <Name>Applications</Name>
  33. <AppDir>/usr/local/share/applications</AppDir>
  34. <DefaultAppDirs/>
  35. <Menu>
  36. + <Name>Accessories</Name>
  37. + <Include>
  38. + <And>
  39. + <Category>Utility</Category>
  40. + <Not>
  41. + <Category>System</Category>
  42. + </Not>
  43. + </And>
  44. + </Include>
  45. + </Menu>
  46. + <Menu>
  47. <Name>Games</Name>
  48. <Include>
  49. <And>
  50. @@ -16,20 +31,44 @@
  51. </Include>
  52. </Menu>
  53. <Menu>
  54. - <Name>Tools</Name>
  55. + <Name>Graphics</Name>
  56. <Include>
  57. - <Category>Development</Category>
  58. <And>
  59. - <Category>System</Category>
  60. - <Not>
  61. - <Category>Settings</Category>
  62. - </Not>
  63. + <Category>Graphics</Category>
  64. + </And>
  65. + </Include>
  66. + </Menu>
  67. +
  68. + <Menu>
  69. + <Name>Internet</Name>
  70. + <Include>
  71. + <And>
  72. + <Category>Network</Category>
  73. + <Not><Category>Settings</Category></Not>
  74. + </And>
  75. + </Include>
  76. + </Menu>
  77. +
  78. + <Menu>
  79. + <Name>Multimedia</Name>
  80. + <Include>
  81. + <And>
  82. + <Category>AudioVideo</Category>
  83. + <Not><Category>Settings</Category></Not>
  84. + </And>
  85. + </Include>
  86. + </Menu>
  87. +
  88. + <Menu>
  89. + <Name>Office</Name>
  90. + <Include>
  91. + <And>
  92. + <Category>Office</Category>
  93. </And>
  94. - <Category>Utility</Category>
  95. </Include>
  96. </Menu>
  97. <Menu>
  98. - <Name>Apps</Name>
  99. + <Name>Other</Name>
  100. <OnlyUnallocated/>
  101. <Include>
  102. <And>
  103. diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
  104. index 3afd536..10f1dcd 100644
  105. --- a/data/theme/gnome-shell.css
  106. +++ b/data/theme/gnome-shell.css
  107. @@ -544,7 +544,7 @@ StTooltip {
  108. /* Apps */
  109.  
  110. .overview-pane {
  111. - width: 440px;
  112. + width: 640px;
  113. }
  114.  
  115. .icon-grid {
  116. @@ -554,17 +554,25 @@ StTooltip {
  117.  
  118. .all-app {
  119. padding: 10px;
  120. + padding-top: 30px; /**/
  121. + padding-bottom: 10px; /**/
  122. }
  123.  
  124. -.app-section-divider-container {
  125. - padding-top: 10px;
  126. - padding-bottom: 10px;
  127. +.app-filters-container {
  128. + width: 201px;
  129. }
  130.  
  131. -.app-section-divider {
  132. - height: 2px;
  133. - background-image: url("separator-white.png");
  134. -}
  135. +.app-filter {
  136. + font-size: 14px;
  137. + font-weight: bold;
  138. + height: 40px;
  139. + color: #aaa;
  140. + }
  141. +.app-filter:selected {
  142. + color: #ffffff;
  143. + background-image: url("filter-selected.svg");
  144. + background-position: 190px 0px;
  145. + }
  146.  
  147. #Dash > .app-well-app {
  148. padding: 6px 12px;
  149. diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
  150. index 09c7c88..a3e6343 100644
  151. --- a/js/ui/appDisplay.js
  152. +++ b/js/ui/appDisplay.js
  153. @@ -29,10 +29,18 @@ function AlphabeticalView() {
  154.  
  155. AlphabeticalView.prototype = {
  156. _init: function() {
  157. - this.actor = new St.BoxLayout({ vertical: true });
  158. this._grid = new IconGrid.IconGrid();
  159. this._appSystem = Shell.AppSystem.get_default();
  160. - this.actor.add(this._grid.actor, { y_align: St.Align.START, expand: tr
  161. +
  162. + let box = new St.BoxLayout({ vertical: true });
  163. + box.add(this._grid.actor, { y_align: St.Align.START, expand: true });
  164. +
  165. + this.actor = new St.ScrollView({ x_fill: true,
  166. + y_fill: false,
  167. + y_align: St.Align.START,
  168. + vshadows: true });
  169. + this.actor.add_actor(box);
  170. + this.actor.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
  171. },
  172.  
  173. _removeAll: function() {
  174. @@ -79,54 +87,82 @@ function ViewByCategories() {
  175. ViewByCategories.prototype = {
  176. _init: function() {
  177. this._appSystem = Shell.AppSystem.get_default();
  178. - this.actor = new St.BoxLayout({ vertical: true });
  179. + let container = new St.BoxLayout();
  180. + this.actor = new St.Bin({ child: container, x_fill: true, y_fill: true
  181. this.actor._delegate = this;
  182. +
  183. + this._view = new AlphabeticalView();
  184. + this._view.connect('launching', Lang.bind(this, function() {
  185. + this.emit('launching');
  186. + }));
  187. + this._view.connect('drag-begin', Lang.bind(this, function() {
  188. + this.emit('drag-begin');
  189. + }));
  190. +
  191. + this._filters = new St.BoxLayout({ style_class: 'app-filters-container
  192. + container.add(this._view.actor, { expand: true, x_fill: true, y_fill:
  193. + container.add(this._filters, { expand: false, y_fill: false, y_align:
  194. +
  195. this._sections = [];
  196. },
  197.  
  198. - _updateSections: function(apps) {
  199. + _selectCategory: function(num) {
  200. + let apps;
  201. + if (num != -1) {
  202. + this._allFilter.remove_style_pseudo_class('selected');
  203. + apps = this._sections[num].apps;
  204. + } else {
  205. + this._allFilter.add_style_pseudo_class('selected');
  206. + apps = this._apps;
  207. + }
  208. + this._view.refresh(apps);
  209. +
  210. + for (let i = 0; i < this._sections.length; i++) {
  211. + if (i == num)
  212. + this._sections[i].menuActor.add_style_pseudo_class('selected')
  213. + else
  214. + this._sections[i].menuActor.remove_style_pseudo_class('selecte
  215. + }
  216. + },
  217. +
  218. + _addFilter: function(name, num) {
  219. + let button = new St.Button({ label: name,
  220. + style_class: 'app-filter',
  221. + x_align: St.Align.START });
  222. + this._filters.add(button, { expand: true, x_fill: true, y_fill: false
  223. + button.connect('clicked', Lang.bind(this, function() {
  224. + this._selectCategory(num);
  225. + }));
  226. +
  227. + return button;
  228. + },
  229. +
  230. + _removeAll: function() {
  231. + this._sections = [];
  232. + this._filters.destroy_children();
  233. + },
  234. +
  235. + refresh: function(apps) {
  236. this._removeAll();
  237.  
  238. let sections = this._appSystem.get_sections();
  239. if (!sections)
  240. return;
  241. - for (let i = 0; i < sections.length; i++) {
  242. - if (i) {
  243. - let actor = new St.Bin({ style_class: 'app-section-divider' })
  244. - let divider = new St.Bin({ style_class: 'app-section-divider-c
  245. - child: actor,
  246. - x_fill: true });
  247. + this._apps = apps;
  248. + this._allFilter = this._addFilter(_("All"), -1);
  249.  
  250. - this.actor.add(divider, { y_fill: false, expand: true });
  251. - }
  252. + for (let i = 0; i < sections.length; i++) {
  253. let _apps = apps.filter(function(app) {
  254. return app.get_section() == sections[i];
  255. });
  256. - this._sections[i] = { view: new AlphabeticalView(),
  257. - apps: _apps,
  258. - name: sections[i] };
  259. - this._sections[i].view.connect('launching', Lang.bind(this, functi
  260. - this.emit('launching');
  261. - }));
  262. - this._sections[i].view.connect('drag-begin', Lang.bind(this, funct
  263. - this.emit('drag-begin');
  264. - }));
  265. - this.actor.add(this._sections[i].view.actor, { y_align: St.Align.S
  266. - }
  267. - },
  268. -
  269. - _removeAll: function() {
  270. - this.actor.destroy_children();
  271. - this._sections.forEach(function (section) { section.view.disconnectAll
  272.  
  273. - this._sections = [];
  274. - },
  275. + let name = this._addFilter(sections[i], i);
  276. + this._sections[i] = { apps: _apps,
  277. + menuActor: name,
  278. + name: sections[i] };
  279.  
  280. - refresh: function(apps) {
  281. - this._updateSections(apps);
  282. - for (let i = 0; i < this._sections.length; i++) {
  283. - this._sections[i].view.refresh(this._sections[i].apps);
  284. }
  285. + this._selectCategory(-1);
  286. }
  287. };
  288.  
  289. @@ -146,18 +182,11 @@ AllAppDisplay.prototype = {
  290. Main.queueDeferredWork(this._workId);
  291. }));
  292.  
  293. - this._scrollView = new St.ScrollView({ x_fill: true,
  294. - y_fill: false,
  295. - vshadows: true });
  296. - this.actor = new St.Bin({ style_class: 'all-app',
  297. - y_align: St.Align.START,
  298. - child: this._scrollView });
  299. -
  300. this._appView = new ViewByCategories();
  301. - this._scrollView.add_actor(this._appView.actor);
  302. -
  303. - this._scrollView.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOM
  304.  
  305. + this.actor = this._appView.actor;
  306. + this.actor.style_class = 'all-app';
  307. +
  308. this._workId = Main.initializeDeferredWork(this.actor, Lang.bind(this,
  309. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement