diff options
author | Jan Lipovsky <janlipovsky@gmail.com> | 2010-05-18 15:47:39 +0200 |
---|---|---|
committer | Jan Lipovsky <janlipovsky@gmail.com> | 2010-05-18 15:47:39 +0200 |
commit | b282327da5b515ce3288b1084bf1e21cf01c49af (patch) | |
tree | 6780b93a2fce034576d1659fe0ea889ea62bc75d | |
parent | edce1bc175adbd9941f17b73ae2d94fd5ffede93 (diff) | |
download | sfshare-b282327da5b515ce3288b1084bf1e21cf01c49af.tar.gz sfshare-b282327da5b515ce3288b1084bf1e21cf01c49af.tar.xz sfshare-b282327da5b515ce3288b1084bf1e21cf01c49af.zip |
Autotools init
-rwxr-xr-x | Makefile.am | 6 | ||||
-rw-r--r-- | autogen.sh | 4 | ||||
-rwxr-xr-x | configure.ac | 61 | ||||
-rwxr-xr-x | nautilus-plugin/Makefile.am | 3 | ||||
-rwxr-xr-x | nautilus-plugin/src/Makefile | 30 | ||||
-rwxr-xr-x | nautilus-plugin/src/Makefile.am | 1 | ||||
-rwxr-xr-x | nautilus-plugin/src/nautilus_sfshare.c | 11 | ||||
-rwxr-xr-x | sfshare-daemon/Makefile.am | 5 | ||||
-rwxr-xr-x | sfshare-daemon/data/Makefile.am | 7 | ||||
-rw-r--r-- | sfshare-daemon/src/Makefile | 50 | ||||
-rwxr-xr-x | sfshare-daemon/src/Makefile.am | 6 | ||||
-rw-r--r-- | sfshare-daemon/src/dbus_service.c | 35 | ||||
-rw-r--r-- | sfshare-daemon/src/dbus_service.h | 2 | ||||
-rw-r--r-- | sfshare-daemon/src/samba_share.c | 38 | ||||
-rw-r--r-- | sfshare-daemon/src/samba_share.h | 28 | ||||
-rw-r--r-- | sfshare-daemon/src/sfshare_errors.h | 4 | ||||
-rw-r--r-- | sfshare-daemon/src/sfshared.c | 2 | ||||
-rwxr-xr-x | sfshare-gui/Makefile.am | 5 | ||||
-rwxr-xr-x | sfshare-gui/data/Makefile.am | 7 | ||||
-rw-r--r-- | sfshare-gui/src/Makefile | 44 | ||||
-rwxr-xr-x | sfshare-gui/src/Makefile.am | 11 | ||||
-rw-r--r-- | sfshare-gui/src/dbus_client.c | 22 | ||||
-rw-r--r-- | sfshare-gui/src/dbus_client.h | 8 | ||||
-rw-r--r-- | sfshare-gui/src/sfshare.c | 29 | ||||
-rw-r--r-- | sfshare-gui/src/sfshare.h | 4 |
25 files changed, 225 insertions, 198 deletions
diff --git a/Makefile.am b/Makefile.am new file mode 100755 index 0000000..2bd6cc5 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,6 @@ +AUTOMAKE_OPTIONS = foreign + +SUBDIRS = \ + sfshare-gui \ + sfshare-daemon +# nautilus-plugin diff --git a/autogen.sh b/autogen.sh new file mode 100644 index 0000000..27eeaa1 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +autoreconf -i + diff --git a/configure.ac b/configure.ac new file mode 100755 index 0000000..76a486b --- /dev/null +++ b/configure.ac @@ -0,0 +1,61 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.63]) +AC_INIT([Simple File Share], [0.1.0], [janlipovsky@gmail.com]) +AM_INIT_AUTOMAKE([Simple File Share], [0.1.0]) + +# Checks for programs. +AC_PROG_CC + +PKG_CHECK_MODULES(GLIB, glib-2.0) +AC_SUBST([GLIB_CFLAGS]) +AC_SUBST([GLIB_LIBS]) + +PKG_CHECK_MODULES(GTK, gtk+-2.0) +AC_SUBST([GTK_CFLAGS]) +AC_SUBST([GTK_LIBS]) + +PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1) +AC_SUBST([DBUS_GLIB_CFLAGS]) +AC_SUBST([DBUS_GLIB_LIBS]) + +PKG_CHECK_MODULES(POLKIT, polkit-gtk-1) +AC_SUBST([POLKIT_CFLAGS]) +AC_SUBST([POLKIT_LIBS]) + +PKG_CHECK_MODULES(NAUTILUS, libnautilus-extension) +AC_SUBST([NAUTILUS_CFLAGS]) +AC_SUBST([NAUTILUS_LIBS]) + + +#AC_CHECK_LIB(gtk-x11-2.0, gtk_init, [], AC_MSG_ERROR([gtk+-2.0 is required for this program])) + +#AC_CHECK_LIB(glib-2.0, g_string_new, [], AC_MSG_ERROR([glib-2.0 is required for this program])) + +#AC_CHECK_LIB([nautilus-extension], [nautilus_file_info_get_file_type], [], AC_MSG_ERROR([libnautilus-extension is required for this program])) + +#AC_CHECK_LIB([dbus-glib-1], [dbus_g_proxy_call], [], AC_MSG_ERROR([dbus-glib-1 is required for this program])) + +#AC_CHECK_LIB([polkit-gtk-1], [polkit_authority_check_authorization_finish], [], AC_MSG_ERROR([polkit-gtk-1 is required for this program])) + +# Checks for header files. +AC_CHECK_HEADERS([stdlib.h string.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_INLINE + +# Checks for library functions. +AC_CHECK_FUNCS([strstr]) + +AC_CONFIG_FILES([Makefile + sfshare-daemon/Makefile + sfshare-daemon/src/Makefile + sfshare-daemon/data/Makefile + sfshare-gui/Makefile + sfshare-gui/src/Makefile + sfshare-gui/data/Makefile]) + +# nautilus-plugin/src/Makefile + +AC_OUTPUT diff --git a/nautilus-plugin/Makefile.am b/nautilus-plugin/Makefile.am new file mode 100755 index 0000000..114bee3 --- /dev/null +++ b/nautilus-plugin/Makefile.am @@ -0,0 +1,3 @@ +AUTOMAKE_OPTIONS = foreign + +SUBDIRS = src diff --git a/nautilus-plugin/src/Makefile b/nautilus-plugin/src/Makefile deleted file mode 100755 index 99417ec..0000000 --- a/nautilus-plugin/src/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -TARGET=libnautilus_sfshare.so -OBJECTS=nautilus_sfshare.o - -LIBDIR=/usr/lib -WFLAGS=-Wall -pedantic -Wmissing-prototypes -CFLAGS= $(WFLAGS) -fPIC -g \ - $(shell pkg-config --cflags libnautilus-extension glib-2.0) - -LDFLAGS=-shared \ - $(shell pkg-config --libs libnautilus-extension glib-2.0) - -all: $(TARGET) - -$(TARGET): $(OBJECTS) - gcc $(LDFLAGS) $(OBJECTS) -o $(TARGET) - -install: all - mkdir -p $(LIBDIR)/nautilus/extensions-2.0 - cp $(TARGET) $(LIBDIR)/nautilus/extensions-2.0/ - - -uninstall: - rm -f $(LIBDIR)/nautilus/extensions-2.0/$(TARGET) - - -nautilus_sfshare.o: nautilus_sfshare.c - gcc -c $(CFLAGS) nautilus_sfshare.c -o nautilus_sfshare.o - -clean: - rm -f $(OBJECTS) $(TARGET) diff --git a/nautilus-plugin/src/Makefile.am b/nautilus-plugin/src/Makefile.am new file mode 100755 index 0000000..f9bf1ab --- /dev/null +++ b/nautilus-plugin/src/Makefile.am @@ -0,0 +1 @@ +#TODO diff --git a/nautilus-plugin/src/nautilus_sfshare.c b/nautilus-plugin/src/nautilus_sfshare.c index 302f3a9..efd707b 100755 --- a/nautilus-plugin/src/nautilus_sfshare.c +++ b/nautilus-plugin/src/nautilus_sfshare.c @@ -80,6 +80,9 @@ sfshare_extension_menu_provider_iface_init (NautilusMenuProviderIface *iface) iface->get_file_items = sfshare_extension_get_file_items; } +/** +* Register new type +*/ static void sfshare_extension_register_type (GTypeModule *module) { @@ -114,7 +117,9 @@ sfshare_extension_register_type (GTypeModule *module) &menu_provider_iface_info); } - +/** +* Add item to folder's context menu +*/ static GList * sfshare_extension_get_file_items ( NautilusMenuProvider *provider, GtkWidget *window, @@ -158,7 +163,9 @@ sfshare_extension_get_file_items ( NautilusMenuProvider *provider, } - +/** +* Run Simple File Share GUI +*/ static void sfshare_start_gui (NautilusMenuItem *item, gpointer user_data) diff --git a/sfshare-daemon/Makefile.am b/sfshare-daemon/Makefile.am new file mode 100755 index 0000000..834fbb9 --- /dev/null +++ b/sfshare-daemon/Makefile.am @@ -0,0 +1,5 @@ +AUTOMAKE_OPTIONS = foreign + +SUBDIRS = \ + src \ + data diff --git a/sfshare-daemon/data/Makefile.am b/sfshare-daemon/data/Makefile.am new file mode 100755 index 0000000..0e32e00 --- /dev/null +++ b/sfshare-daemon/data/Makefile.am @@ -0,0 +1,7 @@ +#/etc/dbus-1/system.d +dbusconfdir = $(sysconfdir)/dbus-1/system.d/ +dbusconf_DATA = org.fedoraproject.SimpleFileShare.conf + + + +EXTRA_DIST = $(dbusconf_DATA) diff --git a/sfshare-daemon/src/Makefile b/sfshare-daemon/src/Makefile deleted file mode 100644 index b703f87..0000000 --- a/sfshare-daemon/src/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# TEMPORARY MAKEFILE -CXX=gcc - -CXXFLAGS=-Wall `pkg-config --cflags --libs gtk+-2.0 dbus-glib-1 polkit-gtk-1` - - -# objektove soubory -OBJS= dbus_service.o samba_share.o - -all: sfshared - -############################################################################### - -samba_share.o: samba_share.c samba_share.h sfshare_errors.h - $(CXX) $(CXXFLAGS) -c samba_share.c - -dbus_service.o: dbus_service.c dbus_service.h samba_share.h sfshare_errors.h - $(CXX) $(CXXFLAGS) -c dbus_service.c - -sfshared: $(OBJS) - $(CXX) $(OBJS) $(CXXFLAGS) sfshared.c -o sfshared - - -################################################################################ -.PHONY: clean edit install uninstall - -clean: - rm -f *.o - rm -f sfshared - -install: all - cp sfshared /usr/sbin -#### only root can run it - cp ../data/org.fedoraproject.SimpleFileShare.conf /etc/dbus-1/system.d/ -#### only root can run it - cp ../data/org.fedoraproject.SimpleFileShare.policy /usr/share/polkit-1/actions/ -#### only root can run it - cp ../data/org.fedoraproject.SimpleFileShare.service /usr/share/dbus-1/system-services/ - -uninstall: - rm -f /usr/sbin/sfshared - rm -f /etc/dbus-1/system.d/org.fedoraproject.SimpleFileShare.conf - rm -f /usr/share/polkit-1/actions/org.fedoraproject.SimpleFileShare.policy - rm -f /usr/share/dbus-1/system-services/org.fedoraproject.SimpleFileShare.service - - -################################################################################ - -edit: - gvim -p *.h *.cpp diff --git a/sfshare-daemon/src/Makefile.am b/sfshare-daemon/src/Makefile.am new file mode 100755 index 0000000..f4c11a2 --- /dev/null +++ b/sfshare-daemon/src/Makefile.am @@ -0,0 +1,6 @@ +AM_CFLAGS=-Wall @POLKIT_CFLAGS@ @GTK_CFLAGS@ @DBUS_GLIB_CFLAGS@ +AM_LDFLAGS= @POLKIT_LIBS@ @GTK_LIBS@ @DBUS_GLIB_LIBS@ + + +bin_PROGRAMS = sfshared +sfshared_SOURCES = dbus_service.c dbus_service.h samba_share.c sfshared.c dbus_service_glue.h samba_share.h sfshare_errors.h diff --git a/sfshare-daemon/src/dbus_service.c b/sfshare-daemon/src/dbus_service.c index ef986bd..c2f0258 100644 --- a/sfshare-daemon/src/dbus_service.c +++ b/sfshare-daemon/src/dbus_service.c @@ -53,7 +53,6 @@ GType daemon_object_get_type (void); struct DaemonObject { GObject parent; - }; struct DaemonObjectClass @@ -79,6 +78,9 @@ gboolean daemon_delete_share (DaemonObject *obj,const gchar *path, DBusGMethodIn #include "dbus_service_glue.h" +/** +* Return text of Error +*/ gchar * get_error_msg (Error_sfshare err) { @@ -144,7 +146,7 @@ get_error_quark (void) } -/* Return error to context */ +/** Return error to context */ static void send_error (DBusGMethodInvocation *context, gint error_code, @@ -167,7 +169,9 @@ send_error (DBusGMethodInvocation *context, } - +/** +* Create pointer to DaemonData filled with values from parameters +*/ DaemonData * daemon_data_new ( DBusGMethodInvocation *context, AuthorizedCallback auth_cb, const gchar **in) { @@ -191,7 +195,9 @@ daemon_data_new ( DBusGMethodInvocation *context, AuthorizedCallback auth_cb, co return ret; } - +/** +* Free DaemonData pointer +*/ void daemon_data_free (DaemonData * data) { @@ -208,9 +214,9 @@ daemon_data_free (DaemonData * data) } - - - +/** +* PolicyKit callback function +*/ static void check_authorization_cb (PolkitAuthority *authority, GAsyncResult *res, @@ -269,10 +275,13 @@ daemon_object_class_init (DaemonObjectClass *klass) { } +/** +* Handle incomming request - D-Bus get_share_status +*/ gboolean daemon_get_share_status (DaemonObject *obj, const gchar *path, gchar ***result, GError **error) { - puts("daemon_get_share_status"); + /* puts("daemon_get_share_status"); */ Error_sfshare err; @@ -287,7 +296,7 @@ daemon_get_share_status (DaemonObject *obj, const gchar *path, gchar ***result, return TRUE; } -/* +/** * Authorized call of smb_set_share - write or change share section */ void @@ -311,7 +320,7 @@ setup_share_authorized (gpointer data) -/* +/** * Dbus setup share - polkit authorization check */ gboolean @@ -337,7 +346,7 @@ daemon_setup_share (DaemonObject *obj,const gchar **parameters, DBusGMethodInvoc -/* +/** * Authorized call of smb_delete_share - delete share section */ void @@ -360,7 +369,7 @@ delete_share_authorized (gpointer data) } -/* +/** * Dbus delete share - polkit authorization check */ gboolean @@ -389,7 +398,7 @@ daemon_delete_share (DaemonObject *obj, const gchar *path, DBusGMethodInvocation } -/* +/** * Start of sfshare deamon */ int diff --git a/sfshare-daemon/src/dbus_service.h b/sfshare-daemon/src/dbus_service.h index 58fe627..79897a1 100644 --- a/sfshare-daemon/src/dbus_service.h +++ b/sfshare-daemon/src/dbus_service.h @@ -33,7 +33,7 @@ typedef struct } DaemonData; -/* Daemon start */ +/** Daemon start */ int dbus_sfshare_start (); GQuark get_error_quark (void); diff --git a/sfshare-daemon/src/samba_share.c b/sfshare-daemon/src/samba_share.c index 01c91b8..32987bf 100644 --- a/sfshare-daemon/src/samba_share.c +++ b/sfshare-daemon/src/samba_share.c @@ -47,14 +47,14 @@ gchar *smb_conf_path = "/etc/samba/smb.conf"; const gchar *smb_special_section [SECTIONS_COUNT] = {"global", "homes", "printers"}; -/* Send SIGHUP to smb and nmb */ +/** Send SIGHUP to smb and nmb */ void smb_reload_service () { system("killall -HUP smb nmb"); } -/* +/** * Function changes path to smb.conf to path */ void @@ -64,7 +64,7 @@ set_smbconf_path (const gchar *path) } -/* +/** * Save string str as new smb.conf */ gint @@ -100,7 +100,7 @@ write_smbconf (const gchar *content) } -/* +/** * Function free TSmbConfItem from memmory */ void @@ -117,7 +117,7 @@ smbconf_item_free(TSmbConfItem *item) } -/* +/** * Function allocs memory for TSmbConfItem */ TSmbConfItem* @@ -137,7 +137,7 @@ smbconf_item_new0 () } -/* +/** * Function allocs memory for TSmbConfItem */ TSmbConfItem* @@ -162,7 +162,7 @@ smbconf_item_new (const gchar *name, const gchar *path, const gchar *comment, co return ret; } -/* +/** * Function returns new array */ GPtrArray* @@ -173,7 +173,7 @@ shared_items_array_new () } -/* +/** * Destroy array */ void @@ -191,7 +191,7 @@ shared_items_array_free (GPtrArray *array) } -/* +/** * If ok return 0 else return number of error */ gint check_item(TSmbConfItem *item) @@ -210,7 +210,7 @@ gint check_item(TSmbConfItem *item) } -/* +/** * Parse line of smb.conf and fill competent field of item structure */ void @@ -325,7 +325,7 @@ parse_to_share_item (gchar *txt, TSmbConfItem *item) -/* +/** * Funciton loads all share section to array */ gint @@ -417,7 +417,7 @@ load_smb_conf (GPtrArray *shared_items) } -/* +/** * Returns share imte if directory [path] is shared, * if not return NULL; */ @@ -442,7 +442,7 @@ TSmbConfItem } -/* +/** * True if share name exist */ gboolean @@ -463,7 +463,7 @@ share_name_exist (GPtrArray *shared_items, const gchar *sharename) } -/* +/** * Write new share section or change chare section defined by share parameter */ gint @@ -746,7 +746,7 @@ write_share (GPtrArray *shared_items, TSmbConfItem *share) -/* +/** * Function erase shared section containing path from smb.conf * shared_items must by actual! */ @@ -853,7 +853,7 @@ void char_to_strv(const gchar *str, gchar ***ret) } -/* +/** * If path is shared then returns share parameters in result. */ gint @@ -898,7 +898,7 @@ smb_get_share_status (const gchar *path, gchar ***result) } -/* +/** * Write share to smb.conf */ gint @@ -927,8 +927,8 @@ smb_set_share (gchar **parameters) } -/* -* Delete share to smb.conf +/** +* Delete share section from smb.conf */ gint smb_delete_share (gchar **path) diff --git a/sfshare-daemon/src/samba_share.h b/sfshare-daemon/src/samba_share.h index f967126..ae9e34b 100644 --- a/sfshare-daemon/src/samba_share.h +++ b/sfshare-daemon/src/samba_share.h @@ -32,46 +32,50 @@ typedef struct smb_conf_item } TSmbConfItem; -/* Funciton loads all share section to array */ +/** Funciton loads all share section to array */ gint load_smb_conf (GPtrArray *shared_items); -/*Function erase shared section containing path from smb.conf */ +/** Function erase shared section containing path from smb.conf */ gint delete_share (GPtrArray *shared_items, const gchar *path); - +/** Write new share section or change chare section defined by share parameter */ gint write_share (GPtrArray *shared_items, TSmbConfItem *share); - +/** If path is shared then returns share parameters in result. */ gboolean smb_get_share_status (const gchar *path, gchar ***result); + +/** Write or channge section in smb.conf */ gint smb_set_share (gchar **parameters); + +/** Delete share section from smb.conf */ gint smb_delete_share (gchar **path); void item_to_strv (TSmbConfItem *item, gchar ***ret); -/*Function changes path to smb.conf to path */ +/** Function changes path to smb.conf to path */ void set_smbconf_path (const gchar *path); -/*Function returns new array */ +/** Function returns new array */ GPtrArray* shared_items_array_new(); -/*Function destroy Share Items Array */ +/** Function destroy Share Items Array */ void shared_items_array_free (GPtrArray *array); -/*Function allocs memory for TSmbConfItem and sets parameters */ +/** Function allocs memory for TSmbConfItem and sets parameters */ TSmbConfItem* smbconf_item_new (const gchar *name, const gchar *path, const gchar *comment, const gchar *read_only, const gchar *guest_ok); -/*Function allocs memory for TSmbConfItem */ +/** Function allocs memory for TSmbConfItem */ TSmbConfItem* smbconf_item_new0 (); -/*If ok return 0 else return number of error */ +/** If ok return 0 else return number of error */ gint check_item (TSmbConfItem *item); -/*Function free memory */ +/** Function free memory */ void smbconf_item_free (TSmbConfItem *item); -/* Send SIGHUP to smb and nmb */ +/** Send SIGHUP to smb and nmb */ void smb_reload_service (); #endif diff --git a/sfshare-daemon/src/sfshare_errors.h b/sfshare-daemon/src/sfshare_errors.h index 4fe9fc7..6c7bc4b 100644 --- a/sfshare-daemon/src/sfshare_errors.h +++ b/sfshare-daemon/src/sfshare_errors.h @@ -19,7 +19,7 @@ #define SFSHARE_ERRORS_H -/* Types of errors */ +/** Types of errors */ typedef enum { OK, @@ -40,7 +40,7 @@ typedef enum } Error_sfshare; -/* Definition in file: dbus_service.c */ +/** Definition in file: dbus_service.c */ gchar *get_error_msg (Error_sfshare err); #endif diff --git a/sfshare-daemon/src/sfshared.c b/sfshare-daemon/src/sfshared.c index 1c81701..0a2ee3b 100644 --- a/sfshare-daemon/src/sfshared.c +++ b/sfshare-daemon/src/sfshared.c @@ -23,7 +23,7 @@ #include "samba_share.h" #include "dbus_service.h" - +/** Run daemon */ int main() { return dbus_sfshare_start(); diff --git a/sfshare-gui/Makefile.am b/sfshare-gui/Makefile.am new file mode 100755 index 0000000..3310172 --- /dev/null +++ b/sfshare-gui/Makefile.am @@ -0,0 +1,5 @@ +AUTOMAKE_OPTIONS = foreign + +SUBDIRS = \ + src \ + data diff --git a/sfshare-gui/data/Makefile.am b/sfshare-gui/data/Makefile.am new file mode 100755 index 0000000..41a66d3 --- /dev/null +++ b/sfshare-gui/data/Makefile.am @@ -0,0 +1,7 @@ +# TODO $(sysconfdir)/sfshare/ +uidir = /usr/share/sfshare/ +ui_DATA = sfshare_window.ui + + + +EXTRA_DIST = $(ui_DATA) diff --git a/sfshare-gui/src/Makefile b/sfshare-gui/src/Makefile deleted file mode 100644 index e6530ad..0000000 --- a/sfshare-gui/src/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# TEMPORARY MAKEFILE -CXX=gcc - -CXXFLAGS=-Wall `pkg-config --cflags --libs gtk+-2.0 dbus-glib-1 polkit-gtk-1` - -USRDIR=/usr/bin -DATADIR=/usr/share - -# objektove soubory -OBJS= dbus_client.o - -all: sfshare - -############################################################################### - -dbus_client.o: dbus_client.c dbus_client.h dbus_client_glue.h - $(CXX) $(CXXFLAGS) -c dbus_client.c - -sfshare: $(OBJS) - $(CXX) $(OBJS) $(CXXFLAGS) sfshare.c -o sfshare-gui - - -################################################################################ -.PHONY: clean edit uninstall - -install: all - cp sfshare-gui $(USRDIR)/ - mkdir -p $(DATADIR)/sfshare - cp ../data/sfshare_window.ui $(DATADIR)/sfshare/ - -clean: - rm -f *.o - rm -f sfshare-gui - - -uninstall: - rm -fr $(DATADIR)/sfshare/ - rm -f $(USRDIR)/sfshare-gui - - -################################################################################ - -edit: - gvim -p *.h *.c diff --git a/sfshare-gui/src/Makefile.am b/sfshare-gui/src/Makefile.am new file mode 100755 index 0000000..c55555f --- /dev/null +++ b/sfshare-gui/src/Makefile.am @@ -0,0 +1,11 @@ +AM_CFLAGS=-Wall @POLKIT_CFLAGS@ @GTK_CFLAGS@ @DBUS_GLIB_CFLAGS@ +# "`$PKG_CONFIG --cflags gtk+-2.0 dbus-glib-1 polkit-gtk-1`" +#$(shell pkg-config --cflags gtk+-2.0 dbus-glib-1 polkit-gtk-1) +AM_LDFLAGS= @POLKIT_LIBS@ @GTK_LIBS@ @DBUS_GLIB_LIBS@ +# "`$PKG_CONFIG --libs gtk+-2.0 dbus-glib-1 polkit-gtk-1`" +#$(shell pkg-config --libs gtk+-2.0 dbus-glib-1 polkit-gtk-1) + + +bin_PROGRAMS = sfshare-gui +sfshare_gui_SOURCES = dbus_client.c dbus_client.h sfshare.h dbus_client_glue.h sfshare.c + diff --git a/sfshare-gui/src/dbus_client.c b/sfshare-gui/src/dbus_client.c index 6a4daa3..e285e97 100644 --- a/sfshare-gui/src/dbus_client.c +++ b/sfshare-gui/src/dbus_client.c @@ -44,7 +44,7 @@ PolkitSubject *subject; PolkitAuthority *authority; -/* Connect to DBUS */ +/** Connect to DBUS */ void dbus_sfshare_connect ( void ) { @@ -74,7 +74,7 @@ dbus_sfshare_connect ( void ) } -/* Disconnect from DBUS */ +/** Disconnect from DBUS - free object */ void dbus_sfshare_disconnect ( void ) { @@ -85,14 +85,14 @@ dbus_sfshare_disconnect ( void ) } } - +/** Get Polkit Authority */ void polkit_sfshare_init () { authority = polkit_authority_get (); } - +/** Free Polkit objects */ void polkit_sfshare_free () { @@ -100,7 +100,7 @@ polkit_sfshare_free () g_object_unref (subject); } - +/** PolicyKit callback */ static void check_authorization_cb (PolkitAuthority *authority, GAsyncResult *res, @@ -136,7 +136,7 @@ check_authorization_cb (PolkitAuthority *authority, } } - +/** Check privileges vie PolicyKit */ void polkit_sfshare_check (const gchar *action_id) { @@ -153,7 +153,7 @@ polkit_sfshare_check (const gchar *action_id) NULL); } - +/** Call daemon D-Bus methot get_share_status */ int dbus_sfshare_get_share (const gchar *path, gchar ***result) { @@ -173,7 +173,7 @@ dbus_sfshare_get_share (const gchar *path, gchar ***result) return 0; } -/* Reply of setup_share */ +/** Reply of setup_share */ void set_share_reply (DBusGProxy *proxy, GError *error, gpointer userdata) { @@ -190,7 +190,7 @@ set_share_reply (DBusGProxy *proxy, GError *error, gpointer userdata) } - +/** Async call daemon D-Bus methot setup_share */ void dbus_sfshare_set_share (const gchar *name, const gchar *path, const gchar *comment, const gchar *read_only, const gchar *guest_ok) { @@ -212,7 +212,7 @@ dbus_sfshare_set_share (const gchar *name, const gchar *path, const gchar *comme - +/** Reply of delete_share */ void delete_share_reply (DBusGProxy *proxy, GError *error, gpointer userdata) { @@ -230,7 +230,7 @@ delete_share_reply (DBusGProxy *proxy, GError *error, gpointer userdata) } - +/** Async call daemon D-Bus methot delete_share */ void dbus_sfshare_delete_share (const gchar *path) { diff --git a/sfshare-gui/src/dbus_client.h b/sfshare-gui/src/dbus_client.h index d633d1a..ce963b2 100644 --- a/sfshare-gui/src/dbus_client.h +++ b/sfshare-gui/src/dbus_client.h @@ -18,18 +18,26 @@ #ifndef DBUS_SERVICE_H #define DBUS_SERVICE_H +/** Call daemon D-Bus methot get_share_status */ int dbus_sfshare_get_share (const gchar *path, gchar ***result); +/** Async call daemon D-Bus methot setup_share */ void dbus_sfshare_set_share (const gchar *name, const gchar *path, const gchar *comment, const gchar *read_only, const gchar *guest_ok); +/** Async call daemon D-Bus methot delete_share */ void dbus_sfshare_delete_share (const gchar *path); +/** Connect to DBUS */ void dbus_sfshare_connect ( void ); +/** Disconnect from DBUS - free object */ void dbus_sfshare_disconnect ( void ); #define ACTION_ID_SETUP_SHARE "org.fedoraproject.SimpleFileShare.setup_share" #define ASTION_ID_DELETE_SHARE "org.fedoraproject.SimpleFileShare.delete_share" +/** Check privileges vie PolicyKit */ void polkit_sfshare_check (const gchar *action_id); +/** Get Polkit Authority */ void polkit_sfshare_init(); +/** Free Polkit objects */ void polkit_sfshare_free(); diff --git a/sfshare-gui/src/sfshare.c b/sfshare-gui/src/sfshare.c index 17bed74..d223cab 100644 --- a/sfshare-gui/src/sfshare.c +++ b/sfshare-gui/src/sfshare.c @@ -25,7 +25,7 @@ #include <stdlib.h> -/* Types of share service */ +/** Types of share service */ typedef enum share_service { NOTHING_SELECTED = -1, @@ -34,7 +34,7 @@ typedef enum share_service } TShare_service; -/* Dialog widgets */ +/** Dialog widgets */ typedef struct _sfsdialog { GtkWidget *window; @@ -52,16 +52,16 @@ typedef struct _sfsdialog } SFSDialog; -/* Dialog window */ +/** Dialog window */ SFSDialog sfsdialog; -/* Is directory shared? */ +/** Is directory shared? */ gboolean shared_smbconf = FALSE; -/* Did user changed something? */ +/** Did user changed something? */ gboolean change_in_gui = FALSE; -/* path to folder */ +/** Path to folder */ gchar *dir_path; @@ -79,7 +79,7 @@ sfshare_dialog_destroy () } - +/** On change event - enable Save button */ void gui_changed ( void ) { @@ -92,7 +92,7 @@ gui_changed ( void ) } -/* Show info, error or warning message*/ +/** Show info, error or warning message */ void show_message (GtkMessageType type, const gchar *format, gchar *msgtxt, const gchar *format_sec, gchar *msgtxt_sec) { @@ -115,7 +115,7 @@ show_message (GtkMessageType type, const gchar *format, gchar *msgtxt, const gch } -/* +/** * Fill in information about shared directory to GUI */ void @@ -181,6 +181,9 @@ reload_share_info ( void ) load_share_info (); } +/** +* Check authority via PolicyKit - OnClick Save +*/ void sfshare_authority_check ( void ) { @@ -218,8 +221,8 @@ sfshare_authority_check ( void ) -/* -* Call set_share +/** +* Save button - call functions to save/change or delete section */ void save_share ( void ) @@ -270,7 +273,9 @@ save_share ( void ) } } - +/** +* Create main window +*/ int main ( int argc, char **argv ) { diff --git a/sfshare-gui/src/sfshare.h b/sfshare-gui/src/sfshare.h index cf757e4..7876e3b 100644 --- a/sfshare-gui/src/sfshare.h +++ b/sfshare-gui/src/sfshare.h @@ -18,11 +18,13 @@ #ifndef SFSHARE_H #define SFSHARE_H -/* Shows error, info, warning dialog */ +/** Shows error, info, warning dialog */ void show_message (GtkMessageType type, const gchar *format, gchar *msgtxt, const gchar *format_sec, gchar *msgtxt_sec); +/** Call functions to save/change or delete section */ void save_share ( void ); +/** Reload smbd and nmbd */ void reload_share_info ( void ); #endif |