diff --git a/CMakeLists.txt b/CMakeLists.txt index fad1658b..2dbd657d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,6 +115,14 @@ if (ENABLE_VALAPANEL) endif() endif() +option(ENABLE_BUDGIE "Enable budgie-desktop plugin" ON) +if (ENABLE_BUDGIE) + pkg_check_modules(BUDGIE budgie-1.0 libpeas-1.0) + if (NOT BUDGIE_FOUND) + set(ENABLE_BUDGIE OFF) + endif() +endif() + option(ENABLE_UNITY_GTK_MODULE "Build unity-gtk-module" OFF) if(ENABLE_UNITY_GTK_MODULE) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index b0fc0f93..bd2141b7 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -10,3 +10,6 @@ endif() if (ENABLE_VALAPANEL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/appmenu.plugin DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/vala-panel/applets/) endif() +if (ENABLE_BUDGIE) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/appmenu-budgie.plugin DESTINATION ${CMAKE_INSTALL_LIBDIR}/budgie-desktop/plugins) +endif() diff --git a/data/appmenu-budgie.desktop.plugin.in b/data/appmenu-budgie.desktop.plugin.in new file mode 100644 index 00000000..60fb5b83 --- /dev/null +++ b/data/appmenu-budgie.desktop.plugin.in @@ -0,0 +1,8 @@ +[Plugin] +Module=appmenu-budgie.so +Name=Global Menu +Description=Show menus from windows +Authors=Konstantin Pugin +Copyright=Copyright © 2016 Konstantin Pugin +Website=https://github.com/rilian-la-te/vala-panel-appmenu +Icon=view-grid-symbolic diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index d5d6edb7..be20d663 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -70,6 +70,7 @@ set(PLUGIN_VALA_FILES valapanel-plugin-appmenu.vala xfce4-plugin-appmenu.vala mate-plugin-appmenu.vala + budgie-plugin-appmenu.vala ) if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/vala-panel-appmenu.vapi OR ${CMAKE_CURRENT_BINARY_DIR}/appmenu-core_valac.stamp IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/vala-panel-appmenu.vapi) @@ -136,7 +137,7 @@ if(ENABLE_VALAPANEL) ) # Build library for plugins and application - set (VP_CFLAGS ${CORE_CFLAGS} ${WNCK_CFLAGS} ${XFCE_CFLAGS}) + set (VP_CFLAGS ${CORE_CFLAGS} ${WNCK_CFLAGS} ${VALAPANEL_CFLAGS}) add_definitions(${VP_CFLAGS}) set (VALAPANEL_LIB_FILES ${VALA_C_CORE} ${VALA_C_VALAPANEL}) @@ -152,6 +153,43 @@ if(ENABLE_VALAPANEL) install(TARGETS appmenu-valapanel DESTINATION ${CMAKE_INSTALL_LIBDIR}/vala-panel/applets) endif() ########## +# Budgie Panel Part +########## +if(ENABLE_BUDGIE) + vala_precompile(VALA_C_BUDGIE appmenu-budgie + budgie-plugin-appmenu.vala + PACKAGES + ${CORE_PACKAGES} + vala-panel-appmenu + ${WNCK_PACKAGES} + budgie-1.0 + libpeas-1.0 + OPTIONS + --vapidir=${CMAKE_SOURCE_DIR}/vapi + --vapidir=${CMAKE_CURRENT_BINARY_DIR} + --target-glib=2.44 + --gresources=${CMAKE_CURRENT_SOURCE_DIR}/libappmenu.gresource.xml + --thread + ${WNCK_DEFINE} + ) + + # Build library for plugins and application + set (VP_CFLAGS ${CORE_CFLAGS} ${WNCK_CFLAGS} ${BUDGIE_CFLAGS}) + add_definitions(${VP_CFLAGS}) + set (BUDGIE_LIB_FILES ${VALA_C_CORE} ${VALA_C_BUDGIE} ${VALA_C_DBUSMENU}) + + add_library (appmenu-budgie MODULE + ${BUDGIE_LIB_FILES} + ${RESOURCES} + ) + add_dependencies(appmenu-budgie appmenu-core) + target_include_directories (appmenu-budgie PRIVATE ${CORE_INCLUDE_DIRS} ${WNCK_INCLUDE_DIRS} ${BUDGIE_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) + target_link_libraries (appmenu-budgie ${CORE_LIBRARIES} ${WNCK_LIBRARIES} ${BUDGIE_LIBRARIES} m) + link_directories (${CORE_LIBRARY_DIRS} ${WNCK_LIBRARY_DIRS} ${BUDGIE_LIBRARY_DIRS}) + # Install plugin stuffs + install(TARGETS appmenu-budgie DESTINATION ${CMAKE_INSTALL_LIBDIR}/budgie-desktop/plugins) +endif() +########## # MATE Part ########## if (ENABLE_MATE) diff --git a/lib/budgie-plugin-appmenu.vala b/lib/budgie-plugin-appmenu.vala new file mode 100644 index 00000000..4eb5cb06 --- /dev/null +++ b/lib/budgie-plugin-appmenu.vala @@ -0,0 +1,52 @@ +/* + * vala-panel-appmenu + * Copyright (C) 2015 Konstantin Pugin + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +using Gtk; +using GLib; +using Budgie; + +public class AppmenuApplet : Plugin, Peas.ExtensionBase +{ + public Applet get_panel_widget(string uid) + { + return new GlobalMenuApplet(uid); + } +} +public class GlobalMenuApplet: Applet +{ + public string uuid { public set ; public get; } + public override bool supports_settings() + { + return false; + } + public GlobalMenuApplet (string uid) + { + Object(uuid: uuid); + var layout = new Appmenu.AppMenuBar(); + this.add(layout); + show_all(); + } +} // End class + +[ModuleInit] +public void peas_register_types(TypeModule module) +{ + // boilerplate - all modules need this + var objmodule = module as Peas.ObjectModule; + objmodule.register_extension_type(typeof(Budgie.Plugin), typeof(AppmenuApplet)); +}