Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ install-sh
missing
stamp-h1
xmonad-log-applet
.libs/
compile
libtool
libxmonad-log-applet.la
libxmonad_log_applet_la-main.lo
ltmain.sh
44 changes: 40 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
plugindir = $(PLUGIN_DIR)

if PANEL_GNOME_IN_PROC

xmonad_log_appletdir = $(libdir)/gnome-panel/modules
PLUGIN_DIR_ = $(libdir)/gnome-panel/modules
xmonad_log_applet_LTLIBRARIES = libxmonad-log-applet.la
PLUGIN_FILE = libxmonad-log-applet.la
IN_PROC_STR = "InProcess=true"

libxmonad_log_applet_la_SOURCES = main.c
libxmonad_log_applet_la_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
$(LIBPANEL_CFLAGS)

libxmonad_log_applet_la_LIBADD = \
$(GLIB_LIBS) \
$(DBUS_GLIB_LIBS) \
$(LIBPANEL_LIBS)

libxmonad_log_applet_la_LDFLAGS = \
-module -avoid-version \
$(WARN_LDFLAGS) \
$(AM_LDFLAGS)

else

plugin_PROGRAMS = xmonad-log-applet
PLUGIN_DIR_ = $(PLUGIN_DIR)
PLUGIN_FILE = xmonad-log-applet

xmonad_log_applet_SOURCES = main.c

xmonad_log_applet_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
Expand All @@ -13,21 +41,29 @@ xmonad_log_applet_LDADD = \
$(DBUS_GLIB_LIBS) \
$(LIBPANEL_LIBS)

endif

