diff options
author | Simon Steinbeiss <simon.steinbeiss@elfenbeinturm.at> | 2019-04-25 00:03:18 +0200 |
---|---|---|
committer | Simon Steinbeiss <simon.steinbeiss@elfenbeinturm.at> | 2019-04-27 00:37:24 +0200 |
commit | 9c858e04d64cda8460da8909b36c02f3314a4bee (patch) | |
tree | d8e7264f09848a2a8e7599311a9ced73f285dc2c | |
parent | f5a30fa3cd88d436de4ad486fb530610a791e857 (diff) | |
download | xfce4-session-9c858e04d64cda8460da8909b36c02f3314a4bee.tar.gz |
Drop splash screens
61 files changed, 165 insertions, 5699 deletions
diff --git a/Makefile.am b/Makefile.am index 25c90ef1..abf3c5cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,6 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} SUBDIRS = \ libxfsm \ doc \ - engines \ icons \ po \ settings \ diff --git a/configure.ac.in b/configure.ac.in index 386409c1..36aa54fc 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -190,13 +190,6 @@ fi AC_CONFIG_FILES([ Makefile doc/Makefile -engines/Makefile -engines/balou/Makefile -engines/balou/scripts/Makefile -engines/balou/themes/Makefile -engines/balou/themes/Default/Makefile -engines/mice/Makefile -engines/simple/Makefile icons/Makefile icons/48x48/Makefile icons/128x128/Makefile diff --git a/engines/Makefile.am b/engines/Makefile.am deleted file mode 100644 index 4fe7b3df..00000000 --- a/engines/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -SUBDIRS = \ - balou \ - mice \ - simple diff --git a/engines/balou/Makefile.am b/engines/balou/Makefile.am deleted file mode 100644 index 1f167409..00000000 --- a/engines/balou/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -SUBDIRS = \ - scripts \ - themes - -baloudir = $(libdir)/xfce4/session/splash-engines - -balou_LTLIBRARIES = libbalou.la - -libbalou_la_SOURCES = \ - balou-theme.c \ - balou-theme.h \ - balou.c \ - balou.h \ - config.c \ - engine.c \ - gnome-uri.c \ - gnome-uri.h - -libbalou_la_CFLAGS = \ - -I$(top_srcdir) \ - $(LIBXFCE4UI_CFLAGS) \ - $(XFCONF_CFLAGS) \ - $(LIBX11_CFLAGS) \ - -DBALOU_EXPORT_THEME=\"$(HELPER_PATH_PREFIX)/xfce4/session/balou-export-theme\" \ - -DBALOU_INSTALL_THEME=\"$(HELPER_PATH_PREFIX)/xfce4/session/balou-install-theme\" - -libbalou_la_LDFLAGS = \ - -avoid-version \ - -no-undefined \ - -module - -libbalou_la_LIBADD = \ - $(top_builddir)/libxfsm/libxfsm-4.6.la \ - $(LIBXFCE4UI_LIBS) \ - $(XFCONF_LIBS) \ - $(LIBX11_LDFLAGS) \ - $(LIBX11_LIBS) \ - $(LIBM) - - -libbalou_la_DEPENDENCIES = \ - $(top_builddir)/libxfsm/libxfsm-4.6.la diff --git a/engines/balou/TODO b/engines/balou/TODO deleted file mode 100644 index ad357f4d..00000000 --- a/engines/balou/TODO +++ /dev/null @@ -1,21 +0,0 @@ -- Zum zwischenspeichern von Previews nicht mehr PNG verwenden, sondern - pixdata serialisieren!!! siehe gdk_pixbuf -> gdk_pixdata, geht deutlich - schneller - -- Dazu zwei funktionen in libxfcegui4 einbauen: - - gboolean xfce_gdk_pixbuf_serialize (GdkPixbuf *pixbuf, - const gchar *path, - GError **error); - - GdkPixbuf *xfce_gdk_pixbuf_deserialize (const gchar *path, - GError **error); - - wobei die deserialize zur Optimierung zunächst versucht die Datei - zu mmap'en und dann auf open() umschwenkt. serialize verwendet nur - open(), write(), close(), rename() für Atomic-Writing! - - -- Man könnte zur Optimierung versuchen, statt jedem Fenster ein Pixmap - als Backbuf zu geben, einen Pixbuf nehmen, der bei Expose neu gezeichnet - wird. (Das Gradient Füllen könnte MMX optimiert werden) diff --git a/engines/balou/balou-theme.c b/engines/balou/balou-theme.c deleted file mode 100644 index 9070d462..00000000 --- a/engines/balou/balou-theme.c +++ /dev/null @@ -1,523 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - -#include <math.h> -#ifdef HAVE_MEMORY_H -#include <memory.h> -#endif -#ifdef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_TIME_H -#include <time.h> -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -#include <libxfce4util/libxfce4util.h> - -#include <engines/balou/balou-theme.h> - - -static void load_color_pair (const XfceRc *rc, - const gchar *name, - GdkRGBA *color1_return, - GdkRGBA *color2_return, - const gchar *color_default); -static GdkPixbuf *load_pixbuf (const gchar *path, - gint available_width, - gint available_height); -static time_t mtime (const gchar *path); -static GdkPixbuf *load_cached_preview (const BalouTheme *theme); -static void store_cached_preview (const BalouTheme *theme, - GdkPixbuf *pixbuf); - - -struct _BalouTheme -{ - GdkRGBA bgcolor1; - GdkRGBA bgcolor2; - GdkRGBA fgcolor; - gchar *name; - gchar *description; - gchar *font; - gchar *theme_file; - gchar *logo_file; -}; - - -#define DEFAULT_BGCOLOR "White" -#define DEFAULT_FGCOLOR "Black" -#define DEFAULT_FONT "Sans Bold 12" - - -BalouTheme* -balou_theme_load (const gchar *name) -{ - BalouTheme *theme; - const gchar *image_file; - const gchar *spec; - gchar *resource; - gchar *file; - XfceRc *rc; - - theme = g_new0 (BalouTheme, 1); - - resource = g_strdup_printf ("%s/balou/themerc", name); - file = xfce_resource_lookup (XFCE_RESOURCE_THEMES, resource); - g_free (resource); - - if (file != NULL) - { - rc = xfce_rc_simple_open (file, TRUE); - if (rc == NULL) - { - g_free (file); - goto set_defaults; - } - - theme->theme_file = g_strdup (file); - - xfce_rc_set_group (rc, "Info"); - theme->name = g_strdup (xfce_rc_read_entry (rc, "Name", name)); - theme->description = g_strdup (xfce_rc_read_entry (rc, "Description", _("No description given"))); - - xfce_rc_set_group (rc, "Splash Screen"); - load_color_pair (rc, "bgcolor", &theme->bgcolor1, &theme->bgcolor2, - DEFAULT_BGCOLOR); - - spec = xfce_rc_read_entry (rc, "fgcolor", DEFAULT_FGCOLOR); - if (!gdk_rgba_parse (&theme->fgcolor, spec)) - gdk_rgba_parse (&theme->fgcolor, DEFAULT_FGCOLOR); - - spec = xfce_rc_read_entry (rc, "font", DEFAULT_FONT); - theme->font = g_strdup (spec); - - image_file = xfce_rc_read_entry (rc, "logo", NULL); - if (image_file != NULL) - { - resource = g_path_get_dirname (file); - theme->logo_file = g_build_filename (resource, image_file, NULL); - g_free (resource); - } - else - { - theme->logo_file = NULL; - } - - xfce_rc_close (rc); - g_free (file); - - return theme; - } - -set_defaults: - gdk_rgba_parse (&theme->bgcolor1, DEFAULT_BGCOLOR); - gdk_rgba_parse (&theme->bgcolor2, DEFAULT_BGCOLOR); - gdk_rgba_parse (&theme->fgcolor, DEFAULT_FGCOLOR); - theme->font = g_strdup (DEFAULT_FONT); - theme->logo_file = NULL; - - return theme; -} - - -const gchar* -balou_theme_get_name (const BalouTheme *theme) -{ - return theme->name; -} - - -const gchar* -balou_theme_get_description (const BalouTheme *theme) -{ - return theme->description; -} - - -const gchar* -balou_theme_get_font (const BalouTheme *theme) -{ - return theme->font; -} - - -void -balou_theme_get_bgcolor (const BalouTheme *theme, - GdkRGBA *color_return) -{ - *color_return = theme->bgcolor1; -} - - -void -balou_theme_get_fgcolor (const BalouTheme *theme, - GdkRGBA *color_return) -{ - *color_return = theme->fgcolor; -} - - -GdkPixbuf* -balou_theme_get_logo (const BalouTheme *theme, - gint available_width, - gint available_height) -{ - return load_pixbuf (theme->logo_file, - available_width, - available_height); -} - - - -void -balou_theme_draw_gradient (const BalouTheme *theme, - cairo_t *cr, - GdkRectangle logobox, - GdkRectangle textbox) -{ - GdkRGBA color; - gint dred; - gint dgreen; - gint dblue; - gint i; - - if (gdk_rgba_equal (&theme->bgcolor1, &theme->bgcolor2)) - { - gdk_cairo_set_source_rgba (cr, &theme->bgcolor1); - - gdk_cairo_rectangle (cr, &logobox); - cairo_fill (cr); - - gdk_cairo_rectangle (cr, &textbox); - cairo_fill (cr); - } - else - { - /* calculate differences */ - dred = theme->bgcolor1.red - theme->bgcolor2.red; - dgreen = theme->bgcolor1.green - theme->bgcolor2.green; - dblue = theme->bgcolor1.blue - theme->bgcolor2.blue; - - for (i = 0; i < logobox.height; ++i) - { - color.red = theme->bgcolor2.red + (i * dred / logobox.height); - color.green = theme->bgcolor2.green + (i * dgreen / logobox.height); - color.blue = theme->bgcolor2.blue + (i * dblue / logobox.height); - - gdk_cairo_set_source_rgba (cr, &color); - cairo_move_to(cr, logobox.x, logobox.y + i); - cairo_line_to(cr, logobox.x + logobox.width, logobox.y + i); - cairo_stroke(cr); - } - - if (textbox.width != 0 && textbox.height != 0) - { - gdk_cairo_set_source_rgba (cr, &theme->bgcolor1); - gdk_cairo_rectangle (cr, &textbox); - cairo_fill(cr); - } - } -} - - -GdkPixbuf* -balou_theme_generate_preview (const BalouTheme *theme, - gint width, - gint height) -{ -#define WIDTH 320 -#define HEIGHT 240 - - GdkRectangle logobox; - GdkRectangle textbox; - GdkPixbuf *pixbuf; - GdkPixbuf *scaled; - GdkWindow *root; - cairo_surface_t *surface; - cairo_t *cr; - gint pw, ph; - - /* check for a cached preview first */ - pixbuf = load_cached_preview (theme); - if (pixbuf != NULL) - { - pw = gdk_pixbuf_get_width (pixbuf); - ph = gdk_pixbuf_get_height (pixbuf); - - if (pw == width && ph == height) - { - return pixbuf; - } - else if (pw >= width && ph >= height) - { - scaled = gdk_pixbuf_scale_simple (pixbuf, width, height, - GDK_INTERP_BILINEAR); - g_object_unref (pixbuf); - return scaled; - } - - g_object_unref (pixbuf); - } - - root = gdk_screen_get_root_window (gdk_screen_get_default ()); - surface = gdk_window_create_similar_surface (root, - CAIRO_CONTENT_COLOR_ALPHA, - gdk_window_get_width (root), - gdk_window_get_height (root)); - cr = cairo_create(surface); - - logobox.x = 0; - logobox.y = 0; - logobox.width = WIDTH; - logobox.height = HEIGHT; - textbox.x = 0; - textbox.y = 0; - balou_theme_draw_gradient (theme, cr, logobox, textbox); - - pixbuf = balou_theme_get_logo (theme, WIDTH, HEIGHT); - if (pixbuf != NULL) - { - pw = gdk_pixbuf_get_width (pixbuf); - ph = gdk_pixbuf_get_height (pixbuf); - - gdk_cairo_set_source_pixbuf (cr, pixbuf, (WIDTH - pw) / 2, (HEIGHT - ph) / 2); - cairo_paint (cr); - - g_object_unref (G_OBJECT (pixbuf)); - } - - cairo_surface_flush (surface); - - pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, WIDTH, HEIGHT); - scaled = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR); - - g_object_unref (pixbuf); - cairo_destroy(cr); - cairo_surface_destroy (surface); - - /* store preview */ - store_cached_preview (theme, scaled); - - return scaled; - -#undef WIDTH -#undef HEIGHT -} - - -void -balou_theme_destroy (BalouTheme *theme) -{ - if (theme->name != NULL) - g_free (theme->name); - if (theme->description != NULL) - g_free (theme->description); - if (theme->theme_file != NULL) - g_free (theme->theme_file); - if (theme->logo_file != NULL) - g_free (theme->logo_file); - g_free (theme); -} - - - -static void -load_color_pair (const XfceRc *rc, - const gchar *name, - GdkRGBA *color1_return, - GdkRGBA *color2_return, - const gchar *color_default) -{ - const gchar *spec; - gchar **s; - - spec = xfce_rc_read_entry (rc, name, color_default); - if (spec == NULL) - { - gdk_rgba_parse (color1_return, color_default); - gdk_rgba_parse (color2_return, color_default); - } - else - { - s = g_strsplit (spec, ":", 2); - - if (s[0] == NULL) - { - gdk_rgba_parse (color1_return, color_default); - gdk_rgba_parse (color2_return, color_default); - } - else if (s[1] == NULL) - { - if (!gdk_rgba_parse (color1_return, s[0])) - gdk_rgba_parse (color1_return, color_default); - *color2_return = *color1_return; - } - else - { - if (!gdk_rgba_parse (color2_return, s[0])) - gdk_rgba_parse (color2_return, color_default); - if (!gdk_rgba_parse (color1_return, s[1])) - *color1_return = *color2_return; - } - - g_strfreev (s); - } -} - - -static GdkPixbuf* -load_pixbuf (const gchar *path, - gint available_width, - gint available_height) -{ - static char *suffixes[] = { "svg", "png", "jpeg", "jpg", "xpm", NULL }; - GdkPixbuf *scaled; - GdkPixbuf *pb = NULL; - gint pb_width; - gint pb_height; - gdouble wratio; - gdouble hratio; - gchar *file; - guint n; - - if (G_UNLIKELY (path == NULL)) - return NULL; - - pb = gdk_pixbuf_new_from_file (path, NULL); - if (G_UNLIKELY (pb == NULL)) - { - for (n = 0; pb == NULL && suffixes[n] != NULL; ++n) - { - file = g_strdup_printf ("%s.%s", path, suffixes[n]); - pb = gdk_pixbuf_new_from_file (file, NULL); - g_free (file); - } - } - - if (G_UNLIKELY (pb == NULL)) - return NULL; - - pb_width = gdk_pixbuf_get_width (pb); - pb_height = gdk_pixbuf_get_height (pb); - - if (pb_width > available_width || pb_height > available_height) - { - wratio = (gdouble) pb_width / (gdouble) available_width; - hratio = (gdouble) pb_height / (gdouble) available_height; - - if (hratio > wratio) - { - pb_width = rint (pb_width / hratio); - pb_height = available_height; - } - else - { - pb_width = available_width; - pb_height = rint (pb_height / wratio); - } - - scaled = gdk_pixbuf_scale_simple (pb, - pb_width, - pb_height, - GDK_INTERP_BILINEAR); - g_object_unref (pb); - pb = scaled; - } - - return pb; -} - - -static time_t -mtime (const gchar *path) -{ - struct stat sb; - - if (path == NULL || stat (path, &sb) < 0) - return (time_t) 0; - - return sb.st_mtime; -} - - -static GdkPixbuf* -load_cached_preview (const BalouTheme *theme) -{ - GdkPixbuf *pixbuf; - gchar *resource; - gchar *preview; - - resource = g_strconcat ("splash-theme-preview-", theme->name, ".png", NULL); - preview = xfce_resource_lookup (XFCE_RESOURCE_CACHE, resource); - g_free (resource); - - if (preview == NULL) - return NULL; - - if ((mtime (preview) < mtime (theme->theme_file)) - || (theme->logo_file != NULL - && (mtime (preview) < mtime (theme->logo_file)))) - { - /* preview is outdated, need to regenerate preview */ - unlink (preview); - g_free (preview); - - return NULL; - } - - pixbuf = gdk_pixbuf_new_from_file (preview, NULL); - g_free (preview); - - return pixbuf; -} - - -static void -store_cached_preview (const BalouTheme *theme, - GdkPixbuf *pixbuf) -{ - gchar *resource; - gchar *preview; - - resource = g_strconcat ("splash-theme-preview-", theme->name, ".png", NULL); - preview = xfce_resource_save_location (XFCE_RESOURCE_CACHE, resource, TRUE); - g_free (resource); - - if (preview != NULL) - { - gdk_pixbuf_save (pixbuf, preview, "png", NULL, NULL); - g_free (preview); - } -} - - - diff --git a/engines/balou/balou-theme.h b/engines/balou/balou-theme.h deleted file mode 100644 index 2cd5dcab..00000000 --- a/engines/balou/balou-theme.h +++ /dev/null @@ -1,56 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifndef __BALOU_THEME_H__ -#define __BALOU_THEME_H__ - -#include <gdk/gdk.h> - - -G_BEGIN_DECLS; - -typedef struct _BalouTheme BalouTheme; - - -BalouTheme *balou_theme_load (const gchar *name); -const gchar *balou_theme_get_name (const BalouTheme *theme); -const gchar *balou_theme_get_description (const BalouTheme *theme); -const gchar *balou_theme_get_font (const BalouTheme *theme); -void balou_theme_get_bgcolor (const BalouTheme *theme, - GdkRGBA *color_return); -void balou_theme_get_fgcolor (const BalouTheme *theme, - GdkRGBA *color_return); -GdkPixbuf *balou_theme_get_logo (const BalouTheme *theme, - gint available_width, - gint available_height); -void balou_theme_draw_gradient (const BalouTheme *theme, - cairo_t *cr, - GdkRectangle logobox, - GdkRectangle textbox); -GdkPixbuf *balou_theme_generate_preview (const BalouTheme *theme, - gint width, - gint height); -void balou_theme_destroy (BalouTheme *theme); - -G_END_DECLS; - - -#endif /* !__BALOU_THEME_H__ */ diff --git a/engines/balou/balou.c b/engines/balou/balou.c deleted file mode 100644 index 4a43c7a3..00000000 --- a/engines/balou/balou.c +++ /dev/null @@ -1,395 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <X11/Xlib.h> -#include <gdk/gdkx.h> - -#include <engines/balou/balou.h> - - -#define BALOU_INCREMENT 2 - - - - -static void balou_window_init (BalouWindow *window, - GdkScreen *screen, - int monitor, - GdkWindow *root, - GdkCursor *cursor); -static void balou_window_destroy (BalouWindow *window); - -static GdkFilterReturn balou_window_filter (GdkXEvent *xevent, - GdkEvent *event, - gpointer data); - - -struct _BalouWindow -{ - GdkWindow *window; - PangoLayout *layout; - GdkRectangle area; - GdkRectangle logobox; - GdkRectangle textbox; - - GtkWidget *wmwindow; - - gboolean dialog_active; -}; - - - -void -balou_init (Balou *balou, - GdkDisplay *display, - GdkScreen *mainscreen, - gint mainmonitor, - BalouTheme *theme) -{ - PangoFontDescription *description; - PangoFontMetrics *metrics; - PangoContext *context; - PangoLayout *layout; - BalouWindow *window; - GdkCursor *cursor; - GdkScreen *screen; - GdkWindow *root; - GdkPixbuf *pb; - cairo_t *cr; - gint layout_height; - gint nmonitors; - gint i; - gint m; - gint px; - gint py; - gint pw; - gint ph; - gint ww; - gint wh; - - balou->theme = theme; - - balou_theme_get_bgcolor (theme, &balou->bgcolor); - balou_theme_get_fgcolor (theme, &balou->fgcolor); - - cursor = gdk_cursor_new_for_display (display, GDK_WATCH); - description = pango_font_description_from_string (balou_theme_get_font (theme)); - - /* determine number of required windows */ - screen = gdk_display_get_default_screen (display); - nmonitors = gdk_screen_get_n_monitors (screen); - for (m = 0; m < nmonitors; ++m) - balou->nwindows++; - - /* create windows */ - balou->windows = g_new (BalouWindow, balou->nwindows); - screen = gdk_display_get_default_screen (display); - nmonitors = gdk_screen_get_n_monitors (screen); - root = gdk_screen_get_root_window (screen); - - /* create pango layout for this screen */ - context = gdk_pango_context_get_for_screen (screen); - pango_context_set_font_description (context, description); - layout = pango_layout_new (context); - metrics = pango_context_get_metrics (context, description, NULL); - layout_height = (pango_font_metrics_get_ascent (metrics) - + pango_font_metrics_get_descent (metrics)) / PANGO_SCALE - + 3; - pango_font_metrics_unref (metrics); - - for (m = 0; m < nmonitors; ++m) - { - cairo_t *window_cr; - window = balou->windows + m; - balou_window_init (window, screen, m, root, cursor); - - window->layout = PANGO_LAYOUT (g_object_ref (layout)); - - /* calculate box dimensions */ - window->logobox = window->area; - window->logobox.x = 0; - window->logobox.height -= layout_height; - window->textbox = window->area; - window->textbox.x = 0; - window->textbox.y += window->logobox.height; - window->textbox.height -= window->logobox.height; - - window_cr = gdk_cairo_create (window->window); - - balou_theme_draw_gradient (balou->theme, - window_cr, - window->logobox, - window->textbox); - - cairo_destroy (window_cr); - - if (mainscreen == screen && mainmonitor == m) - balou->mainwin = window; - } - - g_object_unref (context); - g_object_unref (layout); - - /* show splash windows */ - for (i = 0; i < balou->nwindows; ++i) - { - window = balou->windows + i; - - gtk_widget_show_now (window->wmwindow); - - gdk_window_add_filter (gtk_widget_get_window (window->wmwindow), - balou_window_filter, - window); - - gdk_window_show (window->window); - gdk_window_add_filter (window->window, - balou_window_filter, - window); - } - gdk_flush (); - - /* draw the background and display logo pixbuf (if any) */ - window = balou->mainwin; - - cr = gdk_cairo_create (window->window); - - ww = gdk_window_get_width (GDK_WINDOW (window->window)); - wh = gdk_window_get_height (GDK_WINDOW (window->window)); - - gdk_cairo_set_source_rgba (cr, &balou->bgcolor); - cairo_rectangle (cr, 0, 0, ww, wh); - cairo_fill (cr); - - pb = balou_theme_get_logo (balou->theme, - window->logobox.width, - window->logobox.height); - if (G_LIKELY (pb != NULL)) - { - pw = gdk_pixbuf_get_width (pb); - ph = gdk_pixbuf_get_height (pb); - px = (window->logobox.width - pw) / 2; - py = (window->logobox.height - ph) / 2; - - gdk_cairo_set_source_pixbuf (cr, pb, px, py); - cairo_paint (cr); - - g_object_unref (pb); - cairo_destroy (cr); - } - - pango_font_description_free (description); - g_object_unref (cursor); -} - - -void -balou_fadein (Balou *balou, const gchar *text) -{ - BalouWindow *window = balou->mainwin; - GdkRectangle area; - cairo_t *cr; - GdkPixbuf *pb; - gint median; - gint th; - gint tw; - gint x; - gint ww; - gint wh; - - pango_layout_set_text (window->layout, text, -1); - pango_layout_get_pixel_size (window->layout, &tw, &th); - - area.x = window->textbox.x + BALOU_INCREMENT; - area.y = window->textbox.y + (window->textbox.height - th) / 2; - area.width = tw + BALOU_INCREMENT; - area.height = th; - - ww = gdk_window_get_width (GDK_WINDOW (window->window)); - wh = gdk_window_get_height (GDK_WINDOW (window->window)); - - cr = gdk_cairo_create (window->window); - - gdk_cairo_set_source_rgba (cr, &balou->bgcolor); - cairo_rectangle (cr, 0, 0, ww, wh); - cairo_fill (cr); - - pb = balou_theme_get_logo (balou->theme, - window->logobox.width, - window->logobox.height); - if (G_LIKELY (pb != NULL)) - { - gint pw = gdk_pixbuf_get_width (pb); - gint ph = gdk_pixbuf_get_height (pb); - gint px = (window->logobox.width - pw) / 2; - gint py = (window->logobox.height - ph) / 2; - - gdk_cairo_set_source_pixbuf (cr, pb, px, py); - cairo_paint (cr); - - g_object_unref (pb); - } - - median = (window->area.width - area.width) / 2; - for (x = 0; (median - x) > BALOU_INCREMENT; x += BALOU_INCREMENT) - { - gdk_cairo_set_source_rgba (cr, &balou->bgcolor); - gdk_cairo_rectangle (cr, &window->textbox); - cairo_fill (cr); - - gdk_cairo_set_source_rgba (cr, &balou->fgcolor); - cairo_move_to (cr, x, window->textbox.y); - pango_cairo_show_layout (cr, window->layout); - - gdk_flush (); - - g_main_context_iteration (NULL, FALSE); - } - - area.x += median; - balou->fader_area = area; - - cairo_destroy (cr); -} - - - -int -balou_run (Balou *balou, - GtkWidget *dialog) -{ - GtkRequisition requisition; - BalouWindow *window = balou->mainwin; - int result; - int x; - int y; - - window->dialog_active = TRUE; - - gtk_widget_get_preferred_size (dialog, NULL, &requisition); - x = window->area.x + (window->area.width - requisition.width) / 2; - y = window->area.y + (window->area.height - requisition.height) / 2; - gtk_window_move (GTK_WINDOW (dialog), x, y); - result = gtk_dialog_run (GTK_DIALOG (dialog)); - - window->dialog_active = FALSE; - - return result; -} - - -void -balou_destroy (Balou *balou) -{ - gint i; - - balou_theme_destroy (balou->theme); - - for (i = 0; i < balou->nwindows; ++i) - balou_window_destroy (balou->windows + i); - g_free (balou->windows); -} - - -static void -balou_window_init (BalouWindow *window, - GdkScreen *screen, - int monitor, - GdkWindow *root, - GdkCursor *cursor) -{ - GdkWindowAttr attr; - - /* acquire monitor geometry */ - gdk_screen_get_monitor_geometry (screen, monitor, &window->area); - - /* create splash window */ - attr.x = window->area.x; - attr.y = window->area.y; - attr.event_mask = GDK_VISIBILITY_NOTIFY_MASK; - attr.width = window->area.width; - attr.height = window->area.height; - attr.wclass = GDK_INPUT_OUTPUT; - attr.window_type = GDK_WINDOW_TEMP; - attr.cursor = cursor; - attr.override_redirect = TRUE; - - window->window = gdk_window_new (root, &attr, GDK_WA_X | GDK_WA_Y - | GDK_WA_CURSOR | GDK_WA_NOREDIR); - - /* create wm window (for tricking the window manager to avoid flicker) */ - window->wmwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_move (GTK_WINDOW (window->wmwindow), 0, 0); - gtk_window_resize (GTK_WINDOW (window->wmwindow), 1, 1); - gtk_window_set_decorated (GTK_WINDOW (window->wmwindow), FALSE); - gtk_window_set_screen (GTK_WINDOW (window->wmwindow), screen); - gtk_window_set_skip_pager_hint (GTK_WINDOW (window->wmwindow), TRUE); - gtk_window_set_skip_taskbar_hint (GTK_WINDOW (window->wmwindow), TRUE); -} - - -static void -balou_window_destroy (BalouWindow *window) -{ - gdk_window_remove_filter (window->window, balou_window_filter, window); - if (gtk_widget_get_realized (window->wmwindow)) - { - gdk_window_remove_filter (gtk_widget_get_window(window->wmwindow), - balou_window_filter, - window); - } - - gdk_window_destroy (window->window); - gtk_widget_destroy (window->wmwindow); - g_object_unref (window->layout); -} - - - -static GdkFilterReturn -balou_window_filter (GdkXEvent *xevent, - GdkEvent *event, - gpointer data) -{ - XVisibilityEvent *xvisev = (XVisibilityEvent *) xevent; - BalouWindow *window = (BalouWindow *) data; - - if (!window->dialog_active) - { - switch (xvisev->type) - { - case VisibilityNotify: - /* something obscured the splash window */ - gdk_window_raise (window->window); - return GDK_FILTER_REMOVE; - - case ReparentNotify: - /* window manager is up */ - gdk_window_raise (window->window); - break; - } - } - - return GDK_FILTER_CONTINUE; -} diff --git a/engines/balou/balou.h b/engines/balou/balou.h deleted file mode 100644 index 1f96af25..00000000 --- a/engines/balou/balou.h +++ /dev/null @@ -1,67 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifndef __BALOU_H__ -#define __BALOU_H__ - -#include <gtk/gtk.h> - -#include <engines/balou/balou-theme.h> - - -G_BEGIN_DECLS; - -#define BALOU(obj) ((Balou *)(obj)) - -typedef struct _BalouWindow BalouWindow; -typedef struct _Balou Balou; - - -struct _Balou -{ - GdkRGBA bgcolor; - GdkRGBA fgcolor; - - BalouTheme *theme; - - BalouWindow *mainwin; - BalouWindow *windows; - gint nwindows; - - GdkRectangle fader_area; -}; - - -void balou_init (Balou *balou, - GdkDisplay *display, - GdkScreen *mainscreen, - gint mainmonitor, - BalouTheme *theme); -void balou_fadein (Balou *balou, - const gchar *text); -int balou_run (Balou *balou, - GtkWidget *dialog); -void balou_destroy (Balou *balou); - -G_END_DECLS; - - -#endif /* !__BALOU_H__ */ diff --git a/engines/balou/config.c b/engines/balou/config.c deleted file mode 100644 index 6bf4d945..00000000 --- a/engines/balou/config.c +++ /dev/null @@ -1,1000 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2006 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifdef HAVE_MEMORY_H -#include <memory.h> -#endif -#ifdef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -#ifdef XFCE_DISABLE_DEPRECATED -#undef XFCE_DISABLE_DEPRECATED -#endif - -#include <gmodule.h> - -#include <libxfce4ui/libxfce4ui.h> - -#include <libxfsm/xfsm-splash-engine.h> - -#include <engines/balou/balou-theme.h> -#include <engines/balou/gnome-uri.h> - - -#define BORDER 6 - - -enum -{ - TARGET_RAW_DATA, - TARGET_XDS, - TARGET_URI, - TARGET_STRING, -}; - - -enum -{ - PREVIEW_COLUMN, - TITLE_COLUMN, - NAME_COLUMN, - N_COLUMNS, -}; - - -G_MODULE_EXPORT void config_init (XfsmSplashConfig *config); - - -static GtkTargetEntry dst_targets[] = -{ - { "text/uri-list", 0, TARGET_URI }, - { "STRING", 0, TARGET_STRING }, -}; -static gsize dst_ntargets = sizeof (dst_targets) / sizeof (*dst_targets); - -static GtkTargetEntry src_targets[] = -{ - { "XdndDirectSave0", 0, TARGET_XDS }, -}; -static gsize src_ntargets = sizeof (src_targets) / sizeof (*src_targets); - - -static gboolean -config_load_theme_for_iter (GtkListStore *store, - GtkTreeIter *iter, - const gchar *name) -{ - BalouTheme *theme; - GdkPixbuf *preview; - gchar title[128]; - - theme = balou_theme_load (name); - if (G_UNLIKELY (theme == NULL)) - return FALSE; - - g_snprintf (title, 128, "<b>%s</b>\n<small><i>%s</i></small>", - balou_theme_get_name (theme), - balou_theme_get_description (theme)); - preview = balou_theme_generate_preview (theme, 52, 43); - - gtk_list_store_set (store, iter, - PREVIEW_COLUMN, preview, - TITLE_COLUMN, title, - NAME_COLUMN, name, - -1); - - balou_theme_destroy (theme); - g_object_unref (preview); - - return TRUE; -} - - -static GtkTreeModel* -config_load_themelist (void) -{ - GtkListStore *store; - GtkTreeIter iter; - gchar **themes; - gchar *name; - gchar *endp; - guint n; - - store = gtk_list_store_new (N_COLUMNS, - GDK_TYPE_PIXBUF, - G_TYPE_STRING, - G_TYPE_STRING); - - themes = xfce_resource_match (XFCE_RESOURCE_THEMES, "*/balou/themerc", TRUE); - if (G_LIKELY (themes != NULL)) - { - for (n = 0; themes[n] != NULL; ++n) - { - name = themes[n]; - endp = strchr (name, '/'); - - if (G_UNLIKELY (endp == NULL)) - continue; - else - *endp = '\0'; - - gtk_list_store_append (store, &iter); - if (!config_load_theme_for_iter (store, &iter, name)) - gtk_list_store_remove (store, &iter); - } - - g_strfreev (themes); - } - - return GTK_TREE_MODEL (store); -} - - -static gboolean -config_find_theme (const gchar *theme_name, - GtkTreeView *treeview, - GtkTreeIter *iter) -{ - GtkTreeModel *model; - gboolean match; - gchar *name; - - model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); - - if (gtk_tree_model_get_iter_first (model, iter)) - { - do - { - gtk_tree_model_get (model, iter, NAME_COLUMN, &name, -1); - match = (strcmp (name, theme_name) == 0); - g_free (name); - - if (match) - return TRUE; - } - while (gtk_tree_model_iter_next (model, iter)); - } - - return FALSE; -} - - -static void -config_select_theme (const gchar *selected_theme, - GtkTreeView *treeview) -{ - GtkTreeSelection *selection; - GtkTreeModel *model; - GtkTreeIter iter; - - selection = gtk_tree_view_get_selection (treeview); - model = gtk_tree_view_get_model (treeview); - - if (config_find_theme (selected_theme, treeview, &iter)) - gtk_tree_selection_select_iter (selection, &iter); - else if (gtk_tree_model_get_iter_first (model, &iter)) - gtk_tree_selection_select_iter (selection, &iter); -} - - -static gboolean -config_reload_theme (const gchar *name, - GtkTreeView *treeview) -{ - GtkListStore *store; - GtkTreeIter iter; - - store = GTK_LIST_STORE (gtk_tree_view_get_model (treeview)); - - if (!config_find_theme (name, treeview, &iter)) - gtk_list_store_append (store, &iter); - - if (!config_load_theme_for_iter (store, &iter, name)) - { - gtk_list_store_remove (store, &iter); - return FALSE; - } - - config_select_theme (name, treeview); - - return TRUE; -} - - -static gboolean -config_do_install_theme (const gchar *path, - GtkTreeView *treeview) -{ - gchar *standard_output; - gchar *standard_error; - gint exit_status; - gboolean result; - gchar *target; - gchar *argv[4]; - - g_return_val_if_fail (path != NULL, FALSE); - - target = xfce_resource_save_location (XFCE_RESOURCE_THEMES, NULL, TRUE); - if (G_UNLIKELY (target == NULL)) - { - g_warning ("Unable to determine save location for themes."); - return FALSE; - } - - argv[0] = BALOU_INSTALL_THEME; - argv[1] = (gchar *) path; - argv[2] = target; - argv[3] = NULL; - - result = g_spawn_sync (NULL, argv, NULL, 0, NULL, NULL, - &standard_output, &standard_error, - &exit_status, NULL); - - g_free (target); - - if (G_UNLIKELY (!result)) - { - g_warning ("Unable to execute %s", BALOU_INSTALL_THEME); - return FALSE; - } - - g_strstrip (standard_output); - g_strstrip (standard_error); - - if (G_UNLIKELY (exit_status != 0)) - { - g_warning ("%s failed: %s", BALOU_INSTALL_THEME, standard_error); - g_free (standard_output); - g_free (standard_error); - return FALSE; - } - - result = config_reload_theme (standard_output, treeview); - - g_free (standard_output); - g_free (standard_error); - return result; -} - - -static void -config_dropped (GtkWidget *treeview, GdkDragContext *context, - gint x, gint y, GtkSelectionData *data, - guint info, guint time_, gpointer user_data) -{ - gboolean succeed = FALSE; - GList *fnames; - - fnames = gnome_uri_list_extract_filenames ((const gchar *) gtk_selection_data_get_data(data)); - if (fnames != NULL) - { - if (g_list_length (fnames) == 1) - { - succeed = TRUE; - - if (!config_do_install_theme ((const gchar *) fnames->data, - GTK_TREE_VIEW (treeview))) - succeed = FALSE; - } - - gnome_uri_list_free_strings (fnames); - } - - gtk_drag_finish (context, succeed, FALSE, time_); -} - - -static void -config_install_theme (GtkWidget *item, - GtkWidget *menu) -{ - GtkTreeView *treeview; - GtkWidget *toplevel; - GtkWidget *chooser; - gchar *file; - - treeview = GTK_TREE_VIEW (g_object_get_data (G_OBJECT (menu), "tree-view")); - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (treeview)); - chooser = gtk_file_chooser_dialog_new (_("Choose theme file to install..."), - GTK_WINDOW (toplevel), - GTK_FILE_CHOOSER_ACTION_OPEN, - _("_Cancel"), GTK_RESPONSE_CANCEL, - _("_Open"), GTK_RESPONSE_OK, - NULL); - if (gtk_dialog_run (GTK_DIALOG (chooser)) == GTK_RESPONSE_OK) - { - file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser)); - - if (!config_do_install_theme (file, treeview)) - { - gchar *primary = g_strdup_printf (_("Unable to install splash theme from file \"%s\""), - file); - xfce_message_dialog (GTK_WINDOW (toplevel), - _("Theme File Error"), - "dialog-error", - primary, - _("Please check that the file is a valid splash " - "theme archive."), - XFCE_BUTTON_TYPE_MIXED, "window-close", _("_Close"), GTK_RESPONSE_ACCEPT, - NULL); - g_free (primary); - } - - g_free (file); - } - - gtk_widget_destroy (chooser); -} - - -#ifdef RM_CMD -static void -config_remove_theme (GtkWidget *item, - GtkWidget *menu) -{ - GtkTreeModel *model; - GtkTreeView *treeview; - GtkTreeIter *iter; - gboolean result; - gchar *directory; - gchar *resource; - gchar *name; - gchar* argv[4]; - gint status; - GError *error = NULL; - gchar *error_msg = NULL; - - iter = (GtkTreeIter *) g_object_get_data (G_OBJECT (menu), "iter"); - if (G_UNLIKELY (iter == NULL)) - return; - - treeview = GTK_TREE_VIEW (g_object_get_data (G_OBJECT (menu), "tree-view")); - - model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); - - gtk_tree_model_get (model, iter, NAME_COLUMN, &name, -1); - if (G_UNLIKELY (name == NULL)) - return; - - resource = g_strconcat (name, "/balou/", NULL); - directory = xfce_resource_lookup (XFCE_RESOURCE_THEMES, resource); - g_free (resource); - - argv[0] = RM_CMD; - argv[1] = "-rf"; - argv[2] = directory; - argv[3] = NULL; - - result = g_spawn_sync (NULL, argv, NULL, 0, NULL, NULL, - NULL, &error_msg, &status, NULL); - - if (!result || status != 0) - { - if (!error && error_msg) - g_set_error_literal (&error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, error_msg); - - xfce_dialog_show_error (NULL, error, - _("Unable to remove splash theme \"%s\" from directory %s."), - name, directory); - if (error) - g_error_free (error); - } - else - { - gtk_list_store_remove (GTK_LIST_STORE (model), iter); - } - - g_free (directory); - g_free (name); - g_free (error_msg); -} -#endif - - -static gboolean -config_do_export_theme (const gchar *name, - const gchar *file) -{ - gboolean result; - gchar *standard_error; - gchar *resource; - gchar *themerc; - gchar *argv[4]; - gint status; - - resource = g_strconcat (name, "/balou/themerc", NULL); - themerc = xfce_resource_lookup (XFCE_RESOURCE_THEMES, resource); - g_free (resource); - - argv[0] = BALOU_EXPORT_THEME; - argv[1] = themerc; - argv[2] = (gchar *) file; - argv[3] = NULL; - - result = g_spawn_sync (NULL, argv, NULL, 0, NULL, NULL, - NULL, &standard_error, - &status, NULL); - - g_free (themerc); - - if (result) - { - g_strstrip (standard_error); - - if (status != 0) - { - g_warning ("%s failed: %s", BALOU_EXPORT_THEME, standard_error); - result = FALSE; - } - - g_free (standard_error); - } - else - { - g_warning ("Unable to execute %s", BALOU_EXPORT_THEME); - } - - return result; -} - - -static void -config_export_theme (GtkWidget *item, - GtkWidget *menu) -{ - GtkTreeModel *model; - GtkTreeView *treeview; - GtkTreeIter *iter; - GtkWidget *toplevel; - GtkWidget *dialog; - gchar *file; - gchar *name; - - iter = (GtkTreeIter *) g_object_get_data (G_OBJECT (menu), "iter"); - if (G_UNLIKELY (iter == NULL)) - return; - - treeview = GTK_TREE_VIEW (g_object_get_data (G_OBJECT (menu), "tree-view")); - - model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); - gtk_tree_model_get (model, iter, NAME_COLUMN, &name, -1); - if (G_UNLIKELY (name == NULL)) - return; - - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (treeview)); - - dialog = gtk_file_chooser_dialog_new (_("Choose theme filename..."), - GTK_WINDOW (toplevel), - GTK_FILE_CHOOSER_ACTION_SAVE, - _("_Cancel"), GTK_RESPONSE_CANCEL, - _("_Save"), GTK_RESPONSE_OK, - NULL); - file = g_strconcat (name, ".tar.gz", NULL); - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), file); - g_free (file); - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) - { - file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); - - config_do_export_theme (name, file); - - g_free (file); - } - - gtk_widget_destroy (dialog); - g_free (name); -} - - -static void -config_popup_menu (GtkWidget *treeview, - GdkEventButton *event, - GtkTreeModel *model, - GtkTreeIter *iter) -{ - GtkWidget *menu; - GtkWidget *item; - gboolean writable; - gchar *directory; - gchar *resource; - gchar *name; - guint button; - guint time_; - - menu = (GtkWidget *) g_object_get_data (G_OBJECT (treeview), "popup-menu"); - if (GTK_IS_WIDGET (menu)) - { - if (event != NULL) - { - button = event->button; - time_ = event->time; - } - else - { - button = 0; - time_ = gtk_get_current_event_time (); - } - -#ifdef RM_CMD - if (iter != NULL) - { - gtk_tree_model_get (model, iter, NAME_COLUMN, &name, -1); - - resource = g_strconcat (name, "/", NULL); - directory = xfce_resource_lookup (XFCE_RESOURCE_THEMES, resource); - g_free (resource); - - writable = (access (directory, W_OK) == 0); - - g_free (directory); - g_free (name); - } - else -#endif - { - writable = FALSE; - } - - item = GTK_WIDGET (g_object_get_data (G_OBJECT (menu), "remove-theme")); - gtk_widget_set_sensitive (item, writable); - - g_object_set_data_full (G_OBJECT (menu), "iter", - g_memdup (iter, sizeof (*iter)), - (GDestroyNotify) g_free); - g_object_set_data (G_OBJECT (menu), "tree-view", treeview); - - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, button, time_); - } -} - - -static gboolean -config_button_press_handler (GtkWidget *treeview, GdkEventButton *event) -{ - GtkTreeModel *model; - GtkTreePath *path; - GtkTreeIter iter; - - if (event->button != 3 || event->type != GDK_BUTTON_PRESS) - return FALSE; - - if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (treeview), event->x, - event->y, &path, NULL, NULL, NULL)) - return FALSE; - - model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); - if (!gtk_tree_model_get_iter (model, &iter, path)) - return FALSE; - - config_popup_menu (treeview, event, model, &iter); - return TRUE; -} - - -static gboolean -config_popup_menu_handler (GtkWidget *treeview) -{ - GtkTreeSelection *selection; - GtkTreeModel *model; - GtkTreeIter iter; - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); - if (!gtk_tree_selection_get_selected (selection, &model, &iter)) - return FALSE; - - config_popup_menu (treeview, NULL, model, &iter); - return TRUE; -} - - -static GtkWidget* -config_create_popupmenu (void) -{ - GtkWidget *menu; - GtkWidget *item; - - menu = gtk_menu_new (); - - item = gtk_menu_item_new_with_mnemonic (_("_Install new theme")); - g_object_set_data (G_OBJECT (menu), "install-theme", item); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - g_signal_connect (G_OBJECT (item), "activate", - G_CALLBACK (config_install_theme), menu); - gtk_widget_show (item); - - item = gtk_menu_item_new_with_mnemonic (_("_Remove theme")); - g_object_set_data (G_OBJECT (menu), "remove-theme", item); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); -#ifdef RM_CMD - g_signal_connect (G_OBJECT (item), "activate", - G_CALLBACK (config_remove_theme), menu); -#else - gtk_widget_set_sensitive (item, FALSE); -#endif - gtk_widget_show (item); - - item = gtk_separator_menu_item_new (); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show (item); - - item = gtk_menu_item_new_with_mnemonic (_("_Export theme")); - g_object_set_data (G_OBJECT (menu), "export-theme", item); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - g_signal_connect (G_OBJECT (item), "activate", - G_CALLBACK (config_export_theme), menu); - gtk_widget_show (item); - - return menu; -} - - -static gchar* -extract_local_path (gchar *uri) -{ - gchar *our_host_name; - - if (*uri == '/') - { - gchar *path; - - if (uri[1] != '/') - return uri; /* Just a local path - no host part */ - - path = strchr(uri + 2, '/'); - if (!path) - return NULL; /* //something */ - - if (path - uri == 2) - return path; /* ///path */ - - our_host_name = xfce_gethostname (); - if ((int)strlen(our_host_name) == path - uri - 2 && - strncmp(uri + 2, our_host_name, path - uri - 2) == 0) - { - g_free (our_host_name); - return path; /* //myhost/path */ - } - g_free (our_host_name); - - return NULL; /* From a different host */ - } - else - { - if (strncasecmp(uri, "file:", 5)) - return NULL; /* Don't know this format */ - - uri += 5; - - if (*uri == '/') - return extract_local_path (uri); - - return NULL; - } -} - - -static void -config_drag_begin (GtkWidget *treeview, - GdkDragContext *context) -{ - GtkTreeSelection *selection; - GtkTreeModel *model; - GtkTreeIter iter; - gchar *filename; - gchar *name; - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); - if (!gtk_tree_selection_get_selected (selection, &model, &iter)) - return; - - gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1); - filename = g_strconcat (name, ".tar.gz", NULL); - - gdk_property_change (gdk_drag_context_get_source_window(context), - gdk_atom_intern ("XdndDirectSave0", FALSE), - gdk_atom_intern ("text/plain", FALSE), 8, - GDK_PROP_MODE_REPLACE, (const guchar *)filename, strlen (filename)); - - g_free (filename); - g_free (name); -} - - -static void -config_drag_data_get (GtkWidget *treeview, - GdkDragContext *context, - GtkSelectionData *selection_data, - guint info, - guint32 time_) -{ - GtkTreeSelection *selection; - GtkTreeModel *model; - GtkTreeIter iter; - gchar *name; - guchar *prop_text; - gint prop_len; - gchar *to_send = "E"; - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); - if (!gtk_tree_selection_get_selected (selection, &model, &iter)) - return; - - gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1); - - switch (info) - { - case TARGET_XDS: - if (gdk_property_get (gdk_drag_context_get_source_window(context), - gdk_atom_intern ("XdndDirectSave0", FALSE), - gdk_atom_intern ("text/plain", FALSE), - 0, 1024, FALSE, NULL, NULL, &prop_len, &prop_text) - && prop_text != NULL) - { - gchar *localpath; - - /* Zero-Terminate the string */ - prop_text = g_realloc (prop_text, prop_len + 1); - prop_text[prop_len] = '\0'; - - localpath = extract_local_path ((gchar *)prop_text); - - if (localpath != NULL) - { - if (config_do_export_theme (name, localpath)) - to_send = "S"; - } - else - to_send = "F"; - - g_dataset_set_data (context, "XDS-sent", to_send); - - g_free (prop_text); - } - break; - } - - gtk_selection_data_set (selection_data, gdk_atom_intern ("XA_STRING", FALSE), - 8, (const guchar *)to_send, 1); - - g_free (name); -} - - -static void -config_drag_end (GtkWidget *treeview, GdkDragContext *context) -{ - /* nothing to do here */ -} - - -static void -config_store (GtkTreeView *treeview, - XfsmSplashRc *rc) -{ - GtkTreeSelection *selection; - GtkTreeModel *model; - GtkTreeIter iter; - gchar *name; - - selection = gtk_tree_view_get_selection (treeview); - if (gtk_tree_selection_get_selected (selection, &model, &iter)) - { - gtk_tree_model_get (model, &iter, NAME_COLUMN, &name, -1); - if (name != NULL) - { - xfsm_splash_rc_write_entry (rc, "Theme", name); - g_free (name); - } - } -} - - -static gboolean -config_selection_changed (GtkTreeSelection *selection, - gpointer user_data) -{ - GtkTreeModel *model; - GtkTreeIter iter; - GtkTreeView *treeview; - GdkPixbuf *icon; - - if (gtk_tree_selection_get_selected (selection, &model, &iter)) - { - treeview = gtk_tree_selection_get_tree_view (selection); - gtk_tree_model_get (model, &iter, PREVIEW_COLUMN, &icon, -1); - gtk_drag_source_set_icon_pixbuf (GTK_WIDGET (treeview), icon); - g_object_unref (icon); - } - - return FALSE; -} - - -static GtkWidget* -config_create (XfsmSplashRc *rc) -{ - GtkTreeSelection *selection; - GtkTreeViewColumn *column; - GtkCellRenderer *renderer; - GtkTreeModel *model; - GtkWidget *treeview; - GtkWidget *frame; - GtkWidget *popup; - GtkWidget *page; - GtkWidget *swin; - GtkWidget *vbox; - gchar *theme; - GtkWidget *bin; - - theme = xfsm_splash_rc_read_entry (rc, "Theme", "Default"); - - page = gtk_box_new (GTK_ORIENTATION_VERTICAL, BORDER); - gtk_container_set_border_width (GTK_CONTAINER (page), BORDER); - - frame = xfce_gtk_frame_box_new (_("Balou theme"), &bin); - gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 0); - vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - gtk_container_add (GTK_CONTAINER (bin), vbox); - - swin = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), - GTK_POLICY_NEVER, - GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin), - GTK_SHADOW_ETCHED_IN); - gtk_box_pack_start (GTK_BOX (vbox), swin, TRUE, TRUE, 0); - gtk_widget_show (swin); - - model = config_load_themelist (); - treeview = gtk_tree_view_new_with_model (model); - gtk_widget_set_size_request (treeview, -1, 100); - g_object_unref (G_OBJECT (model)); - config_select_theme (theme, GTK_TREE_VIEW (treeview)); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); - gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection), - GTK_SELECTION_SINGLE); - g_signal_connect (G_OBJECT (selection), "changed", - G_CALLBACK (config_selection_changed), NULL); -#if GLIB_CHECK_VERSION (2, 58, 0) /* TODO: Remove when glib 2.58 is required in configure.ac.in*/ - g_idle_add (G_SOURCE_FUNC (config_selection_changed), selection); -#else - g_idle_add ((GSourceFunc)config_selection_changed, selection); -#endif - gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE); - gtk_container_add (GTK_CONTAINER (swin), treeview); - - /* add tree view columns */ - column = gtk_tree_view_column_new (); - renderer = gtk_cell_renderer_pixbuf_new (); - gtk_tree_view_column_pack_start (column, renderer, FALSE); - gtk_tree_view_column_set_attributes (column, renderer, - "pixbuf", PREVIEW_COLUMN, - NULL); - renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_column_pack_start (column, renderer, TRUE); - gtk_tree_view_column_set_attributes (column, renderer, - "markup", TITLE_COLUMN, - NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column); - - /* Drag&Drop support (destination) */ - gtk_drag_dest_set (treeview, GTK_DEST_DEFAULT_ALL, dst_targets, - dst_ntargets, GDK_ACTION_COPY); - g_signal_connect (G_OBJECT (treeview), "drag_data_received", - G_CALLBACK (config_dropped), NULL); - - /* Drag&Drop support (source) */ - gtk_drag_source_set (treeview, GDK_BUTTON1_MASK, - src_targets, src_ntargets, - GDK_ACTION_COPY | GDK_ACTION_PRIVATE); - g_signal_connect (G_OBJECT (treeview), "drag_begin", - G_CALLBACK (config_drag_begin), NULL); - g_signal_connect (G_OBJECT (treeview), "drag_data_get", - G_CALLBACK (config_drag_data_get), NULL); - g_signal_connect (G_OBJECT (treeview), "drag_end", - G_CALLBACK (config_drag_end), NULL); - - /* popup menu */ - popup = config_create_popupmenu (); - g_object_set_data (G_OBJECT (treeview), - "popup-menu", popup); - g_signal_connect (G_OBJECT (treeview), "popup-menu", - G_CALLBACK (config_popup_menu_handler), NULL); - g_signal_connect (G_OBJECT (treeview), "button-press-event", - G_CALLBACK (config_button_press_handler), NULL); - g_signal_connect_swapped (G_OBJECT (treeview), "destroy", - G_CALLBACK (gtk_widget_destroy), popup); - g_signal_connect (G_OBJECT (treeview), "destroy", - G_CALLBACK (config_store), rc); - - g_free (theme); - - return page; -} - - -static void -config_configure (XfsmSplashConfig *config, - GtkWidget *parent) -{ - GtkWidget *dialog; - GtkWidget *ui; - - dialog = gtk_dialog_new_with_buttons (_("Configure Balou..."), - GTK_WINDOW (parent), - GTK_DIALOG_MODAL - | GTK_DIALOG_DESTROY_WITH_PARENT, - _("_Close"), - GTK_RESPONSE_CLOSE, - NULL); - - ui = config_create (config->rc); - gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area(GTK_DIALOG (dialog))), ui, TRUE, TRUE, 6); - gtk_widget_show_all (ui); - - gtk_dialog_run (GTK_DIALOG (dialog)); - - gtk_widget_destroy (dialog); -} - - -static GdkPixbuf* -config_preview (XfsmSplashConfig *config) -{ - gchar *name; - BalouTheme *theme; - GdkPixbuf *pixbuf = NULL; - - name = xfsm_splash_rc_read_entry (config->rc, "Theme", NULL); - if (G_UNLIKELY (name == NULL)) - return NULL; - - theme = balou_theme_load (name); - pixbuf = balou_theme_generate_preview (theme, 320, 240); - balou_theme_destroy (theme); - - g_free (name); - - return pixbuf; -} - - -G_MODULE_EXPORT void -config_init (XfsmSplashConfig *config) -{ - config->name = g_strdup (_("Balou")); - config->description = g_strdup (_("Balou Splash Engine")); - config->version = g_strdup (VERSION); - config->author = g_strdup ("Benedikt Meurer"); - config->homepage = g_strdup ("http://www.xfce.org/"); - - config->configure = config_configure; - config->preview = config_preview; -} - diff --git a/engines/balou/engine.c b/engines/balou/engine.c deleted file mode 100644 index b0304b61..00000000 --- a/engines/balou/engine.c +++ /dev/null @@ -1,99 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gmodule.h> - -#include <libxfsm/xfsm-splash-engine.h> - -#include <engines/balou/balou.h> - - -#define DEFAULT_THEME "Default" - - -G_MODULE_EXPORT void engine_init (XfsmSplashEngine *engine); - - -static void -engine_setup (XfsmSplashEngine *engine, - XfsmSplashRc *rc) -{ - gchar *theme_name; - BalouTheme *theme; - - theme_name = xfsm_splash_rc_read_entry (rc, "Theme", DEFAULT_THEME); - theme = balou_theme_load (theme_name); - g_free (theme_name); - - balou_init (BALOU (engine->user_data), - engine->display, - engine->primary_screen, - engine->primary_monitor, - theme); -} - - -static void -engine_next (XfsmSplashEngine *engine, - const gchar *text) -{ - Balou *balou = BALOU (engine->user_data); - - balou_fadein (balou, text); -} - - -static int -engine_run (XfsmSplashEngine *engine, - GtkWidget *dialog) -{ - return balou_run (BALOU (engine->user_data), dialog); -} - - -static void -engine_destroy (XfsmSplashEngine *engine) -{ - Balou *balou = BALOU (engine->user_data); - - if (G_LIKELY (balou != NULL)) - { - balou_destroy (balou); - g_free (balou); - } -} - - -G_MODULE_EXPORT void -engine_init (XfsmSplashEngine *engine) -{ - engine->user_data = g_new0 (Balou, 1); - engine->setup = engine_setup; - engine->next = engine_next; - engine->run = engine_run; - engine->destroy = engine_destroy; -} - - diff --git a/engines/balou/gnome-uri.c b/engines/balou/gnome-uri.c deleted file mode 100644 index 8cdad2bb..00000000 --- a/engines/balou/gnome-uri.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 1998 Miguel de Icaza - * Copyright (C) 1997 Paolo Molaro - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 Library General Public License for more details. - * - * You should have received a copy of the GNU Library General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifdef HAVE_STRING_H -#include <string.h> -#endif - -#include <glib-object.h> -#include <engines/balou/gnome-uri.h> - -/*** the next three routines are taken straight from gnome-libs so that the - gtk-only version can receive drag and drops as well ***/ -/** - * gnome_uri_list_free_strings: - * @list: A GList returned by gnome_uri_list_extract_uris() or gnome_uri_list_extract_filenames() - * - * Releases all of the resources allocated by @list. - */ -void -gnome_uri_list_free_strings (GList * list) -{ - g_list_foreach (list, (GFunc) G_CALLBACK (g_free), NULL); - g_list_free (list); -} - -/** - * gnome_uri_list_extract_uris: - * @uri_list: an uri-list in the standard format. - * - * Returns a GList containing strings allocated with g_malloc - * that have been splitted from @uri-list. - */ -GList * -gnome_uri_list_extract_uris (const gchar * uri_list) -{ - const gchar *p, *q; - gchar *retval; - GList *result = NULL; - - g_return_val_if_fail (uri_list != NULL, NULL); - - p = uri_list; - - /* We don't actually try to validate the URI according to RFC - * 2396, or even check for allowed characters - we just ignore - * comments and trim whitespace off the ends. We also - * allow LF delimination as well as the specified CRLF. - */ - while (p) - { - if (*p != '#') - { - while (g_ascii_isspace ((int) (*p))) - p++; - - q = p; - while (*q && (*q != '\n') && (*q != '\r')) - q++; - - if (q > p) - { - q--; - while (q > p && g_ascii_isspace ((int) (*q))) - q--; - - retval = (char *) g_malloc (q - p + 2); - strncpy (retval, p, q - p + 1); - retval[q - p + 1] = '\0'; - - result = g_list_prepend (result, retval); - } - } - p = strchr (p, '\n'); - if (p) - p++; - } - - return g_list_reverse (result); -} - - -/** - * gnome_uri_list_extract_filenames: - * @uri_list: an uri-list in the standard format - * - * Returns a GList containing strings allocated with g_malloc - * that contain the filenames in the uri-list. - * - * Note that unlike gnome_uri_list_extract_uris() function, this - * will discard any non-file uri from the result value. - */ -GList * -gnome_uri_list_extract_filenames (const gchar * uri_list) -{ - GList *tmp_list, *node, *result; - - g_return_val_if_fail (uri_list != NULL, NULL); - - result = gnome_uri_list_extract_uris (uri_list); - - tmp_list = result; - while (tmp_list) - { - gchar *s = (char *) tmp_list->data; - - node = tmp_list; - tmp_list = tmp_list->next; - - if (!strncmp (s, "file:", 5)) - { - /* added by Jasper Huijsmans - remove leading multiple slashes */ - if (!strncmp (s + 5, "///", 3)) - node->data = g_strdup (s + 7); - else - node->data = g_strdup (s + 5); - } - else - { - node->data = g_strdup (s); - } - g_free (s); - } - return result; -} - - - diff --git a/engines/balou/gnome-uri.h b/engines/balou/gnome-uri.h deleted file mode 100644 index 94ef2a89..00000000 --- a/engines/balou/gnome-uri.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 Library General Public License for more details. - * - * You should have received a copy of the GNU Library General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef __GNOME_URI_H__ -#define __GNOME_URI_H__ - -#include <glib.h> - -void gnome_uri_list_free_strings (GList *list); -GList *gnome_uri_list_extract_uris (const gchar *uri_list); -GList *gnome_uri_list_extract_filenames (const gchar *uri_list); - -#endif /* !__GNOME_URI_H__ */ diff --git a/engines/balou/scripts/Makefile.am b/engines/balou/scripts/Makefile.am deleted file mode 100644 index 0ccf8eae..00000000 --- a/engines/balou/scripts/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -baloursciptsdir = $(HELPER_PATH_PREFIX)/xfce4/session -balourscipts_SCRIPTS = \ - balou-export-theme \ - balou-install-theme - -EXTRA_DIST = $(balourscipts_SCRIPTS) diff --git a/engines/balou/scripts/balou-export-theme b/engines/balou/scripts/balou-export-theme deleted file mode 100755 index b682067b..00000000 --- a/engines/balou/scripts/balou-export-theme +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# -# $Id$ -# -# Copyright (c) 2004 Benedikt Meurer <benny@xfce.org> -# All rights reserved. -# -# 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, 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. -# - -if test $# -ne 2; then - echo "Usage: balou-export-theme <themerc> <targetfile>" >&2 - exit 1 -fi - -themerc="${1}" -targetfile="${2}" - -# check theme -baloudir=`dirname "${themerc}"` -basedir=`dirname "${baloudir}"` -themesdir=`dirname "${basedir}"` -themename=`basename "${basedir}"` -if test ! -d "${baloudir}" -o ! -d "${basedir}" -o ! -d "${themesdir}"; then - echo "Broken theme detected." >&2 - exit 1 -fi - -# tarup theme -(cd "${themesdir}" \ - && (tar cf - "${themename}/balou" \ - | gzip --best > "${targetfile}")) > /dev/null 2>&1 -if test $? -ne 0; then - echo "Unable to export theme ${themename} to file ${targetfile}" >&2 - exit 1 -fi - -exit 0 diff --git a/engines/balou/scripts/balou-install-theme b/engines/balou/scripts/balou-install-theme deleted file mode 100755 index 0f889e41..00000000 --- a/engines/balou/scripts/balou-install-theme +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/sh -# -# $Id$ -# -# Copyright (c) 2004 Benedikt Meurer <benny@xfce.org> -# All rights reserved. -# -# 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, 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. -# - -leave() -{ - if test -d "${tmpdir}"; then - rm -rf "${tmpdir}" >/dev/null 2>&1 - fi - exit $1 -} - -if test $# -ne 2; then - echo "Usage: balou-install-theme <theme> <targetdir>" >&2 - exit 1 -fi - -tmpdir="" -themedir="${1}" -targetdir="${2}" - -# ensure the target directory exists -if test ! -d "${targetdir}"; then - mkdir -p "${targetdir}" >/dev/null 2>&1 - if test $? -ne 0; then - echo "Unable to create themes directory ${targetdir}." >&2 - exit 1 - fi -fi - -# if the source is a file, we expect it to be a tarball -if test -f "${themedir}"; then - tmpdir=`mktemp -d "/tmp/balou-theme-XXXXXX"` || exit 1 - - if echo "${themedir}" | grep '\.tar\.gz$' >/dev/null 2>&1; then - tar xzf "${themedir}" -C "${tmpdir}" >/dev/null 2>&1 - if test $? -ne 0; then - echo "Unable to extract theme." 2>&2 - leave 1 - fi - else - echo "Not a splash theme file: ${themedir}." >&2 - leave 1 - fi - - themerc=`ls ${tmpdir}/*/balou/themerc` || leave 1 - baloudir=`dirname "${themerc}"` || leave 1 - topdir=`dirname "${baloudir}"` || leave 1 - - if test ! -d "${topdir}" -o ! -d "${topdir}/balou/"; then - echo "Invalid theme file format." >&2 - leave 1 - fi - - themedir="${topdir}" -fi - -# verify the theme content -if test -d "${themedir}"; then - if test ! -d "${themedir}/balou/"; then - echo "No balou sub directory in theme." >&2 - leave 1 - fi - - if test ! -r "${themedir}/balou/themerc"; then - echo "No themerc file in theme." >&2 - leave 1 - fi -fi - -# install the theme -themebase=`dirname "${themedir}"` -themename=`basename "${themedir}"` -(cd "${themebase}" \ - && tar cf - "${themename}/balou/" \ - | (cd "${targetdir}" && tar xf -)) >/dev/null 2>&1 -if test $? -ne 0; then - echo "Unable to install the theme ${themename} from ${themebase} to ${targetdir}." >&2 - leave 1 -fi - -# tell the caller the name of the installed plugin -echo "${themename}" -leave 0 diff --git a/engines/balou/themes/Default/Makefile.am b/engines/balou/themes/Default/Makefile.am deleted file mode 100644 index 0fbab18d..00000000 --- a/engines/balou/themes/Default/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -themedir = $(datadir)/themes/Default/balou -theme_DATA = \ - logo.png \ - themerc - -EXTRA_DIST = \ - $(theme_DATA) diff --git a/engines/balou/themes/Default/logo.png b/engines/balou/themes/Default/logo.png Binary files differdeleted file mode 100644 index 62ff7f51..00000000 --- a/engines/balou/themes/Default/logo.png +++ /dev/null diff --git a/engines/balou/themes/Default/themerc b/engines/balou/themes/Default/themerc deleted file mode 100644 index 3ca5f1ec..00000000 --- a/engines/balou/themes/Default/themerc +++ /dev/null @@ -1,50 +0,0 @@ -# $Id$ -# -# Default xfce4-session balou theme -# -# Copyright (c) 2004 Benedikt Meurer <benny@xfce.org> -# Copyright (c) 2004 François Le Clainche <fleclainche at wanadoo.fr> -# All rights reserved. -# -# 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, 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. -# - - -# -# Info section -# -[Info] -Name=Default Theme -Name[de]=Standard Thema -Name[ja]=標準ã®ãƒ†ãƒ¼ãƒž -Description=This is the default Balou splash theme. -Description[de]=Dies ist das Standard Balou Thema. -Description[ja]=ã“ã‚Œã¯æ¨™æº–ã® Balou スプラッシュテーマã§ã™ã€‚ - -# -# splash screen settings -# -[Splash Screen] -# The background color, can be a single color or a vertical gradient. The -# latter is written as <color1>:<color2>. -bgcolor=#7991ae:#b6c4d7 -# The foreground color, used for text. -fgcolor=#fefefe -# The logo file, if the extension is missing, xfce4-session will search -# for .svg, .png, .jpeg, .jpg, .xpm -logo=logo - - diff --git a/engines/balou/themes/Makefile.am b/engines/balou/themes/Makefile.am deleted file mode 100644 index 76ed875f..00000000 --- a/engines/balou/themes/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = Default diff --git a/engines/mice/Makefile.am b/engines/mice/Makefile.am deleted file mode 100644 index a1a52947..00000000 --- a/engines/mice/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -micedir = $(libdir)/xfce4/session/splash-engines - -mice_LTLIBRARIES = libmice.la - -libmice_la_SOURCES = \ - preview.h \ - slide.h \ - mice.c - -libmice_la_CFLAGS = \ - -I$(top_srcdir) \ - $(LIBXFCE4UI_CFLAGS) \ - $(LIBX11_CFLAGS) \ - $(XFCONF_CFLAGS) - -libmice_la_LDFLAGS = \ - -avoid-version \ - -no-undefined \ - -module - -libmice_la_LIBADD = \ - $(top_builddir)/libxfsm/libxfsm-4.6.la \ - $(LIBXFCE4UI_LIBS) \ - $(LIBX11_LDFLAGS) \ - $(LIBX11_LIBS) \ - $(XFCONF_LIBS) - -libmice_la_DEPENDENCIES = \ - $(top_builddir)/libxfsm/libxfsm-4.6.la - -noinst_PROGRAMS = \ - generate - -generate_SOURCES = \ - generate.c - -generate_CFLAGS = \ - $(LIBXFCE4UI_CFLAGS) - -generate_LDADD = \ - $(LIBXFCE4UI_LIBS) - -if MAINTAINER_MODE - -BUILT_SOURCES = \ - slide.h \ - preview.h - -preview.h: $(srcdir)/preview.png - $(AM_V_GEN) gdk-pixbuf-csource --static --stream --name=preview $< > $@ - -slide.h: $(srcdir)/slide.png - $(AM_V_GEN) gdk-pixbuf-csource --static --stream --name=slide $< > $@ - -DISTCLEANFILES = \ - $(BUILT_SOURCES) - -endif - -EXTRA_DIST = \ - preview.png \ - slide.png diff --git a/engines/mice/generate.c b/engines/mice/generate.c deleted file mode 100644 index 9645290c..00000000 --- a/engines/mice/generate.c +++ /dev/null @@ -1,123 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdio.h> -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#include <limits.h> -#include <errno.h> - -#include <gtk/gtk.h> - - -static GdkPixbuf* -create_slide (GdkPixbuf *base, int steps) -{ - GdkPixbuf *result; - int rw, rh; - int bw, bh; - int i; - guchar *pixels, *p; - int rowstride; - int n_channels; - int x, y; - - bw = gdk_pixbuf_get_width (base); - bh = gdk_pixbuf_get_height (base); - - rw = bw * steps; - rh = bh; - - result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, rw, rh); - rowstride = gdk_pixbuf_get_rowstride (result); - pixels = gdk_pixbuf_get_pixels (result); - n_channels = gdk_pixbuf_get_n_channels (result); - - for (i = 0; i < steps; ++i) - { - gdk_pixbuf_copy_area (base, 0, 0, bw, bh, - result, i * bw, 0); - - for (x = 0; x < bw; ++x) - { - for (y = 0; y < bh; ++y) - { - p = pixels + y * rowstride + (i * bw + x) * n_channels; - p[3] = ((i + 1) * p[3]) / (steps + 1); - } - } - } - - return result; -} - - -int main (int argc, char **argv) -{ - GdkPixbuf *base; - GdkPixbuf *result; - glong val; - - gtk_init (&argc, &argv); - - if (argc != 3) - { - fprintf (stderr, "Usage: generate <file> <steps>\n"); - return EXIT_FAILURE; - } - - base = gdk_pixbuf_new_from_file (argv[1], NULL); - if (base == NULL) - { - fprintf (stderr, "generate: Unable to open file %s\n", argv[1]); - return EXIT_FAILURE; - } - - val = strtol (argv[2], NULL, 10); - - /* Error checking for untrusted input */ - if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN)) || (errno != 0 && val == 0)) - { - perror("strtol"); - exit(EXIT_FAILURE); - } - - /* Sanity checks */ - if (val > INT_MAX) - val = INT_MAX; - - if (val < 0) - val = 0; - - result = create_slide (base, val); - - gdk_pixbuf_save (result, "slide.png", "png", NULL, NULL); - - printf ("generate: New slide written to slide.png successfully.\n"); - - return EXIT_SUCCESS; -} diff --git a/engines/mice/mice.c b/engines/mice/mice.c deleted file mode 100644 index 12b9f707..00000000 --- a/engines/mice/mice.c +++ /dev/null @@ -1,388 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <X11/Xlib.h> -#include <gdk/gdkx.h> -#include <gdk-pixbuf/gdk-pixdata.h> -#include <gmodule.h> - -#include <libxfsm/xfsm-splash-engine.h> - -#include <engines/mice/preview.h> -#include <engines/mice/slide.h> - - -#define BORDER 2 -#define COLOR "#DAE7FE" -#define STEPS 8 - - -#define MICE_WINDOW(obj) ((MiceWindow *)(obj)) -#define MICE(obj) ((Mice *)(obj)) - - -typedef struct _MiceWindow MiceWindow; -typedef struct _Mice Mice; - - -struct _MiceWindow -{ - GdkWindow *window; - GdkPixbuf *pixbuf; - GdkRGBA *color; - int x; - int y; - Mice *mice; -}; - - -struct _Mice -{ - gboolean dialog_active; - GList *windows; - MiceWindow *mainwin; - int base_width; - int base_height; - int step; - int direction; - guint timeout_id; - int pixbuf_width; - int pixbuf_height; -}; - - -G_MODULE_EXPORT void config_init (XfsmSplashConfig *config); -G_MODULE_EXPORT void engine_init (XfsmSplashEngine *engine); - - -static GdkFilterReturn -mice_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_data) -{ - MiceWindow *mice_window = MICE_WINDOW (user_data); - XVisibilityEvent *xvisev = (XVisibilityEvent *) xevent; - - switch (xvisev->type) - { - case VisibilityNotify: - if (!mice_window->mice->dialog_active) - { - gdk_window_raise (mice_window->window); - return GDK_FILTER_REMOVE; - } - break; - } - - return GDK_FILTER_CONTINUE; -} - - -static MiceWindow* -mice_window_new (GdkScreen *screen, - int monitor, - GdkPixbuf *pixbuf, - const GdkRGBA *color, - GdkCursor *cursor, - Mice *mice) -{ - GdkRectangle geometry; - GdkWindowAttr attr; - MiceWindow *mice_window; - - gdk_screen_get_monitor_geometry (screen, monitor, &geometry); - - mice_window = g_new0 (MiceWindow, 1); - mice_window->mice = mice; - mice_window->pixbuf = GDK_PIXBUF (g_object_ref (pixbuf)); - mice_window->color = gdk_rgba_copy (color); - - /* init win attributes */ - attr.x = geometry.x; - attr.y = geometry.y; - attr.event_mask = GDK_VISIBILITY_NOTIFY_MASK; - attr.width = geometry.width; - attr.height = geometry.height; - attr.wclass = GDK_INPUT_OUTPUT; - attr.window_type = GDK_WINDOW_TEMP; - attr.cursor = cursor; - attr.override_redirect = TRUE; - - mice_window->window = gdk_window_new (gdk_screen_get_root_window (screen), - &attr, GDK_WA_X | GDK_WA_Y - | GDK_WA_NOREDIR | GDK_WA_CURSOR); - - gdk_window_set_background_rgba (mice_window->window, color); - - /* center pixmap */ - mice_window->x = (geometry.width - mice->base_width) / 2; - mice_window->y = (geometry.height - mice->base_height) / 2; - - return mice_window; -} - - -static void -mice_step (Mice *mice) -{ - MiceWindow *mice_window; - GList *lp; - cairo_t *cr; - int sx; - int sy; - int ww; - int wh; - - sx = mice->step * mice->base_width; - sy = 0; - - for (lp = mice->windows; lp != NULL; lp = lp->next) - { - mice_window = MICE_WINDOW (lp->data); - - cr = gdk_cairo_create (mice_window->window); - - ww = gdk_window_get_width (GDK_WINDOW (mice_window->window)); - wh = gdk_window_get_height (GDK_WINDOW (mice_window->window)); - - /* Paint the background */ - gdk_cairo_set_source_rgba (cr, mice_window->color); - cairo_rectangle (cr, 0, 0, ww, wh); - cairo_fill (cr); - - /* Paint the mouse. Cairo is fun, we have to move the source image - * around and clip to the box to show the mouse animation */ - gdk_cairo_set_source_pixbuf (cr, mice_window->pixbuf, mice_window->x - sx, mice_window->y - sy); - cairo_rectangle (cr, mice_window->x, mice_window->y, mice->base_width, mice->base_height); - cairo_clip (cr); - cairo_paint (cr); - - cairo_destroy (cr); - } - - if (mice->step == 0 && mice->direction < 0) - { - mice->step++; - mice->direction = 1; - } - else if (mice->step == STEPS - 1 && mice->direction > 0) - { - mice->step--; - mice->direction = -1; - } - else - { - mice->step += mice->direction; - } -} - - -static gboolean -mice_timeout (gpointer user_data) -{ - Mice *mice = MICE (user_data); - - if (!mice->dialog_active) - mice_step (mice); - - return TRUE; -} - - -static void -mice_setup (XfsmSplashEngine *engine, - XfsmSplashRc *rc) -{ - MiceWindow *mice_window; - GdkWindow *root; - GdkPixbuf *pixbuf; - GdkRGBA color; - GdkCursor *cursor; - GdkScreen *screen; - cairo_t *cr; - GList *lp; - Mice *mice = MICE (engine->user_data); - int nmonitors; - int m; - - gdk_rgba_parse (&color, COLOR); - cursor = gdk_cursor_new_for_display (engine->display, GDK_WATCH); - - /* load slide pixbuf */ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* TODO: use GResource or load it as a normal pixbuf */ - pixbuf = gdk_pixbuf_new_from_inline (-1, slide, FALSE, NULL); - G_GNUC_END_IGNORE_DEPRECATIONS - mice->pixbuf_width = gdk_pixbuf_get_width (pixbuf); - mice->pixbuf_height = gdk_pixbuf_get_height (pixbuf); - - mice->base_width = mice->pixbuf_width / STEPS; - mice->base_height = mice->pixbuf_height; - mice->step = 0; - mice->direction = 1; - - screen = gdk_display_get_default_screen (engine->display); - nmonitors = gdk_screen_get_n_monitors (screen); - root = gdk_screen_get_root_window (screen); - - /* create graphics context for this screen */ - cr = gdk_cairo_create (root); - gdk_cairo_set_source_rgba (cr, &color); - - cairo_rectangle (cr, 0, 0, mice->pixbuf_width, mice->pixbuf_height); - cairo_fill (cr); - - cairo_move_to (cr, 0, 0); - gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); - cairo_paint (cr); - - for (m = 0; m < nmonitors; ++m) - { - mice_window = mice_window_new (screen, m, pixbuf, - &color, cursor, mice); - mice->windows = g_list_append (mice->windows, mice_window); - - if (screen == engine->primary_screen && m == engine->primary_monitor) - mice->mainwin = mice_window; - } - cairo_destroy (cr); - - - /* show all windows and connect filters */ - for (lp = mice->windows; lp != NULL; lp = lp->next) - { - mice_window = MICE_WINDOW (lp->data); - gdk_window_show (mice_window->window); - gdk_window_add_filter (mice_window->window, mice_filter, mice_window); - } - - /* start timer */ - mice->timeout_id = g_timeout_add (100, mice_timeout, mice); - - /* cleanup */ - g_object_unref (pixbuf); - g_object_unref (cursor); -} - - -static void -mice_next (XfsmSplashEngine *engine, const gchar *text) -{ - /* nothing to be done here */ -} - -static int -mice_run (XfsmSplashEngine *engine, - GtkWidget *dialog) -{ - Mice *mice = MICE (engine->user_data); - MiceWindow *mainwin = mice->mainwin; - GtkRequisition requisition; - int result; - int x, y; - int wx, wy; - int ww, wh; - - mice->dialog_active = TRUE; - - gdk_window_get_origin (mainwin->window, &wx, &wy); - - ww = gdk_window_get_width (GDK_WINDOW (mainwin->window)); - wh = gdk_window_get_height (GDK_WINDOW (mainwin->window)); - - gtk_window_set_screen (GTK_WINDOW (dialog), - gdk_window_get_screen (mainwin->window)); - gtk_widget_get_preferred_size (dialog, NULL, &requisition); - x = wx + (ww - requisition.width) / 2; - y = wy + (wh - requisition.height) / 2; - gtk_window_move (GTK_WINDOW (dialog), x, y); - result = gtk_dialog_run (GTK_DIALOG (dialog)); - - mice->dialog_active = FALSE; - - return result; -} - - -static void -mice_destroy (XfsmSplashEngine *engine) -{ - MiceWindow *mice_window; - Mice *mice = MICE (engine->user_data); - GList *lp; - - for (lp = mice->windows; lp != NULL; lp = lp->next) - { - mice_window = MICE_WINDOW (lp->data); - gdk_window_remove_filter (mice_window->window, mice_filter, mice); - gdk_window_destroy (mice_window->window); - g_object_unref (mice_window->pixbuf); - gdk_rgba_free (mice_window->color); - g_free (mice_window); - } - - g_source_remove (mice->timeout_id); - g_list_free (mice->windows); - g_free (mice); -} - - -G_MODULE_EXPORT void -engine_init (XfsmSplashEngine *engine) -{ - Mice *mice; - - mice = g_new0 (Mice, 1); - - engine->user_data = mice; - engine->setup = mice_setup; - engine->next = mice_next; - engine->run = mice_run; - engine->destroy = mice_destroy; -} - - - -static GdkPixbuf* -config_preview (XfsmSplashConfig *config) -{ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* TODO: use GResource or load it as a normal pixbuf */ - return gdk_pixbuf_new_from_inline (-1, preview, FALSE, NULL); - G_GNUC_END_IGNORE_DEPRECATIONS -} - - -G_MODULE_EXPORT void -config_init (XfsmSplashConfig *config) -{ - config->name = g_strdup (_("Mice")); - config->description = g_strdup (_("Mice Splash Engine")); - config->version = g_strdup (VERSION); - config->author = g_strdup ("Benedikt Meurer"); - config->homepage = g_strdup ("http://www.xfce.org/"); - - config->preview = config_preview; -} - - diff --git a/engines/mice/preview.png b/engines/mice/preview.png Binary files differdeleted file mode 100644 index cdd880b5..00000000 --- a/engines/mice/preview.png +++ /dev/null diff --git a/engines/mice/slide.png b/engines/mice/slide.png Binary files differdeleted file mode 100644 index 8ea985b7..00000000 --- a/engines/mice/slide.png +++ /dev/null diff --git a/engines/simple/Makefile.am b/engines/simple/Makefile.am deleted file mode 100644 index 6737c2bc..00000000 --- a/engines/simple/Makefile.am +++ /dev/null @@ -1,51 +0,0 @@ -simpledir = $(libdir)/xfce4/session/splash-engines - -simple_LTLIBRARIES = libsimple.la - -libsimple_la_SOURCES = \ - fallback.h \ - preview.h \ - simple.c - -libsimple_la_CFLAGS = \ - -I$(top_srcdir) \ - $(LIBX11_CFLAGS) \ - $(LIBXFCE4UI_CFLAGS) \ - $(XFCONF_CFLAGS) - -libsimple_la_LDFLAGS = \ - -avoid-version \ - -no-undefined \ - -module \ - $(LIBX11_LIBS) \ - $(LIBX11_LDFLAGS) - -libsimple_la_LIBADD = \ - $(top_builddir)/libxfsm/libxfsm-4.6.la \ - $(LIBX11_LIBS) \ - $(LIBXFCE4UI_LIBS) \ - $(XFCONF_LIBS) - -libsimple_la_DEPENDENCIES = \ - $(top_builddir)/libxfsm/libxfsm-4.6.la - -if MAINTAINER_MODE - -BUILT_SOURCES = \ - fallback.h \ - preview.h - -fallback.h: $(srcdir)/fallback.png - $(AM_V_GEN) gdk-pixbuf-csource --static --stream --name=fallback $< > $@ - -preview.h: $(srcdir)/preview.png - $(AM_V_GEN) gdk-pixbuf-csource --static --stream --name=preview $< > $@ - -DISTCLEANFILES = \ - $(BUILT_SOURCES) - -endif - -EXTRA_DIST = \ - fallback.png \ - preview.png diff --git a/engines/simple/fallback.png b/engines/simple/fallback.png Binary files differdeleted file mode 100644 index 05e07706..00000000 --- a/engines/simple/fallback.png +++ /dev/null diff --git a/engines/simple/preview.png b/engines/simple/preview.png Binary files differdeleted file mode 100644 index 2b72fdd8..00000000 --- a/engines/simple/preview.png +++ /dev/null diff --git a/engines/simple/simple.c b/engines/simple/simple.c deleted file mode 100644 index 8bcd25e2..00000000 --- a/engines/simple/simple.c +++ /dev/null @@ -1,490 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2007 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifdef XFCE_DISABLE_DEPRECATED -#undef XFCE_DISABLE_DEPRECATED -#endif - -#include <X11/Xlib.h> - -#include <gdk-pixbuf/gdk-pixdata.h> -#include <gmodule.h> - -#include <libxfce4ui/libxfce4ui.h> - -#include <libxfsm/xfsm-splash-engine.h> - -#include <engines/simple/fallback.h> -#include <engines/simple/preview.h> - - -#define BORDER 2 - -#define DEFAULT_FONT "Sans Bold 10" -#define DEFAULT_BGCOLOR "Black" -#define DEFAULT_FGCOLOR "White" - - -typedef struct _Simple Simple; -struct _Simple -{ - gboolean dialog_active; - GdkWindow *window; - PangoLayout *layout; - GdkPixbuf *logo; - GdkRectangle area; - GdkRectangle textbox; - GdkRGBA bgcolor; - GdkRGBA fgcolor; -}; - - -G_MODULE_EXPORT void config_init (XfsmSplashConfig *config); -G_MODULE_EXPORT void engine_init (XfsmSplashEngine *engine); - - -static GdkFilterReturn -simple_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_data) -{ - Simple *simple = (Simple *) user_data; - XVisibilityEvent *xvisev = (XVisibilityEvent *) xevent; - - switch (xvisev->type) - { - case VisibilityNotify: - if (!simple->dialog_active) - { - gdk_window_raise (simple->window); - return GDK_FILTER_REMOVE; - } - break; - } - - return GDK_FILTER_CONTINUE; -} - - -static void -simple_setup (XfsmSplashEngine *engine, - XfsmSplashRc *rc) -{ - PangoFontDescription *description; - PangoFontMetrics *metrics; - PangoContext *context; - GdkWindowAttr attr; - GdkRectangle geo; - gchar *color; - gchar *font; - gchar *path; - GdkWindow *root; - GdkCursor *cursor; - Simple *simple; - gint logo_width; - gint logo_height; - gint text_height; - cairo_t *cr; - - simple = (Simple *) engine->user_data; - - /* load settings */ - color = xfsm_splash_rc_read_entry (rc, "BgColor", DEFAULT_BGCOLOR); - gdk_rgba_parse (&simple->bgcolor, color); - g_free (color); - - color = xfsm_splash_rc_read_entry (rc, "FgColor", DEFAULT_FGCOLOR); - gdk_rgba_parse (&simple->fgcolor, color); - g_free (color); - - font = xfsm_splash_rc_read_entry (rc, "Font", DEFAULT_FONT); - path = xfsm_splash_rc_read_entry (rc, "Image", NULL); - - root = gdk_screen_get_root_window (engine->primary_screen); - gdk_screen_get_monitor_geometry (engine->primary_screen, - engine->primary_monitor, - &geo); - - if (path != NULL && g_file_test (path, G_FILE_TEST_IS_REGULAR)) - simple->logo = gdk_pixbuf_new_from_file (path, NULL); - if (simple->logo == NULL) - { - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* TODO: use GResource or load it as a normal pixbuf */ - simple->logo = gdk_pixbuf_new_from_inline (-1, fallback, FALSE, NULL); - G_GNUC_END_IGNORE_DEPRECATIONS - } - logo_width = gdk_pixbuf_get_width (simple->logo); - logo_height = gdk_pixbuf_get_height (simple->logo); - - cursor = gdk_cursor_new_for_display (gdk_window_get_display (root), GDK_WATCH); - - /* create pango layout */ - description = pango_font_description_from_string (font); - context = gdk_pango_context_get_for_screen (engine->primary_screen); - pango_context_set_font_description (context, description); - metrics = pango_context_get_metrics (context, description, NULL); - text_height = (pango_font_metrics_get_ascent (metrics) - + pango_font_metrics_get_descent (metrics)) / PANGO_SCALE - + 4; - - simple->area.width = logo_width + 2 * BORDER; - simple->area.height = logo_height + text_height + 3 * BORDER; - simple->area.x = (geo.width - simple->area.width) / 2; - simple->area.y = (geo.height - simple->area.height) / 2; - - simple->layout = pango_layout_new (context); - simple->textbox.x = BORDER; - simple->textbox.y = simple->area.height - (text_height + BORDER); - simple->textbox.width = simple->area.width - 2 * BORDER; - simple->textbox.height = text_height; - - /* create splash window */ - attr.x = simple->area.x; - attr.y = simple->area.y; - attr.event_mask = GDK_VISIBILITY_NOTIFY_MASK; - attr.width = simple->area.width; - attr.height = simple->area.height; - attr.wclass = GDK_INPUT_OUTPUT; - attr.window_type = GDK_WINDOW_TEMP; - attr.cursor = cursor; - attr.override_redirect = TRUE; - - simple->window = gdk_window_new (root, &attr, GDK_WA_X | GDK_WA_Y - | GDK_WA_NOREDIR | GDK_WA_CURSOR); - - gdk_window_show (simple->window); - - cr = gdk_cairo_create (simple->window); - gdk_cairo_set_source_rgba (cr, &simple->bgcolor); - - cairo_rectangle (cr, 0, 0, simple->area.width, simple->area.height); - cairo_fill (cr); - - cairo_move_to (cr, 0, 0); - gdk_cairo_set_source_pixbuf (cr, simple->logo, 0, 0); - cairo_paint (cr); - - gdk_window_add_filter (simple->window, simple_filter, simple); - gdk_window_show (simple->window); - - /* cleanup */ - g_free (font); - g_free (path); - pango_font_description_free (description); - pango_font_metrics_unref (metrics); - g_object_unref (cursor); - g_object_unref (context); - cairo_destroy (cr); -} - - -static void -simple_next (XfsmSplashEngine *engine, const gchar *text) -{ - Simple *simple = (Simple *) engine->user_data; - GdkRGBA shcolor; - gint tw, th, tx, ty; - cairo_t *cr; - - pango_layout_set_text (simple->layout, text, -1); - pango_layout_get_pixel_size (simple->layout, &tw, &th); - tx = simple->textbox.x + (simple->textbox.width - tw) / 2; - ty = simple->textbox.y + (simple->textbox.height - th) / 2; - - cr = gdk_cairo_create (simple->window); - - /* re-paint the logo */ - gdk_cairo_set_source_pixbuf (cr, simple->logo, 0, 0); - cairo_paint (cr); - - gdk_cairo_set_source_rgba (cr, &simple->bgcolor); - cairo_rectangle (cr, - simple->textbox.x, - simple->textbox.y, - simple->textbox.width, - simple->textbox.height); - cairo_fill (cr); - - /* draw shadow */ - shcolor.red = (simple->fgcolor.red + simple->bgcolor.red) / 2; - shcolor.green = (simple->fgcolor.green + simple->bgcolor.green) / 2; - shcolor.blue = (simple->fgcolor.blue + simple->bgcolor.blue) / 2; - shcolor.red = (shcolor.red + shcolor.green + shcolor.blue) / 3; - shcolor.green = shcolor.red; - shcolor.blue = shcolor.red; - - gdk_cairo_set_source_rgba (cr, &shcolor); - cairo_move_to (cr, tx + 2, ty + 2); - pango_cairo_show_layout (cr, simple->layout); - - gdk_cairo_set_source_rgba (cr, &simple->fgcolor); - cairo_move_to (cr, tx, ty); - pango_cairo_show_layout (cr, simple->layout); - - cairo_destroy (cr); -} - - -static int -simple_run (XfsmSplashEngine *engine, - GtkWidget *dialog) -{ - Simple *simple = (Simple *) engine->user_data; - GtkRequisition requisition; - int result; - int x; - int y; - - simple->dialog_active = TRUE; - - gtk_widget_get_preferred_size (dialog, NULL, &requisition); - x = simple->area.x + (simple->area.width - requisition.width) / 2; - y = simple->area.y + (simple->area.height - requisition.height) / 2; - gtk_window_move (GTK_WINDOW (dialog), x, y); - result = gtk_dialog_run (GTK_DIALOG (dialog)); - - simple->dialog_active = FALSE; - - return result; -} - - -static void -simple_destroy (XfsmSplashEngine *engine) -{ - Simple *simple = (Simple *) engine->user_data; - - gdk_window_remove_filter (simple->window, simple_filter, simple); - gdk_window_destroy (simple->window); - g_object_unref (simple->layout); - g_object_unref (simple->logo); - g_free (engine->user_data); -} - - -G_MODULE_EXPORT void -engine_init (XfsmSplashEngine *engine) -{ - Simple *simple; - - simple = g_new0 (Simple, 1); - - engine->user_data = simple; - engine->setup = simple_setup; - engine->next = simple_next; - engine->run = simple_run; - engine->destroy = simple_destroy; -} - - - -static void -config_toggled (GtkWidget *button, GtkWidget *widget) -{ - gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active ( - GTK_TOGGLE_BUTTON (button))); -} - - -static void -config_configure (XfsmSplashConfig *config, - GtkWidget *parent) -{ - gchar *font; - gchar *path; - gchar *path_locale = NULL; - gchar *colorstr; - GtkWidget *dialog; - GtkWidget *frame; - GtkWidget *btn_font; - GtkWidget *table; - GtkWidget *label; - GtkWidget *sel_bg; - GtkWidget *sel_fg; - GtkWidget *checkbox; - GtkWidget *vbox; - GtkWidget *button; - GtkFileFilter *filter; - GdkRGBA color; - GtkBox *dbox; - gchar *buffer; - GtkWidget *bin; - - dialog = gtk_dialog_new_with_buttons (_("Configure Simple..."), - GTK_WINDOW (parent), - GTK_DIALOG_MODAL - | GTK_DIALOG_DESTROY_WITH_PARENT, - _("_Close"), - GTK_RESPONSE_CLOSE, - NULL); - - dbox = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))); - - frame = xfce_gtk_frame_box_new (_("Font"), &bin); - gtk_box_pack_start (dbox, frame, FALSE, FALSE, 6); - gtk_widget_show (frame); - - font = xfsm_splash_rc_read_entry (config->rc, "Font", DEFAULT_FONT); - btn_font = gtk_font_button_new_with_font (font); - g_free (font); - gtk_container_add (GTK_CONTAINER (bin), btn_font); - gtk_widget_show (btn_font); - - frame = xfce_gtk_frame_box_new (_("Colors"), &bin); - gtk_box_pack_start (dbox, frame, FALSE, FALSE, 6); - gtk_widget_show (frame); - - table = gtk_grid_new (); - gtk_container_add (GTK_CONTAINER (bin), table); - gtk_widget_show (table); - - label = gtk_label_new (_("Background color:")); - gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1); - gtk_widget_show (label); - - colorstr = xfsm_splash_rc_read_entry (config->rc, "BgColor", DEFAULT_BGCOLOR); - gdk_rgba_parse (&color, colorstr); - g_free (colorstr); - sel_bg = gtk_color_button_new_with_rgba (&color); - gtk_grid_attach (GTK_GRID (table), sel_bg, 1, 0, 1, 1); - gtk_widget_show (sel_bg); - - label = gtk_label_new (_("Text color:")); - gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1); - gtk_widget_show (label); - - colorstr = xfsm_splash_rc_read_entry (config->rc, "FgColor", DEFAULT_FGCOLOR); - g_debug ("FgColor %s", colorstr); - gdk_rgba_parse (&color, colorstr); - g_free (colorstr); - sel_fg = gtk_color_button_new_with_rgba (&color); - gtk_grid_attach (GTK_GRID (table), sel_fg, 1, 1, 1, 1); - gtk_widget_show (sel_fg); - - frame = xfce_gtk_frame_box_new (_("Image"), &bin); - gtk_box_pack_start (dbox, frame, FALSE, FALSE, 6); - gtk_widget_show (frame); - - vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); - gtk_container_add (GTK_CONTAINER (bin), vbox); - gtk_widget_show (vbox); - - checkbox = gtk_check_button_new_with_label (_("Use custom image")); - gtk_box_pack_start (GTK_BOX (vbox), checkbox, FALSE, FALSE, 0); - gtk_widget_show (checkbox); - - button = gtk_file_chooser_button_new (_("Choose image..."), - GTK_FILE_CHOOSER_ACTION_OPEN); - gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - gtk_widget_show (button); - - filter = gtk_file_filter_new (); - gtk_file_filter_set_name (filter, _("Images")); - gtk_file_filter_add_pixbuf_formats (filter); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (button), filter); - gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (button), filter); - - filter = gtk_file_filter_new (); - gtk_file_filter_set_name (filter, _("All files")); - gtk_file_filter_add_pattern (filter, "*"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (button), filter); - - path = xfsm_splash_rc_read_entry (config->rc, "Image", NULL); - if (path != NULL) - path_locale = g_filename_from_utf8 (path, -1, NULL, NULL, NULL); - g_free (path); - if (path_locale == NULL || !g_file_test (path_locale, G_FILE_TEST_IS_REGULAR)) - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), FALSE); - gtk_widget_set_sensitive (button, FALSE); - } - else - { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), TRUE); - gtk_widget_set_sensitive (button, TRUE); - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (button), path_locale); - } - g_free (path_locale); - g_signal_connect (G_OBJECT (checkbox), "toggled", - G_CALLBACK (config_toggled), button); - - /* run the dialog */ - gtk_dialog_run (GTK_DIALOG (dialog)); - - /* store settings */ - xfsm_splash_rc_write_entry (config->rc, "Font", - gtk_font_button_get_font_name (GTK_FONT_BUTTON (btn_font))); - - gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (sel_bg), &color); - buffer = gdk_rgba_to_string (&color); - xfsm_splash_rc_write_entry (config->rc, "BgColor", buffer); - g_free (buffer); - - gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (sel_fg), &color); - buffer = gdk_rgba_to_string (&color); - xfsm_splash_rc_write_entry (config->rc, "FgColor", buffer); - g_free (buffer); - - path_locale = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (button)); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)) - && path_locale != NULL && g_file_test (path_locale, G_FILE_TEST_IS_REGULAR)) - { - path = g_filename_to_utf8 (path_locale, -1, NULL, NULL, NULL); - xfsm_splash_rc_write_entry (config->rc, "Image", path); - g_free (path); - } - else - { - xfsm_splash_rc_write_entry (config->rc, "Image", ""); - } - g_free (path_locale); - - gtk_widget_destroy (dialog); -} - - -static GdkPixbuf* -config_preview (XfsmSplashConfig *config) -{ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* TODO: use GResource or load it as a normal pixbuf */ - return gdk_pixbuf_new_from_inline (-1, preview, FALSE, NULL); - G_GNUC_END_IGNORE_DEPRECATIONS -} - - -G_MODULE_EXPORT void -config_init (XfsmSplashConfig *config) -{ - config->name = g_strdup (_("Simple")); - config->description = g_strdup (_("Simple Splash Engine")); - config->version = g_strdup (VERSION); - config->author = g_strdup ("Benedikt Meurer"); - config->homepage = g_strdup ("http://www.xfce.org/"); - - config->configure = config_configure; - config->preview = config_preview; -} - - diff --git a/icons/48x48/Makefile.am b/icons/48x48/Makefile.am index c6f7e21a..6a8426e0 100644 --- a/icons/48x48/Makefile.am +++ b/icons/48x48/Makefile.am @@ -1,7 +1,6 @@ iconsdir = $(datadir)/icons/hicolor/48x48/apps icons_DATA = \ xfce4-session.png \ - xfce4-splash.png \ system-hibernate.png \ system-log-out.png \ system-reboot.png \ diff --git a/icons/48x48/xfce4-splash.png b/icons/48x48/xfce4-splash.png Binary files differdeleted file mode 100644 index 1f71517c..00000000 --- a/icons/48x48/xfce4-splash.png +++ /dev/null diff --git a/libxfsm/Makefile.am b/libxfsm/Makefile.am index b2199333..538ab84c 100644 --- a/libxfsm/Makefile.am +++ b/libxfsm/Makefile.am @@ -5,8 +5,6 @@ AM_CPPFLAGS = \ lib_LTLIBRARIES = libxfsm-4.6.la libxfsm_4_6_la_SOURCES = \ - xfsm-splash-rc.c \ - xfsm-splash-rc.h \ xfsm-util.h \ xfsm-util.c @@ -30,16 +28,8 @@ libxfsm_4_6_la_LIBADD = \ $(LIBXFCE4UI_LIBS) \ $(XFCONF_LIBS) - libxfsmincludedir = \ $(includedir)/xfce4/xfce4-session-4.6/libxfsm -libxfsminclude_HEADERS = \ - xfsm-splash-engine.h \ - xfsm-splash-rc.h - - pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = xfce4-session-2.0.pc - - diff --git a/libxfsm/xfsm-splash-engine.h b/libxfsm/xfsm-splash-engine.h deleted file mode 100644 index d77a8db5..00000000 --- a/libxfsm/xfsm-splash-engine.h +++ /dev/null @@ -1,124 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifndef __XFSM_SPLASH_ENGINE_H__ -#define __XFSM_SPLASH_ENGINE_H__ - -#include <time.h> - -#include <gtk/gtk.h> - -#include <libxfsm/xfsm-splash-rc.h> - - -#define XFSM_CHOOSE_LOGOUT 0 -#define XFSM_CHOOSE_LOAD 1 -#define XFSM_CHOOSE_NEW 2 - - -typedef struct _XfsmSplashEngine XfsmSplashEngine; -typedef struct _XfsmSplashConfig XfsmSplashConfig; -typedef struct _XfsmSessionInfo XfsmSessionInfo; - - -struct _XfsmSplashEngine -{ - /* provided by the session manager */ - GdkDisplay *display; - GdkScreen *primary_screen; - int primary_monitor; - - - /* to be filled in by the engine */ - gpointer user_data; - - /* load config from rc and display the splash window */ - void (*setup) (XfsmSplashEngine *engine, - XfsmSplashRc *rc); - - /* tells the engine that the session will start now, where - steps is the approx. number of apps started in the session, - name is the name of the session and the preview at 52x42 - (OPTIONAL) */ - void (*start) (XfsmSplashEngine *engine, - const gchar *name, - GdkPixbuf *preview, - unsigned steps); - - /* place, run, hide the dialog and return the result of the run. - override on demand (OPTIONAL) */ - int (*run) (XfsmSplashEngine *engine, - GtkWidget *dialog); - - /* display the text (OPTIONAL) */ - void (*next) (XfsmSplashEngine *engine, - const gchar *text); - - /* choose a session (OPTIONAL), should return XFSM_CHOOSE_* */ - int (*choose) (XfsmSplashEngine *engine, - GList *sessions, - const gchar *default_session, - gchar **name_return); - - void (*destroy) (XfsmSplashEngine *engine); - - gpointer _reserved[8]; -}; - - -struct _XfsmSplashConfig -{ - /* provided by the session manager */ - XfsmSplashRc *rc; - - - /* to be filled in by the config (freed by the session manager) */ - gchar *name; - gchar *description; - gchar *version; - gchar *author; - gchar *homepage; - - /* config internals (config is responsible for freeing during destroy) */ - gpointer user_data; - - /* generate preview for engine, should be 320x240! (OPTIONAL) */ - GdkPixbuf *(*preview) (XfsmSplashConfig *config); - - /* display a configuration dialog (OPTIONAL) */ - void (*configure) (XfsmSplashConfig *config, - GtkWidget *parent); - - void (*destroy) (XfsmSplashConfig *config); - - gpointer _reserved[8]; -}; - - -struct _XfsmSessionInfo -{ - gchar *name; /* name of the session */ - time_t atime; /* last access time */ - GdkPixbuf *preview; /* preview icon (52x42) */ -}; - - -#endif /* !__XFSM_SPLASH_ENGINE_H__ */ diff --git a/libxfsm/xfsm-splash-rc.c b/libxfsm/xfsm-splash-rc.c deleted file mode 100644 index d652d1d6..00000000 --- a/libxfsm/xfsm-splash-rc.c +++ /dev/null @@ -1,140 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <libxfsm/xfsm-splash-rc.h> - -#define PROP_FROM_KEY(varname, key) \ - gchar varname[4096]; \ - g_strlcpy(varname, "/", sizeof(varname)); \ - g_strlcat(varname, key, sizeof(varname)) - - -struct _XfsmSplashRc -{ - XfconfChannel *channel; -}; - - -XfsmSplashRc* -xfsm_splash_rc_new (XfconfChannel *channel) -{ - XfsmSplashRc *splash_rc; - - splash_rc = g_new (XfsmSplashRc, 1); - splash_rc->channel = g_object_ref (channel); - - return splash_rc; -} - - -gchar* -xfsm_splash_rc_read_entry (XfsmSplashRc *splash_rc, - const gchar *key, - const gchar *fallback) -{ - PROP_FROM_KEY(prop, key); - return xfconf_channel_get_string (splash_rc->channel, prop, fallback); -} - - -gint -xfsm_splash_rc_read_int_entry (XfsmSplashRc *splash_rc, - const gchar *key, - gint fallback) -{ - PROP_FROM_KEY(prop, key); - return xfconf_channel_get_int (splash_rc->channel, prop, fallback); -} - - -gboolean -xfsm_splash_rc_read_bool_entry (XfsmSplashRc *splash_rc, - const gchar *key, - gboolean fallback) -{ - PROP_FROM_KEY(prop, key); - return xfconf_channel_get_bool (splash_rc->channel, prop, fallback); -} - - -gchar** -xfsm_splash_rc_read_list_entry (XfsmSplashRc *splash_rc, - const gchar *key, - const gchar *delimiter) -{ - PROP_FROM_KEY(prop, key); - return xfconf_channel_get_string_list (splash_rc->channel, prop); -} - - -void -xfsm_splash_rc_write_entry (XfsmSplashRc *splash_rc, - const gchar *key, - const gchar *value) -{ - PROP_FROM_KEY(prop, key); - xfconf_channel_set_string (splash_rc->channel, prop, value); -} - - -void -xfsm_splash_rc_write_int_entry (XfsmSplashRc *splash_rc, - const gchar *key, - gint value) -{ - PROP_FROM_KEY(prop, key); - xfconf_channel_set_int (splash_rc->channel, prop, value); -} - - -void -xfsm_splash_rc_write_bool_entry (XfsmSplashRc *splash_rc, - const gchar *key, - gboolean value) -{ - PROP_FROM_KEY(prop, key); - xfconf_channel_set_bool (splash_rc->channel, prop, value); -} - - -void -xfsm_splash_rc_write_list_entry (XfsmSplashRc *splash_rc, - const gchar *key, - gchar **value, - const gchar *delimiter) -{ - PROP_FROM_KEY(prop, key); - xfconf_channel_set_string_list (splash_rc->channel, prop, (gchar const **)value); -} - - -void -xfsm_splash_rc_free (XfsmSplashRc *splash_rc) -{ - g_object_unref (splash_rc->channel); - g_free (splash_rc); -} - - diff --git a/libxfsm/xfsm-splash-rc.h b/libxfsm/xfsm-splash-rc.h deleted file mode 100644 index 4dd21f9f..00000000 --- a/libxfsm/xfsm-splash-rc.h +++ /dev/null @@ -1,77 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifndef __XFSM_SPLASH_RC_H__ -#define __XFSM_SPLASH_RC_H__ - -#include <gmodule.h> -#include <xfconf/xfconf.h> -#include <libxfce4util/libxfce4util.h> - - -G_BEGIN_DECLS; - -typedef struct _XfsmSplashRc XfsmSplashRc; - - -G_MODULE_IMPORT -XfsmSplashRc *xfsm_splash_rc_new (XfconfChannel*channel); - -G_MODULE_IMPORT -gchar *xfsm_splash_rc_read_entry (XfsmSplashRc *splash_rc, - const gchar *key, - const gchar *fallback); -G_MODULE_IMPORT -gint xfsm_splash_rc_read_int_entry (XfsmSplashRc *splash_rc, - const gchar *key, - gint fallback); -G_MODULE_IMPORT -gboolean xfsm_splash_rc_read_bool_entry (XfsmSplashRc *splash_rc, - const gchar *key, - gboolean fallback); -G_MODULE_IMPORT -gchar **xfsm_splash_rc_read_list_entry (XfsmSplashRc *splash_rc, - const gchar *key, - const gchar *delimiter); -G_MODULE_IMPORT -void xfsm_splash_rc_write_entry (XfsmSplashRc *splash_rc, - const gchar *key, - const gchar *value); -G_MODULE_IMPORT -void xfsm_splash_rc_write_int_entry (XfsmSplashRc *splash_rc, - const gchar *key, - gint value); -G_MODULE_IMPORT -void xfsm_splash_rc_write_bool_entry (XfsmSplashRc *splash_rc, - const gchar *key, - gboolean value); -G_MODULE_IMPORT -void xfsm_splash_rc_write_list_entry (XfsmSplashRc *splash_rc, - const gchar *key, - gchar **value, - const gchar *delimiter); -void xfsm_splash_rc_free (XfsmSplashRc *splash_rc); - -G_END_DECLS; - - -#endif /* !__XFSM_SPLASH_RC_H__ */ - diff --git a/po/POTFILES.in b/po/POTFILES.in index 453edbca..8a891911 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -20,7 +20,6 @@ xfce4-session/xfsm-compat-kde.c xfce4-session/xfsm-dns.c xfce4-session/xfsm-manager.c xfce4-session/xfsm-logout-dialog.c -xfce4-session/xfsm-splash-screen.c xfce4-session/xfsm-startup.c xfce4-session/xfsm-shutdown.c xfce4-session-logout/main.c diff --git a/settings/Makefile.am b/settings/Makefile.am index f629b518..4c85c44e 100644 --- a/settings/Makefile.am +++ b/settings/Makefile.am @@ -2,10 +2,7 @@ bin_PROGRAMS = xfce4-session-settings xfce4_session_settings_SOURCES = \ main.c \ - module.c \ - module.h \ session-editor.c \ - splash-settings.c \ xfae-dialog.c \ xfae-dialog.h \ xfae-model.c \ @@ -23,7 +20,6 @@ xfce4_session_settings_SOURCES = \ xfce4_session_settings_CFLAGS = \ -DLOCALEDIR=\"$(localedir)\" \ - -DMODULESDIR=\"$(libdir)/xfce4/session/splash-engines\" \ -DG_LOG_DOMAIN=\"xfce4-session-settings\" \ -I$(top_srcdir) \ $(LIBXFCE4UTIL_CFLAGS) \ diff --git a/settings/main.c b/settings/main.c index 8786706b..cd488c7b 100644 --- a/settings/main.c +++ b/settings/main.c @@ -123,7 +123,6 @@ main(int argc, return EXIT_FAILURE; } - splash_settings_init(builder); session_editor_init(builder); /* FIXME: someday, glade-ify this, maybe. */ @@ -132,7 +131,7 @@ main(int argc, notebook = GTK_WIDGET(gtk_builder_get_object(builder, "plug-child")); lbl = gtk_label_new_with_mnemonic(_("App_lication Autostart")); gtk_widget_show(lbl); - gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), xfae_page, lbl, 2); + gtk_notebook_insert_page(GTK_NOTEBOOK(notebook), xfae_page, lbl, 1); channel = xfconf_channel_get(SETTINGS_CHANNEL); diff --git a/settings/module.c b/settings/module.c deleted file mode 100644 index 8b0dc3b3..00000000 --- a/settings/module.c +++ /dev/null @@ -1,281 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifdef HAVE_MEMORY_H -#include <memory.h> -#endif -#ifdef HAVE_STRING_H -#include <string.h> -#endif - -#include <gmodule.h> - -#include <libxfce4ui/libxfce4ui.h> - -#include <libxfsm/xfsm-splash-engine.h> -#include <libxfsm/xfsm-splash-rc.h> - -#include "module.h" - - -struct _Module -{ - gchar *engine; - GModule *handle; - XfsmSplashConfig config; -}; - - - -Module* -module_load (const gchar *path, - const gchar *channel_name) -{ - void (*init) (XfsmSplashConfig *config); - Module *module; - gchar property_base[512]; - XfconfChannel *channel; - gchar *dp; - gchar *sp; - - /* load module */ - module = g_new0 (Module, 1); -#if GLIB_CHECK_VERSION(2,4,0) - module->handle = g_module_open (path, G_MODULE_BIND_LOCAL); -#else - module->handle = g_module_open (path, 0); -#endif - if (G_UNLIKELY (module->handle == NULL)) - goto error0; - if (!g_module_symbol (module->handle, "config_init", (gpointer)&init)) - goto error1; - - /* determine engine name */ - sp = module->engine = g_path_get_basename (path); - if (sp[0] == 'l' && sp[1] == 'i' && sp[2] == 'b') - sp += 3; - for (dp = module->engine; *sp != '\0'; ++dp, ++sp) - { - if (*sp == '.') - break; - else - *dp = *sp; - } - *dp = '\0'; - - g_snprintf (property_base, sizeof (property_base), - "/splash/engines/%s", module->engine); - channel = xfconf_channel_new_with_property_base (channel_name, - property_base); - - /* initialize module */ - module->config.rc = xfsm_splash_rc_new (channel); - g_object_unref (channel); - init (&module->config); - if (G_UNLIKELY (module->config.name == NULL)) - { - module_free (module); - return NULL; - } - - /* succeed */ - return module; - -error1: - g_module_close (module->handle); -error0: - g_free (module); - return NULL; -} - - -const gchar* -module_engine (const Module *module) -{ - return module->engine; -} - - -const gchar* -module_name (const Module *module) -{ - return module->config.name; -} - - -const gchar* -module_descr (const Module *module) -{ - return module->config.description; -} - - -const gchar* -module_version (const Module *module) -{ - return module->config.version; -} - - -const gchar* -module_author (const Module *module) -{ - return module->config.author; -} - - -const gchar* -module_homepage (const Module *module) -{ - return module->config.homepage; -} - - -GdkPixbuf* -module_preview (Module *module) -{ - if (G_LIKELY (module->config.preview != NULL)) - return module->config.preview (&module->config); - else - return NULL; -} - - -gboolean -module_can_configure (const Module *module) -{ - return module->config.configure != NULL; -} - - -void -module_configure (Module *module, - GtkWidget *parent) -{ - if (G_LIKELY (module->config.configure != NULL)) - module->config.configure (&module->config, parent); -} - - -void -module_test (Module *module, - GdkDisplay *display) -{ - static char *steps[] = - { - "Starting the Window Manager", - "Starting the Desktop Manager", - "Starting the Taskbar", - "Starting the Panel", - NULL, - }; - - void (*init) (XfsmSplashEngine *engine); - XfsmSplashEngine engine; - GdkScreen *screen; - guint id; - int monitor; - int step; - - /* properly initialize the engine struct with zeros! */ - bzero (&engine, sizeof (engine)); - - /* locate monitor with pointer */ - screen = xfce_gdk_screen_get_active (&monitor); - if (G_UNLIKELY (screen == NULL) || (gdk_screen_get_display(screen) != display)) - { - screen = gdk_display_get_default_screen (display); - monitor = 0; - } - - /* initialize engine struct */ - engine.display = display; - engine.primary_screen = screen; - engine.primary_monitor = monitor; - - /* load and setup the engine */ - if (g_module_symbol (module->handle, "engine_init", (gpointer)&init)) - { - init (&engine); - - if (G_LIKELY (engine.setup != NULL)) - { - engine.setup (&engine, module->config.rc); - gdk_flush (); - } - - if (G_LIKELY (engine.start != NULL)) - { - engine.start (&engine, "Default", NULL, 4); - gdk_flush (); - } - - if (G_LIKELY (engine.next != NULL)) - { - for (step = 0; steps[step] != NULL; ++step) - { - engine.next (&engine, steps[step]); - id = g_timeout_add (1000, (GSourceFunc) gtk_main_quit, NULL); - gtk_main (); - g_source_remove (id); - } - } - - if (G_LIKELY (engine.destroy != NULL)) - engine.destroy (&engine); - } -} - - -void -module_free (Module *module) -{ - if (G_LIKELY (module->config.destroy != NULL)) - module->config.destroy (&module->config); - - if (G_LIKELY (module->config.name != NULL)) - g_free (module->config.name); - - if (G_LIKELY (module->config.description != NULL)) - g_free (module->config.description); - - if (G_LIKELY (module->config.version != NULL)) - g_free (module->config.version); - - if (G_LIKELY (module->config.author != NULL)) - g_free (module->config.author); - - if (G_LIKELY (module->config.homepage != NULL)) - g_free (module->config.homepage); - - xfsm_splash_rc_free (module->config.rc); - g_module_close (module->handle); - g_free (module->engine); - g_free (module); -} - - - - diff --git a/settings/module.h b/settings/module.h deleted file mode 100644 index c2a6e29e..00000000 --- a/settings/module.h +++ /dev/null @@ -1,67 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifndef __MODULE_H__ -#define __MODULE_H__ - -#include <gtk/gtk.h> - -#include <libxfce4util/libxfce4util.h> - - -G_BEGIN_DECLS; - -#define MODULE(obj) ((Module *)(obj)) - -typedef struct _Module Module; - - -Module *module_load (const gchar *path, - const gchar *channel_name); - -const gchar *module_engine (const Module *module); - -const gchar *module_name (const Module *module); - -const gchar *module_descr (const Module *module); - -const gchar *module_version (const Module *module); - -const gchar *module_author (const Module *module); - -const gchar *module_homepage (const Module *module); - -GdkPixbuf *module_preview (Module *module); - -gboolean module_can_configure (const Module *module); - -void module_configure (Module *module, - GtkWidget *parent); - -void module_test (Module *module, - GdkDisplay *display); - -void module_free (Module *module); - -G_END_DECLS; - - -#endif /* !__XFSM_SPLASH_MODULE_H__ */ diff --git a/settings/splash-settings.c b/settings/splash-settings.c deleted file mode 100644 index 4892cf82..00000000 --- a/settings/splash-settings.c +++ /dev/null @@ -1,428 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2006 Benedikt Meurer <benny@xfce.org> - * Copyright (c) 2008 Jannis Pohlmann <jannis@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifdef HAVE_MEMORY_H -#include <memory.h> -#endif -#ifndef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#ifdef XFCE_DISABLE_DEPRECATED -#undef XFCE_DISABLE_DEPRECATED -#endif - -#include <xfconf/xfconf.h> - -#include <gdk-pixbuf/gdk-pixdata.h> -#include <gmodule.h> -#include <gtk/gtk.h> - -#include <libxfce4ui/libxfce4ui.h> - -#include <libxfsm/xfsm-util.h> -#include <libxfsm/xfsm-splash-engine.h> - -#include "module.h" -#include "xfce4-session-settings-common.h" - -#define SPLASH_ENGINE_PROP "/splash/Engine" - -/* - Prototypes - */ -static void splash_selection_changed (GtkTreeSelection *selection); - - -/* - Declarations - */ -enum -{ - COLUMN_NAME, - COLUMN_MODULE, - N_COLUMNS, -}; - - -/* - Global variables - */ -static GList *modules = NULL; -static XfceRc *modules_rc = NULL; -static gboolean kiosk_can_splash = FALSE; -static gboolean splash_centered; -static GtkWidget *splash_dialog = NULL; -static GtkWidget *splash_treeview; -static GtkWidget *splash_button_cfg; -static GtkWidget *splash_button_test; -static GtkWidget *splash_image; -static GtkWidget *splash_descr0; -static GtkWidget *splash_descr1; -static GtkWidget *splash_version0; -static GtkWidget *splash_version1; -static GtkWidget *splash_author0; -static GtkWidget *splash_author1; -static GtkWidget *splash_www0; -static GtkWidget *splash_www1; - - -/* - Module loading/unloading - */ -static void -splash_load_modules (void) -{ - const gchar *entry; - Module *module; - gchar *file; - GDir *dir; - - modules_rc = xfce_rc_config_open (XFCE_RESOURCE_CONFIG, - "xfce4-session/xfce4-splash.rc", - FALSE); - - dir = g_dir_open (MODULESDIR, 0, NULL); - if (G_LIKELY (dir != NULL)) - { - while ((entry = g_dir_read_name (dir)) != NULL) - { - if (*entry == '\0' || *entry == '.') - continue; - - if (!g_str_has_suffix (entry, "." G_MODULE_SUFFIX)) - continue; - - file = g_strconcat (MODULESDIR, G_DIR_SEPARATOR_S, entry, NULL); - module = module_load (file, SETTINGS_CHANNEL); - if (G_LIKELY (module != NULL)) - modules = g_list_append (modules, module); - g_free (file); - } - - g_dir_close (dir); - } -} - - -static void -splash_unload_modules (void) -{ - GList *lp; - - if (G_LIKELY (modules != NULL)) - { - for (lp = modules; lp != NULL; lp = lp->next) - module_free (MODULE (lp->data)); - g_list_free (modules); - modules = NULL; - } - - if (G_LIKELY (modules_rc != NULL)) - { - xfce_rc_close (modules_rc); - modules_rc = NULL; - } -} - - -static void -splash_configure (void) -{ - GtkTreeSelection *selection; - GtkTreeModel *model; - GtkTreeIter iter; - Module *module; - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (splash_treeview)); - if (gtk_tree_selection_get_selected (selection, &model, &iter)) - { - gtk_tree_model_get (model, &iter, COLUMN_MODULE, &module, -1); - module_configure (module, splash_dialog); - splash_selection_changed (selection); - xfce_rc_flush (modules_rc); - } -} - - -static void -splash_test (void) -{ - GtkTreeSelection *selection; - GtkTreeModel *model; - GtkTreeIter iter; - Module *module; - - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (splash_treeview)); - if (gtk_tree_selection_get_selected (selection, &model, &iter)) - { - gtk_tree_model_get (model, &iter, COLUMN_MODULE, &module, -1); - gtk_widget_set_sensitive (splash_dialog, FALSE); - module_test (module, gtk_widget_get_display (splash_dialog)); - gtk_widget_set_sensitive (splash_dialog, TRUE); - } -} - - -static void -splash_selection_changed (GtkTreeSelection *selection) -{ - XfconfChannel *channel; - GtkTreeModel *model; - GtkTreeIter iter; - const gchar *str; - GdkPixbuf *preview; - Module *module; - - if (gtk_tree_selection_get_selected (selection, &model, &iter)) - { - gtk_tree_model_get (model, &iter, COLUMN_MODULE, &module, -1); - - if (module != NULL) - { - str = module_descr (module); - if (G_LIKELY (str != NULL)) - { - gtk_label_set_text (GTK_LABEL (splash_descr1), str); - gtk_widget_show (splash_descr0); - gtk_widget_show (splash_descr1); - } - else - { - gtk_widget_hide (splash_descr0); - gtk_widget_hide (splash_descr1); - } - gtk_widget_set_sensitive (splash_descr1, TRUE); - - str = module_version (module); - if (G_LIKELY (str != NULL)) - { - gtk_label_set_text (GTK_LABEL (splash_version1), str); - gtk_widget_show (splash_version0); - gtk_widget_show (splash_version1); - } - else - { - gtk_widget_hide (splash_version0); - gtk_widget_hide (splash_version1); - } - gtk_widget_set_sensitive (splash_version1, TRUE); - - str = module_author (module); - if (G_LIKELY (str != NULL)) - { - gtk_label_set_text (GTK_LABEL (splash_author1), str); - gtk_widget_show (splash_author0); - gtk_widget_show (splash_author1); - } - else - { - gtk_widget_hide (splash_author0); - gtk_widget_hide (splash_author1); - } - gtk_widget_set_sensitive (splash_author1, TRUE); - - str = module_homepage (module); - if (G_LIKELY (str != NULL)) - { - gtk_label_set_text (GTK_LABEL (splash_www1), str); - gtk_widget_show (splash_www0); - gtk_widget_show (splash_www1); - } - else - { - gtk_widget_hide (splash_www0); - gtk_widget_hide (splash_www1); - } - gtk_widget_set_sensitive (splash_www1, TRUE); - - preview = module_preview (module); - if (G_LIKELY (preview != NULL)) - { - gtk_image_set_from_pixbuf (GTK_IMAGE (splash_image), preview); - g_object_unref (G_OBJECT (preview)); - } - else - { - gtk_image_set_from_icon_name (GTK_IMAGE (splash_image), - "image-missing", - GTK_ICON_SIZE_DIALOG); - } - - channel = xfconf_channel_get (SETTINGS_CHANNEL); - xfconf_channel_set_string (channel, SPLASH_ENGINE_PROP, module_engine (module)); - - gtk_widget_set_sensitive (splash_button_cfg, kiosk_can_splash - && module_can_configure (module)); - gtk_widget_set_sensitive (splash_button_test, TRUE); - } - else - { - gtk_image_set_from_icon_name (GTK_IMAGE (splash_image), - "image-missing", - GTK_ICON_SIZE_DIALOG); - - gtk_label_set_text (GTK_LABEL (splash_descr1), _("None")); - gtk_widget_set_sensitive (splash_descr1, FALSE); - - gtk_label_set_text (GTK_LABEL (splash_version1), _("None")); - gtk_widget_set_sensitive (splash_version1, FALSE); - - gtk_label_set_text (GTK_LABEL (splash_author1), _("None")); - gtk_widget_set_sensitive (splash_author1, FALSE); - - gtk_label_set_text (GTK_LABEL (splash_www1), _("None")); - gtk_widget_set_sensitive (splash_www1, FALSE); - - gtk_widget_set_sensitive (splash_button_cfg, FALSE); - gtk_widget_set_sensitive (splash_button_test, FALSE); - - channel = xfconf_channel_get (SETTINGS_CHANNEL); - xfconf_channel_set_string (channel, SPLASH_ENGINE_PROP, ""); - } - } - - /* centering must be delayed! */ - if (!splash_centered) - { - xfce_gtk_window_center_on_active_screen(GTK_WINDOW(splash_dialog)); - splash_centered = TRUE; - } -} - - -static void -splash_dialog_destroy (GtkWidget *widget, - gpointer user_data) -{ - splash_unload_modules (); -} - - -void -splash_settings_init (GtkBuilder *builder) -{ - XfconfChannel *channel; - GtkTreeSelection *selection; - GtkTreeViewColumn *column; - GtkCellRenderer *renderer; - GtkListStore *store; - gchar *engine; - GtkTreePath *path; - GtkTreeIter iter; - XfceKiosk *kiosk; - GList *lp; - - /* load splash modules */ - splash_load_modules (); - - /* query kiosk settings */ - kiosk = xfce_kiosk_new ("xfce4-session"); - kiosk_can_splash = xfce_kiosk_query (kiosk, "Splash") || xfce_kiosk_query (kiosk, "CustomizeSplash"); - xfce_kiosk_free (kiosk); - - /* load config */ - channel = xfconf_channel_get (SETTINGS_CHANNEL); - engine = xfconf_channel_get_string (channel, SPLASH_ENGINE_PROP, ""); - - store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER); - gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, - COLUMN_NAME, _("None"), - COLUMN_MODULE, NULL, - -1); - path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter); - - for (lp = modules; lp != NULL; lp = lp->next) - { - gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, - COLUMN_NAME, module_name (MODULE (lp->data)), - COLUMN_MODULE, MODULE (lp->data), - -1); - - if (strcmp (module_engine (MODULE (lp->data)), engine) == 0) - { - gtk_tree_path_free (path); - path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter); - } - } - - g_free (engine); - - splash_centered = FALSE; - - splash_treeview = GTK_WIDGET(gtk_builder_get_object (builder, "treeview_splash")); - gtk_tree_view_set_model (GTK_TREE_VIEW (splash_treeview), GTK_TREE_MODEL (store)); - g_object_unref (G_OBJECT (store)); - - /* FIXME: this won't work right when we embed */ - splash_dialog = gtk_widget_get_toplevel (splash_treeview); - g_signal_connect (G_OBJECT (splash_dialog), "destroy", - G_CALLBACK (splash_dialog_destroy), NULL); - - /* add tree view column */ - column = gtk_tree_view_column_new (); - renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_column_pack_start (column, renderer, FALSE); - gtk_tree_view_column_set_attributes (column, renderer, - "text", COLUMN_NAME, - NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (splash_treeview), column); - - splash_button_cfg = GTK_WIDGET(gtk_builder_get_object (builder, "btn_splash_configure")); - g_signal_connect (G_OBJECT (splash_button_cfg), "clicked", - splash_configure, NULL); - - splash_button_test = GTK_WIDGET(gtk_builder_get_object (builder, "btn_splash_test")); - g_signal_connect (G_OBJECT (splash_button_test), "clicked", - splash_test, NULL); - - splash_image = GTK_WIDGET(gtk_builder_get_object (builder, "img_splash_preview")); - gtk_widget_set_size_request (splash_image, 300, 240); - - splash_descr0 = GTK_WIDGET(gtk_builder_get_object (builder, "lbl_splash_desc0")); - splash_version0 =GTK_WIDGET(gtk_builder_get_object (builder, "lbl_splash_version0")); - splash_author0 = GTK_WIDGET(gtk_builder_get_object (builder, "lbl_splash_author0")); - splash_www0 = GTK_WIDGET(gtk_builder_get_object (builder, "lbl_splash_homepage0")); - splash_descr1 = GTK_WIDGET(gtk_builder_get_object (builder, "lbl_splash_desc1")); - splash_version1 = GTK_WIDGET(gtk_builder_get_object (builder, "lbl_splash_version1")); - splash_author1 = GTK_WIDGET(gtk_builder_get_object (builder, "lbl_splash_author1")); - splash_www1 = GTK_WIDGET(gtk_builder_get_object (builder, "lbl_splash_homepage1")); - - /* handle selection */ - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (splash_treeview)); - gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); - g_signal_connect (G_OBJECT (selection), "changed", - G_CALLBACK (splash_selection_changed), NULL); - gtk_tree_view_set_cursor (GTK_TREE_VIEW (splash_treeview), path, NULL, FALSE); - gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (splash_treeview), path, NULL, - TRUE, 0.5, 0.0); - gtk_tree_path_free (path); -} diff --git a/settings/xfce-session-settings.desktop.in b/settings/xfce-session-settings.desktop.in index 9c4dced3..1c1c3768 100644 --- a/settings/xfce-session-settings.desktop.in +++ b/settings/xfce-session-settings.desktop.in @@ -1,6 +1,6 @@ [Desktop Entry] _Name=Session and Startup -_Comment=Customize desktop startup and splash screen +_Comment=Customize desktop startup Exec=xfce4-session-settings Icon=xfce4-session Terminal=false diff --git a/settings/xfce4-session-settings-common.h b/settings/xfce4-session-settings-common.h index 03623be9..3c1a11db 100644 --- a/settings/xfce4-session-settings-common.h +++ b/settings/xfce4-session-settings-common.h @@ -21,7 +21,6 @@ #define SETTINGS_CHANNEL "xfce4-session" -void splash_settings_init(GtkBuilder *builder); void session_editor_init(GtkBuilder *builder); #endif diff --git a/settings/xfce4-session-settings.ui b/settings/xfce4-session-settings.ui index f33536c5..307bfadf 100644 --- a/settings/xfce4-session-settings.ui +++ b/settings/xfce4-session-settings.ui @@ -56,7 +56,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="pack_type">end</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> <child> @@ -201,329 +201,6 @@ </packing> </child> <child> - <object class="GtkBox" id="hbox2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="border_width">12</property> - <property name="spacing">12</property> - <child> - <object class="GtkBox" id="vbox6"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkScrolledWindow" id="scrolledwindow2"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="shadow_type">etched-in</property> - <child> - <object class="GtkTreeView" id="treeview_splash"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="headers_visible">False</property> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="treeview-selection1"/> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="btn_splash_configure"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Opens the configuration panel for the selected splash screen</property> - <child> - <object class="GtkBox" id="hbox3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">4</property> - <child> - <object class="GtkImage" id="image2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="stock">gtk-preferences</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label11"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Con_figure</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">btn_splash_configure</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="btn_splash_test"> - <property name="use_action_appearance">False</property> - <property name="visible">True</property> - <property name="sensitive">False</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes">Demonstrates the selected splash screen</property> - <child> - <object class="GtkBox" id="hbox4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">4</property> - <child> - <object class="GtkImage" id="image3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">1</property> - <property name="stock">gtk-execute</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label12"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Test</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">btn_splash_test</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkBox" id="vbox7"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkImage" id="img_splash_preview"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="stock">gtk-missing-image</property> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkFrame" id="frame5"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label_xalign">0</property> - <child> - <object class="GtkAlignment" id="alignment6"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="bottom_padding">4</property> - <property name="left_padding">12</property> - <child> - <object class="GtkGrid" id="table1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="row_spacing">2</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel" id="lbl_splash_desc0"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Description:</b></property> - <property name="use_markup">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="lbl_splash_homepage1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">label</property> - <property name="selectable">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="lbl_splash_desc1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">label</property> - <property name="selectable">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="lbl_splash_version0"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Version:</b></property> - <property name="use_markup">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="lbl_splash_version1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">label</property> - <property name="selectable">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="lbl_splash_author0"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Author:</b></property> - <property name="use_markup">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="lbl_splash_author1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">label</property> - <property name="selectable">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="lbl_splash_homepage0"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Homepage:</b></property> - <property name="use_markup">True</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - </packing> - </child> - </object> - </child> - </object> - </child> - <child type="label"> - <object class="GtkLabel" id="label13"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes"><b>Information</b></property> - <property name="use_markup">True</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child type="tab"> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">S_plash</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="position">1</property> - <property name="tab_fill">False</property> - </packing> - </child> - <child> <object class="GtkBox" id="vbox8"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -751,7 +428,7 @@ </child> </object> <packing> - <property name="position">2</property> + <property name="position">1</property> </packing> </child> <child type="tab"> @@ -762,7 +439,7 @@ <property name="use_underline">True</property> </object> <packing> - <property name="position">2</property> + <property name="position">1</property> <property name="tab_fill">False</property> </packing> </child> @@ -932,7 +609,7 @@ </child> </object> <packing> - <property name="position">3</property> + <property name="position">2</property> </packing> </child> <child type="tab"> @@ -943,15 +620,21 @@ <property name="use_underline">True</property> </object> <packing> - <property name="position">3</property> + <property name="position">2</property> <property name="tab_fill">False</property> </packing> </child> + <child> + <placeholder/> + </child> + <child type="tab"> + <placeholder/> + </child> </object> <packing> <property name="expand">True</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">0</property> </packing> </child> </object> diff --git a/settings/xfce4-session.xml b/settings/xfce4-session.xml index a1c87bdd..acb5afe3 100644 --- a/settings/xfce4-session.xml +++ b/settings/xfce4-session.xml @@ -32,7 +32,4 @@ <property name="Client4_PerScreen" type="bool" value="false"/> </property> </property> - <property name="splash" type="empty"> - <property name="Engine" type="string" value=""/> - </property> </channel> diff --git a/xfce4-session/Makefile.am b/xfce4-session/Makefile.am index 3ea31c1a..b4a0ddf6 100644 --- a/xfce4-session/Makefile.am +++ b/xfce4-session/Makefile.am @@ -63,8 +63,6 @@ xfce4_session_SOURCES = \ xfsm-shutdown-fallback.h \ xfsm-shutdown.c \ xfsm-shutdown.h \ - xfsm-splash-screen.c \ - xfsm-splash-screen.h \ xfsm-startup.c \ xfsm-startup.h \ xfce-screensaver.c \ diff --git a/xfce4-session/main.c b/xfce4-session/main.c index 3d124e47..8afdb452 100644 --- a/xfce4-session/main.c +++ b/xfce4-session/main.c @@ -137,14 +137,6 @@ init_display (XfsmManager *manager, GdkDisplay *dpy, gboolean disable_tcp) { - gchar *engine; - - engine = xfconf_channel_get_string (channel, "/splash/Engine", "mice"); - - splash_screen = xfsm_splash_screen_new (dpy, engine); - g_free (engine); - xfsm_splash_screen_next (splash_screen, _("Loading desktop settings")); - gdk_flush (); sm_init (channel, disable_tcp, manager); @@ -195,12 +187,10 @@ bus_acquired (GDBusConnection *connection, if (!opt_disable_tcp && xfconf_channel_get_bool (channel, "/security/EnableTcp", FALSE)) { - /* verify that the DNS settings are ok */ - xfsm_splash_screen_next (splash_screen, _("Verifying DNS settings")); + /* verify that the DNS settings are ok */ xfsm_dns_check (); } - xfsm_splash_screen_next (splash_screen, _("Loading session data")); xfsm_startup_init (channel); xfsm_manager_load (manager, channel); diff --git a/xfce4-session/xfsm-chooser.c b/xfce4-session/xfsm-chooser.c index 948cfcf3..82bab8f1 100644 --- a/xfce4-session/xfsm-chooser.c +++ b/xfce4-session/xfsm-chooser.c @@ -36,7 +36,6 @@ #include <libxfce4util/libxfce4util.h> #include <libxfce4ui/libxfce4ui.h> -#include <libxfsm/xfsm-splash-engine.h> #include <libxfsm/xfsm-util.h> #include <xfce4-session/xfsm-chooser.h> @@ -146,6 +145,8 @@ xfsm_chooser_init (XfsmChooser *chooser) GtkListStore *model; GtkWidget *button; GtkWidget *swin; + GtkWidget *vbox; + GtkWidget *label; GtkWidget *dbox; dbox = gtk_dialog_get_content_area(GTK_DIALOG (chooser)); @@ -153,6 +154,12 @@ xfsm_chooser_init (XfsmChooser *chooser) g_signal_connect_after (G_OBJECT (chooser), "realize", G_CALLBACK (xfsm_chooser_realized), chooser); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); + gtk_widget_set_margin_bottom (vbox, 6); + gtk_box_pack_start (GTK_BOX (dbox), vbox, TRUE, TRUE, 0); + label = gtk_label_new (_("Choose session")); + gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0); + /* scrolled window */ swin = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin), @@ -160,8 +167,11 @@ xfsm_chooser_init (XfsmChooser *chooser) GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin), GTK_SHADOW_ETCHED_IN); - gtk_box_pack_start (GTK_BOX (dbox), swin, TRUE, TRUE, 0); - gtk_widget_show (swin); + gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (swin), + 200); + gtk_box_pack_start (GTK_BOX (vbox), swin, TRUE, TRUE, 0); + + gtk_widget_show_all (vbox); /* tree view */ model = gtk_list_store_new (N_COLUMNS, @@ -235,4 +245,3 @@ xfsm_chooser_realized (GtkWidget *widget, gdk_window_set_cursor (gtk_widget_get_window(widget), cursor); g_object_unref (cursor); } - diff --git a/xfce4-session/xfsm-chooser.h b/xfce4-session/xfsm-chooser.h index e75f60a2..e8bb9565 100644 --- a/xfce4-session/xfsm-chooser.h +++ b/xfce4-session/xfsm-chooser.h @@ -37,6 +37,7 @@ G_BEGIN_DECLS; typedef struct _XfsmChooser XfsmChooser; typedef struct _XfsmChooserClass XfsmChooserClass; +typedef struct _XfsmSessionInfo XfsmSessionInfo; struct _XfsmChooserClass { @@ -50,6 +51,13 @@ struct _XfsmChooser GtkWidget *tree; }; +struct _XfsmSessionInfo +{ + gchar *name; /* name of the session */ + time_t atime; /* last access time */ + GdkPixbuf *preview; /* preview icon (52x42) */ +}; + GType xfsm_chooser_get_type (void) G_GNUC_CONST; void xfsm_chooser_set_sessions (XfsmChooser *chooser, diff --git a/xfce4-session/xfsm-compat-gnome.c b/xfce4-session/xfsm-compat-gnome.c index 8734fb9b..9b0c4137 100644 --- a/xfce4-session/xfsm-compat-gnome.c +++ b/xfce4-session/xfsm-compat-gnome.c @@ -243,7 +243,7 @@ xfsm_compat_gnome_smproxy_shutdown (void) void -xfsm_compat_gnome_startup (XfsmSplashScreen *splash) +xfsm_compat_gnome_startup () { if (G_UNLIKELY (gnome_compat_started)) return; @@ -251,8 +251,6 @@ xfsm_compat_gnome_startup (XfsmSplashScreen *splash) xfsm_compat_gnome_smproxy_startup (); /* fire up the keyring daemon */ - if (G_LIKELY (splash != NULL)) - xfsm_splash_screen_next (splash, _("Starting The Gnome Keyring Daemon")); gnome_keyring_daemon_startup (); gnome_compat_started = TRUE; @@ -272,4 +270,3 @@ xfsm_compat_gnome_shutdown (void) gnome_compat_started = FALSE; } - diff --git a/xfce4-session/xfsm-compat-gnome.h b/xfce4-session/xfsm-compat-gnome.h index b404ec1e..4c8b2cfc 100644 --- a/xfce4-session/xfsm-compat-gnome.h +++ b/xfce4-session/xfsm-compat-gnome.h @@ -24,9 +24,7 @@ #ifndef __XFSM_COMPAT_GNOME_H__ #define __XFSM_COMPAT_GNOME_H__ -#include <xfce4-session/xfsm-splash-screen.h> - -void xfsm_compat_gnome_startup (XfsmSplashScreen *splash); +void xfsm_compat_gnome_startup (); void xfsm_compat_gnome_shutdown (void); #endif /* !__XFSM_COMPAT_GNOME_H__ */ diff --git a/xfce4-session/xfsm-compat-kde.c b/xfce4-session/xfsm-compat-kde.c index 6b6f2f40..877dc7df 100644 --- a/xfce4-session/xfsm-compat-kde.c +++ b/xfce4-session/xfsm-compat-kde.c @@ -43,6 +43,7 @@ #include <unistd.h> #endif +#include <gtk/gtk.h> #include <gdk/gdkx.h> #include <libxfce4util/libxfce4util.h> @@ -115,16 +116,13 @@ run (const gchar *command) void -xfsm_compat_kde_startup (XfsmSplashScreen *splash) +xfsm_compat_kde_startup () { gchar command[256]; if (G_UNLIKELY (kde_compat_started)) return; - if (G_LIKELY (splash != NULL)) - xfsm_splash_screen_next (splash, _("Starting KDE services")); - run ("kdeinit4"); /* tell klauncher about the session manager */ @@ -156,4 +154,3 @@ xfsm_compat_kde_shutdown (void) kde_compat_started = FALSE; } - diff --git a/xfce4-session/xfsm-compat-kde.h b/xfce4-session/xfsm-compat-kde.h index 1e60de48..8a0d3e32 100644 --- a/xfce4-session/xfsm-compat-kde.h +++ b/xfce4-session/xfsm-compat-kde.h @@ -22,10 +22,8 @@ #ifndef __XFSM_COMPAT_KDE_H__ #define __XFSM_COMPAT_KDE_H__ -#include <xfce4-session/xfsm-splash-screen.h> - -void xfsm_compat_kde_startup (XfsmSplashScreen *splash); +void xfsm_compat_kde_startup (); void xfsm_compat_kde_shutdown (void); #endif /* !__XFSM_COMPAT_KDE_H__ */ diff --git a/xfce4-session/xfsm-dns.c b/xfce4-session/xfsm-dns.c index 3363b9f4..6e62d7ba 100644 --- a/xfce4-session/xfsm-dns.c +++ b/xfce4-session/xfsm-dns.c @@ -167,7 +167,7 @@ xfsm_dns_check (void) gtk_dialog_set_default_response (GTK_DIALOG (msgbox), RESPONSE_TRY_AGAIN); - response = xfsm_splash_screen_run (splash_screen, msgbox); + response = gtk_dialog_run (GTK_DIALOG (msgbox)); if (response != RESPONSE_TRY_AGAIN) break; @@ -177,5 +177,3 @@ xfsm_dns_check (void) if (msgbox != NULL) gtk_widget_destroy (msgbox); } - - diff --git a/xfce4-session/xfsm-global.c b/xfce4-session/xfsm-global.c index 6aa8ef60..bbaf7844 100644 --- a/xfce4-session/xfsm-global.c +++ b/xfce4-session/xfsm-global.c @@ -58,7 +58,6 @@ /* global variables */ gboolean verbose = FALSE; -XfsmSplashScreen *splash_screen = NULL; void xfsm_failsafe_client_free (FailsafeClient *fclient) diff --git a/xfce4-session/xfsm-global.h b/xfce4-session/xfsm-global.h index 3adeba83..78131bc7 100644 --- a/xfce4-session/xfsm-global.h +++ b/xfce4-session/xfsm-global.h @@ -23,10 +23,9 @@ #define __XFSM_GLOBAL_H__ #include <glib.h> - +#include <gdk/gdkx.h> #include <X11/SM/SMlib.h> -#include <xfce4-session/xfsm-splash-screen.h> #include <xfce4-session/xfsm-shutdown.h> /* XfsmShutdownType */ #include "settings/xfae-model.h" /* XfsmRunHook */ @@ -45,8 +44,6 @@ void xfsm_failsafe_client_free (FailsafeClient *fclient); extern gboolean verbose; -extern XfsmSplashScreen *splash_screen; - #if defined(G_HAVE_ISO_VARARGS) diff --git a/xfce4-session/xfsm-manager.c b/xfce4-session/xfsm-manager.c index 2419aab9..e847eea4 100644 --- a/xfce4-session/xfsm-manager.c +++ b/xfce4-session/xfsm-manager.c @@ -53,7 +53,6 @@ #include <libxfce4ui/libxfce4ui.h> -#include <libxfsm/xfsm-splash-engine.h> #include <libxfsm/xfsm-util.h> #include <xfce4-session/xfsm-manager-dbus.h> @@ -135,6 +134,9 @@ enum static guint manager_signals[LAST_SIGNAL] = { 0, }; +int xfsm_splash_screen_choose (GList *sessions, + const gchar *default_session, + gchar **name_return); static void xfsm_manager_finalize (GObject *obj); static gboolean xfsm_manager_startup (XfsmManager *manager); @@ -473,7 +475,7 @@ xfsm_manager_choose_session (XfsmManager *manager, if (sessions != NULL) { - result = xfsm_splash_screen_choose (splash_screen, sessions, + result = xfsm_splash_screen_choose (sessions, manager->session_name, &name); if (result == XFSM_CHOOSE_LOGOUT) @@ -643,6 +645,118 @@ xfsm_manager_load_failsafe (XfsmManager *manager, } +int +xfsm_splash_screen_choose (GList *sessions, + const gchar *default_session, + gchar **name_return) +{ + GdkDisplay *display; + GdkScreen *screen; + int monitor; + GtkWidget *chooser; + GtkWidget *label; + GtkWidget *dialog; + GtkWidget *entry; + gchar title[256]; + int result; + + g_assert (default_session != NULL); + + +again: + display = gdk_display_get_default (); + screen = xfce_gdk_screen_get_active (&monitor); + + if (G_UNLIKELY (screen == NULL)) + { + screen = gdk_display_get_default_screen (display); + monitor = 0; + } + + chooser = g_object_new (XFSM_TYPE_CHOOSER, + "type", GTK_WINDOW_POPUP, + NULL); + xfsm_window_add_border (GTK_WINDOW (chooser)); + xfsm_chooser_set_sessions (XFSM_CHOOSER (chooser), + sessions, default_session); + gtk_window_set_screen (GTK_WINDOW (chooser), screen); + gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_CENTER); + result = gtk_dialog_run (GTK_DIALOG (chooser)); + + if (result == XFSM_RESPONSE_LOAD) + { + if (name_return != NULL) + *name_return = xfsm_chooser_get_session (XFSM_CHOOSER (chooser)); + result = XFSM_CHOOSE_LOAD; + } + else if (result == XFSM_RESPONSE_NEW) + { + result = XFSM_CHOOSE_NEW; + } + else + { + result = XFSM_CHOOSE_LOGOUT; + } + + gtk_widget_destroy (chooser); + + if (result == XFSM_CHOOSE_NEW) + { + dialog = gtk_dialog_new_with_buttons (NULL, + NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + _("_Cancel"), + GTK_RESPONSE_CANCEL, + _("_OK"), + GTK_RESPONSE_OK, + NULL); + gtk_dialog_set_default_response (GTK_DIALOG (dialog), + GTK_RESPONSE_OK); + gtk_window_set_screen (GTK_WINDOW (dialog), screen); + gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); + g_snprintf (title, 256, "<big>%s</big>", + _("Choose a name for the new session:")); + label = gtk_label_new (title); + gtk_label_set_use_markup (GTK_LABEL (label), TRUE); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + label, TRUE, TRUE, 6); + gtk_widget_show (label); + + entry = gtk_entry_new (); + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), + entry, TRUE, TRUE, 6); + gtk_widget_show (entry); + + xfsm_window_add_border (GTK_WINDOW (dialog)); + +again1: + result = gtk_dialog_run (GTK_DIALOG (dialog)); + + if (result != GTK_RESPONSE_OK) + { + gtk_widget_destroy (dialog); + goto again; + } + + if (name_return != NULL) + { + *name_return = gtk_editable_get_chars (GTK_EDITABLE (entry), + 0, -1); + if (strlen (*name_return) == 0) + { + g_free (*name_return); + goto again1; + } + } + + gtk_widget_destroy (dialog); + result = XFSM_CHOOSE_NEW; + } + + return result; +} + + static void xfsm_manager_load_settings (XfsmManager *manager, XfconfChannel *channel) @@ -673,12 +787,6 @@ xfsm_manager_load_settings (XfsmManager *manager, if (!xfsm_manager_load_failsafe (manager, channel, &errorstr)) { - if (G_LIKELY (splash_screen != NULL)) - { - xfsm_splash_screen_free (splash_screen); - splash_screen = NULL; - } - /* FIXME: migrate this into the splash screen somehow so the * window doesn't look ugly (right now no WM is running, so it * won't have window decorations). */ @@ -731,27 +839,11 @@ xfsm_manager_load (XfsmManager *manager, gboolean xfsm_manager_restart (XfsmManager *manager) { - GdkPixbuf *preview; - unsigned steps; - g_assert (manager->session_name != NULL); /* setup legacy application handling */ xfsm_legacy_init (); - /* tell splash screen that the session is starting now */ - preview = xfsm_load_session_preview (manager->session_name); - if (preview == NULL) - { - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - /* TODO: Turn this into a normal pixbuf? */ - preview = gdk_pixbuf_new_from_inline (-1, xfsm_chooser_icon_data, FALSE, NULL); - G_GNUC_END_IGNORE_DEPRECATIONS - } - steps = g_queue_get_length (manager->failsafe_mode ? manager->failsafe_clients : manager->pending_properties); - xfsm_splash_screen_start (splash_screen, manager->session_name, preview, steps); - g_object_unref (preview); - g_idle_add ((GSourceFunc) xfsm_manager_startup, manager); return TRUE; diff --git a/xfce4-session/xfsm-manager.h b/xfce4-session/xfsm-manager.h index 8918175a..0691a0e9 100644 --- a/xfce4-session/xfsm-manager.h +++ b/xfce4-session/xfsm-manager.h @@ -42,6 +42,9 @@ G_BEGIN_DECLS #define SAVE_TIMEOUT ( 60 * 1000) #define STARTUP_TIMEOUT ( 8 * 1000) #define RESTART_RESET_TIMEOUT (5 * 60 * 1000) +#define XFSM_CHOOSE_LOGOUT 0 +#define XFSM_CHOOSE_LOAD 1 +#define XFSM_CHOOSE_NEW 2 typedef enum { diff --git a/xfce4-session/xfsm-splash-screen.c b/xfce4-session/xfsm-splash-screen.c deleted file mode 100644 index 60ba68cc..00000000 --- a/xfce4-session/xfsm-splash-screen.c +++ /dev/null @@ -1,305 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2006 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#ifdef HAVE_STRING_H -#include <string.h> -#endif - -#include <gmodule.h> - -#include <xfconf/xfconf.h> -#include <libxfce4util/libxfce4util.h> -#include <libxfce4ui/libxfce4ui.h> - -#include <libxfsm/xfsm-splash-engine.h> -#include <libxfsm/xfsm-util.h> - -#include <xfce4-session/xfsm-chooser.h> -#include <xfce4-session/xfsm-splash-screen.h> - - -struct _XfsmSplashScreen -{ - XfsmSplashEngine engine; - GModule *module; -}; - - -static void xfsm_splash_screen_load (XfsmSplashScreen *splash, - const gchar *engine); - - -XfsmSplashScreen* -xfsm_splash_screen_new (GdkDisplay *display, - const gchar *engine) -{ - XfsmSplashScreen *splash; - XfsmSplashRc *splash_rc; - GdkScreen *screen; - gchar name[128]; - int monitor; - XfconfChannel *channel; - - /* locate monitor with pointer */ - screen = xfce_gdk_screen_get_active (&monitor); - - if (G_UNLIKELY (screen == NULL) || (gdk_screen_get_display (screen) != display)) - { - screen = gdk_display_get_default_screen (display); - monitor = 0; - } - - /* initialize the screen struct */ - splash = g_new0 (XfsmSplashScreen, 1); - splash->engine.display = display; - splash->engine.primary_screen = screen; - splash->engine.primary_monitor = monitor; - - /* load and setup the engine */ - if (G_LIKELY (engine != NULL && *engine != '\0')) - { - xfsm_splash_screen_load (splash, engine); - if (G_LIKELY (splash->engine.setup != NULL)) - { - g_snprintf (name, sizeof(name), "/splash/engines/%s", engine); - channel = xfconf_channel_new_with_property_base ("xfce4-session", - name); - splash_rc = xfsm_splash_rc_new (channel); - g_object_unref (channel); - splash->engine.setup (&splash->engine, splash_rc); - xfsm_splash_rc_free (splash_rc); - - gdk_flush (); - } - } - - return splash; -} - - -void -xfsm_splash_screen_start (XfsmSplashScreen *splash, - const gchar *name, - GdkPixbuf *preview, - unsigned steps) -{ - if (G_LIKELY (splash->engine.start != NULL)) - { - splash->engine.start (&splash->engine, name, preview, steps); - gdk_flush (); - } -} - - -void -xfsm_splash_screen_next (XfsmSplashScreen *splash, - const gchar *text) -{ - if (G_LIKELY (splash->engine.next != NULL)) - { - splash->engine.next (&splash->engine, text); - gdk_flush (); - } -} - - -int -xfsm_splash_screen_run (XfsmSplashScreen *splash, - GtkWidget *dialog) -{ - int result; - - if (G_LIKELY (splash->engine.run != NULL)) - { - result = splash->engine.run (&splash->engine, dialog); - } - else - { - gtk_window_set_screen (GTK_WINDOW (dialog), splash->engine.primary_screen); - gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER); - - result = gtk_dialog_run (GTK_DIALOG (dialog)); - } - - return result; -} - - -int -xfsm_splash_screen_choose (XfsmSplashScreen *splash, - GList *sessions, - const gchar *default_session, - gchar **name_return) -{ - GtkWidget *chooser; - GtkWidget *label; - GtkWidget *dialog; - GtkWidget *entry; - gchar title[256]; - int result; - - g_assert (default_session != NULL); - - if (splash->engine.choose != NULL) - { - result = splash->engine.choose (&splash->engine, - sessions, - default_session, - name_return); - } - else - { -again: - xfsm_splash_screen_next (splash, _("Choose session")); - - chooser = g_object_new (XFSM_TYPE_CHOOSER, - "screen", splash->engine.primary_screen, - "type", GTK_WINDOW_POPUP, - NULL); - xfsm_window_add_border (GTK_WINDOW (chooser)); - xfsm_chooser_set_sessions (XFSM_CHOOSER (chooser), - sessions, default_session); - result = xfsm_splash_screen_run (splash, chooser); - - if (result == XFSM_RESPONSE_LOAD) - { - if (name_return != NULL) - *name_return = xfsm_chooser_get_session (XFSM_CHOOSER (chooser)); - result = XFSM_CHOOSE_LOAD; - } - else if (result == XFSM_RESPONSE_NEW) - { - result = XFSM_CHOOSE_NEW; - } - else - { - result = XFSM_CHOOSE_LOGOUT; - } - - gtk_widget_destroy (chooser); - - if (result == XFSM_CHOOSE_NEW) - { - xfsm_splash_screen_next (splash, _("Choose session name")); - - dialog = gtk_dialog_new_with_buttons (NULL, - NULL, - GTK_DIALOG_DESTROY_WITH_PARENT, - _("_Cancel"), - GTK_RESPONSE_CANCEL, - _("_OK"), - GTK_RESPONSE_OK, - NULL); - gtk_dialog_set_default_response (GTK_DIALOG (dialog), - GTK_RESPONSE_OK); - - g_snprintf (title, 256, "<big>%s</big>", - _("Choose a name for the new session:")); - label = gtk_label_new (title); - gtk_label_set_use_markup (GTK_LABEL (label), TRUE); - gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), - label, TRUE, TRUE, 6); - gtk_widget_show (label); - - entry = gtk_entry_new (); - gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), - entry, TRUE, TRUE, 6); - gtk_widget_show (entry); - - xfsm_window_add_border (GTK_WINDOW (dialog)); - -again1: - result = xfsm_splash_screen_run (splash, dialog); - - if (result != GTK_RESPONSE_OK) - { - gtk_widget_destroy (dialog); - goto again; - } - - if (name_return != NULL) - { - *name_return = gtk_editable_get_chars (GTK_EDITABLE (entry), - 0, -1); - if (strlen (*name_return) == 0) - { - g_free (*name_return); - goto again1; - } - } - - gtk_widget_destroy (dialog); - result = XFSM_CHOOSE_NEW; - } - } - - return result; -} - - -void -xfsm_splash_screen_free (XfsmSplashScreen *splash) -{ - if (G_LIKELY (splash->engine.destroy != NULL)) - splash->engine.destroy (&splash->engine); - if (G_LIKELY (splash->module != NULL)) - g_module_close (splash->module); - g_free (splash); -} - - -static void -xfsm_splash_screen_load (XfsmSplashScreen *splash, - const gchar *engine) -{ - void (*init) (XfsmSplashEngine *engine); - gchar *filename; - - filename = g_module_build_path (LIBDIR "/xfce4/session/splash-engines", engine); - splash->module = g_module_open (filename, G_MODULE_BIND_LOCAL); - g_free (filename); - - if (G_LIKELY (splash->module != NULL)) - { - if (g_module_symbol (splash->module, "engine_init", (gpointer)&init)) - { - init (&splash->engine); - } - else - { - g_module_close (splash->module); - splash->module = NULL; - } - } - else - { - g_warning ("Unable to load engine \"%s\": %s", engine, g_module_error ()); - } -} - - diff --git a/xfce4-session/xfsm-splash-screen.h b/xfce4-session/xfsm-splash-screen.h deleted file mode 100644 index f68c5d47..00000000 --- a/xfce4-session/xfsm-splash-screen.h +++ /dev/null @@ -1,58 +0,0 @@ -/* $Id$ */ -/*- - * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org> - * All rights reserved. - * - * 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, 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., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA. - */ - -#ifndef __XFSM_SPLASH_SCREEN_H__ -#define __XFSM_SPLASH_SCREEN_H__ - -#include <gtk/gtk.h> - -#include <libxfce4util/libxfce4util.h> - - -G_BEGIN_DECLS; - -typedef struct _XfsmSplashScreen XfsmSplashScreen; - -XfsmSplashScreen *xfsm_splash_screen_new (GdkDisplay *display, - const gchar *engine); - -void xfsm_splash_screen_start (XfsmSplashScreen *splash, - const gchar *name, - GdkPixbuf *preview, - unsigned steps); - -void xfsm_splash_screen_next (XfsmSplashScreen *splash, - const gchar *text); - -int xfsm_splash_screen_run (XfsmSplashScreen *splash, - GtkWidget *dialog); - -int xfsm_splash_screen_choose (XfsmSplashScreen *splash, - GList *sessions, - const gchar *default_session, - gchar **name_return); - -void xfsm_splash_screen_free (XfsmSplashScreen *splash); - -G_END_DECLS; - - -#endif /* !__XFSM_SPLASH_SCREEN_H__ */ diff --git a/xfce4-session/xfsm-startup.c b/xfce4-session/xfsm-startup.c index 1f93100f..4f176566 100644 --- a/xfce4-session/xfsm-startup.c +++ b/xfce4-session/xfsm-startup.c @@ -62,7 +62,6 @@ #include <xfce4-session/xfsm-compat-kde.h> #include <xfce4-session/xfsm-global.h> #include <xfce4-session/xfsm-manager.h> -#include <xfce4-session/xfsm-splash-screen.h> #include <xfce4-session/xfsm-systemd.h> #include <xfce4-session/xfsm-startup.h> @@ -392,20 +391,6 @@ xfsm_startup_shutdown (void) } - -static gboolean -destroy_splash (gpointer user_data) -{ - if (G_LIKELY (splash_screen != NULL)) - { - xfsm_splash_screen_free (splash_screen); - splash_screen = NULL; - } - - return FALSE; -} - - static const gchar* figure_app_name (const gchar *program_path) { @@ -470,21 +455,7 @@ figure_app_name (const gchar *program_path) static void xfsm_startup_autostart (XfsmManager *manager) { - gint n; - - n = xfsm_launch_desktop_files_on_login (FALSE); - - if (n > 0) - { - if (G_LIKELY (splash_screen != NULL)) - xfsm_splash_screen_next (splash_screen, _("Performing Autostart...")); - - g_timeout_add (2000, destroy_splash, NULL); - } - else - { - g_timeout_add (1000, destroy_splash, NULL); - } + xfsm_launch_desktop_files_on_login (FALSE); } @@ -493,10 +464,10 @@ void xfsm_startup_foreign (XfsmManager *manager) { if (xfsm_manager_get_compat_startup(manager, XFSM_MANAGER_COMPAT_KDE)) - xfsm_compat_kde_startup (splash_screen); + xfsm_compat_kde_startup (); if (xfsm_manager_get_compat_startup(manager, XFSM_MANAGER_COMPAT_GNOME)) - xfsm_compat_gnome_startup (splash_screen); + xfsm_compat_gnome_startup (); } @@ -582,9 +553,6 @@ xfsm_startup_at (XfsmManager *manager) if (n > 0) { - if (G_LIKELY (splash_screen != NULL)) - xfsm_splash_screen_next (splash_screen, _("Starting Assistive Technologies")); - xfsm_startup_at_set_gtk_modules (); /* wait for 2 seconds until the at-spi registered, not very nice @@ -632,14 +600,6 @@ xfsm_startup_failsafe (XfsmManager *manager) while ((fclient = g_queue_pop_head (failsafe_clients))) { - /* FIXME: splash */ - /* let the user know whats going on */ - if (G_LIKELY (splash_screen != NULL)) - { - xfsm_splash_screen_next (splash_screen, - figure_app_name (fclient->command[0])); - } - /* start the application */ xfsm_start_application (fclient->command, NULL, fclient->screen, NULL, NULL, NULL); @@ -779,39 +739,6 @@ xfsm_startup_session_next_prio_group (XfsmManager *manager) break; } - /* FIXME: splash */ - if (G_LIKELY (splash_screen != NULL)) - { - const gchar *app_name = NULL; - const gchar *desktop_file; - XfceRc *rcfile = NULL; - - desktop_file = xfsm_properties_get_string (properties, GsmDesktopFile); - - if (desktop_file) - { - rcfile = xfce_rc_simple_open (desktop_file, TRUE); - if (rcfile) - { - xfce_rc_set_group (rcfile, "Desktop Entry"); - app_name = xfce_rc_read_entry (rcfile, "Name", NULL); - } - } - - if (!app_name) - app_name = figure_app_name (xfsm_properties_get_string (properties, - SmProgram)); - - xfsm_splash_screen_next (splash_screen, app_name); - - if (rcfile) - { - /* delay closing because app_name belongs to the rcfile - * if we found it in the file */ - xfce_rc_close (rcfile); - } - } - if (G_LIKELY (xfsm_startup_start_properties (properties, manager))) { g_queue_push_tail (starting_properties, properties); |