From d8839cc07665fe2a82a4ada43ad5dcb6582f3921 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 6 Dec 2012 04:06:20 +0100 Subject: [PATCH] Code cleanup --- Makefile | 1 + include/Browser.h | 36 +---------------------- include/Browser/Makefile | 9 ++++-- include/Browser/plugin.h | 57 ++++++++++++++++++++++++++++++++++++ include/Browser/project.conf | 7 +++-- include/Makefile | 6 ++-- include/project.conf | 2 +- 7 files changed, 74 insertions(+), 44 deletions(-) create mode 100644 include/Browser/plugin.h diff --git a/Makefile b/Makefile index 40d4d80..8b171f4 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,7 @@ dist: $(PACKAGE)-$(VERSION)/include/Makefile \ $(PACKAGE)-$(VERSION)/include/project.conf \ $(PACKAGE)-$(VERSION)/include/Browser/desktop.h \ + $(PACKAGE)-$(VERSION)/include/Browser/plugin.h \ $(PACKAGE)-$(VERSION)/include/Browser/Makefile \ $(PACKAGE)-$(VERSION)/include/Browser/project.conf \ $(PACKAGE)-$(VERSION)/po/Makefile \ diff --git a/include/Browser.h b/include/Browser.h index 01706de..8d751ec 100644 --- a/include/Browser.h +++ b/include/Browser.h @@ -18,41 +18,7 @@ #ifndef DESKTOP_BROWSER_H # define DESKTOP_BROWSER_H -# include -# include -# include # include "Browser/desktop.h" - - -/* Browser */ -/* public */ -/* types */ -typedef struct _Browser Browser; - -typedef struct _BrowserPlugin BrowserPlugin; - -typedef struct _BrowserPluginHelper -{ - Browser * browser; - int (*error)(Browser * browser, char const * message, int ret); - GdkPixbuf * (*get_icon)(Browser * browser, char const * filename, - char const * type, struct stat * lst, struct stat * st, - int size); - Mime * (*get_mime)(Browser * browser); - char const * (*get_type)(Browser * browser, char const * filename, - mode_t mode); - int (*set_location)(Browser * browser, char const * path); -} BrowserPluginHelper; - -typedef const struct _BrowserPluginDefinition -{ - char const * name; - char const * icon; - char const * description; - BrowserPlugin * (*init)(BrowserPluginHelper * helper); - void (*destroy)(BrowserPlugin * plugin); - GtkWidget * (*get_widget)(BrowserPlugin * plugin); - void (*refresh)(BrowserPlugin * plugin, GList * selection); -} BrowserPluginDefinition; +# include "Browser/plugin.h" #endif /* !DESKTOP_BROWSER_H */ diff --git a/include/Browser/Makefile b/include/Browser/Makefile index 114ec38..55223ec 100644 --- a/include/Browser/Makefile +++ b/include/Browser/Makefile @@ -14,10 +14,13 @@ clean: distclean: clean install: - $(MKDIR) $(DESTDIR)$(PREFIX)/include/Desktop/Browser - $(INSTALL) -m 0644 -- desktop.h $(DESTDIR)$(PREFIX)/include/Desktop/Browser/desktop.h + $(MKDIR) $(DESTDIR)$(INCLUDEDIR)/Desktop/Browser + $(INSTALL) -m 0644 -- desktop.h $(DESTDIR)$(INCLUDEDIR)/Desktop/Browser/desktop.h + $(MKDIR) $(DESTDIR)$(INCLUDEDIR)/Desktop/Browser + $(INSTALL) -m 0644 -- plugin.h $(DESTDIR)$(INCLUDEDIR)/Desktop/Browser/plugin.h uninstall: - $(RM) -- $(DESTDIR)$(PREFIX)/include/Desktop/Browser/desktop.h + $(RM) -- $(DESTDIR)$(INCLUDEDIR)/Desktop/Browser/desktop.h + $(RM) -- $(DESTDIR)$(INCLUDEDIR)/Desktop/Browser/plugin.h .PHONY: all clean distclean install uninstall diff --git a/include/Browser/plugin.h b/include/Browser/plugin.h new file mode 100644 index 0000000..73adda9 --- /dev/null +++ b/include/Browser/plugin.h @@ -0,0 +1,57 @@ +/* $Id$ */ +/* Copyright (c) 2012 Pierre Pronchery */ +/* This file is part of DeforaOS Desktop Browser */ +/* 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, version 3 of the License. + * + * 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, see . */ + + + +#ifndef DESKTOP_BROWSER_PLUGIN_H +# define DESKTOP_BROWSER_PLUGIN_H + +# include +# include +# include + + +/* Browser */ +/* public */ +/* types */ +typedef struct _Browser Browser; + +typedef struct _BrowserPlugin BrowserPlugin; + +typedef struct _BrowserPluginHelper +{ + Browser * browser; + int (*error)(Browser * browser, char const * message, int ret); + GdkPixbuf * (*get_icon)(Browser * browser, char const * filename, + char const * type, struct stat * lst, struct stat * st, + int size); + Mime * (*get_mime)(Browser * browser); + char const * (*get_type)(Browser * browser, char const * filename, + mode_t mode); + int (*set_location)(Browser * browser, char const * path); +} BrowserPluginHelper; + +typedef const struct _BrowserPluginDefinition +{ + char const * name; + char const * icon; + char const * description; + BrowserPlugin * (*init)(BrowserPluginHelper * helper); + void (*destroy)(BrowserPlugin * plugin); + GtkWidget * (*get_widget)(BrowserPlugin * plugin); + void (*refresh)(BrowserPlugin * plugin, GList * selection); +} BrowserPluginDefinition; + +#endif /* !DESKTOP_BROWSER_PLUGIN_H */ diff --git a/include/Browser/project.conf b/include/Browser/project.conf index 0b92a3e..d436b21 100644 --- a/include/Browser/project.conf +++ b/include/Browser/project.conf @@ -1,5 +1,8 @@ -includes=desktop.h +includes=desktop.h,plugin.h dist=Makefile [desktop.h] -install=$(PREFIX)/include/Desktop/Browser +install=$(INCLUDEDIR)/Desktop/Browser + +[plugin.h] +install=$(INCLUDEDIR)/Desktop/Browser diff --git a/include/Makefile b/include/Makefile index 72647da..b4760ec 100644 --- a/include/Makefile +++ b/include/Makefile @@ -21,11 +21,11 @@ distclean: install: @for i in $(SUBDIRS); do (cd $$i && $(MAKE) install) || exit; done - $(MKDIR) $(DESTDIR)$(PREFIX)/include/Desktop - $(INSTALL) -m 0644 -- Browser.h $(DESTDIR)$(PREFIX)/include/Desktop/Browser.h + $(MKDIR) $(DESTDIR)$(INCLUDEDIR)/Desktop + $(INSTALL) -m 0644 -- Browser.h $(DESTDIR)$(INCLUDEDIR)/Desktop/Browser.h uninstall: @for i in $(SUBDIRS); do (cd $$i && $(MAKE) uninstall) || exit; done - $(RM) -- $(DESTDIR)$(PREFIX)/include/Desktop/Browser.h + $(RM) -- $(DESTDIR)$(INCLUDEDIR)/Desktop/Browser.h .PHONY: all subdirs clean distclean install uninstall diff --git a/include/project.conf b/include/project.conf index 71357fc..1b8898f 100644 --- a/include/project.conf +++ b/include/project.conf @@ -3,4 +3,4 @@ includes=Browser.h dist=Makefile [Browser.h] -install=$(PREFIX)/include/Desktop +install=$(INCLUDEDIR)/Desktop