Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tidy

  • Loading branch information...
commit d6941d83f8ffbfbda1c645680fe401dab5fab9cd 1 parent 8951124
@alexkay authored
Showing with 84 additions and 77 deletions.
  1. +2 −2 .gitignore
  2. +37 −41 Makefile.am
  3. +4 −4 README.md
  4. +16 −15 configure.ac
  5. +25 −15 main.c
View
4 .gitignore
@@ -1,10 +1,10 @@
*.desktop
-*.un~
+*.mate-panel-applet
*.o
*.panel-applet
-*.mate-panel-applet
*.service
*.tar.gz
+*.un~
.#*
.*.swp
.deps
View
78 Makefile.am
@@ -4,83 +4,79 @@ plugin_PROGRAMS = xmonad-log-applet
xmonad_log_applet_SOURCES = main.c
xmonad_log_applet_CPPFLAGS = \
- $(GLIB_CFLAGS) \
- $(DBUS_GLIB_CFLAGS) \
- $(LIBPANEL_CFLAGS) \
- $(LIBMATEPANEL_CFLAGS) \
- @GTK_CFLAGS@
+ $(GLIB_CFLAGS) \
+ $(DBUS_GLIB_CFLAGS) \
+ $(LIBPANEL_CFLAGS)
xmonad_log_applet_LDADD = \
- $(GLIB_LIBS) \
- $(DBUS_GLIB_LIBS) \
- $(LIBPANEL_LIBS) \
- $(LIBMATEPANEL_LIBS) \
- @GTK_LIBS@
+ $(GLIB_LIBS) \
+ $(DBUS_GLIB_LIBS) \
+ $(LIBPANEL_LIBS)
appletdir = $(LIBPANEL_APPLET_DIR)
-if PANEL_XFCE4
-applet_files = xmonad-log-applet.desktop
-$(applet_files): $(applet_files:.desktop=.desktop.in)
+if PANEL_GNOME
+applet_files = org.gnome.panel.XmonadLogApplet.panel-applet
+$(applet_files): $(applet_files:.panel-applet=.panel-applet.in)
$(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
-else
+endif
if PANEL_MATE
applet_files = org.mate.panel.XmonadLogApplet.mate-panel-applet
$(applet_files): $(applet_files:.mate-panel-applet=.mate-panel-applet.in)
$(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
-else
-applet_files = org.gnome.panel.XmonadLogApplet.panel-applet
-$(applet_files): $(applet_files:.panel-applet=.panel-applet.in)
- $(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
endif
+if PANEL_XFCE4
+applet_files = xmonad-log-applet.desktop
+$(applet_files): $(applet_files:.desktop=.desktop.in)
+ $(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
endif
applet_DATA = $(applet_files)
-if !PANEL_XFCE4
-if !PANEL_MATE
+if PANEL_GNOME
servicedir = $(SESSION_BUS_SERVICES_DIR)
service_in_files = org.gnome.panel.applet.XmonadLogAppletFactory.service.in
service_DATA = $(service_in_files:.service.in=.service)
org.gnome.panel.applet.XmonadLogAppletFactory.service: $(service_in_files)
- $(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
-else
+ $(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
+endif
+if PANEL_MATE
servicedir = $(SESSION_BUS_SERVICES_DIR)
service_in_files = org.mate.panel.applet.XmonadLogAppletFactory.service.in
service_DATA = $(service_in_files:.service.in=.service)
org.mate.panel.applet.XmonadLogAppletFactory.service: $(service_in_files)
$(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
endif
-endif
DISTCLEANFILES = \
- $(applet_DATA) \
- $(service_DATA)
+ $(applet_DATA) \
+ $(service_DATA)
EXTRA_DIST = \
- AUTHORS.md \
- LICENSE \
- README.md \
- xmonad.hs \
- xmonad-log-applet48.png \
- org.gnome.panel.XmonadLogApplet.panel-applet.in \
- org.mate.panel.XmonadLogApplet.panel-applet.in \
- xmonad-log-applet.desktop.in \
- $(service_in_files)
+ AUTHORS.md \
+ LICENSE \
+ README.md \
+ xmonad.hs \
+ xmonad-log-applet48.png \
+ org.gnome.panel.XmonadLogApplet.panel-applet.in \
+ org.mate.panel.XmonadLogApplet.panel-applet.in \
+ xmonad-log-applet.desktop.in \
+ $(service_in_files)
gtk_update_icon_cache = gtk-update-icon-cache -f -t
update-icon-cache:
@-if test -z "$(DESTDIR)"; then \
- echo "Updating Gtk icon cache."; \
- $(gtk_update_icon_cache) $(datadir)/icons/hicolor; \
- else \
- echo "*** Icon cache not updated. After (un)install, run this:"; \
- echo "*** $(gtk_update_icon_cache) $(datadir)/icons/hicolor"; \
- fi
+ echo "Updating Gtk icon cache."; \
+ $(gtk_update_icon_cache) $(datadir)/icons/hicolor; \
+ else \
+ echo "*** Icon cache not updated. After (un)install, run this:"; \
+ echo "*** $(gtk_update_icon_cache) $(datadir)/icons/hicolor"; \
+ fi
install-icons:
mkdir -p $(DESTDIR)$(datadir)/icons/hicolor/48x48/apps; \
- $(INSTALL_DATA) $(srcdir)/xmonad-log-applet48.png $(DESTDIR)$(datadir)/icons/hicolor/48x48/apps/xmonad-log-applet.png;
+ $(INSTALL_DATA) $(srcdir)/xmonad-log-applet48.png \
+ $(DESTDIR)$(datadir)/icons/hicolor/48x48/apps/xmonad-log-applet.png;
uninstall-icons:
rm -f $(DESTDIR)$(datadir)/icons/hicolor/48x48/apps/xmonad-log-applet.png;
View
8 README.md
@@ -1,6 +1,6 @@
# xmonad-log-applet
-xmonad-log-applet is for Xmonad users who find the GNOME or Xfce panel
+xmonad-log-applet is for Xmonad users who find the GNOME, MATE, or Xfce panel
useful. The applet will show the active workspaces, the title of the selected
window or whatever information you send it from your xmonad.hs.
@@ -10,7 +10,7 @@ on the [old website][0].
## Installation
There are two pieces of setup you'll need to get this working, assuming you are
-already running Xmonad within [GNOME][1] or [Xfce][2]:
+already running Xmonad within [GNOME][1], MATE or [Xfce][2]:
* An xmonad.hs setup file that will send properly-formatted information to
D-Bus. You can use [this xmonad.hs][3] as an example; obviously, feel free to
@@ -20,9 +20,9 @@ already running Xmonad within [GNOME][1] or [Xfce][2]:
[tarball][4], or pull the latest version from the git repository: `git clone
git://github.com/alexkay/xmonad-log-applet.git`
-The applet supports GNOME 2, GNOME 3 and Xfce 4 panels, just pass
+The applet supports GNOME 2, GNOME 3, MATE and Xfce 4 panels, just pass
`--with-panel=X` to `./configure` when compiling, where X is one of gnome2,
-gnome3 or xfce4.
+gnome3, mate or xfce4.
If you are compiling from a git clone, you should run `./autogen.sh` instead of
`./configure`.
View
31 configure.ac
@@ -13,16 +13,14 @@ AC_HEADER_STDC
PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.20.0)
-PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= 0.80)
-
-AM_PATH_GTK_2_0([2.10.0],,AC_MSG_ERROR([Gtk+ 2.10.0 or higher required.]))
+PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1 >= 0.80)
SESSION_BUS_SERVICES_DIR=`$PKG_CONFIG --variable=session_bus_services_dir dbus-1`
AC_SUBST([SESSION_BUS_SERVICES_DIR])
AC_ARG_WITH(
[panel],
- [AS_HELP_STRING([--with-panel], [target gnome2 (default), mate, gnome3 or xfce4 panel])],
+ [AS_HELP_STRING([--with-panel], [target gnome2 (default), gnome3, mate or xfce4 panel])],
[panel=$withval],
[panel=gnome2]
)
@@ -31,34 +29,37 @@ AS_IF(
[PKG_CHECK_MODULES(LIBPANEL, libpanelapplet-3.0 >= 2.32.0)]
LIBPANEL_APPLET_DIR=`$PKG_CONFIG --variable=prefix libpanelapplet-3.0`/share/gnome-panel/applets
PLUGIN_DIR=`$PKG_CONFIG --variable=prefix libpanelapplet-3.0`/libexec
- [AC_DEFINE(PANEL_GNOME2, 1, [panel version])]
- ,
- [test "x$panel" = xmate],
- [PKG_CHECK_MODULES(LIBMATEPANEL, libmatepanelapplet-3.0 >= 1.4.0)]
- LIBPANEL_APPLET_DIR=`$PKG_CONFIG --variable=prefix libmatepanelapplet-3.0`/share/mate-panel/applets
- PLUGIN_DIR=`$PKG_CONFIG --variable=prefix libmatepanelapplet-3.0`/libexec
- [AC_DEFINE(PANEL_MATE, 1, [panel version])]
+ [AC_DEFINE(PANEL_GNOME, 1, [panel type])]
+ [AC_DEFINE(PANEL_GNOME2, 1, [panel type])]
,
[test "x$panel" = xgnome3],
[PKG_CHECK_MODULES(LIBPANEL, libpanelapplet-4.0 >= 3.0.0)]
LIBPANEL_APPLET_DIR=`$PKG_CONFIG --variable=libpanel_applet_dir libpanelapplet-4.0`
PLUGIN_DIR=`$PKG_CONFIG --variable=prefix libpanelapplet-4.0`/libexec
- [AC_DEFINE(PANEL_GNOME3, 1, [panel version])]
+ [AC_DEFINE(PANEL_GNOME, 1, [panel type])]
+ [AC_DEFINE(PANEL_GNOME3, 1, [panel type])]
+ ,
+ [test "x$panel" = xmate],
+ [PKG_CHECK_MODULES(LIBPANEL, libmatepanelapplet-3.0 >= 1.4.0)]
+ LIBPANEL_APPLET_DIR=`$PKG_CONFIG --variable=prefix libmatepanelapplet-3.0`/share/mate-panel/applets
+ PLUGIN_DIR=`$PKG_CONFIG --variable=prefix libmatepanelapplet-3.0`/libexec
+ [AC_DEFINE(PANEL_MATE, 1, [panel type])]
,
[test "x$panel" = xxfce4],
[PKG_CHECK_MODULES(LIBPANEL, libxfce4panel-1.0 >= 4.6.0)]
LIBPANEL_APPLET_DIR=`$PKG_CONFIG --variable=prefix libxfce4panel-1.0`/share/xfce4/panel-plugins
PLUGIN_DIR=`$PKG_CONFIG --variable=libdir libxfce4panel-1.0`/xfce4/panel/plugins
- [AC_DEFINE(PANEL_XFCE4, 1, [panel version])]
+ [AC_DEFINE(PANEL_XFCE4, 1, [panel type])]
,
- [AC_MSG_ERROR([Unknown panel type, use gnome2, gnome3 or xfce4])]
+ [AC_MSG_ERROR([Unknown panel type, use gnome2, gnome3, mate or xfce4])]
)
AC_SUBST([LIBPANEL_APPLET_DIR])
AC_SUBST([PLUGIN_DIR])
+AM_CONDITIONAL([PANEL_GNOME], [test "x$panel" = xgnome2 -o "x$panel" = xgnome3])
AM_CONDITIONAL([PANEL_GNOME2], [test "x$panel" = xgnome2])
-AM_CONDITIONAL([PANEL_MATE], [test "x$panel" = xmate])
AM_CONDITIONAL([PANEL_GNOME3], [test "x$panel" = xgnome3])
+AM_CONDITIONAL([PANEL_MATE], [test "x$panel" = xmate])
AM_CONDITIONAL([PANEL_XFCE4], [test "x$panel" = xxfce4])
AC_CONFIG_FILES([Makefile])
View
40 main.c
@@ -1,8 +1,9 @@
/* main.c
*
* Copyright (c) 2009 Adam Wick
- * Copyright (c) 2011 Alexander Kojevnikov
+ * Copyright (c) 2011-2012 Alexander Kojevnikov
* Copyright (c) 2011 Dan Callaghan
+ * Copyright (c) 2012 Ari Croock
*
* See LICENSE for licensing information
*/
@@ -15,12 +16,14 @@
#include <gtk/gtk.h>
#include <dbus/dbus-glib.h>
+#ifdef PANEL_GNOME
+#include <panel-applet.h>
+#endif
#ifdef PANEL_MATE
#include <mate-panel-applet.h>
-#elif defined(PANEL_XFCE4)
+#endif
+#ifdef PANEL_XFCE4
#include <libxfce4panel/xfce-panel-plugin.h>
-#else
-#include <panel-applet.h>
#endif
static void signal_handler(DBusGProxy *obj, const char *msg, GtkWidget *widget)
@@ -51,15 +54,17 @@ static void set_up_dbus_transfer(GtkWidget *buf)
}
-#if defined(PANEL_GNOME2) || defined(PANEL_GNOME3)
+#ifdef PANEL_GNOME
static gboolean xmonad_log_applet_fill(PanelApplet *applet)
-#elif defined(PANEL_MATE)
+#endif
+#ifdef PANEL_MATE
static gboolean xmonad_log_applet_fill(MatePanelApplet *applet)
-#else
+#endif
+#ifdef PANEL_XFCE4
static void xmonad_log_applet_fill(GtkContainer *container)
#endif
{
-#if defined(PANEL_GNOME2) || defined(PANEL_GNOME3)
+#ifdef PANEL_GNOME
panel_applet_set_flags(
applet,
PANEL_APPLET_EXPAND_MAJOR |
@@ -67,7 +72,8 @@ static void xmonad_log_applet_fill(GtkContainer *container)
PANEL_APPLET_HAS_HANDLE);
panel_applet_set_background_widget(applet, GTK_WIDGET(applet));
-#elif defined(PANEL_MATE)
+#endif
+#ifdef PANEL_MATE
mate_panel_applet_set_flags(
applet,
MATE_PANEL_APPLET_EXPAND_MAJOR |
@@ -94,7 +100,7 @@ static void xmonad_log_applet_fill(GtkContainer *container)
#endif
}
-#if defined(PANEL_GNOME2) || defined(PANEL_GNOME3)
+#ifdef PANEL_GNOME
static gboolean xmonad_log_applet_factory(
PanelApplet *applet, const gchar *iid, gpointer data)
{
@@ -110,7 +116,8 @@ static gboolean xmonad_log_applet_factory(
return retval;
}
-#elif defined(PANEL_MATE)
+#endif
+#ifdef PANEL_MATE
static gboolean xmonad_log_applet_factory(
MatePanelApplet *applet, const gchar *iid, gpointer data)
{
@@ -126,7 +133,8 @@ static gboolean xmonad_log_applet_factory(
return retval;
}
-#else
+#endif
+#ifdef PANEL_XFCE4
static void xmonad_log_applet_construct(XfcePanelPlugin *plugin)
{
xmonad_log_applet_fill(GTK_CONTAINER(plugin));
@@ -135,7 +143,7 @@ static void xmonad_log_applet_construct(XfcePanelPlugin *plugin)
}
#endif
-#if defined(PANEL_GNOME2) || defined(PANEL_GNOME3)
+#ifdef PANEL_GNOME
PANEL_APPLET_OUT_PROCESS_FACTORY(
"XmonadLogAppletFactory",
PANEL_TYPE_APPLET,
@@ -144,14 +152,16 @@ PANEL_APPLET_OUT_PROCESS_FACTORY(
#endif
xmonad_log_applet_factory,
NULL);
-#elif defined(PANEL_MATE)
+#endif
+#ifdef PANEL_MATE
MATE_PANEL_APPLET_OUT_PROCESS_FACTORY(
"XmonadLogAppletFactory",
PANEL_TYPE_APPLET,
"XmonadLogApplet",
xmonad_log_applet_factory,
NULL);
-#else
+#endif
+#ifdef PANEL_XFCE4
XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL(
xmonad_log_applet_construct);
#endif

0 comments on commit d6941d8

Please sign in to comment.
Something went wrong with that request. Please try again.