appletdir = $(LIBPANEL_APPLET_DIR)
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)|" $< > $@
$(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR_)|" \
-e "s|\@PLUGIN_FILE\@|$(PLUGIN_FILE)|" \
-e "s|\@IN_PROC\@|$(IN_PROC_STR)|" $< > $@
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)|" $< > $@
$(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR_)|" \
-e "s|\@PLUGIN_FILE\@|$(PLUGIN_FILE)|" \
-e "s|\@IN_PROC\@|$(IN_PROC_STR)|" $< > $@
endif
if PANEL_XFCE4
applet_files = xmonad-log-applet.desktop
$(applet_files): $(applet_files:.desktop=.desktop.in)
$(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" $< > $@
$(SED) -e "s|\@PLUGIN_DIR\@|$(PLUGIN_DIR)|" \
-e "s|\@PLUGIN_FILE\@|$(PLUGIN_FILE)|" \
-e "s|\@IN_PROC\@|$(IN_PROC_STR)|" $< > $@
endif

applet_DATA = $(applet_files)
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ already running Xmonad within [GNOME][1], MATE 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, MATE and Xfce 4 panels, just pass
The applet supports GNOME 2, GNOME Flashback, MATE and Xfce 4 panels, just pass
`--with-panel=X` to `./configure` when compiling, where X is one of gnome2,
gnome3, mate or xfce4.
gnome3, gnomeflashback, mate or xfce4. Use gnome3 when compiling for older
versions of Gnome 3 with libpanelapplet-4.0.

If you are compiling from a git clone, you should run `./autogen.sh` instead of
`./configure`.
Expand Down
21 changes: 18 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ AM_INIT_AUTOMAKE([foreign])

AM_MAINTAINER_MODE

LT_PREREQ([2.2.6])
LT_INIT([dlopen disable-static])
LT_LIB_M

AC_PROG_CC
AC_PROG_SED
AC_PROG_INSTALL
Expand All @@ -20,7 +24,7 @@ AC_SUBST([SESSION_BUS_SERVICES_DIR])

AC_ARG_WITH(
[panel],
[AS_HELP_STRING([--with-panel], [target gnome2, gnome3, mate or xfce4 (default) panel])],
[AS_HELP_STRING([--with-panel], [target gnome2, gnome3, gnomeflashback, mate or xfce4 (default) panel])],
[panel=$withval],
[panel=xfce4]
)
Expand All @@ -39,6 +43,13 @@ AS_IF(
[AC_DEFINE(PANEL_GNOME, 1, [panel type])]
[AC_DEFINE(PANEL_GNOME3, 1, [panel type])]
,
[test "x$panel" = xgnomeflashback],
[PKG_CHECK_MODULES(LIBPANEL, libpanel-applet >= 3.0.0)]
LIBPANEL_APPLET_DIR=`$PKG_CONFIG --variable=libpanel_applet_dir libpanel-applet`
PLUGIN_DIR=`$PKG_CONFIG --variable=prefix libpanel-applet`/libexec
[AC_DEFINE(PANEL_GNOME, 1, [panel type])]
[AC_DEFINE(PANEL_GNOMEFLASHBACK, 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
Expand All @@ -51,16 +62,20 @@ AS_IF(
PLUGIN_DIR=`$PKG_CONFIG --variable=libdir libxfce4panel-1.0`/xfce4/panel/plugins
[AC_DEFINE(PANEL_XFCE4, 1, [panel type])]
,
[AC_MSG_ERROR([Unknown panel type, use gnome2, gnome3, mate or xfce4])]
[AC_MSG_ERROR([Unknown panel type, use gnome2, gnome3, gnomeflashback, mate or xfce4])]
)
PKG_CHECK_MODULES(LIBPANEL_GE_3_22, libpanel-applet >= 3.22.0, PANEL_GNOME_IN_PROC=1, PANEL_GNOME_IN_PROC=0)
AC_SUBST([LIBPANEL_APPLET_DIR])
AC_SUBST([PLUGIN_DIR])

AM_CONDITIONAL([PANEL_GNOME], [test "x$panel" = xgnome2 -o "x$panel" = xgnome3])
AM_CONDITIONAL([PANEL_GNOME], [test "x$panel" = xgnome2 -o "x$panel" = xgnome3 -o "x$panel" = xgnomeflashback])
AM_CONDITIONAL([PANEL_GNOME2], [test "x$panel" = xgnome2])
AM_CONDITIONAL([PANEL_GNOME3], [test "x$panel" = xgnome3])
AM_CONDITIONAL([PANEL_GNOMEFLASHBACK], [test "x$panel" = xgnomeflashback])
AM_CONDITIONAL([PANEL_MATE], [test "x$panel" = xmate])
AM_CONDITIONAL([PANEL_XFCE4], [test "x$panel" = xxfce4])
AM_CONDITIONAL([PANEL_GNOME_IN_PROC], [test "$PANEL_GNOME_IN_PROC" -eq 1])
AS_IF([test "$PANEL_GNOME_IN_PROC" -eq 1], [AC_DEFINE([PANEL_GNOME_IN_PROC], [1], [Define if using libpanel-applet >= 3.22.0 and we need in process applet.])])

AC_CONFIG_FILES([Makefile])

Expand Down
20 changes: 19 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ static void set_up_dbus_transfer(GtkWidget *buf)
if(connection == NULL) {
g_printerr("Failed to open connection: %s\n", error->message);
g_error_free(error);
exit(1);
#ifdef PANEL_GNOME_IN_PROC
return;
#else
exit(-1);
#endif
}

proxy = dbus_g_proxy_new_for_name(
Expand Down Expand Up @@ -71,7 +75,9 @@ static void xmonad_log_applet_fill(GtkContainer *container)
PANEL_APPLET_EXPAND_MINOR |
PANEL_APPLET_HAS_HANDLE);

#ifndef PANEL_GNOME_IN_PROC
panel_applet_set_background_widget(applet, GTK_WIDGET(applet));
#endif
#endif
#ifdef PANEL_MATE
mate_panel_applet_set_flags(
Expand Down Expand Up @@ -111,7 +117,11 @@ static gboolean xmonad_log_applet_factory(

if(retval == FALSE) {
printf("Wrong applet!\n");
#ifdef PANEL_GNOME_IN_PROC
return FALSE;
#else
exit(-1);
#endif
}

return retval;
Expand All @@ -128,7 +138,11 @@ static gboolean xmonad_log_applet_factory(

if(retval == FALSE) {
printf("Wrong applet!\n");
#ifdef PANEL_GNOME_IN_PROC
return NULL;
#else
exit(-1);
#endif
}

return retval;
Expand All @@ -144,7 +158,11 @@ static void xmonad_log_applet_construct(XfcePanelPlugin *plugin)
#endif

#ifdef PANEL_GNOME
#ifdef PANEL_GNOME_IN_PROC
PANEL_APPLET_IN_PROCESS_FACTORY(
#else
PANEL_APPLET_OUT_PROCESS_FACTORY(
#endif
"XmonadLogAppletFactory",
PANEL_TYPE_APPLET,
#ifdef PANEL_GNOME2
Expand Down
3 changes: 2 additions & 1 deletion org.gnome.panel.XmonadLogApplet.panel-applet.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[Applet Factory]
Id=XmonadLogAppletFactory
Location=@PLUGIN_DIR@/xmonad-log-applet
@IN_PROC@
Location=@PLUGIN_DIR@/@PLUGIN_FILE@
Name=Xmonad Log Factory
Description=Factory for the xmonad-log-applet

Expand Down