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

Proposed by Cody Garver
Status: Merged
Approved by: Cody Garver
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 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
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2015-11-25 05:48:28 +0000
+++ CMakeLists.txt 2015-11-27 00:35:16 +0000
@@ -1,14 +1,17 @@
1# Check http://webdev.elementaryos.org/docs/developer-guide/cmake for documentation1# Main configuration
2
3cmake_minimum_required (VERSION 2.6)2cmake_minimum_required (VERSION 2.6)
4cmake_policy (VERSION 2.6)3cmake_policy (VERSION 2.6)
5list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)4list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
65
6# Project information
7project (slingshot)7project (slingshot)
8set (INDICATORTITLE "Slingshot")
9set (INDICATORDESCRIPTION "Application menu")
810
9set (APPNAME "${CMAKE_PROJECT_NAME}-launcher")11# Set some variables
10set (DATADIR "${CMAKE_INSTALL_PREFIX}/share")12include (GNUInstallDirs)
11set (PKGDATADIR "${DATADIR}/${CMAKE_PROJECT_NAME}")13set (DATADIR "${CMAKE_INSTALL_FULL_LIBDIR}/wingpanel")
14set (PKGDATADIR "${DATADIR}")
12set (GETTEXT_PACKAGE "${CMAKE_PROJECT_NAME}")15set (GETTEXT_PACKAGE "${CMAKE_PROJECT_NAME}")
13set (RELEASE_NAME "Donatello")16set (RELEASE_NAME "Donatello")
14set (VERSION "0.8.2")17set (VERSION "0.8.2")
@@ -18,8 +21,8 @@
18# Files21# Files
19file (GLOB applications_menu "${CMAKE_CURRENT_SOURCE_DIR}/data/pantheon-applications.menu")22file (GLOB applications_menu "${CMAKE_CURRENT_SOURCE_DIR}/data/pantheon-applications.menu")
2023
21# Configure file24# Configuration file
22configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)25configure_file (${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/lib/synapse-core/config.h)
2326
24# Add 'make dist' command for creating release tarball27# Add 'make dist' command for creating release tarball
25set (CPACK_PACKAGE_VERSION ${VERSION})28set (CPACK_PACKAGE_VERSION ${VERSION})
@@ -27,13 +30,12 @@
27set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")30set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")
28set (CPACK_SOURCE_IGNORE_FILES "/build/;/.bzr/;/.bzrignore;~$;${CPACK_SOURCE_IGNORE_FILES}")31set (CPACK_SOURCE_IGNORE_FILES "/build/;/.bzr/;/.bzrignore;~$;${CPACK_SOURCE_IGNORE_FILES}")
2932
33# Include CPack
30include (CPack)34include (CPack)
31add_custom_target (dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)35add_custom_target (dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
3236
33# Slingshot37# Option to configure the use of the unity integration
34
35option (USE_UNITY "Use Unity integration" ON)38option (USE_UNITY "Use Unity integration" ON)
36
37if (USE_UNITY)39if (USE_UNITY)
38 message ("-- Unity integration enabled")40 message ("-- Unity integration enabled")
39 set (UNITY_DEPS unity)41 set (UNITY_DEPS unity)
@@ -42,8 +44,8 @@
42 message ("-- Unity integration disabled")44 message ("-- Unity integration disabled")
43endif ()45endif ()
4446
47# Option to configure the use of the zeitgeist integration
45option (USE_ZEITGEIST "Use Zeitgeist integration" ON)48option (USE_ZEITGEIST "Use Zeitgeist integration" ON)
46
47if (USE_ZEITGEIST)49if (USE_ZEITGEIST)
48 message ("-- Zeitgeist integration enabled")50 message ("-- Zeitgeist integration enabled")
49 set (ZEITGEIST_DEPS zeitgeist-2.0)51 set (ZEITGEIST_DEPS zeitgeist-2.0)
@@ -52,7 +54,16 @@
52 message ("-- Zeitgeist integration disabled")54 message ("-- Zeitgeist integration disabled")
53endif ()55endif ()
5456
57# Gettext package
58add_definitions (-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
59
60# Comment this out to enable C compiler warnings
61add_definitions (-w)
62
63# Load PkgConfig
55find_package (PkgConfig)64find_package (PkgConfig)
65
66# Check for Vala
56 67
57pkg_check_modules(PLANK011 QUIET plank>=0.10.9)68pkg_check_modules(PLANK011 QUIET plank>=0.10.9)
58if (PLANK011_FOUND)69if (PLANK011_FOUND)
@@ -67,7 +78,7 @@
67endif ()78endif ()
6879
69set (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};")80set (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};")
70set (UI_DEPS "gtk+-3.0>=3.12.0;granite;${ZEITGEIST_DEPS};")81set (UI_DEPS "wingpanel-2.0;gtk+-3.0>=3.12.0;granite;${ZEITGEIST_DEPS};")
7182
72pkg_check_modules (DEPS REQUIRED "${CORE_DEPS}${UI_DEPS}" gthread-2.0)83pkg_check_modules (DEPS REQUIRED "${CORE_DEPS}${UI_DEPS}" gthread-2.0)
7384
@@ -75,68 +86,29 @@
75include (ValaVersion)86include (ValaVersion)
76ensure_vala_version ("0.26.2" MINIMUM)87ensure_vala_version ("0.26.2" MINIMUM)
7788
89# Include vala precompile
78include (ValaPrecompile)90include (ValaPrecompile)
79vala_precompile (VALA_C ${APPNAME}91
80 src/Slingshot.vala92# Synapse libraries
81 src/SlingshotView.vala93include_directories (${CMAKE_BINARY_DIR}/lib/synapse-core)
82 src/Settings.vala94include_directories (${CMAKE_BINARY_DIR}/lib/synapse-plugins)
83 src/Utils.vala95
84 src/Pixels.vala96# Link some libraries
85 src/Backend/AppSystem.vala
86 src/Backend/DBusService.vala
87 src/Backend/App.vala
88 src/Backend/RelevancyService.vala
89 src/Backend/SynapseSearch.vala
90 src/Widgets/AppEntry.vala
91 src/Widgets/Grid.vala
92 src/Widgets/Switcher.vala
93 src/Widgets/SearchView.vala
94 src/Widgets/SearchItem.vala
95 src/Widgets/Sidebar.vala
96 src/Widgets/CategoryView.vala
97PACKAGES
98 ${CORE_DEPS}
99 ${UI_DEPS}
100 synapse-core
101 synapse-plugins
102CUSTOM_VAPIS
103 vapi/config.vapi
104OPTIONS
105 --thread
106 --target-glib=2.32
107 --vapidir=${CMAKE_BINARY_DIR}/lib/synapse-core
108 --vapidir=${CMAKE_BINARY_DIR}/lib/synapse-plugins
109 -g
110 ${UNITY_OPTIONS}
111 ${ZEITGEIST_OPTIONS}
112 ${PLANK_OPTIONS}
113)
114
115include_directories(${CMAKE_BINARY_DIR}/lib/synapse-core)
116include_directories(${CMAKE_BINARY_DIR}/lib/synapse-plugins)
117
118add_subdirectory(lib/synapse-core)
119add_subdirectory(lib/synapse-plugins)
120
121# Comment this out to enable C compiler warnings
122add_definitions (-w)
123
124add_definitions (${DEPS_CFLAGS} -DGMENU_I_KNOW_THIS_IS_UNSTABLE -include config.h)97add_definitions (${DEPS_CFLAGS} -DGMENU_I_KNOW_THIS_IS_UNSTABLE -include config.h)
125link_libraries (${DEPS_LIBRARIES})98link_libraries (${DEPS_LIBRARIES})
126link_directories (${DEPS_LIBRARY_DIRS})99link_directories (${DEPS_LIBRARY_DIRS})
127100
128add_executable (${APPNAME} ${VALA_C})
129target_link_libraries(${APPNAME} m synapse-core synapse-plugins)
130
131# Installation101# Installation
132install (TARGETS ${APPNAME} RUNTIME DESTINATION bin)102install (TARGETS ${APPNAME} RUNTIME DESTINATION bin)
133install (FILES ${applications_menu} DESTINATION /etc/xdg/menus)103install (FILES ${applications_menu} DESTINATION /etc/xdg/menus)
104file (GLOB resources "${CMAKE_CURRENT_SOURCE_DIR}/data/*")
134105
135#106# Settings schema
136# GSettings Schema
137#
138include (GSettings)107include (GSettings)
139add_schema ("org.pantheon.desktop.slingshot.gschema.xml")108add_schema ("org.pantheon.desktop.slingshot.gschema.xml")
140109
141# Translations110# Directories
111add_subdirectory (lib/synapse-core)
112add_subdirectory (lib/synapse-plugins)
113add_subdirectory (src)
142add_subdirectory (po)114add_subdirectory (po)
143115
=== modified file 'lib/synapse-core/CMakeLists.txt'
--- lib/synapse-core/CMakeLists.txt 2014-07-03 06:38:42 +0000
+++ lib/synapse-core/CMakeLists.txt 2015-11-27 00:35:16 +0000
@@ -1,7 +1,8 @@
1set(CORE_LIB_VERSION 0.1)1# Library information
2set(CORE_LIB_SOVERSION 0)2set (CORE_LIB_VERSION 0.1)
3set(CORE_LIBRARY_NAME synapse-core)3set (CORE_LIB_SOVERSION 0)
4set(CORE_PKG4set (CORE_LIBRARY_NAME synapse-core)
5set (CORE_PKG
5 glib-2.06 glib-2.0
6 zeitgeist-2.07 zeitgeist-2.0
7 gio-unix-2.08 gio-unix-2.0
@@ -10,9 +11,11 @@
10 gtk+-3.011 gtk+-3.0
11)12)
1213
13pkg_check_modules(CORE_DEPS REQUIRED ${CORE_PKG})14# Check for dependencies
15pkg_check_modules (CORE_DEPS REQUIRED ${CORE_PKG})
1416
15set(CORE_SOURCE17# Source files
18set (CORE_SOURCE
16 common-actions.vala19 common-actions.vala
17 config-service.vala20 config-service.vala
18 data-sink.vala21 data-sink.vala
@@ -28,9 +31,8 @@
28 volume-service.vala31 volume-service.vala
29)32)
3033
31set(LINK_MODE STATIC)34# Compile
3235vala_precompile (CORE_VALA_C ${CORE_LIBRARY_NAME}
33vala_precompile(CORE_VALA_C ${CORE_LIBRARY_NAME}
34 ${CORE_SOURCE}36 ${CORE_SOURCE}
35PACKAGES37PACKAGES
36 ${CORE_PKG}38 ${CORE_PKG}
@@ -40,15 +42,17 @@
40 ${CORE_LIBRARY_NAME}42 ${CORE_LIBRARY_NAME}
41)43)
4244
43add_definitions(${CORE_DEPS_CFLAGS} -include config.h -w)45# Some compiler flags
44link_directories(${CORE_DEPS_LIBRARY_DIRS})46add_definitions (${CORE_DEPS_CFLAGS} -fPIC -include config.h -w)
47link_directories (${CORE_DEPS_LIBRARY_DIRS})
4548
46add_library(${CORE_LIBRARY_NAME} STATIC ${CORE_VALA_C})49# Library
50add_library (${CORE_LIBRARY_NAME} STATIC ${CORE_VALA_C})
47target_link_libraries (${CORE_LIBRARY_NAME} ${CORE_DEPS_LIBRARIES})51target_link_libraries (${CORE_LIBRARY_NAME} ${CORE_DEPS_LIBRARIES})
4852
49set_target_properties(${CORE_LIBRARY_NAME} PROPERTIES53# Set some properties
54set_target_properties (${CORE_LIBRARY_NAME} PROPERTIES
50 OUTPUT_NAME ${CORE_LIBRARY_NAME}55 OUTPUT_NAME ${CORE_LIBRARY_NAME}
51 VERSION ${CORE_LIB_VERSION}56 VERSION ${CORE_LIB_VERSION}
52 SOVERSION ${CORE_LIB_SOVERSION}57 SOVERSION ${CORE_LIB_SOVERSION}
53)58)
54
5559
=== modified file 'lib/synapse-plugins/CMakeLists.txt'
--- lib/synapse-plugins/CMakeLists.txt 2015-06-03 19:10:24 +0000
+++ lib/synapse-plugins/CMakeLists.txt 2015-11-27 00:35:16 +0000
@@ -1,7 +1,8 @@
1set(PLUGINS_LIB_VERSION 0.1)1# Library information
2set(PLUGINS_LIB_SOVERSION 0)2set (PLUGINS_LIB_VERSION 0.1)
3set(PLUGINS_LIBRARY_NAME synapse-plugins)3set (PLUGINS_LIB_SOVERSION 0)
4set(PLUGINS_PKG4set (PLUGINS_LIBRARY_NAME synapse-plugins)
5set (PLUGINS_PKG
5 glib-2.06 glib-2.0
6 gio-unix-2.07 gio-unix-2.0
7 gee-0.88 gee-0.8
@@ -9,9 +10,11 @@
9 switchboard-2.010 switchboard-2.0
10)11)
1112
12pkg_check_modules(PLUGINS_DEPS REQUIRED ${PLUGINS_PKG})13# Check for dependencies
14pkg_check_modules (PLUGINS_DEPS REQUIRED ${PLUGINS_PKG})
1315
14set(PLUGINS_SOURCE16# Source files
17set (PLUGINS_SOURCE
15 calculator-plugin.vala18 calculator-plugin.vala
16 command-plugin.vala19 command-plugin.vala
17 desktop-file-plugin.vala20 desktop-file-plugin.vala
@@ -19,9 +22,8 @@
19 system-managment.vala22 system-managment.vala
20)23)
2124
22set(LINK_MODE STATIC)25# Compile
2326vala_precompile (PLUGINS_VALA_C ${PLUGINS_LIBRARY_NAME}
24vala_precompile(PLUGINS_VALA_C ${PLUGINS_LIBRARY_NAME}
25 ${PLUGINS_SOURCE}27 ${PLUGINS_SOURCE}
26PACKAGES28PACKAGES
27 ${PLUGINS_PKG}29 ${PLUGINS_PKG}
@@ -34,17 +36,20 @@
34 ${PLUGINS_LIBRARY_NAME}36 ${PLUGINS_LIBRARY_NAME}
35)37)
3638
37add_definitions(${PLUGINS_DEPS_CFLAGS} -include config.h -w)39# Compiler flags
38link_directories(${PLUGINS_DEPS_LIBRARY_DIRS})40add_definitions (${PLUGINS_DEPS_CFLAGS} -fPIC -include config.h -w)
39include_directories(${CMAKE_BINARY_DIR}/lib/synapse-core)41link_directories (${PLUGINS_DEPS_LIBRARY_DIRS})
4042include_directories (${CMAKE_BINARY_DIR}/lib/synapse-core)
41add_library(${PLUGINS_LIBRARY_NAME} STATIC ${PLUGINS_VALA_C})43
4244# Add library
43set_target_properties(${PLUGINS_LIBRARY_NAME} PROPERTIES45add_library (${PLUGINS_LIBRARY_NAME} STATIC ${PLUGINS_VALA_C})
46
47# Set some properties
48set_target_properties (${PLUGINS_LIBRARY_NAME} PROPERTIES
44 OUTPUT_NAME ${PLUGINS_LIBRARY_NAME}49 OUTPUT_NAME ${PLUGINS_LIBRARY_NAME}
45 VERSION ${PLUGINS_LIB_VERSION}50 VERSION ${PLUGINS_LIB_VERSION}
46 SOVERSION ${PLUGINS_LIB_SOVERSION}51 SOVERSION ${PLUGINS_LIB_SOVERSION}
47)52)
4853
54# Link libraries
49target_link_libraries (${PLUGINS_LIBRARY_NAME} ${PLUGINS_DEPS_LIBRARIES} synapse-core)55target_link_libraries (${PLUGINS_LIBRARY_NAME} ${PLUGINS_DEPS_LIBRARIES} synapse-core)
50
5156
=== modified file 'src/Backend/DBusService.vala'
--- src/Backend/DBusService.vala 2013-12-26 00:08:04 +0000
+++ src/Backend/DBusService.vala 2015-11-27 00:35:16 +0000
@@ -66,4 +66,4 @@
66 // Emit initial state66 // Emit initial state
67 service.on_view_visibility_change ();67 service.on_view_visibility_change ();
68 }68 }
69}
70\ No newline at end of file69\ No newline at end of file
70}
7171
=== added file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ src/CMakeLists.txt 2015-11-27 00:35:16 +0000
@@ -0,0 +1,54 @@
1# Some dependencies
2set (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};")
3set (UI_DEPS "gtk+-3.0>=3.12.0;granite;wingpanel-2.0;${ZEITGEIST_DEPS};")
4
5# Check for these dependencies
6pkg_check_modules (DEPS REQUIRED "${CORE_DEPS}${UI_DEPS}" gthread-2.0)
7
8# Compiling options
9vala_precompile (VALA_C ${CMAKE_PROJECT_NAME}
10 Slingshot.vala
11 SlingshotView.vala
12 Settings.vala
13 Utils.vala
14 Pixels.vala
15 Backend/AppSystem.vala
16 Backend/DBusService.vala
17 Backend/App.vala
18 Backend/RelevancyService.vala
19 Backend/SynapseSearch.vala
20 Widgets/AppEntry.vala
21 Widgets/Grid.vala
22 Widgets/Switcher.vala
23 Widgets/SearchView.vala
24 Widgets/SearchItem.vala
25 Widgets/Sidebar.vala
26 Widgets/CategoryView.vala
27PACKAGES
28 ${CORE_DEPS}
29 ${UI_DEPS}
30 synapse-core
31 synapse-plugins
32CUSTOM_VAPIS
33 ../vapi/config.vapi
34OPTIONS
35 --thread
36 --target-glib=2.32
37 --vapidir=${CMAKE_BINARY_DIR}/lib/synapse-core
38 --vapidir=${CMAKE_BINARY_DIR}/lib/synapse-plugins
39 -g
40 ${UNITY_OPTIONS}
41 ${ZEITGEIST_OPTIONS}
42 ${PLANK_OPTIONS}
43)
44
45add_definitions(${DEPS_CFLAGS})
46
47# Library
48add_library (${CMAKE_PROJECT_NAME} MODULE ${VALA_C})
49target_link_libraries(${CMAKE_PROJECT_NAME} ${DEPS_LIBRARIES})
50
51target_link_libraries(${CMAKE_PROJECT_NAME} synapse-plugins)
52
53# Installation
54install (TARGETS ${CMAKE_PROJECT_NAME} DESTINATION ${PKGDATADIR})
055
=== modified file 'src/Slingshot.vala'
--- src/Slingshot.vala 2015-01-17 23:56:32 +0000
+++ src/Slingshot.vala 2015-11-27 00:35:16 +0000
@@ -16,92 +16,65 @@
16// along with this program. If not, see <http://www.gnu.org/licenses/>.16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17//17//
1818
19public class Slingshot.Slingshot : Granite.Application {19public class Slingshot.Slingshot : Wingpanel.Indicator {
2020
21 private SlingshotView view = null;21 private SlingshotView? view = null;
22 public static bool silent = false;22
23 public static bool command_mode = false;23 private Gtk.Label? indicator_label = null;
2424
25 public static Settings settings { get; private set; default = null; }25 public static Settings settings { get; private set; default = null; }
26 //public static CssProvider style_provider { get; private set; default = null; }
27 public static Gtk.IconTheme icon_theme { get; set; default = null; }26 public static Gtk.IconTheme icon_theme { get; set; default = null; }
27
28 private DBusService? dbus_service = null;28 private DBusService? dbus_service = null;
2929
30 construct {
31
32 build_data_dir = Build.DATADIR;
33 build_pkg_data_dir = Build.PKGDATADIR;
34 build_release_name = Build.RELEASE_NAME;
35 build_version = Build.VERSION;
36 build_version_info = Build.VERSION_INFO;
37
38 program_name = "Slingshot";
39 exec_name = "slingshot-launcher";
40 app_copyright = "GPLv3";
41 app_icon = "";
42 app_launcher = "";
43 app_years = "2011-2012";
44 application_id = "net.launchpad.slingshot";
45 main_url = "https://launchpad.net/slingshot";
46 bug_url = "https://bugs.launchpad.net/slingshot";
47 help_url = "https://answers.launchpad.net/slingshot";
48 translate_url = "https://translations.launchpad.net/slingshot";
49
50 about_authors = {"Giulio Collura <random.cpp@gmail.com>",
51 "Andrea Basso <andrea@elementaryos.org"};
52 about_artists = {"Harvey Cabaguio 'BassUltra' <harveycabaguio@gmail.com>",
53 "Daniel Foré <bunny@go-docky.com>"};
54 about_translators = "Launchpad Translators";
55 about_license_type = Gtk.License.GPL_3_0;
56
57 }
58
59 public Slingshot () {30 public Slingshot () {
60 settings = new Settings ();31 Object (code_name: Wingpanel.Indicator.APP_LAUNCHER,
61 }32 display_name: _("Slingshot"),
6233 description:_("The app-menu indicator"));
63 protected override void activate () {34 }
64 if (get_windows () == null) {35
36 void on_close_indicator () {
37 close ();
38 }
39
40 public override Gtk.Widget? get_widget () {
41 if (view == null) {
42 settings = new Settings ();
43
65 view = new SlingshotView ();44 view = new SlingshotView ();
66 view.set_application (this);45
46 view.close_indicator.connect (on_close_indicator);
6747
68 if (dbus_service == null)48 if (dbus_service == null)
69 dbus_service = new DBusService (view);49 dbus_service = new DBusService (view);
7050 }
71 if (!silent) {51
72 view.show_slingshot ();52 return view;
73 }53 }
74 } else {54
75 if (view.visible && !silent)55 public override Gtk.Widget get_display_widget () {
76 view.hide ();56 if (indicator_label == null)
77 else57 indicator_label = new Gtk.Label ("Applications");
78 view.show_slingshot ();58
79 }59 visible = true;
80 silent = false;60
81 }61 return indicator_label;
8262 }
83 static const OptionEntry[] entries = {63
84 { "silent", 's', 0, OptionArg.NONE, ref silent, "Launch Slingshot as a background process without it appearing visually.", null },64 public override void opened () {
85 { "command-mode", 'c', 0, OptionArg.NONE, ref command_mode, "This feature is not implemented yet. When it is, description will be changed.", null },65 if (view != null)
86 { null }66 view.show_slingshot ();
87 };67 }
8868
89 public static int main (string[] args) {69 public override void closed () {
90 if (args.length > 1) {70 // TODO: Do we need to do anyhting here?
91 var context = new OptionContext ("");71 }
92 context.add_main_entries (entries, "slingshot");72
93 context.add_group (Gtk.get_option_group (true));73}
94 74
95 try {75public Wingpanel.Indicator get_indicator (Module module) {
96 context.parse (ref args);76 debug ("Activating Slingshot");
97 } catch (Error e) {77 var indicator = new Slingshot.Slingshot ();
98 print (e.message + "\n");78 return indicator;
99 }79}
100 }80
101
102 var app = new Slingshot ();
103
104 return app.run (args);
105 }
106
107}
10881
=== modified file 'src/SlingshotView.vala'
--- src/SlingshotView.vala 2015-02-01 15:13:15 +0000
+++ src/SlingshotView.vala 2015-11-27 00:35:16 +0000
@@ -24,8 +24,7 @@
24 SEARCH_VIEW24 SEARCH_VIEW
25 }25 }
2626
27 public class SlingshotView : Granite.Widgets.CompositedWindow {27 public class SlingshotView : Gtk.Grid {
28
29 // Widgets28 // Widgets
30 public Gtk.SearchEntry search_entry;29 public Gtk.SearchEntry search_entry;
31 public Gtk.Stack stack;30 public Gtk.Stack stack;
@@ -42,8 +41,6 @@
42 public Gtk.Stack main_stack;41 public Gtk.Stack main_stack;
43 public Gtk.Box content_area;42 public Gtk.Box content_area;
44 private Gtk.EventBox event_box;43 private Gtk.EventBox event_box;
45 private Gtk.Popover popover;
46 private Gtk.Grid ref_grid;
4744
48 public Backend.AppSystem app_system;45 public Backend.AppSystem app_system;
49 private Gee.ArrayList<GMenu.TreeDirectory> categories;46 private Gee.ArrayList<GMenu.TreeDirectory> categories;
@@ -77,16 +74,11 @@
7774
78 private int primary_monitor = 0;75 private int primary_monitor = 0;
7976
77 Gdk.Screen screen;
78
79 public signal void close_indicator ();
80
80 public SlingshotView () {81 public SlingshotView () {
81
82 // Window properties
83 this.title = "Slingshot";
84 this.skip_pager_hint = true;
85 this.skip_taskbar_hint = true;
86 this.set_keep_above (true);
87 this.set_type_hint (Gdk.WindowTypeHint.MENU);
88 this.focus_on_map = true;
89
90 // Have the window in the right place82 // Have the window in the right place
91 read_settings (true);83 read_settings (true);
9284
@@ -98,6 +90,8 @@
98 categories = app_system.get_categories ();90 categories = app_system.get_categories ();
99 apps = app_system.get_apps ();91 apps = app_system.get_apps ();
10092
93 screen = get_screen ();
94
101 primary_monitor = screen.get_primary_monitor ();95 primary_monitor = screen.get_primary_monitor ();
102 Gdk.Rectangle geometry;96 Gdk.Rectangle geometry;
103 screen.get_monitor_geometry (primary_monitor, out geometry);97 screen.get_monitor_geometry (primary_monitor, out geometry);
@@ -132,7 +126,7 @@
132 default_columns--;126 default_columns--;
133 }127 }
134128
135 while ((calculate_grid_height () >= 2 * geometry.width / 3)) {129 while ((calculate_grid_height () >= 2 * geometry.height / 3)) {
136 default_rows--;130 default_rows--;
137 }131 }
138132
@@ -216,14 +210,7 @@
216 event_box.add (container);210 event_box.add (container);
217 // Add the container to the dialog's content area211 // Add the container to the dialog's content area
218212
219 ref_grid = new Gtk.Grid ();213 this.add (event_box);
220 this.add (ref_grid);
221
222 popover = new Gtk.Popover (ref_grid);
223 popover.add (event_box);
224 popover.set_position (Gtk.PositionType.TOP);
225
226 this.show.connect (() => popover.show ());
227214
228 if (Slingshot.settings.use_category)215 if (Slingshot.settings.use_category)
229 set_modality (Modality.CATEGORY_VIEW);216 set_modality (Modality.CATEGORY_VIEW);
@@ -232,40 +219,12 @@
232 debug ("Ui setup completed");219 debug ("Ui setup completed");
233 }220 }
234221
235 public void grab_device () {
236 var display = Gdk.Display.get_default ();
237 var pointer = display.get_device_manager ().get_client_pointer ();
238 var keyboard = pointer.associated_device;
239 var keyboard_status = Gdk.GrabStatus.SUCCESS;
240
241 if (keyboard != null && keyboard.input_source == Gdk.InputSource.KEYBOARD) {
242 keyboard_status = keyboard.grab (get_window (), Gdk.GrabOwnership.NONE, true,
243 Gdk.EventMask.KEY_PRESS_MASK | Gdk.EventMask.KEY_RELEASE_MASK,
244 null, Gdk.CURRENT_TIME);
245 }
246
247 var pointer_status = pointer.grab (get_window (), Gdk.GrabOwnership.NONE, true,
248 Gdk.EventMask.SMOOTH_SCROLL_MASK | Gdk.EventMask.BUTTON_PRESS_MASK |
249 Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.POINTER_MOTION_MASK,
250 null, Gdk.CURRENT_TIME);
251
252 if (pointer_status != Gdk.GrabStatus.SUCCESS || keyboard_status != Gdk.GrabStatus.SUCCESS) {
253 // If grab failed, retry again. Happens when "Applications" button is long held.
254 Timeout.add (100, () => {
255 if (visible)
256 grab_device ();
257
258 return false;
259 });
260 }
261 }
262
263 public override bool button_press_event (Gdk.EventButton event) {222 public override bool button_press_event (Gdk.EventButton event) {
264 var pointer = Gdk.Display.get_default ().get_device_manager ().get_client_pointer ();223 var pointer = Gdk.Display.get_default ().get_device_manager ().get_client_pointer ();
265224
266 // get_window_at_position returns null if the window belongs to another application.225 // get_window_at_position returns null if the window belongs to another application.
267 if (pointer.get_window_at_position (null, null) == null) {226 if (pointer.get_window_at_position (null, null) == null) {
268 hide ();227 close_indicator ();
269228
270 return true;229 return true;
271 }230 }
@@ -273,21 +232,6 @@
273 return false;232 return false;
274 }233 }
275234
276 public override void get_preferred_width (out int minimum_width, out int natural_width) {
277 popover.get_preferred_width (out minimum_width, out natural_width);
278 }
279
280 public override void get_preferred_height (out int minimum_height, out int natural_height) {
281 popover.get_preferred_height (out minimum_height, out natural_height);
282 }
283
284 public override bool map_event (Gdk.EventAny event) {
285 if (visible)
286 grab_device ();
287
288 return false;
289 }
290
291 private bool hotcorner_trigger (Gdk.EventMotion event) {235 private bool hotcorner_trigger (Gdk.EventMotion event) {
292 if (can_trigger_hotcorner && event.x_root <= 0 && event.y_root <= 0) {236 if (can_trigger_hotcorner && event.x_root <= 0 && event.y_root <= 0) {
293 Gdk.Display.get_default ().get_device_manager ().get_client_pointer ().ungrab (event.time);237 Gdk.Display.get_default ().get_device_manager ().get_client_pointer ().ungrab (event.time);
@@ -309,11 +253,6 @@
309 event_box.key_press_event.connect (on_key_press);253 event_box.key_press_event.connect (on_key_press);
310 search_entry.key_press_event.connect (search_entry_key_press);254 search_entry.key_press_event.connect (search_entry_key_press);
311 // Showing a menu reverts the effect of the grab_device function.255 // Showing a menu reverts the effect of the grab_device function.
312 search_entry.populate_popup.connect ((menu) => {
313 menu.hide.connect (() => {
314 grab_device ();
315 });
316 });
317 search_entry.search_changed.connect (() => {256 search_entry.search_changed.connect (() => {
318 if (modality != Modality.SEARCH_VIEW)257 if (modality != Modality.SEARCH_VIEW)
319 set_modality (Modality.SEARCH_VIEW);258 set_modality (Modality.SEARCH_VIEW);
@@ -322,7 +261,8 @@
322 search_entry.grab_focus ();261 search_entry.grab_focus ();
323 search_entry.activate.connect (search_entry_activated);262 search_entry.activate.connect (search_entry_activated);
324263
325 search_view.app_launched.connect (() => hide ());264 // FIXME: signals chain up is not supported
265 search_view.app_launched.connect (() => { close_indicator (); });
326266
327 // This function must be after creating the page switcher267 // This function must be after creating the page switcher
328 populate_grid_view ();268 populate_grid_view ();
@@ -353,18 +293,6 @@
353 if (Slingshot.settings.screen_resolution != @"$(geometry.width)x$(geometry.height)") {293 if (Slingshot.settings.screen_resolution != @"$(geometry.width)x$(geometry.height)") {
354 setup_size ();294 setup_size ();
355 }295 }
356 reposition ();
357 });
358 screen.monitors_changed.connect (() => {
359 reposition ();
360 });
361
362 get_style_context ().notify["direction"].connect (() => {
363 reposition ();
364 });
365
366 popover.hide.connect (() => {
367 hide ();
368 });296 });
369297
370 // check for change in gala settings298 // check for change in gala settings
@@ -383,22 +311,6 @@
383 }311 }
384 }312 }
385313
386 private void reposition () {
387 debug("Repositioning");
388
389 Gdk.Rectangle monitor_dimensions;
390 screen.get_monitor_geometry (this.screen.get_primary_monitor(), out monitor_dimensions);
391 if (get_style_context ().direction == Gtk.TextDirection.LTR) {
392 popover.set_pointing_to ({36, 0, 0, 0});
393 // Added 36px to y to be aligned with other popovers.
394 move (monitor_dimensions.x, monitor_dimensions.y + 36);
395 } else {
396 popover.set_pointing_to ({ref_grid.get_window ().get_width () - 36, 0, 0, 0});
397 // Added 36px to y to be aligned with other popovers.
398 move (monitor_dimensions.x + monitor_dimensions.width - this.get_window ().get_width (), monitor_dimensions.y + 36);
399 }
400 }
401
402 private void change_view_mode (string key) {314 private void change_view_mode (string key) {
403 switch (key) {315 switch (key) {
404 case "1": // Normal view316 case "1": // Normal view
@@ -413,7 +325,7 @@
413 // Handle super+space when the user is typing in the search entry325 // Handle super+space when the user is typing in the search entry
414 private bool search_entry_key_press (Gdk.EventKey event) {326 private bool search_entry_key_press (Gdk.EventKey event) {
415 if ((event.keyval == Gdk.Key.space) && ((event.state & Gdk.ModifierType.SUPER_MASK) != 0)) {327 if ((event.keyval == Gdk.Key.space) && ((event.state & Gdk.ModifierType.SUPER_MASK) != 0)) {
416 hide ();328 close_indicator ();
417 return true;329 return true;
418 }330 }
419331
@@ -425,16 +337,18 @@
425 return true;337 return true;
426 }338 }
427339
428 return false;340 return on_key_press (event);
429 }341 }
430342
431 private void search_entry_activated () {343 private void search_entry_activated () {
432 if (modality == Modality.SEARCH_VIEW) {344 if (modality == Modality.SEARCH_VIEW) {
433 if (search_view.launch_selected ())345 if (search_view.launch_selected ())
434 hide ();346 close_indicator ();
435 } else {347 } else {
348/* TODO
436 if (get_focus () as Widgets.AppEntry != null) // checking the selected widget is an AppEntry349 if (get_focus () as Widgets.AppEntry != null) // checking the selected widget is an AppEntry
437 ((Widgets.AppEntry) get_focus ()).launch_app ();350 ((Widgets.AppEntry) get_focus ()).launch_app ();
351*/
438 }352 }
439 }353 }
440354
@@ -462,7 +376,7 @@
462 switch (key) {376 switch (key) {
463 case "F4":377 case "F4":
464 if ((event.state & Gdk.ModifierType.MOD1_MASK) != 0) {378 if ((event.state & Gdk.ModifierType.MOD1_MASK) != 0) {
465 hide ();379 close_indicator ();
466 }380 }
467381
468 break;382 break;
@@ -471,7 +385,7 @@
471 if (search_entry.text.length > 0) {385 if (search_entry.text.length > 0) {
472 search_entry.text = "";386 search_entry.text = "";
473 } else {387 } else {
474 hide ();388 close_indicator ();
475 }389 }
476390
477 return true;391 return true;
@@ -481,10 +395,12 @@
481 case "KP_Enter":395 case "KP_Enter":
482 if (modality == Modality.SEARCH_VIEW) {396 if (modality == Modality.SEARCH_VIEW) {
483 if (search_view.launch_selected ())397 if (search_view.launch_selected ())
484 hide ();398 close_indicator ();
485 } else {399 } else {
400/* TODO
486 if (get_focus () as Widgets.AppEntry != null) // checking the selected widget is an AppEntry401 if (get_focus () as Widgets.AppEntry != null) // checking the selected widget is an AppEntry
487 ((Widgets.AppEntry)get_focus ()).launch_app ();402 ((Widgets.AppEntry)get_focus ()).launch_app ();
403*/
488 }404 }
489 return true;405 return true;
490406
@@ -698,14 +614,12 @@
698 public void show_slingshot () {614 public void show_slingshot () {
699 search_entry.text = "";615 search_entry.text = "";
700616
701 reposition ();617/* TODO
702 show_all ();
703 popover.show_all ();
704 present ();
705
706 set_focus (null);618 set_focus (null);
619*/
620
707 search_entry.grab_focus ();621 search_entry.grab_focus ();
708 //This is needed in order to not animate if the previous view was the search view.622 // This is needed in order to not animate if the previous view was the search view.
709 view_selector_revealer.transition_type = Gtk.RevealerTransitionType.NONE;623 view_selector_revealer.transition_type = Gtk.RevealerTransitionType.NONE;
710 stack.transition_type = Gtk.StackTransitionType.NONE;624 stack.transition_type = Gtk.StackTransitionType.NONE;
711 set_modality ((Modality) view_selector.selected);625 set_modality ((Modality) view_selector.selected);
@@ -826,7 +740,7 @@
826 grid_view.clear ();740 grid_view.clear ();
827 foreach (Backend.App app in app_system.get_apps_by_name ()) {741 foreach (Backend.App app in app_system.get_apps_by_name ()) {
828 var app_entry = new Widgets.AppEntry (app);742 var app_entry = new Widgets.AppEntry (app);
829 app_entry.app_launched.connect (() => hide ());743 app_entry.app_launched.connect (() => close_indicator ());
830 grid_view.append (app_entry);744 grid_view.append (app_entry);
831 app_entry.show_all ();745 app_entry.show_all ();
832 }746 }
@@ -860,6 +774,7 @@
860 }774 }
861775
862 private void normal_move_focus (int delta_column, int delta_row) {776 private void normal_move_focus (int delta_column, int delta_row) {
777/* TODO
863 if (get_focus () as Widgets.AppEntry != null) { // we check if any AppEntry has focus. If it does, we move778 if (get_focus () as Widgets.AppEntry != null) { // we check if any AppEntry has focus. If it does, we move
864 if (column_focus + delta_column < 0 || row_focus + delta_row < 0)779 if (column_focus + delta_column < 0 || row_focus + delta_row < 0)
865 return;780 return;
@@ -891,6 +806,7 @@
891 grid_view.get_child_at (column_focus, 0).grab_focus ();806 grid_view.get_child_at (column_focus, 0).grab_focus ();
892 row_focus = 0;807 row_focus = 0;
893 }808 }
809*/
894 }810 }
895811
896 private void category_move_focus (int delta_column, int delta_row) {812 private void category_move_focus (int delta_column, int delta_row) {
@@ -944,6 +860,8 @@
944 category_column_focus = 0;860 category_column_focus = 0;
945 category_row_focus = 0;861 category_row_focus = 0;
946 }862 }
863
864
947 }865 }
948866
949}867}
950868
=== modified file 'src/Widgets/AppEntry.vala'
--- src/Widgets/AppEntry.vala 2015-11-03 15:36:28 +0000
+++ src/Widgets/AppEntry.vala 2015-11-27 00:35:16 +0000
@@ -118,7 +118,6 @@
118 this.drag_end.connect ( () => {118 this.drag_end.connect ( () => {
119 this.dragging = false;119 this.dragging = false;
120 var slingshot_app = (Gtk.Application) GLib.Application.get_default ();120 var slingshot_app = (Gtk.Application) GLib.Application.get_default ();
121 ((SlingshotView)slingshot_app.active_window).grab_device ();
122 });121 });
123122
124 this.drag_data_get.connect ( (ctx, sel, info, time) => {123 this.drag_data_get.connect ( (ctx, sel, info, time) => {
@@ -162,7 +161,6 @@
162 // Showing a menu reverts the effect of the grab_device function.161 // Showing a menu reverts the effect of the grab_device function.
163 menu.hide.connect (() => {162 menu.hide.connect (() => {
164 var slingshot_app = (Gtk.Application) GLib.Application.get_default ();163 var slingshot_app = (Gtk.Application) GLib.Application.get_default ();
165 ((SlingshotView)slingshot_app.active_window).grab_device ();
166 });164 });
167165
168 foreach (var action in application.actions) {166 foreach (var action in application.actions) {
169167
=== modified file 'src/Widgets/CategoryView.vala'
--- src/Widgets/CategoryView.vala 2015-01-17 23:56:32 +0000
+++ src/Widgets/CategoryView.vala 2015-11-27 00:35:16 +0000
@@ -96,7 +96,7 @@
9696
97 private void add_app (Backend.App app) {97 private void add_app (Backend.App app) {
98 var app_entry = new AppEntry (app);98 var app_entry = new AppEntry (app);
99 app_entry.app_launched.connect (() => view.hide ());99 app_entry.app_launched.connect (() => view.close_indicator ());
100 app_view.append (app_entry);100 app_view.append (app_entry);
101 app_view.show_all ();101 app_view.show_all ();
102102

Subscribers

People subscribed via source and target branches