1
/* Zapping (TV viewer for the Gnome Desktop)
2
* Copyright (C) 2000 I�aki Garc�a Etxebarria
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
* Generic command implementation. This is mostly useful for plugins,
21
* that can use this routines for executing arbitrary functions in a
24
1
#ifndef __REMOTE_H__
25
2
#define __REMOTE_H__
29
/* The meaning of arg and the returned gpointer value depend on the
30
function you call. The command checking isn't case sensitive */
31
gpointer remote_command(gchar *command, gpointer arg);
34
* Parses the given command and calls old_remote_command appropiately.
35
* Command is a set of lines containing a single command each, or many
36
* commands separated by ";"
37
* Example > set_channel 5;
39
void run_command(const gchar *command);
42
Implemented commands and description
43
------------------------------------
44
- command="quit", arg=ignored, returns=NULL
45
Quits the program, just like if the user had pressed the delete
48
- command="switch_mode", arg=GINT_TO_POINTER(enum tveng_capture_mode
49
new_mode), returns=GINT_TO_POINTER(-1 on error, 0 on success)
50
Switchs between different running modes. See tveng.h for valid
54
Not implemented, use the current_mode field in
55
your copy of the tveng_device_info * struct.
57
- command="get_cur_channel", arg=ignored,
58
returns=GINT_TO_POINTER(current_channel).
59
Returns the currently selected station in Zapping.
61
- command="get_channel_info", arg=index
62
returns=tveng_tuned_channel* channel, or NULL if not found.
63
Info about the given channel. Use tveng_clear_tuned_channel(result)
64
when not longer needed.
66
- command="get_num_channels", arg=ignored,
67
returns=GINT_TO_POINTER(number_of_channels).
68
Number of channels in the channel list.
70
- command="set_channel", arg=GINT_TO_POINTER(channel_index),
72
Sets a given channel in the Channel list. The given value is clipped
73
to the nearest valid values.
75
- commmand="channel_up", command="channel_down", arg=ignored,
77
Go to the previous/next channel in the channel list.
79
- command="set_vbi_mode", arg=GINT_TO_POINTER(gboolean init_vbi),
81
Starts/stops Teletext, depending on the value of arg. If arg is
82
TRUE, then teletext is started. Please note that if you stop
83
Teletext, it doesn't restore the previous capture mode, you need to
86
- command="load_page", arg=GINT_TO_POINTER((page<<16)+subpage)
87
Loads the given page in the main window, tries to start TTX if it
88
isn't already on (i.e., if info->current_mode != TVENG_CAPTURE_NONE).
89
Loading all subpages of a page is done by giving the value
90
ANY_SUB to subpage. Example: load_page((100<<16)+ANY_SUB)
94
* Zapping commands Mk II
97
typedef gboolean (cmd_func) (GtkWidget * widget,
102
extern void startup_remote (void);
103
extern void shutdown_remote (void);
105
extern void cmd_register (const gchar * name,
108
extern void cmd_remove (const gchar * name);
110
extern GList * cmd_list (void);
112
extern gboolean cmd_execute (GtkWidget * widget,
113
const gchar * command_string);
114
extern gboolean cmd_execute_printf (GtkWidget * widget,
117
extern void on_remote_command1 (GtkWidget * widget,
119
extern void on_remote_command2 (GtkWidget * widget,
123
extern gboolean on_remote_command_blocked;
125
#define ORC_BLOCK(_func) \
126
(on_remote_command_blocked = TRUE, _func, on_remote_command_blocked = FALSE)
130
GtkObject object = GTK_OBJECT (_object);
131
GtkHandler *handler0 = gtk_object_get_data_by_id (object, gtk_handler_quark);
135
for (handler = handler0; handler; handler = handler->next)
136
if (handler->id > 0 && handler->func == on_remote_command)
137
handler->blocked += 1;
141
for (handler = handler0; handler; handler = handler->next)
142
if (handler->id > 0 && handler->func == on_remote_command)
143
handler->blocked -= 1;
149
extern void cmd_return (const gchar * command_return_value);
151
#endif /* remote.h */
5
* This provides a Python interface to the internal Zapping routines.
9
/* python 2.3 redefines. ugh. */
10
# undef _POSIX_C_SOURCE
12
# ifndef _POSIX_C_SOURCE
13
# define _POSIX_C_SOURCE 199506L
22
ParseTuple (PyObject * args,
26
/* The zapping dictionary in case you want to add things
27
manually. To register functions use cmd_register() instead. */
28
extern PyObject * dict;
31
on_python_command1 (GtkWidget * widget,
34
on_python_command2 (GtkWidget * widget,
38
on_python_command3 (GtkWidget * widget,
43
#define python_command(widget, cmd) on_python_command1 (widget, cmd)
46
python_command_printf (GtkWidget * widget,
50
python_command_widget (void);
55
cmd_action_from_cmd (const gchar * cmd);
57
cmd_action_to_cmd (const gchar * action);
59
cmd_action_menu (void);
61
cmd_compatibility (const gchar * cmd);
63
_cmd_register (const gchar * name,
67
#define cmd_register(name, cfunc, flags, args...) \
68
_cmd_register (name, cfunc, flags ,##args , 0)
70
shutdown_remote (void);
72
startup_remote (void);
74
/* The following macros simplify writing the python wrappers. */
75
#define py_return_none \
81
#define py_return_true return PyInt_FromLong (TRUE)
82
#define py_return_false return PyInt_FromLong (FALSE)
84
#endif /* __REMOTE_H__ */