|
@@ -25,6 +25,8 @@ static gboolean mssh_window_entry_focused(GtkWidget *widget,
|
|
|
static gboolean mssh_window_session_close(gpointer data);
|
|
|
static void mssh_window_session_focused(MSSHTerminal *terminal,
|
|
|
gpointer data);
|
|
|
+static gboolean mssh_window_mouse_paste_cb(MSSHTerminal *terminal,
|
|
|
+ gpointer data);
|
|
|
static void mssh_window_insert(GtkWidget *widget, gchar *new_text,
|
|
|
gint new_text_length, gint *position, gpointer data);
|
|
|
static void mssh_window_add_session(MSSHWindow *window, char *hostname);
|
|
@@ -63,6 +65,24 @@ static void mssh_window_sendhost(GtkWidget *widget, gpointer data)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static void mssh_window_sendcommand(GtkWidget *widget, gpointer data)
|
|
|
+{
|
|
|
+ int i;
|
|
|
+ char *command;
|
|
|
+
|
|
|
+ MSSHWindow *window = MSSH_WINDOW(data);
|
|
|
+ GtkMenuItem *item = (GtkMenuItem *)widget;
|
|
|
+
|
|
|
+ command = g_datalist_get_data(MSSH_WINDOW(data)->commands, gtk_menu_item_get_label (item));
|
|
|
+
|
|
|
+ for(i = 0; i < window->terminals->len; i++)
|
|
|
+ {
|
|
|
+ mssh_terminal_send_string(g_array_index(window->terminals,
|
|
|
+ MSSHTerminal*, i), command);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
static void mssh_window_destroy(GtkWidget *widget, gpointer data)
|
|
|
{
|
|
|
gtk_main_quit();
|
|
@@ -286,6 +306,14 @@ void mssh_window_session_closed(MSSHTerminal *terminal, gpointer data)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static gboolean mssh_window_mouse_paste_cb(MSSHTerminal *terminal,
|
|
|
+ gpointer data)
|
|
|
+{
|
|
|
+ gtk_widget_grab_focus(GTK_WIDGET(terminal));
|
|
|
+
|
|
|
+ return FALSE;
|
|
|
+}
|
|
|
+
|
|
|
static void mssh_window_session_focused(MSSHTerminal *terminal,
|
|
|
gpointer data)
|
|
|
{
|
|
@@ -422,6 +450,8 @@ static void mssh_window_add_session(MSSHWindow *window, char *hostname)
|
|
|
G_CALLBACK(mssh_window_session_closed), window);
|
|
|
g_signal_connect(G_OBJECT(terminal), "session-focused",
|
|
|
G_CALLBACK(mssh_window_session_focused), window);
|
|
|
+ g_signal_connect(GTK_WIDGET(terminal), "button-release-event",
|
|
|
+ G_CALLBACK(mssh_window_mouse_paste_cb), window);
|
|
|
|
|
|
mssh_terminal_init_session(terminal, hostname);
|
|
|
|
|
@@ -443,6 +473,7 @@ static void mssh_window_init(MSSHWindow* window)
|
|
|
GtkWidget *file_item = gtk_menu_item_new_with_label("File");
|
|
|
GtkWidget *edit_item = gtk_menu_item_new_with_label("Edit");
|
|
|
GtkWidget *server_item = gtk_menu_item_new_with_label("Servers");
|
|
|
+ GtkWidget *command_item = gtk_menu_item_new_with_label("Commands");
|
|
|
|
|
|
GtkWidget *file_quit = gtk_image_menu_item_new_from_stock(
|
|
|
GTK_STOCK_QUIT, NULL);
|
|
@@ -460,6 +491,8 @@ static void mssh_window_init(MSSHWindow* window)
|
|
|
|
|
|
window->server_menu = gtk_menu_new();
|
|
|
|
|
|
+ window->command_menu = gtk_menu_new();
|
|
|
+
|
|
|
window->global_entry = entry;
|
|
|
|
|
|
window->last_closed = -1;
|
|
@@ -476,6 +509,8 @@ static void mssh_window_init(MSSHWindow* window)
|
|
|
gtk_menu_item_set_submenu(GTK_MENU_ITEM(edit_item), edit_menu);
|
|
|
gtk_menu_item_set_submenu(GTK_MENU_ITEM(server_item),
|
|
|
window->server_menu);
|
|
|
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(command_item),
|
|
|
+ window->command_menu);
|
|
|
|
|
|
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_add);
|
|
|
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), file_sendhost);
|
|
@@ -493,6 +528,7 @@ static void mssh_window_init(MSSHWindow* window)
|
|
|
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), file_item);
|
|
|
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), edit_item);
|
|
|
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), server_item);
|
|
|
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), command_item);
|
|
|
|
|
|
g_signal_connect(G_OBJECT(entry), "key-press-event",
|
|
|
G_CALLBACK(mssh_window_key_press), window);
|
|
@@ -511,7 +547,8 @@ static void mssh_window_init(MSSHWindow* window)
|
|
|
|
|
|
gtk_container_add(GTK_CONTAINER(window), vbox);
|
|
|
|
|
|
- gtk_widget_set_size_request(GTK_WIDGET(window), 1024, 768);
|
|
|
+ gtk_widget_set_size_request(GTK_WIDGET(window), 0, 0);
|
|
|
+ gtk_window_set_default_size(GTK_WINDOW(window), 1024, 768);
|
|
|
gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME);
|
|
|
|
|
|
client = gconf_client_get_default();
|
|
@@ -609,6 +646,18 @@ void mssh_window_start_session(MSSHWindow* window, char **env,
|
|
|
mssh_window_relayout(window);
|
|
|
}
|
|
|
|
|
|
+void mssh_window_add_command(GQuark key_id, gpointer data, gpointer user_data)
|
|
|
+{
|
|
|
+ GtkWidget *menu_item;
|
|
|
+ GtkWidget* window = (GtkWidget *)user_data;
|
|
|
+
|
|
|
+ menu_item = gtk_menu_item_new_with_label(g_quark_to_string (key_id));
|
|
|
+
|
|
|
+ gtk_menu_shell_append(GTK_MENU_SHELL(MSSH_WINDOW(window)->command_menu), menu_item);
|
|
|
+ g_signal_connect(G_OBJECT(menu_item), "activate",
|
|
|
+ G_CALLBACK(mssh_window_sendcommand), window);
|
|
|
+}
|
|
|
+
|
|
|
static void mssh_window_class_init(MSSHWindowClass *klass)
|
|
|
{
|
|
|
}
|