Skip to content

Commit

Permalink
Experimental Budgie support. Fixes #61
Browse files Browse the repository at this point in the history
  • Loading branch information
rilian-la-te committed Apr 8, 2017
1 parent d5a3ce4 commit e5c6bdb
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
8 changes: 8 additions & 0 deletions data/appmenu-budgie.desktop.plugin.in
Original file line number Diff line number Diff line change
@@ -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
40 changes: 39 additions & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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})

Expand All @@ -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)
Expand Down
52 changes: 52 additions & 0 deletions lib/budgie-plugin-appmenu.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* vala-panel-appmenu
* Copyright (C) 2015 Konstantin Pugin <[email protected]>
*
* 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 <http://www.gnu.org/licenses/>.
*/

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));
}

0 comments on commit e5c6bdb

Please sign in to comment.