Code cleanup

This commit is contained in:
Pierre Pronchery 2012-12-06 04:06:20 +01:00
parent 5d76bb7571
commit d8839cc076
7 changed files with 74 additions and 44 deletions

View File

@ -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 \

View File

@ -18,41 +18,7 @@
#ifndef DESKTOP_BROWSER_H
# define DESKTOP_BROWSER_H
# include <sys/stat.h>
# include <gtk/gtk.h>
# include <Desktop.h>
# 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 */

View File

@ -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

57
include/Browser/plugin.h Normal file
View File

@ -0,0 +1,57 @@
/* $Id$ */
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
/* 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 <http://www.gnu.org/licenses/>. */
#ifndef DESKTOP_BROWSER_PLUGIN_H
# define DESKTOP_BROWSER_PLUGIN_H
# include <sys/stat.h>
# include <gtk/gtk.h>
# include <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;
#endif /* !DESKTOP_BROWSER_PLUGIN_H */

View File

@ -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

View File

@ -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

View File

@ -3,4 +3,4 @@ includes=Browser.h
dist=Makefile
[Browser.h]
install=$(PREFIX)/include/Desktop
install=$(INCLUDEDIR)/Desktop