/* * Copyright (c) 2004 Danny Milosavljevic * * 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; You may only use version 2 of the License, * you have no option to use any other 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., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #ifdef HAVE_CONFIG_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include #include #include #include #include #include "fallbackicon.h" #define SCREENSAVER_EXE "xscreensaver-demo" /* static prototypes */ static void run_dialog (McsPlugin *); /* */ McsPluginInitResult mcs_plugin_init (McsPlugin * plugin) { gchar *where; xfce_textdomain (GETTEXT_PACKAGE, LOCALEDIR, "UTF-8"); plugin->plugin_name = g_strdup ("screensaver"); /* the button label in the xfce-mcs-manager dialog */ plugin->caption = g_strdup (Q_ ("Button Label|Screensaver")); plugin->run_dialog = run_dialog; plugin->icon = xfce_themed_icon_load ("xscreensaver", 48); if (!plugin->icon) { plugin->icon = gdk_pixbuf_new_from_inline (-1, fallbackicon_inline, FALSE, NULL); } else { g_object_set_data_full (G_OBJECT (plugin->icon), "mcs-plugin-icon-name", g_strdup ("xscreensaver"), g_free); } where = g_find_program_in_path (SCREENSAVER_EXE); if (where) { g_free (where); return (MCS_PLUGIN_INIT_OK); } else { return (MCS_PLUGIN_INIT_ERROR); } } /* */ static void run_dialog (McsPlugin * plugin) { gchar *argv[] = { SCREENSAVER_EXE, NULL }; GError *error; error = NULL; if (g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, NULL, &error) == FALSE) { /* TODO */ g_error_free (error); } } /* */ MCS_PLUGIN_CHECK_INIT