diff options
author | Richard Hughes <richard@hughsie.com> | 2009-06-04 12:04:41 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2009-06-04 12:04:41 +0100 |
commit | 4c947b068f26e14a189bd3227db0d255f1c13bea (patch) | |
tree | 8673dde16a5b39e38772b08874bee2b279382b78 | |
parent | 677c70a2b6bfd3cb5b401cd35e700f0ba5ba0f48 (diff) |
Make GIO a hard build dependency and remove the conditional code
-rw-r--r-- | configure.ac | 23 | ||||
-rw-r--r-- | src/Makefile.am | 11 | ||||
-rw-r--r-- | src/pk-file-monitor-dummy.c | 153 | ||||
-rw-r--r-- | src/pk-file-monitor.c (renamed from src/pk-file-monitor-gio.c) | 0 | ||||
-rw-r--r-- | src/pk-post-trans.c | 11 |
5 files changed, 10 insertions, 188 deletions
diff --git a/configure.ac b/configure.ac index 6e6c51d37..1b8555820 100644 --- a/configure.ac +++ b/configure.ac @@ -166,6 +166,12 @@ PKG_CHECK_MODULES(DBUS, \ AC_SUBST(DBUS_CFLAGS) AC_SUBST(DBUS_LIBS) +PKG_CHECK_MODULES(GIO, \ + gio-2.0 >= $GIO_REQUIRED \ + gio-unix-2.0 >= $DBUS_REQUIRED) +AC_SUBST(GIO_CFLAGS) +AC_SUBST(GIO_LIBS) + dnl --------------------------------------------------------------------------- dnl - Build PackageKit-Qt dnl --------------------------------------------------------------------------- @@ -258,22 +264,6 @@ dnl - moc (for packagekit-qt) dnl --------------------------------------------------------------------------- AC_PATH_PROG([MOC], [moc-qt4]) -dnl --------------------------------------------------------------------------- -dnl - Is GIO available? -dnl --------------------------------------------------------------------------- -PKG_CHECK_MODULES(GIO, gio-2.0 >= $GIO_REQUIRED gio-unix-2.0 >= $GIO_REQUIRED, PK_BUILD_GIO="yes", PK_BUILD_GIO="no") -if test "x$PK_BUILD_GIO" = "xyes"; then - with_gio="yes" - AC_DEFINE(PK_BUILD_GIO, 1, [define if GIO is installed]) -else - with_gio="no" - PK_BUILD_GIO=no -fi - -AM_CONDITIONAL(PK_BUILD_GIO, test x$PK_BUILD_GIO = xyes) -AC_SUBST(GIO_CFLAGS) -AC_SUBST(GIO_LIBS) - # unix networking stack always available networking_apis="unix" @@ -784,7 +774,6 @@ echo " Developer warnings: ${enable_developer} Security framework: ${with_security_framework} Networking stacks: ${networking_apis} - GIO support: ${with_gio} Browser plugin: ${build_browser_plugin} GStreamer plugin: ${build_gstreamer_plugin} Pango module: ${build_gtk_module} diff --git a/src/Makefile.am b/src/Makefile.am index 937b23b92..596930035 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -86,6 +86,7 @@ shared_SOURCES = \ pk-sysdep.h \ pk-sysdep.c \ pk-file-monitor.h \ + pk-file-monitor.c \ pk-engine.h \ pk-engine.c \ pk-inhibit.h \ @@ -108,16 +109,6 @@ shared_SOURCES += \ pk-network-stack-connman.c endif -if PK_BUILD_GIO -shared_SOURCES += \ - pk-file-monitor-gio.c \ - $(NULL) -else -shared_SOURCES += \ - pk-file-monitor-dummy.c \ - $(NULL) -endif - if SECURITY_TYPE_POLKIT shared_SOURCES += pk-security-polkit.c endif diff --git a/src/pk-file-monitor-dummy.c b/src/pk-file-monitor-dummy.c deleted file mode 100644 index 7f456bf1f..000000000 --- a/src/pk-file-monitor-dummy.c +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Copyright (C) 2008 Richard Hughes <richard@hughsie.com> - * - * Licensed under the GNU General Public License Version 2 - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include <stdlib.h> -#include <stdio.h> -#include <time.h> -#include <errno.h> -#include <signal.h> - -#include <string.h> -#include <sys/time.h> -#include <sys/types.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif /* HAVE_UNISTD_H */ - -#include <glib/gi18n.h> -#include <packagekit-glib/packagekit.h> - -#include <egg-debug.h> -#include "pk-file-monitor.h" - -static void pk_file_monitor_class_init (PkFileMonitorClass *klass); -static void pk_file_monitor_init (PkFileMonitor *file_monitor); -static void pk_file_monitor_finalize (GObject *object); - -#define PK_FILE_MONITOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_FILE_MONITOR, PkFileMonitorPrivate)) - -struct PkFileMonitorPrivate -{ - gboolean dummy; -}; - -enum { - PK_FILE_MONITOR_CHANGED, - PK_FILE_MONITOR_LAST_SIGNAL -}; - -static guint signals [PK_FILE_MONITOR_LAST_SIGNAL] = { 0 }; - -G_DEFINE_TYPE (PkFileMonitor, pk_file_monitor, G_TYPE_OBJECT) - -/** - * pk_file_monitor_class_init: - * @klass: The PkFileMonitorClass - **/ -static void -pk_file_monitor_class_init (PkFileMonitorClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->finalize = pk_file_monitor_finalize; - - signals [PK_FILE_MONITOR_CHANGED] = - g_signal_new ("file-changed", - G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, - 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - g_type_class_add_private (klass, sizeof (PkFileMonitorPrivate)); -} - -/** - * pk_file_monitor_init: - * @file_monitor: This class instance - **/ -static void -pk_file_monitor_init (PkFileMonitor *file_monitor) -{ - file_monitor->priv = PK_FILE_MONITOR_GET_PRIVATE (file_monitor); -} - -/** - * pk_file_monitor_set_file: - **/ -gboolean -pk_file_monitor_set_file (PkFileMonitor *file_monitor, const gchar *filename) -{ - return TRUE; -} - -/** - * pk_file_monitor_finalize: - * @object: The object to finalize - **/ -static void -pk_file_monitor_finalize (GObject *object) -{ - PkFileMonitor *file_monitor; - - g_return_if_fail (PK_IS_FILE_MONITOR (object)); - - file_monitor = PK_FILE_MONITOR (object); - g_return_if_fail (file_monitor->priv != NULL); - - G_OBJECT_CLASS (pk_file_monitor_parent_class)->finalize (object); -} - -/** - * pk_file_monitor_new: - * - * Return value: a new PkFileMonitor object. - **/ -PkFileMonitor * -pk_file_monitor_new (void) -{ - PkFileMonitor *file_monitor; - file_monitor = g_object_new (PK_TYPE_FILE_MONITOR, NULL); - return PK_FILE_MONITOR (file_monitor); -} - -/*************************************************************************** - *** MAKE CHECK TESTS *** - ***************************************************************************/ -#ifdef EGG_TEST -#include "egg-test.h" - -void -pk_file_monitor_test (EggTest *test) -{ - PkFileMonitor *file_monitor; - - if (!egg_test_start (test, "PkFileMonitor")) - return; - - /************************************************************/ - egg_test_title (test, "get a file_monitor"); - file_monitor = pk_file_monitor_new (); - egg_test_assert (test, file_monitor != NULL); - g_object_unref (file_monitor); - - egg_test_end (test); -} -#endif - diff --git a/src/pk-file-monitor-gio.c b/src/pk-file-monitor.c index 748f5be8f..748f5be8f 100644 --- a/src/pk-file-monitor-gio.c +++ b/src/pk-file-monitor.c diff --git a/src/pk-post-trans.c b/src/pk-post-trans.c index 518bc9d50..199d258cc 100644 --- a/src/pk-post-trans.c +++ b/src/pk-post-trans.c @@ -29,6 +29,7 @@ #include <glib.h> #include <glib/gi18n.h> #include <packagekit-glib/packagekit.h> +#include <gio/gdesktopappinfo.h> #include <sqlite3.h> #ifdef USE_SECURITY_POLKIT @@ -36,10 +37,6 @@ #include <polkit-dbus/polkit-dbus.h> #endif -#ifdef PK_BUILD_GIO - #include <gio/gdesktopappinfo.h> -#endif - #include "egg-debug.h" #include "pk-post-trans.h" @@ -225,8 +222,7 @@ pk_post_trans_sqlite_add_filename_details (PkPostTrans *post, const gchar *filen gchar *error_msg = NULL; sqlite3_stmt *sql_statement = NULL; gint rc = -1; - gint show = TRUE; -#ifdef PK_BUILD_GIO + gint show; GDesktopAppInfo *info; /* find out if we should show desktop file in menus */ @@ -235,9 +231,8 @@ pk_post_trans_sqlite_add_filename_details (PkPostTrans *post, const gchar *filen egg_warning ("could not load desktop file %s", filename); goto out; } - show = g_app_info_should_show (G_APP_INFO(info)); + show = g_app_info_should_show (G_APP_INFO (info)); g_object_unref (info); -#endif egg_debug ("add filename %s from %s with md5: %s (show: %i)", filename, package, md5, show); |