Merge lp:~wingpanel-devs/slingshot/wingpanel-indicator into lp:~elementary-pantheon/slingshot/trunk

Proposed by Cody Garver on 2015-11-27
Status: Merged
Approved by: Cody Garver on 2015-11-27
Approved revision: 540
Merged at revision: 603
Proposed branch: lp:~wingpanel-devs/slingshot/wingpanel-indicator
Merge into: lp:~elementary-pantheon/slingshot/trunk
Diff against target: 881 lines (+215/-291)
9 files modified
CMakeLists.txt (+36/-64)
lib/synapse-core/CMakeLists.txt (+18/-14)
lib/synapse-plugins/CMakeLists.txt (+22/-17)
src/Backend/DBusService.vala (+1/-1)
src/CMakeLists.txt (+54/-0)
src/Slingshot.vala (+52/-79)
src/SlingshotView.vala (+31/-113)
src/Widgets/AppEntry.vala (+0/-2)
src/Widgets/CategoryView.vala (+1/-1)
To merge this branch: bzr merge lp:~wingpanel-devs/slingshot/wingpanel-indicator
Reviewer Review Type Date Requested Status
elementary Pantheon team 2015-11-27 Pending
Review via email: mp+278758@code.launchpad.net

Commit message

Convert to wingpanel indicator

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-11-25 05:48:28 +0000
3+++ CMakeLists.txt 2015-11-27 00:35:16 +0000
4@@ -1,14 +1,17 @@
5-# Check http://webdev.elementaryos.org/docs/developer-guide/cmake for documentation
6-
7+# Main configuration
8 cmake_minimum_required (VERSION 2.6)
9 cmake_policy (VERSION 2.6)
10 list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
11
12+# Project information
13 project (slingshot)
14+set (INDICATORTITLE "Slingshot")
15+set (INDICATORDESCRIPTION "Application menu")
16
17-set (APPNAME "${CMAKE_PROJECT_NAME}-launcher")
18-set (DATADIR "${CMAKE_INSTALL_PREFIX}/share")
19-set (PKGDATADIR "${DATADIR}/${CMAKE_PROJECT_NAME}")
20+# Set some variables
21+include (GNUInstallDirs)
22+set (DATADIR "${CMAKE_INSTALL_FULL_LIBDIR}/wingpanel")
23+set (PKGDATADIR "${DATADIR}")
24 set (GETTEXT_PACKAGE "${CMAKE_PROJECT_NAME}")
25 set (RELEASE_NAME "Donatello")
26 set (VERSION "0.8.2")
27@@ -18,8 +21,8 @@
28 # Files
29 file (GLOB applications_menu "${CMAKE_CURRENT_SOURCE_DIR}/data/pantheon-applications.menu")
30
31-# Configure file
32-configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
33+# Configuration file
34+configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/lib/synapse-core/config.h)
35
36 # Add 'make dist' command for creating release tarball
37 set (CPACK_PACKAGE_VERSION ${VERSION})
38@@ -27,13 +30,12 @@
39 set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")
40 set (CPACK_SOURCE_IGNORE_FILES "/build/;/.bzr/;/.bzrignore;~$;${CPACK_SOURCE_IGNORE_FILES}")
41
42+# Include CPack
43 include (CPack)
44 add_custom_target (dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
45
46-# Slingshot
47-
48+# Option to configure the use of the unity integration
49 option (USE_UNITY "Use Unity integration" ON)
50-
51 if (USE_UNITY)
52 message ("-- Unity integration enabled")
53 set (UNITY_DEPS unity)
54@@ -42,8 +44,8 @@
55 message ("-- Unity integration disabled")
56 endif ()
57
58+# Option to configure the use of the zeitgeist integration
59 option (USE_ZEITGEIST "Use Zeitgeist integration" ON)
60-
61 if (USE_ZEITGEIST)
62 message ("-- Zeitgeist integration enabled")
63 set (ZEITGEIST_DEPS zeitgeist-2.0)
64@@ -52,7 +54,16 @@
65 message ("-- Zeitgeist integration disabled")
66 endif ()
67
68+# Gettext package
69+add_definitions (-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
70+
71+# Comment this out to enable C compiler warnings
72+add_definitions (-w)
73+
74+# Load PkgConfig
75 find_package (PkgConfig)
76+
77+# Check for Vala
78
79 pkg_check_modules(PLANK011 QUIET plank>=0.10.9)
80 if (PLANK011_FOUND)
81@@ -67,7 +78,7 @@
82 endif ()
83
84 set (CORE_DEPS "gobject-2.0;glib-2.0;gio-2.0;gio-unix-2.0;libsoup-2.4;gee-0.8;libgnome-menu-3.0;json-glib-1.0;${UNITY_DEPS};${PLANK_DEPS};")
85-set (UI_DEPS "gtk+-3.0>=3.12.0;granite;${ZEITGEIST_DEPS};")
86+set (UI_DEPS "wingpanel-2.0;gtk+-3.0>=3.12.0;granite;${ZEITGEIST_DEPS};")
87
88 pkg_check_modules (DEPS REQUIRED "${CORE_DEPS}${UI_DEPS}" gthread-2.0)
89
90@@ -75,68 +86,29 @@
91 include (ValaVersion)
92 ensure_vala_version ("0.26.2" MINIMUM)
93
94+# Include vala precompile
95 include (ValaPrecompile)
96-vala_precompile (VALA_C ${APPNAME}
97- src/Slingshot.vala
98- src/SlingshotView.vala
99- src/Settings.vala
100- src/Utils.vala
101- src/Pixels.vala
102- src/Backend/AppSystem.vala
103- src/Backend/DBusService.vala
104- src/Backend/App.vala
105- src/Backend/RelevancyService.vala
106- src/Backend/SynapseSearch.vala
107- src/Widgets/AppEntry.vala
108- src/Widgets/Grid.vala
109- src/Widgets/Switcher.vala
110- src/Widgets/SearchView.vala
111- src/Widgets/SearchItem.vala
112- src/Widgets/Sidebar.vala
113- src/Widgets/CategoryView.vala
114-PACKAGES
115- ${CORE_DEPS}
116- ${UI_DEPS}
117- synapse-core
118- synapse-plugins
119-CUSTOM_VAPIS
120- vapi/config.vapi
121-OPTIONS
122- --thread
123- --target-glib=2.32
124- --vapidir=${CMAKE_BINARY_DIR}/lib/synapse-core
125- --vapidir=${CMAKE_BINARY_DIR}/lib/synapse-plugins
126- -g
127- ${UNITY_OPTIONS}
128- ${ZEITGEIST_OPTIONS}
129- ${PLANK_OPTIONS}
130-)
131-
132-include_directories(${CMAKE_BINARY_DIR}/lib/synapse-core)
133-include_directories(${CMAKE_BINARY_DIR}/lib/synapse-plugins)
134-
135-add_subdirectory(lib/synapse-core)
136-add_subdirectory(lib/synapse-plugins)
137-
138-# Comment this out to enable C compiler warnings
139-add_definitions (-w)
140-
141+
142+# Synapse libraries
143+include_directories (${CMAKE_BINARY_DIR}/lib/synapse-core)
144+include_directories (${CMAKE_BINARY_DIR}/lib/synapse-plugins)
145+
146+# Link some libraries
147 add_definitions (${DEPS_CFLAGS} -DGMENU_I_KNOW_THIS_IS_UNSTABLE -include config.h)
148 link_libraries (${DEPS_LIBRARIES})
149 link_directories (${DEPS_LIBRARY_DIRS})
150
151-add_executable (${APPNAME} ${VALA_C})
152-target_link_libraries(${APPNAME} m synapse-core synapse-plugins)
153-
154 # Installation
155 install (TARGETS ${APPNAME} RUNTIME DESTINATION bin)
156 install (FILES ${applications_menu} DESTINATION /etc/xdg/menus)
157+file (GLOB resources "${CMAKE_CURRENT_SOURCE_DIR}/data/*")
158
159-#
160-# GSettings Schema
161-#
162+# Settings schema
163 include (GSettings)
164 add_schema ("org.pantheon.desktop.slingshot.gschema.xml")
165
166-# Translations
167+# Directories
168+add_subdirectory (lib/synapse-core)
169+add_subdirectory (lib/synapse-plugins)
170+add_subdirectory (src)
171 add_subdirectory (po)
172
173=== modified file 'lib/synapse-core/CMakeLists.txt'
174--- lib/synapse-core/CMakeLists.txt 2014-07-03 06:38:42 +0000
175+++ lib/synapse-core/CMakeLists.txt 2015-11-27 00:35:16 +0000
176@@ -1,7 +1,8 @@
177-set(CORE_LIB_VERSION 0.1)
178-set(CORE_LIB_SOVERSION 0)
179-set(CORE_LIBRARY_NAME synapse-core)
180-set(CORE_PKG
181+# Library information
182+set (CORE_LIB_VERSION 0.1)
183+set (CORE_LIB_SOVERSION 0)
184+set (CORE_LIBRARY_NAME synapse-core)
185+set (CORE_PKG
186 glib-2.0
187 zeitgeist-2.0
188 gio-unix-2.0
189@@ -10,9 +11,11 @@
190 gtk+-3.0
191 )
192
193-pkg_check_modules(CORE_DEPS REQUIRED ${CORE_PKG})
194+# Check for dependencies
195+pkg_check_modules (CORE_DEPS REQUIRED ${CORE_PKG})
196
197-set(CORE_SOURCE
198+# Source files
199+set (CORE_SOURCE
200 common-actions.vala
201 config-service.vala
202 data-sink.vala
203@@ -28,9 +31,8 @@
204 volume-service.vala
205 )
206
207-set(LINK_MODE STATIC)
208-
209-vala_precompile(CORE_VALA_C ${CORE_LIBRARY_NAME}
210+# Compile
211+vala_precompile (CORE_VALA_C ${CORE_LIBRARY_NAME}
212 ${CORE_SOURCE}
213 PACKAGES
214 ${CORE_PKG}
215@@ -40,15 +42,17 @@
216 ${CORE_LIBRARY_NAME}
217 )
218
219-add_definitions(${CORE_DEPS_CFLAGS} -include config.h -w)
220-link_directories(${CORE_DEPS_LIBRARY_DIRS})
221+# Some compiler flags
222+add_definitions (${CORE_DEPS_CFLAGS} -fPIC -include config.h -w)
223+link_directories (${CORE_DEPS_LIBRARY_DIRS})
224
225-add_library(${CORE_LIBRARY_NAME} STATIC ${CORE_VALA_C})
226+# Library
227+add_library (${CORE_LIBRARY_NAME} STATIC ${CORE_VALA_C})
228 target_link_libraries (${CORE_LIBRARY_NAME} ${CORE_DEPS_LIBRARIES})
229
230-set_target_properties(${CORE_LIBRARY_NAME} PROPERTIES
231+# Set some properties
232+set_target_properties (${CORE_LIBRARY_NAME} PROPERTIES
233 OUTPUT_NAME ${CORE_LIBRARY_NAME}
234 VERSION ${CORE_LIB_VERSION}
235 SOVERSION ${CORE_LIB_SOVERSION}
236 )
237-
238
239=== modified file 'lib/synapse-plugins/CMakeLists.txt'
240--- lib/synapse-plugins/CMakeLists.txt 2015-06-03 19:10:24 +0000
241+++ lib/synapse-plugins/CMakeLists.txt 2015-11-27 00:35:16 +0000
242@@ -1,7 +1,8 @@
243-set(PLUGINS_LIB_VERSION 0.1)
244-set(PLUGINS_LIB_SOVERSION 0)
245-set(PLUGINS_LIBRARY_NAME synapse-plugins)
246-set(PLUGINS_PKG
247+# Library information
248+set (PLUGINS_LIB_VERSION 0.1)
249+set (PLUGINS_LIB_SOVERSION 0)
250+set (PLUGINS_LIBRARY_NAME synapse-plugins)
251+set (PLUGINS_PKG
252 glib-2.0
253 gio-unix-2.0
254 gee-0.8
255@@ -9,9 +10,11 @@
256 switchboard-2.0
257 )
258
259-pkg_check_modules(PLUGINS_DEPS REQUIRED ${PLUGINS_PKG})
260+# Check for dependencies
261+pkg_check_modules (PLUGINS_DEPS REQUIRED ${PLUGINS_PKG})
262
263-set(PLUGINS_SOURCE
264+# Source files
265+set (PLUGINS_SOURCE
266 calculator-plugin.vala
267 command-plugin.vala
268 desktop-file-plugin.vala
269@@ -19,9 +22,8 @@
270 system-managment.vala
271 )
272
273-set(LINK_MODE STATIC)
274-
275-vala_precompile(PLUGINS_VALA_C ${PLUGINS_LIBRARY_NAME}
276+# Compile
277+vala_precompile (PLUGINS_VALA_C ${PLUGINS_LIBRARY_NAME}
278 ${PLUGINS_SOURCE}
279 PACKAGES
280 ${PLUGINS_PKG}
281@@ -34,17 +36,20 @@
282 ${PLUGINS_LIBRARY_NAME}
283 )
284
285-add_definitions(${PLUGINS_DEPS_CFLAGS} -include config.h -w)
286-link_directories(${PLUGINS_DEPS_LIBRARY_DIRS})
287-include_directories(${CMAKE_BINARY_DIR}/lib/synapse-core)
288-
289-add_library(${PLUGINS_LIBRARY_NAME} STATIC ${PLUGINS_VALA_C})
290-
291-set_target_properties(${PLUGINS_LIBRARY_NAME} PROPERTIES
292+# Compiler flags
293+add_definitions (${PLUGINS_DEPS_CFLAGS} -fPIC -include config.h -w)
294+link_directories (${PLUGINS_DEPS_LIBRARY_DIRS})
295+include_directories (${CMAKE_BINARY_DIR}/lib/synapse-core)
296+
297+# Add library
298+add_library (${PLUGINS_LIBRARY_NAME} STATIC ${PLUGINS_VALA_C})
299+
300+# Set some properties
301+set_target_properties (${PLUGINS_LIBRARY_NAME} PROPERTIES
302 OUTPUT_NAME ${PLUGINS_LIBRARY_NAME}
303 VERSION ${PLUGINS_LIB_VERSION}
304 SOVERSION ${PLUGINS_LIB_SOVERSION}
305 )
306
307+# Link libraries
308 target_link_libraries (${PLUGINS_LIBRARY_NAME} ${PLUGINS_DEPS_LIBRARIES} synapse-core)
309-
310
311=== modified file 'src/Backend/DBusService.vala'
312--- src/Backend/DBusService.vala 2013-12-26 00:08:04 +0000
313+++ src/Backend/DBusService.vala 2015-11-27 00:35:16 +0000
314@@ -66,4 +66,4 @@
315 // Emit initial state
316 service.on_view_visibility_change ();
317 }
318-}
319\ No newline at end of file
320+}
321
322=== added file 'src/CMakeLists.txt'
323--- src/CMakeLists.txt 1970-01-01 00:00:00 +0000
324+++ src/CMakeLists.txt 2015-11-27 00:35:16 +0000
325@@ -0,0 +1,54 @@
326+# Some dependencies
327+set (CORE_DEPS "gobject-2.0;gio-2.0;gio-unix-2.0;libsoup-2.4;gee-0.8;libgnome-menu-3.0;${UNITY_DEPS};${PLANK_DEPS};")
328+set (UI_DEPS "gtk+-3.0>=3.12.0;granite;wingpanel-2.0;${ZEITGEIST_DEPS};")
329+
330+# Check for these dependencies
331+pkg_check_modules (DEPS REQUIRED "${CORE_DEPS}${UI_DEPS}" gthread-2.0)
332+
333+# Compiling options
334+vala_precompile (VALA_C ${CMAKE_PROJECT_NAME}
335+ Slingshot.vala
336+ SlingshotView.vala
337+ Settings.vala
338+ Utils.vala
339+ Pixels.vala
340+ Backend/AppSystem.vala
341+ Backend/DBusService.vala
342+ Backend/App.vala
343+ Backend/RelevancyService.vala
344+ Backend/SynapseSearch.vala
345+ Widgets/AppEntry.vala
346+ Widgets/Grid.vala
347+ Widgets/Switcher.vala
348+ Widgets/SearchView.vala
349+ Widgets/SearchItem.vala
350+ Widgets/Sidebar.vala
351+ Widgets/CategoryView.vala
352+PACKAGES
353+ ${CORE_DEPS}
354+ ${UI_DEPS}
355+ synapse-core
356+ synapse-plugins
357+CUSTOM_VAPIS
358+ ../vapi/config.vapi
359+OPTIONS
360+ --thread
361+ --target-glib=2.32
362+ --vapidir=${CMAKE_BINARY_DIR}/lib/synapse-core
363+ --vapidir=${CMAKE_BINARY_DIR}/lib/synapse-plugins
364+ -g
365+ ${UNITY_OPTIONS}
366+ ${ZEITGEIST_OPTIONS}
367+ ${PLANK_OPTIONS}
368+)
369+
370+add_definitions(${DEPS_CFLAGS})
371+
372+# Library
373+add_library (${CMAKE_PROJECT_NAME} MODULE ${VALA_C})
374+target_link_libraries(${CMAKE_PROJECT_NAME} ${DEPS_LIBRARIES})
375+
376+target_link_libraries(${CMAKE_PROJECT_NAME} synapse-plugins)
377+
378+# Installation
379+install (TARGETS ${CMAKE_PROJECT_NAME} DESTINATION ${PKGDATADIR})
380
381=== modified file 'src/Slingshot.vala'
382--- src/Slingshot.vala 2015-01-17 23:56:32 +0000
383+++ src/Slingshot.vala 2015-11-27 00:35:16 +0000
384@@ -16,92 +16,65 @@
385 // along with this program. If not, see <http://www.gnu.org/licenses/>.
386 //
387
388-public class Slingshot.Slingshot : Granite.Application {
389-
390- private SlingshotView view = null;
391- public static bool silent = false;
392- public static bool command_mode = false;
393+public class Slingshot.Slingshot : Wingpanel.Indicator {
394+
395+ private SlingshotView? view = null;
396+
397+ private Gtk.Label? indicator_label = null;
398
399 public static Settings settings { get; private set; default = null; }
400- //public static CssProvider style_provider { get; private set; default = null; }
401 public static Gtk.IconTheme icon_theme { get; set; default = null; }
402+
403 private DBusService? dbus_service = null;
404
405- construct {
406-
407- build_data_dir = Build.DATADIR;
408- build_pkg_data_dir = Build.PKGDATADIR;
409- build_release_name = Build.RELEASE_NAME;
410- build_version = Build.VERSION;
411- build_version_info = Build.VERSION_INFO;
412-
413- program_name = "Slingshot";
414- exec_name = "slingshot-launcher";
415- app_copyright = "GPLv3";
416- app_icon = "";
417- app_launcher = "";
418- app_years = "2011-2012";
419- application_id = "net.launchpad.slingshot";
420- main_url = "https://launchpad.net/slingshot";
421- bug_url = "https://bugs.launchpad.net/slingshot";
422- help_url = "https://answers.launchpad.net/slingshot";
423- translate_url = "https://translations.launchpad.net/slingshot";
424-
425- about_authors = {"Giulio Collura <random.cpp@gmail.com>",
426- "Andrea Basso <andrea@elementaryos.org"};
427- about_artists = {"Harvey Cabaguio 'BassUltra' <harveycabaguio@gmail.com>",
428- "Daniel Foré <bunny@go-docky.com>"};
429- about_translators = "Launchpad Translators";
430- about_license_type = Gtk.License.GPL_3_0;
431-
432- }
433-
434 public Slingshot () {
435- settings = new Settings ();
436- }
437-
438- protected override void activate () {
439- if (get_windows () == null) {
440+ Object (code_name: Wingpanel.Indicator.APP_LAUNCHER,
441+ display_name: _("Slingshot"),
442+ description:_("The app-menu indicator"));
443+ }
444+
445+ void on_close_indicator () {
446+ close ();
447+ }
448+
449+ public override Gtk.Widget? get_widget () {
450+ if (view == null) {
451+ settings = new Settings ();
452+
453 view = new SlingshotView ();
454- view.set_application (this);
455+
456+ view.close_indicator.connect (on_close_indicator);
457
458 if (dbus_service == null)
459 dbus_service = new DBusService (view);
460-
461- if (!silent) {
462- view.show_slingshot ();
463- }
464- } else {
465- if (view.visible && !silent)
466- view.hide ();
467- else
468- view.show_slingshot ();
469- }
470- silent = false;
471- }
472-
473- static const OptionEntry[] entries = {
474- { "silent", 's', 0, OptionArg.NONE, ref silent, "Launch Slingshot as a background process without it appearing visually.", null },
475- { "command-mode", 'c', 0, OptionArg.NONE, ref command_mode, "This feature is not implemented yet. When it is, description will be changed.", null },
476- { null }
477- };
478-
479- public static int main (string[] args) {
480- if (args.length > 1) {
481- var context = new OptionContext ("");
482- context.add_main_entries (entries, "slingshot");
483- context.add_group (Gtk.get_option_group (true));
484-
485- try {
486- context.parse (ref args);
487- } catch (Error e) {
488- print (e.message + "\n");
489- }
490- }
491-
492- var app = new Slingshot ();
493-
494- return app.run (args);
495- }
496-
497-}
498+ }
499+
500+ return view;
501+ }
502+
503+ public override Gtk.Widget get_display_widget () {
504+ if (indicator_label == null)
505+ indicator_label = new Gtk.Label ("Applications");
506+
507+ visible = true;
508+
509+ return indicator_label;
510+ }
511+
512+ public override void opened () {
513+ if (view != null)
514+ view.show_slingshot ();
515+ }
516+
517+ public override void closed () {
518+ // TODO: Do we need to do anyhting here?
519+ }
520+
521+}
522+
523+public Wingpanel.Indicator get_indicator (Module module) {
524+ debug ("Activating Slingshot");
525+ var indicator = new Slingshot.Slingshot ();
526+ return indicator;
527+}
528+
529
530=== modified file 'src/SlingshotView.vala'
531--- src/SlingshotView.vala 2015-02-01 15:13:15 +0000
532+++ src/SlingshotView.vala 2015-11-27 00:35:16 +0000
533@@ -24,8 +24,7 @@
534 SEARCH_VIEW
535 }
536
537- public class SlingshotView : Granite.Widgets.CompositedWindow {
538-
539+ public class SlingshotView : Gtk.Grid {
540 // Widgets
541 public Gtk.SearchEntry search_entry;
542 public Gtk.Stack stack;
543@@ -42,8 +41,6 @@
544 public Gtk.Stack main_stack;
545 public Gtk.Box content_area;
546 private Gtk.EventBox event_box;
547- private Gtk.Popover popover;
548- private Gtk.Grid ref_grid;
549
550 public Backend.AppSystem app_system;
551 private Gee.ArrayList<GMenu.TreeDirectory> categories;
552@@ -77,16 +74,11 @@
553
554 private int primary_monitor = 0;
555
556+ Gdk.Screen screen;
557+
558+ public signal void close_indicator ();
559+
560 public SlingshotView () {
561-
562- // Window properties
563- this.title = "Slingshot";
564- this.skip_pager_hint = true;
565- this.skip_taskbar_hint = true;
566- this.set_keep_above (true);
567- this.set_type_hint (Gdk.WindowTypeHint.MENU);
568- this.focus_on_map = true;
569-
570 // Have the window in the right place
571 read_settings (true);
572
573@@ -98,6 +90,8 @@
574 categories = app_system.get_categories ();
575 apps = app_system.get_apps ();
576
577+ screen = get_screen ();
578+
579 primary_monitor = screen.get_primary_monitor ();
580 Gdk.Rectangle geometry;
581 screen.get_monitor_geometry (primary_monitor, out geometry);
582@@ -132,7 +126,7 @@
583 default_columns--;
584 }
585
586- while ((calculate_grid_height () >= 2 * geometry.width / 3)) {
587+ while ((calculate_grid_height () >= 2 * geometry.height / 3)) {
588 default_rows--;
589 }
590
591@@ -216,14 +210,7 @@
592 event_box.add (container);
593 // Add the container to the dialog's content area
594
595- ref_grid = new Gtk.Grid ();
596- this.add (ref_grid);
597-
598- popover = new Gtk.Popover (ref_grid);
599- popover.add (event_box);
600- popover.set_position (Gtk.PositionType.TOP);
601-
602- this.show.connect (() => popover.show ());
603+ this.add (event_box);
604
605 if (Slingshot.settings.use_category)
606 set_modality (Modality.CATEGORY_VIEW);
607@@ -232,40 +219,12 @@
608 debug ("Ui setup completed");
609 }
610
611- public void grab_device () {
612- var display = Gdk.Display.get_default ();
613- var pointer = display.get_device_manager ().get_client_pointer ();
614- var keyboard = pointer.associated_device;
615- var keyboard_status = Gdk.GrabStatus.SUCCESS;
616-
617- if (keyboard != null && keyboard.input_source == Gdk.InputSource.KEYBOARD) {
618- keyboard_status = keyboard.grab (get_window (), Gdk.GrabOwnership.NONE, true,
619- Gdk.EventMask.KEY_PRESS_MASK | Gdk.EventMask.KEY_RELEASE_MASK,
620- null, Gdk.CURRENT_TIME);
621- }
622-
623- var pointer_status = pointer.grab (get_window (), Gdk.GrabOwnership.NONE, true,
624- Gdk.EventMask.SMOOTH_SCROLL_MASK | Gdk.EventMask.BUTTON_PRESS_MASK |
625- Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.POINTER_MOTION_MASK,
626- null, Gdk.CURRENT_TIME);
627-
628- if (pointer_status != Gdk.GrabStatus.SUCCESS || keyboard_status != Gdk.GrabStatus.SUCCESS) {
629- // If grab failed, retry again. Happens when "Applications" button is long held.
630- Timeout.add (100, () => {
631- if (visible)
632- grab_device ();
633-
634- return false;
635- });
636- }
637- }
638-
639 public override bool button_press_event (Gdk.EventButton event) {
640 var pointer = Gdk.Display.get_default ().get_device_manager ().get_client_pointer ();
641
642 // get_window_at_position returns null if the window belongs to another application.
643 if (pointer.get_window_at_position (null, null) == null) {
644- hide ();
645+ close_indicator ();
646
647 return true;
648 }
649@@ -273,21 +232,6 @@
650 return false;
651 }
652
653- public override void get_preferred_width (out int minimum_width, out int natural_width) {
654- popover.get_preferred_width (out minimum_width, out natural_width);
655- }
656-
657- public override void get_preferred_height (out int minimum_height, out int natural_height) {
658- popover.get_preferred_height (out minimum_height, out natural_height);
659- }
660-
661- public override bool map_event (Gdk.EventAny event) {
662- if (visible)
663- grab_device ();
664-
665- return false;
666- }
667-
668 private bool hotcorner_trigger (Gdk.EventMotion event) {
669 if (can_trigger_hotcorner && event.x_root <= 0 && event.y_root <= 0) {
670 Gdk.Display.get_default ().get_device_manager ().get_client_pointer ().ungrab (event.time);
671@@ -309,11 +253,6 @@
672 event_box.key_press_event.connect (on_key_press);
673 search_entry.key_press_event.connect (search_entry_key_press);
674 // Showing a menu reverts the effect of the grab_device function.
675- search_entry.populate_popup.connect ((menu) => {
676- menu.hide.connect (() => {
677- grab_device ();
678- });
679- });
680 search_entry.search_changed.connect (() => {
681 if (modality != Modality.SEARCH_VIEW)
682 set_modality (Modality.SEARCH_VIEW);
683@@ -322,7 +261,8 @@
684 search_entry.grab_focus ();
685 search_entry.activate.connect (search_entry_activated);
686
687- search_view.app_launched.connect (() => hide ());
688+ // FIXME: signals chain up is not supported
689+ search_view.app_launched.connect (() => { close_indicator (); });
690
691 // This function must be after creating the page switcher
692 populate_grid_view ();
693@@ -353,18 +293,6 @@
694 if (Slingshot.settings.screen_resolution != @"$(geometry.width)x$(geometry.height)") {
695 setup_size ();
696 }
697- reposition ();
698- });
699- screen.monitors_changed.connect (() => {
700- reposition ();
701- });
702-
703- get_style_context ().notify["direction"].connect (() => {
704- reposition ();
705- });
706-
707- popover.hide.connect (() => {
708- hide ();
709 });
710
711 // check for change in gala settings
712@@ -383,22 +311,6 @@
713 }
714 }
715
716- private void reposition () {
717- debug("Repositioning");
718-
719- Gdk.Rectangle monitor_dimensions;
720- screen.get_monitor_geometry (this.screen.get_primary_monitor(), out monitor_dimensions);
721- if (get_style_context ().direction == Gtk.TextDirection.LTR) {
722- popover.set_pointing_to ({36, 0, 0, 0});
723- // Added 36px to y to be aligned with other popovers.
724- move (monitor_dimensions.x, monitor_dimensions.y + 36);
725- } else {
726- popover.set_pointing_to ({ref_grid.get_window ().get_width () - 36, 0, 0, 0});
727- // Added 36px to y to be aligned with other popovers.
728- move (monitor_dimensions.x + monitor_dimensions.width - this.get_window ().get_width (), monitor_dimensions.y + 36);
729- }
730- }
731-
732 private void change_view_mode (string key) {
733 switch (key) {
734 case "1": // Normal view
735@@ -413,7 +325,7 @@
736 // Handle super+space when the user is typing in the search entry
737 private bool search_entry_key_press (Gdk.EventKey event) {
738 if ((event.keyval == Gdk.Key.space) && ((event.state & Gdk.ModifierType.SUPER_MASK) != 0)) {
739- hide ();
740+ close_indicator ();
741 return true;
742 }
743
744@@ -425,16 +337,18 @@
745 return true;
746 }
747
748- return false;
749+ return on_key_press (event);
750 }
751
752 private void search_entry_activated () {
753 if (modality == Modality.SEARCH_VIEW) {
754 if (search_view.launch_selected ())
755- hide ();
756+ close_indicator ();
757 } else {
758+/* TODO
759 if (get_focus () as Widgets.AppEntry != null) // checking the selected widget is an AppEntry
760 ((Widgets.AppEntry) get_focus ()).launch_app ();
761+*/
762 }
763 }
764
765@@ -462,7 +376,7 @@
766 switch (key) {
767 case "F4":
768 if ((event.state & Gdk.ModifierType.MOD1_MASK) != 0) {
769- hide ();
770+ close_indicator ();
771 }
772
773 break;
774@@ -471,7 +385,7 @@
775 if (search_entry.text.length > 0) {
776 search_entry.text = "";
777 } else {
778- hide ();
779+ close_indicator ();
780 }
781
782 return true;
783@@ -481,10 +395,12 @@
784 case "KP_Enter":
785 if (modality == Modality.SEARCH_VIEW) {
786 if (search_view.launch_selected ())
787- hide ();
788+ close_indicator ();
789 } else {
790+/* TODO
791 if (get_focus () as Widgets.AppEntry != null) // checking the selected widget is an AppEntry
792 ((Widgets.AppEntry)get_focus ()).launch_app ();
793+*/
794 }
795 return true;
796
797@@ -698,14 +614,12 @@
798 public void show_slingshot () {
799 search_entry.text = "";
800
801- reposition ();
802- show_all ();
803- popover.show_all ();
804- present ();
805-
806+/* TODO
807 set_focus (null);
808+*/
809+
810 search_entry.grab_focus ();
811- //This is needed in order to not animate if the previous view was the search view.
812+ // This is needed in order to not animate if the previous view was the search view.
813 view_selector_revealer.transition_type = Gtk.RevealerTransitionType.NONE;
814 stack.transition_type = Gtk.StackTransitionType.NONE;
815 set_modality ((Modality) view_selector.selected);
816@@ -826,7 +740,7 @@
817 grid_view.clear ();
818 foreach (Backend.App app in app_system.get_apps_by_name ()) {
819 var app_entry = new Widgets.AppEntry (app);
820- app_entry.app_launched.connect (() => hide ());
821+ app_entry.app_launched.connect (() => close_indicator ());
822 grid_view.append (app_entry);
823 app_entry.show_all ();
824 }
825@@ -860,6 +774,7 @@
826 }
827
828 private void normal_move_focus (int delta_column, int delta_row) {
829+/* TODO
830 if (get_focus () as Widgets.AppEntry != null) { // we check if any AppEntry has focus. If it does, we move
831 if (column_focus + delta_column < 0 || row_focus + delta_row < 0)
832 return;
833@@ -891,6 +806,7 @@
834 grid_view.get_child_at (column_focus, 0).grab_focus ();
835 row_focus = 0;
836 }
837+*/
838 }
839
840 private void category_move_focus (int delta_column, int delta_row) {
841@@ -944,6 +860,8 @@
842 category_column_focus = 0;
843 category_row_focus = 0;
844 }
845+
846+
847 }
848
849 }
850
851=== modified file 'src/Widgets/AppEntry.vala'
852--- src/Widgets/AppEntry.vala 2015-11-03 15:36:28 +0000
853+++ src/Widgets/AppEntry.vala 2015-11-27 00:35:16 +0000
854@@ -118,7 +118,6 @@
855 this.drag_end.connect ( () => {
856 this.dragging = false;
857 var slingshot_app = (Gtk.Application) GLib.Application.get_default ();
858- ((SlingshotView)slingshot_app.active_window).grab_device ();
859 });
860
861 this.drag_data_get.connect ( (ctx, sel, info, time) => {
862@@ -162,7 +161,6 @@
863 // Showing a menu reverts the effect of the grab_device function.
864 menu.hide.connect (() => {
865 var slingshot_app = (Gtk.Application) GLib.Application.get_default ();
866- ((SlingshotView)slingshot_app.active_window).grab_device ();
867 });
868
869 foreach (var action in application.actions) {
870
871=== modified file 'src/Widgets/CategoryView.vala'
872--- src/Widgets/CategoryView.vala 2015-01-17 23:56:32 +0000
873+++ src/Widgets/CategoryView.vala 2015-11-27 00:35:16 +0000
874@@ -96,7 +96,7 @@
875
876 private void add_app (Backend.App app) {
877 var app_entry = new AppEntry (app);
878- app_entry.app_launched.connect (() => view.hide ());
879+ app_entry.app_launched.connect (() => view.close_indicator ());
880 app_view.append (app_entry);
881 app_view.show_all ();
882

Subscribers

People subscribed via source and target branches