tasks.h

Go to the documentation of this file.
00001 #ifndef __TASKS_H__
00002 #define __TASKS_H__
00003 
00004 /**
00005  * File Name  : tasks.h
00006  *
00007  * Description: Task list handling functions
00008  */
00009 
00010 /*
00011  * This file is part of sysd.
00012  *
00013  * sysd is free software: you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation, either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * sysd is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00025  */
00026 
00027 /**
00028  * Copyright (C) 2008 iRex Technologies B.V.
00029  * All rights reserved.
00030  */
00031 
00032 
00033 //----------------------------------------------------------------------------
00034 // Include Files
00035 //----------------------------------------------------------------------------
00036 
00037 #include <liberipc/eripc.h>
00038 #include <X11/Xlib.h>
00039 #include "process.h"
00040 
00041 G_BEGIN_DECLS
00042 
00043 
00044 //----------------------------------------------------------------------------
00045 // Definitions
00046 //---------------------------------------------------------------------------- 
00047 
00048 
00049 //----------------------------------------------------------------------------
00050 // Forward Declarations
00051 //----------------------------------------------------------------------------
00052 
00053 
00054 //----------------------------------------------------------------------------
00055 // Type Declarations
00056 //----------------------------------------------------------------------------
00057 
00058 
00059 //----------------------------------------------------------------------------
00060 // Global Constants
00061 //----------------------------------------------------------------------------
00062 
00063 
00064 //============================================================================
00065 // Public Functions
00066 //============================================================================
00067 
00068 /**---------------------------------------------------------------------------
00069  *
00070  * Name :  task_start
00071  *
00072  * @brief  Start a task
00073  *
00074  * @param  command_line Full command line to spawn, quoted as g_shell_quote
00075  * @param  working_dir  Working directory or NULL to inherit from sysd
00076  * @param  label        Text label shown under icon in popup menu
00077  * @param  image        Full path to icon shown in popup menu
00078  *
00079  * @return Window ID
00080  *
00081  *--------------------------------------------------------------------------*/
00082 gboolean task_start(const char *command_line, 
00083                     const char *working_dir, 
00084                     const char *label, 
00085                     const char *image, 
00086                     eripc_context_t *context, 
00087                     const char *message_id);
00088 
00089 /**---------------------------------------------------------------------------
00090  *
00091  * Name :  task_activate
00092  *
00093  * @brief  Activate a running task
00094  *
00095  * @param  command_line Full command line of task, quoted as g_shell_quote
00096  *
00097  * @return Returns TRUE on success, FALSE on failure
00098  *
00099  *--------------------------------------------------------------------------*/
00100 gboolean task_activate(const char *command_line);
00101 
00102 void task_activate_by_xid(int xid);
00103 
00104 /**---------------------------------------------------------------------------
00105  *
00106  * Name :  task_service_by_window
00107  *
00108  * @brief  Get service of task with given window
00109  *
00110  * @param  xid          Window ID
00111  *
00112  * @return Returns IPC service
00113  *
00114  *--------------------------------------------------------------------------*/
00115 const gchar *task_service_by_window(Window xid);
00116 
00117 
00118 /**---------------------------------------------------------------------------
00119  *
00120  * Name :  task_stop
00121  *
00122  * @brief  Stop a running task
00123  *
00124  * @param  command_line Full command line of task, quoted as g_shell_quote
00125  *
00126  * @return Returns TRUE on success, FALSE on failure
00127  *
00128  *--------------------------------------------------------------------------*/
00129 gboolean task_stop(const char *command_line,
00130                    eripc_context_t *context, 
00131                    const char *message_id);
00132 
00133 gboolean task_rename(int xid, const char *new_document, const char* new_label);
00134 
00135 /**---------------------------------------------------------------------------
00136  *
00137  * Name :  task_add
00138  *
00139  * @brief  Add a task which is already running
00140  *
00141  * @param  application  Basename of the application
00142  * @param  document     Full path of the document
00143  * @param  label        Text label shown under icon in popup menu
00144  * @param  image        Full path to icon shown in popup menu
00145  * @param  ipc_service  IPC service name of the application
00146  * @param  pid          Process ID
00147  * @param  xid          Window ID
00148  *
00149  * @return Returns TRUE on success, FALSE on failure
00150  *
00151  *--------------------------------------------------------------------------*/
00152 gboolean task_add(const char *application, 
00153                   const char *document, 
00154                   const char *label, 
00155                   const char *image, 
00156                   const char *ipc_service, 
00157                   gint        pid, 
00158                   Window      xid);
00159 
00160 /**---------------------------------------------------------------------------
00161  *
00162  * Name :  task_cleanup_pid
00163  *
00164  * @brief  Cleanup tasks for process
00165  *
00166  * @param  pid Process that has exited
00167  *
00168  * @return Returns TRUE on success, FALSE on failure
00169  *
00170  *--------------------------------------------------------------------------*/
00171 gboolean task_cleanup_pid(GPid pid);
00172 
00173 /**---------------------------------------------------------------------------
00174  *
00175  * Name :  task_cleanup_window
00176  *
00177  * @brief  Cleanup tasks for window
00178  *
00179  * @param  xid Window that was closed
00180  *
00181  * @return Returns TRUE on success, FALSE on failure
00182  *
00183  *--------------------------------------------------------------------------*/
00184 gboolean task_cleanup_window(Window xid);
00185 
00186 /**---------------------------------------------------------------------------
00187  *
00188  * Name :  task_startup_completed
00189  *
00190  * @brief  Call when a task has finished starting
00191  *
00192  * @param  proc Process
00193  * @param  xid  Window id
00194  *
00195  * @return Returns TRUE on success, FALSE on failure
00196  *
00197  *--------------------------------------------------------------------------*/
00198 gboolean task_startup_completed(proc_t *proc, Window xid);
00199 
00200 char* testing_task_get_list();
00201 
00202 #if (TESTING_ON)
00203 void print_task_list();
00204 #endif
00205 
00206 G_END_DECLS
00207 
00208 #endif /* __TASKS_H__ */
Generated by  doxygen 1.6.2-20100208