From d72b28afcb1e1e5d630a214eb6a9217e30d90d50 Mon Sep 17 00:00:00 2001 From: Charles Lehner Date: Sun, 22 Nov 2015 17:24:15 -0500 Subject: Add LXPanel plugin --- Makefile.am | 2 +- README.md | 2 +- config.h.in | 3 +++ configure.ac | 23 ++++++++++++++++++ lxpanel-plugin/Makefile.am | 11 +++++++++ lxpanel-plugin/topmenu-lxpanel-plugin.c | 41 +++++++++++++++++++++++++++++++++ 6 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 lxpanel-plugin/Makefile.am create mode 100644 lxpanel-plugin/topmenu-lxpanel-plugin.c diff --git a/Makefile.am b/Makefile.am index 11946ff..4cc3d27 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ AUTOMAKE_OPTIONS = foreign -SUBDIRS = libtopmenu-server libtopmenu-client module test mate-applet xfce-applet icons +SUBDIRS = libtopmenu-server libtopmenu-client module test mate-applet xfce-applet lxpanel-plugin icons noinst_HEADERS = global.h diff --git a/README.md b/README.md index 22ced6f..8af107e 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ # Requirements and compatibility -Currently, TopMenu ships as a panel applet for either Mate 1.8 or Xfce >= 4.8 (Gtk+2 versions only). The Mate applet would be relatively easy to port to Gnome 2. +Currently, TopMenu ships as a panel applet for either Mate 1.8, Xfce >= 4.8 (Gtk+2 versions only), or LXPanel. The Mate applet would be relatively easy to port to Gnome 2. Gtk+2 is the preferred toolkit, albeit Gtk+3 is partially supported. Additionally, plugins are shipped for Qt 4 and some Mozilla apps (Firefox, Thunderbird and Zotero). Note that, except in the Gtk+ 3 case, menu bars will always be rendered using the Gtk+ 2 theme. diff --git a/config.h.in b/config.h.in index 90fca35..0f70f2a 100644 --- a/config.h.in +++ b/config.h.in @@ -9,6 +9,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define if you have lxpanel */ +#undef HAVE_LXPANEL + /* Define if you have libmatepanelapplet */ #undef HAVE_MATEPANELAPPLET diff --git a/configure.ac b/configure.ac index 8c67f7a..a245bbb 100644 --- a/configure.ac +++ b/configure.ac @@ -21,6 +21,10 @@ AC_ARG_WITH([gtk-module-dir], [AS_HELP_STRING([--with-gtk-module-dir=DIR], [GTK+ module directory [default=`pkg-config --variable=libdir gtk+-3.0`/gtk-3.0/modules]])], [], [with_gtk_module_dir=$with_gtk_libdir/gtk-$with_gtk.0/modules]) +AC_ARG_WITH([lxpanel-plugin-dir], + [AS_HELP_STRING([--with-lxpanel-plugin-dir=DIR], [LXPanel plugin directory [default=`pkg-config --variable=pluginsdir lxpanel`]])], + [], + [with_lxpanel_plugin_dir=$with_gtk_libdir/lxpanel/plugins]) AC_ARG_WITH([wnck], [AS_HELP_STRING([--with-wnck], [support window management using [wnck1|wnck3|matewnck] @<:@default=check@:>@])], [], @@ -36,10 +40,16 @@ AC_ARG_ENABLE([xfce-applet], [], [enable_xfce_applet=check]) +AC_ARG_ENABLE([lxpanel-plugin], + [AS_HELP_STRING([--enable-lxpanel-plugin], [build the LXPanel plugin @<:@default=check@:>@])], + [], + [enable_lxpanel_plugin=check]) + AM_CONDITIONAL([GTK3], [test GTK$with_gtk = GTK3]) AC_SUBST([GTK_VERSION], [$with_gtk]) AC_DEFINE_UNQUOTED([GTK_VERSION], [$with_gtk], [Define to GTK major version used]) AC_SUBST([GTK_MODULE_DIR], [$with_gtk_module_dir]) +AC_SUBST([LXPANEL_PLUGIN_DIR], [$with_lxpanel_plugin_dir]) # Checks for programs. AC_PROG_CC @@ -102,10 +112,22 @@ AS_IF([test "x$with_gtk" = x3], [if test "x$enable_xfce_applet" = xyes; then AC_MSG_FAILURE([--enable-xfce-applet was given, but test for libxfce4panel failed]) fi] + )]) + + AS_IF([test "x$enable_lxpanel_plugin" != xno], + [PKG_CHECK_MODULES([LXPANELPLUGIN], [lxpanel >= 0.8.0 libfm >= 1.2.3], + [ + AC_DEFINE([HAVE_LXPANEL], [1], [Define if you have lxpanel]) + enable_lxpanel_plugin=yes + ], + [if test "x$enable_lxpanel_plugin" = xyes; then + AC_MSG_FAILURE([--enable-lxpanel-plugin was given, but test for lxpanel failed]) + fi] )])]) AM_CONDITIONAL([WANT_MATE_APPLET], [test x$enable_mate_applet = xyes]) AM_CONDITIONAL([WANT_XFCE_APPLET], [test x$enable_xfce_applet = xyes]) +AM_CONDITIONAL([WANT_LXPANEL_PLUGIN], [test x$enable_lxpanel_plugin = xyes]) # Output files AC_CONFIG_FILES([ @@ -115,6 +137,7 @@ AC_CONFIG_FILES([ module/Makefile mate-applet/Makefile xfce-applet/Makefile + lxpanel-plugin/Makefile icons/Makefile test/Makefile ]) diff --git a/lxpanel-plugin/Makefile.am b/lxpanel-plugin/Makefile.am new file mode 100644 index 0000000..eb44246 --- /dev/null +++ b/lxpanel-plugin/Makefile.am @@ -0,0 +1,11 @@ +if WANT_LXPANEL_PLUGIN + +plugindir = $(LXPANEL_PLUGIN_DIR) +plugin_LTLIBRARIES = libtopmenu.la + +libtopmenu_la_SOURCES = topmenu-lxpanel-plugin.c +libtopmenu_la_CPPFLAGS = $(GTK_CFLAGS) $(LXPANELPLUGIN_CFLAGS) -DG_LOG_DOMAIN=\"topmenu-xfce-panel-applet\" +libtopmenu_la_LIBADD = $(GTK_LIBS) $(LXPANELPLUGIN_LIBS) ../libtopmenu-server/libtopmenu-server-gtk$(GTK_VERSION).la +libtopmenu_la_LDFLAGS = -avoid-version -shared -no-undefined + +endif diff --git a/lxpanel-plugin/topmenu-lxpanel-plugin.c b/lxpanel-plugin/topmenu-lxpanel-plugin.c new file mode 100644 index 0000000..6b0f882 --- /dev/null +++ b/lxpanel-plugin/topmenu-lxpanel-plugin.c @@ -0,0 +1,41 @@ +/* + * Copyright 2015 Charles E. Lehner + * + * This file is part of TopMenu. + * + * TopMenu 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. + * + * TopMenu 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with TopMenu. If not, see . + */ + +#include +#include "../libtopmenu-server/topmenu-widget.h" + +static GtkWidget *topmenu_lxpanel_new_instance(LXPanel *panel, config_setting_t *settings) +{ + GtkWidget *menu = GTK_WIDGET(topmenu_widget_new()); + gtk_widget_set_can_focus(menu, TRUE); + gtk_widget_show_all(menu); + + return menu; +} + +FM_DEFINE_MODULE(lxpanel_gtk, topmenu_lxpanel) + +LXPanelPluginInit fm_module_init_lxpanel_gtk = { + .name = "TopMenu", + .description = "Shows the topmenu menu bar", + .new_instance = topmenu_lxpanel_new_instance, + .expand_available = 1, + .expand_default = 1, + .one_per_system = 1, +}; -- cgit v1.2.3