Move the DesktopHandler class to a dedicated file

This commit is contained in:
Pierre Pronchery 2020-09-26 16:12:38 +02:00
parent 2cc84a81f6
commit d4f12c794f
6 changed files with 2051 additions and 1876 deletions

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@
# include <gtk/gtk.h>
# include <Desktop.h>
# include "../../include/Browser.h"
# include "Browser/desktop.h"
# include "../common.h"
@ -55,11 +55,13 @@ void desktop_delete(Desktop * desktop);
int desktop_get_drag_data(Desktop * desktop, GtkSelectionData * seldata);
GdkPixbuf * desktop_get_file(Desktop * desktop);
GdkPixbuf * desktop_get_folder(Desktop * desktop);
String const * desktop_get_home(Desktop * desktop);
void desktop_get_icon_size(Desktop * desktop, unsigned int * width,
unsigned int * height, unsigned int * size);
DesktopIcon ** desktop_get_icons_selected(Desktop * desktop);
Mime * desktop_get_mime(Desktop * desktop);
GtkIconTheme * desktop_get_theme(Desktop * desktop);
GtkWidget * desktop_get_window(Desktop * desktop);
void desktop_set_alignment(Desktop * desktop, DesktopAlignment alignment);
void desktop_set_icons(Desktop * desktop, DesktopIcons icons);
@ -68,14 +70,18 @@ int desktop_set_layout(Desktop * desktop, DesktopLayout layout);
/* useful */
int desktop_error(Desktop * desktop, char const * message, char const * error,
int ret);
int desktop_perror(Desktop * desktop, char const * message, int ret);
int desktop_serror(Desktop * desktop, char const * message, int ret);
void desktop_refresh(Desktop * desktop);
void desktop_reset(Desktop * desktop);
void desktop_icon_add(Desktop * desktop, DesktopIcon * icon);
void desktop_icon_add(Desktop * desktop, DesktopIcon * icon, gboolean align);
void desktop_icon_remove(Desktop * desktop, DesktopIcon * icon);
void desktop_cleanup(Desktop * desktop);
void desktop_icons_align(Desktop * desktop);
DesktopIcon * desktop_icons_lookup(Desktop * desktop, String const * name);
void desktop_icons_sort(Desktop * desktop);
void desktop_select_all(Desktop * desktop);
@ -83,4 +89,6 @@ void desktop_select_above(Desktop * desktop, DesktopIcon * icon);
void desktop_select_under(Desktop * desktop, DesktopIcon * icon);
void desktop_unselect_all(Desktop * desktop);
void desktop_show_preferences(Desktop * desktop);
#endif /* !BROWSER_DESKTOP_H */

View File

@ -29,6 +29,7 @@
# define BROWSER_DESKTOPICON_H
# include <gtk/gtk.h>
# include "Browser/desktop.h"
# include "../common.h"

1417
src/desktop/handler.c Normal file

File diff suppressed because it is too large Load Diff

48
src/desktop/handler.h Normal file
View File

@ -0,0 +1,48 @@
/* $Id$ */
/* Copyright (c) 2020 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Browser */
/* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
#ifndef BROWSER_DESKTOPHANDLER_H
# define BROWSER_DESKTOPHANDLER_H
# include <X11/Xlib.h>
# include "Browser/desktop.h"
/* DesktopHandler */
/* types */
/* functions */
DesktopHandler * desktophandler_new(Desktop * desktop, DesktopIcons icons);
void desktophandler_delete(DesktopHandler * handler);
/* accessors */
void desktophandler_set_icons(DesktopHandler * handler, DesktopIcons icons);
/* useful */
void desktophandler_popup(DesktopHandler * handler, XButtonEvent * xbev);
void desktophandler_refresh(DesktopHandler * handler);
#endif /* !BROWSER_DESKTOPHANDLER_H */

View File

@ -5,13 +5,13 @@ cflags_force=`pkg-config --cflags libDesktop`
cflags=-W -Wall -g -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
ldflags_force=`pkg-config --libs libDesktop` -lintl
ldflags=-pie -Wl,-z,relro -Wl,-z,now
dist=Makefile,desktop.h,desktopicon.h,desktopiconwindow.h
dist=Makefile,desktop.h,desktopicon.h,desktopiconwindow.h,handler.h
#targets
[desktop]
type=binary
depends=$(OBJDIR)../lib/libBrowser.a
sources=desktop.c,desktopicon.c,desktopiconwindow.c,main.c
sources=desktop.c,desktopicon.c,desktopiconwindow.c,handler.c,main.c
cflags=`pkg-config --cflags x11 xrandr`
ldflags=`pkg-config --libs x11 xrandr` -L$(OBJDIR)../lib -Wl,-rpath,$(LIBDIR) -lBrowser
install=$(BINDIR)
@ -36,5 +36,8 @@ cppflags=-D PREFIX=\"$(PREFIX)\"
[desktopiconwindow.c]
depends=../common.h,desktop.h,desktopicon.h,desktopiconwindow.h
[handler.c]
depends=desktop.h,desktopicon.h,desktopiconwindow.h,handler.h
[main.c]
depends=desktop.h,../../config.h