Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fw-control-center.git;a=commitdiff;h=412ddb33ca38e4fd187b18fa3a90f09f106deea8

commit 412ddb33ca38e4fd187b18fa3a90f09f106deea8
Author: Priyank <[EMAIL PROTECTED]>
Date:   Sat Oct 13 01:31:32 2007 +0530

updatenotifier
* Initial import

diff --git a/updatenotifier/AUTHORS b/updatenotifier/AUTHORS
new file mode 100644
index 0000000..1fe29ca
--- /dev/null
+++ b/updatenotifier/AUTHORS
@@ -0,0 +1 @@
+Alex Smith <[EMAIL PROTECTED]>
diff --git a/updatenotifier/ChangeLog b/updatenotifier/ChangeLog
new file mode 100644
index 0000000..e69de29
diff --git a/updatenotifier/INSTALL b/updatenotifier/INSTALL
new file mode 100644
index 0000000..5458714
--- /dev/null
+++ b/updatenotifier/INSTALL
@@ -0,0 +1,234 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006 Free Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
diff --git a/updatenotifier/Makefile.am b/updatenotifier/Makefile.am
new file mode 100644
index 0000000..0b8e3df
--- /dev/null
+++ b/updatenotifier/Makefile.am
@@ -0,0 +1,10 @@
+SUBDIRS = src
+
+dbusdir = $(DBUS_SYS_DIR)
+dbus_DATA = updnotifierd.conf
+
+EXTRA_DIST = $(dbus_DATA)
+
+clean-local :
+       rm -f *~
+
diff --git a/updatenotifier/NEWS b/updatenotifier/NEWS
new file mode 100644
index 0000000..e69de29
diff --git a/updatenotifier/README b/updatenotifier/README
new file mode 100644
index 0000000..e69de29
diff --git a/updatenotifier/autoclean.sh b/updatenotifier/autoclean.sh
new file mode 100644
index 0000000..dfc8a6d
--- /dev/null
+++ b/updatenotifier/autoclean.sh
@@ -0,0 +1,24 @@
+#!/bin/sh -xu
+
+[ -f Makefile ] && make distclean
+rm -rf autom4te.cache
+rm -rf Makefile
+rm -rf Makefile.in
+rm -rf configure
+rm -rf config.*
+rm -rf stamp*
+rm -rf depcomp
+rm -rf install-sh
+rm -rf missing
+rm -rf src/Makefile
+rm -rf src/Makefile.in
+rm -rf aclocal.m4
+rm -rf ltmain.sh
+rm -rf compile
+rm -rf libtool
+rm -rf mkinstalldirs
+rm -rf config.rpath
+rm -rf intltool-extract
+rm -rf intltool-merge
+rm -rf intltool-update
+rm -rf po/stamp-it
diff --git a/updatenotifier/autogen.sh b/updatenotifier/autogen.sh
new file mode 100644
index 0000000..502c2c0
--- /dev/null
+++ b/updatenotifier/autogen.sh
@@ -0,0 +1,8 @@
+#!/bin/sh -e
+
+aclocal --force
+autoheader -f
+autoconf -f
+cp -f $(dirname $(which automake))/../share/automake/mkinstalldirs ./
+cp -f $(dirname $(which automake))/../share/gettext/config.rpath ./
+automake -a -c --gnu --foreign
diff --git a/updatenotifier/configure.ac b/updatenotifier/configure.ac
new file mode 100644
index 0000000..d975267
--- /dev/null
+++ b/updatenotifier/configure.ac
@@ -0,0 +1,51 @@
+ENV_CFLAGS=$CFLAGS
+
+AC_PREREQ(2.59)
+AC_INIT([updnotifierd], 0.1, [EMAIL PROTECTED], updnotifierd)
+AC_CONFIG_SRCDIR([src/updnotifierd.c])
+AC_LANG(C)
+AM_CONFIG_HEADER(config.h)
+AC_CANONICAL_SYSTEM
+AM_INIT_AUTOMAKE
+
+AC_PROG_CC
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdlib.h string.h sys/ioctl.h unistd.h pacman.h libfwutil.h])
+
+AC_PATH_PROG(DBUSBINDINGTOOL, dbus-binding-tool, no)
+
+if test "x$DBUSBINDINGTOOL" = "xno"; then
+       AC_MSG_ERROR([dbus-binding-tool not found in your PATH. Please correct 
this])
+fi
+
+AC_SUBST(DBUS_BINDING_TOOL)
+
+PKG_CHECK_MODULES([UPDNOTIFIERD], [dbus-glib-1 >= 0.73])
+
+AC_ARG_WITH(dbus-sys, [  --with-dbus-sys=<dir>   where D-BUS system.d 
directory is])
+
+if ! test -z "$with_dbus_sys" ; then
+       DBUS_SYS_DIR="$with_dbus_sys"
+else
+       DBUS_SYS_DIR="$sysconfdir/dbus-1/system.d"
+fi
+
+AC_SUBST(DBUS_SYS_DIR)
+
+CFLAGS="${CFLAGS}"
+
+dnl ==========================================================================
+
+AC_OUTPUT([
+src/Makefile
+Makefile
+])
+
+echo "
+Updatenotifierd $VERSION configuration summary:
+
+        prefix                   : ${prefix}
+        source code location     : ${srcdir}
+        compiler                 : ${CC}
+        compiler flags           : ${CFLAGS}
+"
diff --git a/updatenotifier/src/Makefile.am b/updatenotifier/src/Makefile.am
new file mode 100644
index 0000000..7355636
--- /dev/null
+++ b/updatenotifier/src/Makefile.am
@@ -0,0 +1,19 @@
+INCLUDES = @UPDNOTIFIERD_CFLAGS@ \
+       -DPREFIX=\"$(prefix)\" \
+       -fPIC
+
+sbin_PROGRAMS = updnotifierd
+
+updnotifierd_SOURCES = updnotifierd.c
+
+updnotifierd_LDADD= @UPDNOTIFIERD_LIBS@ -lpacman -lfwutil
+
+BUILT_SOURCES = updnotifierd-dbus-glue.h
+
+updnotifierd-dbus-glue.h: updnotifierd.xml
+       @DBUSBINDINGTOOL@ --mode=glib-server --prefix=updnotifierd \
+               $(srcdir)/updnotifierd.xml > updnotifierd-dbus-glue.h
+
+EXTRA_DIST = updnotifierd.xml
+DISTCLEANFILES = \
+       updnotifierd-dbus-glue.h
diff --git a/updatenotifier/src/netconfig-command 
b/updatenotifier/src/netconfig-command
new file mode 100644
index 0000000..f4a56b8
--- /dev/null
+++ b/updatenotifier/src/netconfig-command
@@ -0,0 +1,60 @@
+#!/usr/bin/python
+
+import os, sys, dbus
+
+if os.getuid() != 0:
+       print "Must be run as root!"
+       sys.exit(1)
+
+bus = dbus.SystemBus()
+object = bus.get_object('org.frugalware.UpdNotifier', 
'/org/frugalware/UpdNotifier')
+
+if len(sys.argv) < 2:
+       print "Must specify an action: start, stop, changeprofile"
+       sys.exit(1)
+
+def doStop():
+       print "Stopping networking... " ,
+       ret = object.StopNetworking()
+       if ret > 0:
+               print "failed!"
+       else:
+               print "done."
+
+def doStart():
+       print "Starting networking... " ,
+       ret = object.StartNetworking()
+       if ret > 0:
+               print "failed!"
+       else:
+               print "done."
+
+def doChangeProfile(profile):
+       print "Changing profile... " ,
+       ret = object.ChangeProfile(profile)
+       if ret > 0:
+               print "failed!"
+       else:
+               print "done."
+
+def doUpdateCheck():
+       print "checking for updates..." ,
+       ret = object.CheckUpdate()
+       if ret == 0:
+               print "success"
+       else:
+               print "failed"
+
+if sys.argv[1] == "stop":
+       doStop()
+elif sys.argv[1] == "start":
+       doUpdateCheck()
+elif sys.argv[1] == "changeprofile":
+       if len(sys.argv) != 3:
+               doChangeProfile(sys.argv[2])
+       else:
+               print "Missing profile name!"
+               sys.exit(1)
+else:
+       print "Invalid action. Valid actions are: start, stop, changeprofile"
+       sys.exit(1)
diff --git a/updatenotifier/src/updnotifierd.c 
b/updatenotifier/src/updnotifierd.c
new file mode 100644
index 0000000..26c7d9f
--- /dev/null
+++ b/updatenotifier/src/updnotifierd.c
@@ -0,0 +1,269 @@
+/***************************************************************************
+ *  netconfigd.c
+ *  Author(s):  Alex Smith <[EMAIL PROTECTED]>
+ *  Copyright (C) 2007 Frugalware Developer Team
+ ****************************************************************************/
+
+/*
+ *  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 <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <dbus/dbus-glib-bindings.h>
+#include <libfwutil.h>
+#include <dirent.h>
+#include <config.h>
+#include <syslog.h>
+#include <pacman.h>
+#include "updnotifierd.h"
+#include "updnotifierd-dbus-glue.h"
+
+typedef void* netbuf;
+static PM_DB *sync_db = NULL;
+
+G_DEFINE_TYPE(UpdNotifier, updnotifierd, G_TYPE_OBJECT);
+
+void updnotifierd_class_init(UpdNotifierClass *class) {
+       // Nothing here
+}
+
+void updnotifierd_init(UpdNotifier *server) {
+       GError *error = NULL;
+       DBusGProxy *driver_proxy;
+       int request_ret;
+
+       // Init the DBus connection
+       server->connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
+       if (server->connection == NULL) {
+               g_warning("Unable to connect to dbus: %s", error->message);
+               g_error_free(error);
+               return;
+       }
+
+       dbus_g_object_type_install_info(updnotifierd_get_type(), 
&dbus_glib_updnotifierd_object_info);
+
+       // Register DBUS path
+       dbus_g_connection_register_g_object(server->connection, 
"/org/frugalware/UpdNotifier", G_OBJECT(server));
+
+       // Register the service name, the constant here are defined in 
dbus-glib-bindings.h
+       driver_proxy = dbus_g_proxy_new_for_name(server->connection, 
DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
+
+       if (!org_freedesktop_DBus_request_name (driver_proxy, 
"org.frugalware.UpdNotifier", 0, &request_ret, &error)) {
+               g_warning("Unable to register service: %s", error->message);
+               g_error_free(error);
+       }
+
+       g_object_unref(driver_proxy);
+}
+
+// Copied from netconfig.
+int handle_network_stop() {
+       return(1);
+}
+
+int handle_network_start() {
+       return 0;
+}
+
+static void
+_db_callback (char *section, PM_DB *db) {
+       g_print ("section: %s\n", section);
+       return;
+}
+
+static void
+_evt_progress (netbuf *ctl, int xferred, void *arg) {
+       g_print ("im here\n");
+}
+
+static void
+_evt_evt (unsigned char event, char *pkgname, int percent, int howmany, int 
remain) {
+       return;
+}
+
+static void
+_log_cb (unsigned short level, char *msg) {
+       g_print ("%s\n", msg);
+
+       return;
+}
+
+static gboolean
+_updatenotifierd_init_pacman () {
+       /* initialize the pacman-g2 library */
+       if (pacman_initialize ("/") == -1)
+               return FALSE;
+
+       /* parse the pacman-g2 config */
+       pacman_parse_config ("/etc/pacman.conf", _db_callback, "");
+       pacman_set_option (PM_OPT_LOGMASK, (long)-1);
+       pacman_set_option (PM_OPT_LOGCB, (long)_log_cb);
+
+       /* register the main repo */
+       /* FIXME: Later add support for custom repos */
+       sync_db = pacman_db_register ("frugalware-current");
+
+       if (sync_db == NULL)
+               return FALSE;
+
+       return TRUE;
+}
+
+static gint
+_updnotifierd_update_db () {
+       int ret = 0;
+
+       /* update the pacman database */
+       ret = pacman_db_update (0, sync_db);
+
+       /* something went wrong */
+       if (ret == -1) {
+               printf ("%s\n", pacman_strerror(pm_errno));
+               return ret;
+       }
+       else if (ret == 0) {
+               printf ("Database updated\n");
+       }
+       else {
+               printf ("Database is up to date\n");
+       }
+
+       return ret;
+}
+
+gboolean updnotifier_update_database (UpdNotifier *obj, gint32 *ret, GError 
**error) {
+       PM_LIST *packages = NULL;
+
+       if (_updnotifierd_update_db() == 0) {
+               *ret = 0;
+       }
+
+       if (pacman_trans_init(PM_TRANS_TYPE_SYNC, 0, _evt_evt, NULL, 
_evt_progress) == -1) {
+               gchar *errorstr = g_strdup_printf ("Failed to init transaction 
(%s)\n", pacman_strerror(pm_errno));
+               g_print (errorstr);
+               g_free (errorstr);
+       }
+       else {
+               if (pacman_trans_sysupgrade() == -1) {
+                       g_print (pacman_strerror(pm_errno));
+               }
+               else {
+                       packages = pacman_trans_getinfo (PM_TRANS_PACKAGES);
+                       if (packages == NULL) {
+                               g_print ("No new updates are available\n");
+                               g_print (pacman_strerror(pm_errno));
+                       }
+                       else {
+                               PM_LIST *i = NULL;
+
+                               for (i=packages;i!=NULL;i=pacman_list_next(i)) {
+                                       g_print ("%s\n", 
pacman_list_getdata(i));
+                               }
+                       }
+                       pacman_trans_release ();
+               }
+       }
+
+       return TRUE;
+}
+
+gboolean netconfig_get_current_profile(UpdNotifier *obj, gchar **profile, 
GError **error) {
+       return TRUE;
+}
+
+gboolean netconfig_change_profile(UpdNotifier *obj, gchar *profile, gint32 
*ret, GError **error) {
+       return TRUE;
+}
+
+gboolean netconfig_stop_networking(UpdNotifier *obj, gint32 *ret, GError 
**error) {
+       return TRUE;
+}
+
+gboolean netconfig_start_networking(UpdNotifier *obj, gint32 *ret, GError 
**error) {
+       return TRUE;
+}
+
+gboolean netconfig_get_profiles(UpdNotifier *obj, gchar **profiles, GError 
**error) {
+       return TRUE;
+}
+
+void usage() {
+       printf("Netconfigd v" VERSION "\n");
+       printf(" --help        Display this help text\n");
+       printf(" --daemon      Fork into the background\n");
+}
+
+int main (int argc, char *argv[]) {
+       GMainLoop *main_loop;
+       UpdNotifier *server;
+       int i = 1;
+       int daemonize = 0;
+
+       // Parse command line options
+       for (i = 1; i < argc; i++) {
+               if (!strcmp(argv[i], "--daemon"))
+                       daemonize = 1;
+               else if (!strcmp(argv[i], "--help")) {
+                       usage();
+                       return 0;
+               } else {
+                       usage();
+                       return 1;
+               }
+       }
+
+       if (getuid() != 0) {
+               printf("Must run as root!\n");
+               exit(1);
+       }
+
+       // Daemonize if wanted
+       if (daemonize) {
+               switch (fork()) {
+                       case 0:
+                               break;
+                       case -1:
+                               printf("Can't fork: %s\n", strerror(errno));
+                               exit(1);
+                               break;
+                       default:
+                               exit(0);
+               }
+
+               fclose(stdin);
+               fclose(stdout);
+               fclose(stderr);
+       }
+
+       // Connect to syslog
+       openlog("netconfigd", LOG_PID, LOG_DAEMON);
+
+       syslog(LOG_INFO, "Netconfigd v" VERSION " started...");
+
+       g_type_init();
+
+       server = g_object_new(updnotifierd_get_type(), NULL);
+
+       _updatenotifierd_init_pacman ();
+       main_loop = g_main_loop_new(NULL, FALSE);
+       g_main_loop_run(main_loop);
+
+       return 0;
+}
+
diff --git a/updatenotifier/src/updnotifierd.h 
b/updatenotifier/src/updnotifierd.h
new file mode 100644
index 0000000..3d4c4e9
--- /dev/null
+++ b/updatenotifier/src/updnotifierd.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ *  netconfigd.h
+ *  Author(s):  Alex Smith <[EMAIL PROTECTED]>
+ *  Copyright (C) 2007 Frugalware Developer Team
+ ****************************************************************************/
+
+/*
+ *  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.
+ */
+
+#ifndef _UPDNOTIFIERD_H
+#define _UPDNOTIFIERD_H
+
+typedef struct
+{
+       GObject parent;
+       DBusGConnection *connection;
+} UpdNotifier;
+
+typedef struct
+{
+       GObjectClass parent_class;
+} UpdNotifierClass;
+
+static void updnotifierd_init(UpdNotifier *server);
+static void updnotifierd_class_init(UpdNotifierClass *class);
+
+gboolean netconfig_get_current_profile(UpdNotifier *obj, gchar **profile, 
GError **error);
+gboolean netconfig_change_profile(UpdNotifier *obj, gchar *profile, gint32 
*ret, GError **error);
+gboolean netconfig_stop_networking(UpdNotifier *obj, gint32 *ret, GError 
**error);
+gboolean netconfig_start_networking(UpdNotifier *obj, gint32 *ret, GError 
**error);
+gboolean netconfig_get_profiles(UpdNotifier *obj, gchar **profiles, GError 
**error);
+gboolean updnotifier_update_database(UpdNotifier *obj, gint32 *ret, GError 
**error);
+
+#endif
diff --git a/updatenotifier/src/updnotifierd.xml 
b/updatenotifier/src/updnotifierd.xml
new file mode 100644
index 0000000..bc5db75
--- /dev/null
+++ b/updatenotifier/src/updnotifierd.xml
@@ -0,0 +1,30 @@
+<node name="/org/frugalware/UpdNotifier">
+       <interface name="org.frugalware.UpdNotifier">
+               <annotation name="org.freedesktop.DBus.GLib.CSymbol" 
value="updnotifier"/>
+               <method name="GetCurrentProfile">
+                       <annotation name="org.freedesktop.DBus.GLib.CSymbol" 
value="netconfig_get_current_profile"/>
+                       <arg type="s" name="profile" direction="out" />
+               </method>
+               <method name="ChangeProfile">
+                       <annotation name="org.freedesktop.DBus.GLib.CSymbol" 
value="netconfig_change_profile"/>
+                       <arg type="s" name="profile" direction="in" />
+                       <arg type="u" direction="out" />
+               </method>
+               <method name="StopNetworking">
+                       <annotation name="org.freedesktop.DBus.GLib.CSymbol" 
value="netconfig_stop_networking"/>
+                       <arg type="u" direction="out" />
+               </method>
+               <method name="StartNetworking">
+                       <annotation name="org.freedesktop.DBus.GLib.CSymbol" 
value="netconfig_start_networking"/>
+                       <arg type="u" direction="out" />
+               </method>
+               <method name="GetProfiles">
+                       <annotation name="org.freedesktop.DBus.GLib.CSymbol" 
value="netconfig_get_profiles"/>
+                       <arg type="s" name="profiles" direction="out" />
+               </method>
+               <method name="CheckUpdate">
+                       <annotation name="org.freedesktop.DBus.GLib.CSymbol" 
value="updnotifier_update_database"/>
+                       <arg type="s" name="profiles" direction="out" />
+               </method>
+       </interface>
+</node>
diff --git a/updatenotifier/updnotifierd.conf b/updatenotifier/updnotifierd.conf
new file mode 100644
index 0000000..1557583
--- /dev/null
+++ b/updatenotifier/updnotifierd.conf
@@ -0,0 +1,20 @@
+<!DOCTYPE busconfig PUBLIC
+ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd";>
+<busconfig>
+       <policy user="root">
+               <allow own="org.frugalware.UpdNotifier"/>
+               <allow send_destination="org.frugalware.UpdNotifier"/>
+               <allow send_interface="org.frugalware.UpdNotifier"/>
+       </policy>
+       <policy group="users">
+               <deny own="org.frugalware.UpdNotifier"/>
+               <allow send_destination="org.frugalware.UpdNotifier"/>
+               <allow send_interface="org.frugalware.UpdNotifier"/>
+       </policy>
+       <policy context="default">
+               <deny own="org.frugalware.UpdNotifier"/>
+               <deny send_destination="org.frugalware.UpdNotifier"/>
+               <deny send_interface="org.frugalware.UpdNotifier"/>
+       </policy>
+</busconfig>
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to