Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cd2ceaa
Showing
11 changed files
with
239 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SUBDIRS = src pixmaps po |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
# Run this to generate all the initial makefiles, etc. | ||
|
||
srcdir=`dirname $0` | ||
test -z "$srcdir" && srcdir=. | ||
|
||
PKG_NAME="indicator-sensors" | ||
|
||
(test -f $srcdir/configure.ac) || { | ||
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" | ||
echo " top-level $PKG_NAME directory" | ||
exit 1 | ||
} | ||
|
||
which gnome-autogen.sh || { | ||
echo -n "ERROR: gnome-autogen.sh not found in path: " | ||
echo "Please install gnome-common before running this script" | ||
exit 1 | ||
} | ||
|
||
REQUIRED_AUTOMAKE_VERSION=1.7 USE_GNOME2_MACROS=1 . gnome-autogen.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
# ================= initialization =================== # | ||
|
||
AC_INIT([Indicator Sensors], [0.1], [murray.alex@gmail.com], | ||
[indicator-sensors]) | ||
|
||
AC_CONFIG_SRCDIR([src/indicator-sensors.c]) | ||
AM_CONFIG_HEADER([src/config.h]) | ||
AM_INIT_AUTOMAKE | ||
AM_MAINTAINER_MODE | ||
|
||
# ============== basic compiler settings ============= # | ||
AC_PROG_CC | ||
AC_HEADER_STDC | ||
|
||
# =================== for plugins ==================== # | ||
AC_PROG_LIBTOOL | ||
|
||
# =========== take care of some localization ========= # | ||
AH_TEMPLATE([GETTEXT_PACKAGE], [Package name for gettext]) | ||
GETTEXT_PACKAGE=indicator-sensors | ||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE") | ||
AC_SUBST(GETTEXT_PACKAGE) | ||
AM_GLIB_GNU_GETTEXT | ||
AC_PROG_INTLTOOL | ||
|
||
# ========== export compiler / linker options ======== # | ||
AC_SUBST(CFLAGS) | ||
AC_SUBST(CPPFLAGS) | ||
AC_SUBST(LDFLAGS) | ||
AC_SUBST(LIBS) | ||
|
||
# ============== look for dependencies =============== # | ||
# check for headers needed for standard interfaces | ||
#AC_CHECK_HEADERS() | ||
|
||
GLIB_REQUIRED=2.14.0 | ||
GTK_REQUIRED=2.14.0 | ||
APPINDICATOR_REQUIRED=0.0.7 | ||
|
||
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED) | ||
AC_SUBST(GLIB_CFLAGS) | ||
AC_SUBST(GLIB_LIBS) | ||
|
||
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= $GTK_REQUIRED) | ||
AC_SUBST(GTK_CFLAGS) | ||
AC_SUBST(GTK_LIBS) | ||
|
||
PKG_CHECK_MODULES(APPINDICATOR, appindicator-0.1 >= $APPINDICATOR_REQUIRED) | ||
AC_SUBST(APPINDICATOR_CFLAGS) | ||
AC_SUBST(APPINDICATOR_LIBS) | ||
|
||
AC_CHECK_HEADERS(regex.h) | ||
AC_CHECK_HEADERS(sensors/sensors.h, | ||
AC_CHECK_LIB(sensors, sensors_init,[ | ||
AC_DEFINE(HAVE_LIBSENSORS,1,[libsensors is available]) | ||
if test "x${SENSORS_DIR}" != "x"; then | ||
LIBSENSORS_CFLAGS="-I${SENSORS_DIR}/include" | ||
LIBSENSORS_LIBS="-L${SENSORS_DIR}/lib -lsensors" | ||
else | ||
LIBSENSORS_LIBS="-lsensors" | ||
fi])) | ||
|
||
AM_CONDITIONAL(LIBSENSORS, test -n "$LIBSENSORS_LIBS") | ||
|
||
AC_SUBST(LIBSENSORS_CFLAGS) | ||
AC_SUBST(LIBSENSORS_LIBS) | ||
|
||
# do nvidia by default if available | ||
AC_ARG_WITH(nvidia, | ||
[ --with-nvidia[=DIR] use nvidia in DIR],[ | ||
if test "$withval" != "no" -a "$withval" != "yes"; then | ||
NVIDIA_DIR=$withval | ||
CFLAGS="${CFLAGS} -I${NVIDIA_DIR}/include" | ||
LIBS="${LIBS} -L${NVIDIA_DIR}/lib" | ||
fi | ||
with_nvidia=$withval],[ | ||
with_nvidia="yes" | ||
]) | ||
|
||
if test "$with_nvidia" = "no"; then | ||
echo "Disabling nvidia support" | ||
else | ||
AC_ARG_WITH(x11, | ||
[ --with-x11[=DIR] use x11 in DIR],[ | ||
if test "$withval" != "no" -a "$withval" != "yes"; then | ||
X11_DIR=$withval | ||
CFLAGS="${CFLAGS} -I${X11_DIR}/include" | ||
LIBS="${LIBS} -L${X11_DIR}/lib" | ||
fi | ||
with_x11=$withval],[ | ||
with_x11="yes" | ||
]) | ||
|
||
AC_CHECK_HEADERS(X11/Xlib.h, | ||
AC_CHECK_LIB(X11, XOpenDisplay, [ HAVE_X11=true ])) | ||
# can't embed next AC_CHECK_HEADERS in true case of AC_CHECK_LIB | ||
if test "${HAVE_X11}" = "true"; then | ||
LIBS="${LIBS} -lX11 -lXext" | ||
# need to specifically include X11/Xlib header when | ||
# doing checks for NVCtrl headers | ||
AC_CHECK_HEADERS(NVCtrl/NVCtrl.h NVCtrl/NVCtrlLib.h, [ HAVE_NVIDIA=true ], [], | ||
[ | ||
#include <X11/Xlib.h> | ||
]) | ||
if test "${HAVE_NVIDIA}" = "true"; then | ||
AC_CHECK_LIB(XNVCtrl, XNVCTRLQueryExtension, [ | ||
NVIDIA_LIBS="-lXNVCtrl" | ||
AC_DEFINE(HAVE_NVIDIA,1,[nvidia sensors available]) | ||
]) | ||
fi | ||
fi | ||
fi | ||
AM_CONDITIONAL(NVIDIA, test -n "$NVIDIA_LIBS") | ||
|
||
AC_SUBST(NVIDIA_CFLAGS) | ||
AC_SUBST(NVIDIA_LIBS) | ||
|
||
AC_SUBST(CFLAGS) | ||
# for help docs stuff | ||
AC_PATH_PROG(XSLTPROC, xsltproc, no) | ||
if test x"$XSLTPROC" = xno; then | ||
AC_MSG_ERROR([xsltproc executable not found in your path - should be installed with libxslt]) | ||
fi | ||
|
||
GNOME_COMPILE_WARNINGS(maximum) | ||
|
||
# ================ gnome-doc-utils stuff ============= # | ||
GNOME_DOC_INIT | ||
|
||
# ==================== plugin stuff ================== # | ||
PLUGIN_LIBTOOL_FLAGS="-module -avoid-version" | ||
AC_SUBST(PLUGIN_LIBTOOL_FLAGS) | ||
|
||
# ================= generate files =================== # | ||
AC_CONFIG_FILES([ | ||
Makefile | ||
src/Makefile | ||
pixmaps/Makefile | ||
po/Makefile.in | ||
]) | ||
AC_OUTPUT |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## Process this file with automake to produce Makefile.in | ||
INCLUDES = -DGNOMELOCALEDIR=\""$(datadir)/locale/"\" \ | ||
-DG_LOG_DOMAIN=\""Sensors Applet"\" \ | ||
-DPIXMAPS_DIR=\""$(datadir)/pixmaps/$(PACKAGE)/"\" \ | ||
-DDATADIR=\""$(datadir)"\" \ | ||
-DLIBDIR=\""$(libdir)"\" \ | ||
-DSYSCONFDIR=\""$(sysconfdir)"\" \ | ||
-DPREFIX=\""$(prefix)"\" \ | ||
-I$(top_srcdir) \ | ||
$(GLIB_CFLAGS) $(GTK_CFLAGS) $(APPINDICATOR_CFLAGS) | ||
|
||
|
||
LIBS = $(GLIB_LIBS) $(GTK_LIBS) $(APPINDICATOR_LIBS) | ||
|
||
bin_PROGRAMS = indicator-sensors | ||
indicator_sensors_SOURCES = indicator-sensors.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include <gtk/gtk.h> | ||
#include <libappindicator/app-indicator.h> | ||
|
||
static void activate_action(GtkAction *action); | ||
|
||
static GtkActionEntry entries[] = { | ||
{ "Preferences", "application-preferences", "_Preferences", NULL, | ||
"Preferences...", G_CALLBACK(activate_action) }, | ||
{ "Quit", "application-exit", "_Quit", "<control>Q", | ||
"Exit indicator-sensors", G_CALLBACK(gtk_main_quit) }, | ||
}; | ||
static guint n_entries = G_N_ELEMENTS(entries); | ||
|
||
static const gchar *ui_info = | ||
"<ui>" | ||
" <popup name='Indicator'>" | ||
" <menuitem action='Preferences' />" | ||
" </popup>" | ||
"</ui>"; | ||
|
||
static void activate_action(GtkAction *action) | ||
{ | ||
g_debug("activated action %s", gtk_action_get_name(action)); | ||
} | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
AppIndicator *indicator; | ||
GtkActionGroup *action_group; | ||
GtkUIManager *ui_manager; | ||
GtkWidget *menu; | ||
GError *error = NULL; | ||
|
||
gtk_init(&argc, &argv); | ||
|
||
indicator = app_indicator_new("indicator-sensors", | ||
"indicator-sensors", | ||
APP_INDICATOR_CATEGORY_HARDWARE); | ||
|
||
action_group = gtk_action_group_new("AppActions"); | ||
gtk_action_group_add_actions(action_group, | ||
entries, n_entries, | ||
indicator); | ||
|
||
ui_manager = gtk_ui_manager_new(); | ||
gtk_ui_manager_insert_action_group(ui_manager, action_group, 0); | ||
if (!gtk_ui_manager_add_ui_from_string(ui_manager, ui_info, -1, &error)) { | ||
g_error("Failed to build menus: %s\n", error->message); | ||
} | ||
|
||
menu = gtk_ui_manager_get_widget(ui_manager, "/ui/Indicator"); | ||
|
||
app_indicator_set_status(indicator, APP_INDICATOR_STATUS_ACTIVE); | ||
app_indicator_set_attention_icon(indicator, "indicator-sensors"); | ||
app_indicator_set_label(indicator, "indicator-sensors", "indicator-sensors"); | ||
app_indicator_set_menu(indicator, GTK_MENU(menu)); | ||
gtk_main (); | ||
|
||
return 0; | ||
} |