Skip to content

Commit

Permalink
Make it compilable under newer distros and GTK3
Browse files Browse the repository at this point in the history
Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
  • Loading branch information
freemangordon committed Nov 11, 2016
1 parent 1e767ea commit cd1fdf7
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
16 changes: 15 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,27 @@ AC_HEADER_STDC
AC_DISABLE_STATIC
AC_PROG_LIBTOOL

PKG_CHECK_MODULES(HILDON, hildon-1)
PKG_CHECK_MODULES([HILDON], [hildon-1],
[AC_DEFINE(WITH_HILDON,[1],[Use Hildon])],
[PKG_CHECK_MODULES(HILDON, gtk+-3.0, [AC_DEFINE(WITH_GTK3,[1],[Use Gtk3])])])

PKG_CHECK_MODULES(OSSO, libosso)
PKG_CHECK_MODULES(GCONF, gconf-2.0)
PKG_CHECK_MODULES(DBUS, dbus-1)
PKG_CHECK_MODULES(X11, x11)
PKG_CHECK_MODULES(OSSO_SYSTEMUI_DBUS, osso-systemui-dbus)
PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1)
PKG_CHECK_MODULES(CANBERRA, libcanberra)

OLD_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $DBUS_CFLAGS"
AC_CHECK_TYPES([DBusBasicValue],,,[[#include <dbus/dbus.h>]])

CFLAGS="$OLD_CFLAGS $HILDON_CFLAGS -Werror"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <glib.h>]], [[g_thread_init();]])],
[AC_DEFINE([HAVE_G_THREAD_INIT],[],["g_thread_init() is deprecated"])], [])
CFLAGS=$OLD_CFLAGS

AC_ARG_ENABLE(cast-checks, [ --disable-cast-checks compile with GLIB cast checks disabled],[cchecks=${enableval}],cchecks=yes)
if test "x$cchecks" = "xno"; then
Expand Down
9 changes: 7 additions & 2 deletions src/dbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#include <libintl.h>
#include <canberra.h>
#include <mce/dbus-names.h>
#ifdef WITH_HILDON
#include <hildon/hildon-banner.h>
#endif
#include <systemui/dbus-names.h>
#include <osso-log.h>
#include <systemui.h>
Expand All @@ -11,6 +13,7 @@
#include <dbus/dbus-glib-lowlevel.h>

#include "dbus.h"
#include "config.h"

/* Those are supposed to be in some osso-locale.h file, can't find it */
#define LOCALE_CHANGED_INTERFACE "com.nokia.LocaleChangeNotification"
Expand Down Expand Up @@ -71,8 +74,9 @@ handle_thermal_notification(system_ui_data *ui, const char *state)
DBusMessage *msg;
ca_context *c = 0;
int ca_error;
#ifdef WITH_HILDON
GtkWidget *banner;

#endif
dbus_send_message(ui->system_bus,
dbus_message_new_method_call(MCE_SERVICE,
MCE_REQUEST_PATH,
Expand Down Expand Up @@ -104,14 +108,15 @@ handle_thermal_notification(system_ui_data *ui, const char *state)
if (ca_error)
SYSTEMUI_ERROR("Failed to play sound (%d, %s)", ca_error,
ca_strerror(ca_error));

#ifdef WITH_HILDON
banner =
hildon_banner_show_information(NULL, NULL,
dgettext("osso-powerup-shutdown",
"dpup_ia_thermal_shutdown"));
hildon_banner_set_timeout(HILDON_BANNER(banner), 9000);
gtk_widget_show_all(banner);
WindowPriority_ShowWindow(banner, 300u);
#endif
thermal_shutdown_started = TRUE;
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/ipm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include <gdk/gdkx.h>
#include <systemui.h>

#include "config.h"

struct window_priority
{
guint32 priority;
Expand Down Expand Up @@ -70,7 +72,13 @@ ipm_show_window(GtkWidget *widget, unsigned int priority)
"_HILDON_STACKING_LAYER");

XChangeProperty(gdk_x11_display_get_xdisplay(dpy),

#ifdef WITH_GTK3
gdk_x11_window_get_xid(gtk_widget_get_window(widget)),
hsl_atom,
#else
gdk_x11_drawable_get_xid(widget->window), hsl_atom,
#endif
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *)layer, 1);
}
Expand Down Expand Up @@ -105,7 +113,11 @@ ipm_hide_window(GtkWidget *widget)
g_free(l->data);

window_priority_list = g_slist_delete_link(window_priority_list, l);
#ifdef WITH_GTK3
gtk_widget_hide(widget);
#else
gtk_widget_hide_all(widget);
#endif

#if 0 /* Why is that? */
g_slist_length(window_priority_list);
Expand Down
2 changes: 2 additions & 0 deletions src/systemui.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,9 @@ main(int argc, char **argv)
build_layers_tab();

gtk_init(&argc, &argv);
#ifdef HAVE_G_THREAD_INIT
g_thread_init(0);
#endif
app_ui_data->icontheme = gtk_icon_theme_get_default();
app_ui_data->gc_client = gconf_client_get_default();

Expand Down
4 changes: 4 additions & 0 deletions src/systemui.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <gconf/gconf-client.h>
#include <syslog.h>

#include "config.h"

typedef struct
{
GTree *handlers;
Expand All @@ -45,6 +47,7 @@ typedef struct
int unk2;
} system_ui_data;

#ifndef HAVE_DBUSBASICVALUE
typedef struct
{
dbus_uint32_t first32;
Expand All @@ -69,6 +72,7 @@ typedef union
char *str;
int fd;
} DBusBasicValue;
#endif

typedef struct
{
Expand Down

0 comments on commit cd1fdf7

Please sign in to comment.