Ticket #39: osso-xterm-enter-passwd.en3.diff
| File osso-xterm-enter-passwd.en3.diff, 6.5 kB (added by erik@nygren.org, 2 years ago) |
|---|
-
osso-xterm-0.13.mh24bora1/debian/changelog
old new 1 osso-xterm (0.13.mh24bora1en3) unstable; urgency=low 2 3 * Add "Terminal->Enter Password..." which opens a dialog box 4 for non-visible entry of a password that won't be remembered. 5 6 -- Erik Nygren <nygren@mit.edu> Sat, 30 Jun 2007 13:54:00 -0500 7 1 8 osso-xterm (0.13.mh24bora1) unstable; urgency=low 2 9 3 10 * Build for bora. -
osso-xterm-0.13.mh24bora1/src/terminal-app.c
old new 46 46 #include <hildon-widgets/hildon-program.h> 47 47 #include <hildon-widgets/hildon-defines.h> 48 48 #include <hildon-widgets/hildon-banner.h> 49 #include <hildon-widgets/hildon-get-password-dialog.h> 50 #include <hildon-widgets/hildon-input-mode-hint.h> 49 51 #elif HILDON == 1 50 52 #include <hildon/hildon-window.h> 51 53 #include <hildon/hildon-program.h> 52 54 #include <hildon/hildon-defines.h> 53 55 #include <hildon/hildon-banner.h> 56 #include <hildon/hildon-get-password-dialog.h> 57 #include <hildon/hildon-input-mode-hint.h> 54 58 #endif 55 59 #include <gconf/gconf-client.h> 56 60 #include <gdk/gdkkeysyms.h> … … 59 63 #include "terminal-settings.h" 60 64 #include "terminal-tab-header.h" 61 65 #include "terminal-app.h" 66 #include "terminal-widget.h" 62 67 #include "shortcuts.h" 63 68 64 69 … … 118 123 TerminalApp *app); 119 124 static void terminal_app_action_ctrl (GtkAction *action, 120 125 TerminalApp *app); 126 static void terminal_app_action_enter_passwd (GtkAction *action, 127 TerminalApp *app); 121 128 static void terminal_app_action_settings (GtkAction *action, 122 129 TerminalApp *app); 123 130 static void terminal_app_action_quit (GtkAction *action, … … 155 162 { "reset", NULL, N_ ("Reset"), NULL, NULL, G_CALLBACK (terminal_app_action_reset), }, 156 163 { "reset-and-clear", NULL, N_ ("Reset and Clear"), NULL, NULL, G_CALLBACK (terminal_app_action_reset_and_clear), }, 157 164 { "ctrl", NULL, N_ ("Send Ctrl-<some key>"), NULL, NULL, G_CALLBACK (terminal_app_action_ctrl), }, 165 { "enter-passwd", NULL, N_ ("Enter Password..."), NULL, NULL, G_CALLBACK (terminal_app_action_enter_passwd), }, 158 166 { "settings", NULL, N_ ("Settings..."), NULL, NULL, G_CALLBACK (terminal_app_action_settings), }, 159 167 { "quit", NULL, N_ ("Quit"), NULL, NULL, G_CALLBACK (terminal_app_action_quit), }, 160 168 }; … … 198 206 " <menuitem action='fullscreen'/>" 199 207 " <separator/>" 200 208 " <menuitem action='ctrl'/>" 209 " <menuitem action='enter-passwd'/>" 201 210 " <separator/>" 202 211 " <menu action='font-menu'>" 203 212 " <menuitem action='-8pt'/>" … … 307 316 attach_item(parent, actiongroup, accelgroup, "reset"); 308 317 attach_item(parent, actiongroup, accelgroup, "reset-and-clear"); 309 318 attach_item(parent, actiongroup, accelgroup, "ctrl"); 319 attach_item(parent, actiongroup, accelgroup, "enter-passwd"); 310 320 311 321 attach_item(menubar, actiongroup, accelgroup, "settings"); 312 322 … … 1114 1124 1115 1125 1116 1126 static void 1127 terminal_app_action_enter_passwd (GtkAction *action, 1128 TerminalApp *app) 1129 { 1130 GtkWidget *dialog, *label; 1131 GtkEntry *pwd_entry; 1132 1133 dialog = gtk_dialog_new_with_buttons("Enter Password", 1134 GTK_WINDOW(app), 1135 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, 1136 GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, 1137 GTK_STOCK_OK, GTK_RESPONSE_OK, 1138 NULL); 1139 1140 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); 1141 1142 label = gtk_label_new("Enter password/text to send..."); 1143 gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), label); 1144 1145 pwd_entry = GTK_ENTRY (gtk_entry_new ()); 1146 gtk_entry_set_visibility (pwd_entry, FALSE); 1147 gtk_entry_set_activates_default (pwd_entry, TRUE); 1148 g_object_set(G_OBJECT(pwd_entry), HILDON_AUTOCAP, FALSE, NULL); 1149 1150 gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), GTK_WIDGET(pwd_entry)); 1151 1152 gtk_widget_show_all(dialog); 1153 1154 /* It would be nice to activate the text box to keep the input area up, 1155 but I'm not quite sure how to do that? Neither of these quite work: 1156 1157 gtk_widget_grab_focus(GTK_WIDGET(pwd_entry)); 1158 gtk_widget_activate(GTK_WIDGET(pwd_entry)); 1159 */ 1160 1161 if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { 1162 gchar *pwd = (gchar*)gtk_entry_get_text (pwd_entry); 1163 TerminalWidget *tw = terminal_app_get_active(app); 1164 int i; 1165 1166 if (tw) { 1167 for (i=0; pwd[i]; i++) { 1168 terminal_widget_send_key(tw, pwd[i], 0); 1169 pwd[i] = 0; 1170 } 1171 terminal_widget_send_key(tw, GDK_KP_Enter, 0); 1172 } 1173 } 1174 1175 gtk_widget_hide(dialog); 1176 gtk_widget_destroy(dialog); 1177 1178 } 1179 1180 1181 static void 1117 1182 terminal_app_action_settings (GtkAction *action, 1118 1183 TerminalApp *app) 1119 1184 { -
osso-xterm-0.13.mh24bora1/src/terminal-widget.c
old new 1739 1739 } 1740 1740 } 1741 1741 1742 staticvoid1742 void 1743 1743 terminal_widget_send_key(TerminalWidget *widget, 1744 1744 guint keyval, 1745 1745 guint state) -
osso-xterm-0.13.mh24bora1/src/terminal-widget.h
old new 124 124 gint y, 125 125 gint *tag); 126 126 127 void 128 terminal_widget_send_key(TerminalWidget *widget, 129 guint keyval, 130 guint state); 131 132 127 133 G_END_DECLS; 128 134 129 135 #endif /* !__TERMINAL_WIDGET_H__ */
