Changeset 19
- Timestamp:
- 01/21/07 16:07:14 (2 years ago)
- Files:
-
- osso-xterm/trunk/configure.ac (modified) (1 diff)
- osso-xterm/trunk/debian/changelog (modified) (1 diff)
- osso-xterm/trunk/debian/control (modified) (1 diff)
- osso-xterm/trunk/src/main.c (modified) (6 diffs)
- osso-xterm/trunk/src/terminal-app.c (modified) (2 diffs)
- osso-xterm/trunk/src/terminal-app.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
osso-xterm/trunk/configure.ac
r18 r19 1 AC_INIT([osso-xterm],[0.13.mh1 4])1 AC_INIT([osso-xterm],[0.13.mh15]) 2 2 3 3 dnl Initialize automake osso-xterm/trunk/debian/changelog
r18 r19 1 osso-xterm (0.13.mh15) unstable; urgency=low 2 3 * Preliminary support for commands from command line. 4 5 -- Santtu Lakkala <inz@inz.fi> Sun, 21 Jan 2007 16:02:30 +0200 6 1 7 osso-xterm (0.13.mh14) unstable; urgency=low 2 8 osso-xterm/trunk/debian/control
r1 r19 8 8 Package: osso-xterm 9 9 Architecture: any 10 Depends: ${shlibs:Depends}, ${misc k:Depends}, ttf-bitstream-vera10 Depends: ${shlibs:Depends}, ${misc:Depends}, ttf-bitstream-vera 11 11 Provides: x-terminal-emulator 12 12 Conflicts: xterminal osso-xterm/trunk/src/main.c
r1 r19 32 32 #include <stdlib.h> 33 33 #include <stdio.h> 34 #include <string.h> 34 35 35 36 #include <gtk/gtk.h> … … 40 41 #include "terminal-app.h" 41 42 43 static gint osso_xterm_incoming(const gchar *interface, 44 const gchar *method, 45 GArray *arguments, 46 gpointer data, 47 osso_rpc_t *retval) 48 { 49 gchar *command = NULL; 50 51 if (strcmp(method, "run_command")) { 52 retval->type = DBUS_TYPE_STRING; 53 retval->value.s = g_strdup("Meh"); 54 return OSSO_ERROR; 55 } 56 57 if (arguments->len && 58 g_array_index(arguments, osso_rpc_t, 0).type == DBUS_TYPE_STRING) { 59 command = g_array_index(arguments, osso_rpc_t, 0).value.s; 60 } 61 62 retval->value.b = terminal_app_launch(TERMINAL_APP(data), 63 command, 64 NULL); 65 retval->type = DBUS_TYPE_BOOLEAN; 66 67 return OSSO_OK; 68 } 69 42 70 int 43 71 main (int argc, char **argv) … … 46 74 GError *error = NULL; 47 75 osso_context_t *osso_context; 76 const gchar *command = NULL; 77 DBusConnection *system_bus = NULL; 48 78 49 79 setlocale (LC_ALL, ""); … … 59 89 gtk_init (&argc, &argv); 60 90 91 if (argc > 1) { 92 command = argv[1]; 93 } 94 95 system_bus = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); 96 if (system_bus && dbus_bus_name_has_owner(system_bus, 97 "com.nokia.xterm", 98 NULL)) { 99 DBusConnection *session_bus = dbus_bus_get(DBUS_BUS_SESSION, NULL); 100 if (!session_bus) { 101 exit(EXIT_FAILURE); 102 } 103 DBusMessage *msg = dbus_message_new_method_call("com.nokia.xterm", 104 "/com/nokia/xterm", 105 "com.nokia.xterm", 106 "run_command"); 107 if (!msg) { 108 exit(EXIT_FAILURE); 109 } 110 if (command) { 111 dbus_message_append_args(msg, 112 DBUS_TYPE_STRING, &command, 113 DBUS_TYPE_INVALID); 114 } 115 dbus_message_set_no_reply(msg, TRUE); 116 dbus_connection_send(session_bus, msg, NULL); 117 dbus_connection_flush(session_bus); 118 exit(EXIT_SUCCESS); 119 } 120 61 121 app = terminal_app_new(); 62 122 g_object_add_weak_pointer(G_OBJECT(app), &app); … … 65 125 66 126 if (osso_context == NULL) { 67 g_printerr("osso_initialize() failed!\n");68 exit(EXIT_FAILURE);127 g_printerr("osso_initialize() failed!\n"); 128 exit(EXIT_FAILURE); 69 129 } 70 130 71 131 g_object_set_data(G_OBJECT(app), "osso", osso_context); 72 if (!terminal_app_launch (TERMINAL_APP(app), &error))132 if (!terminal_app_launch (TERMINAL_APP(app), command, &error)) 73 133 { 74 134 g_printerr (_("Unable to launch terminal: %s\n"), error->message); … … 76 136 exit(EXIT_FAILURE); 77 137 } 138 139 osso_rpc_set_default_cb_f(osso_context, 140 osso_xterm_incoming, 141 app); 78 142 79 143 gtk_main (); osso-xterm/trunk/src/terminal-app.c
r18 r19 1263 1263 gboolean 1264 1264 terminal_app_launch (TerminalApp *app, 1265 const gchar *command, 1265 1266 GError **error) 1266 1267 { … … 1276 1277 1277 1278 terminal_app_add (app, TERMINAL_WIDGET (terminal)); 1279 if (command) { 1280 gint argc; 1281 gchar **argv; 1282 1283 if (g_shell_parse_argv(command, 1284 &argc, 1285 &argv, 1286 NULL)) { 1287 terminal_widget_set_custom_command(TERMINAL_WIDGET (terminal), 1288 argv); 1289 g_strfreev(argv); 1290 } 1291 } 1278 1292 terminal_widget_launch_child (TERMINAL_WIDGET (terminal)); 1279 1293 osso-xterm/trunk/src/terminal-app.h
r1 r19 60 60 61 61 gboolean terminal_app_launch (TerminalApp *app, 62 const gchar *command, 62 63 GError **error); 63 64
