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  
     1osso-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 
    18osso-xterm (0.13.mh24bora1) unstable; urgency=low 
    29 
    310  * Build for bora. 
  • osso-xterm-0.13.mh24bora1/src/terminal-app.c

    old new  
    4646#include <hildon-widgets/hildon-program.h> 
    4747#include <hildon-widgets/hildon-defines.h> 
    4848#include <hildon-widgets/hildon-banner.h> 
     49#include <hildon-widgets/hildon-get-password-dialog.h> 
     50#include <hildon-widgets/hildon-input-mode-hint.h> 
    4951#elif HILDON == 1 
    5052#include <hildon/hildon-window.h> 
    5153#include <hildon/hildon-program.h> 
    5254#include <hildon/hildon-defines.h> 
    5355#include <hildon/hildon-banner.h> 
     56#include <hildon/hildon-get-password-dialog.h> 
     57#include <hildon/hildon-input-mode-hint.h> 
    5458#endif 
    5559#include <gconf/gconf-client.h> 
    5660#include <gdk/gdkkeysyms.h> 
     
    5963#include "terminal-settings.h" 
    6064#include "terminal-tab-header.h" 
    6165#include "terminal-app.h" 
     66#include "terminal-widget.h" 
    6267#include "shortcuts.h" 
    6368 
    6469 
     
    118123                                                             TerminalApp     *app); 
    119124static void            terminal_app_action_ctrl             (GtkAction       *action, 
    120125                                                             TerminalApp     *app); 
     126static void            terminal_app_action_enter_passwd     (GtkAction       *action, 
     127                                                             TerminalApp     *app); 
    121128static void            terminal_app_action_settings         (GtkAction       *action, 
    122129                                                             TerminalApp     *app); 
    123130static void            terminal_app_action_quit             (GtkAction       *action, 
     
    155162  { "reset", NULL, N_ ("Reset"), NULL, NULL, G_CALLBACK (terminal_app_action_reset), }, 
    156163  { "reset-and-clear", NULL, N_ ("Reset and Clear"), NULL, NULL, G_CALLBACK (terminal_app_action_reset_and_clear), }, 
    157164  { "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), }, 
    158166  { "settings", NULL, N_ ("Settings..."), NULL, NULL, G_CALLBACK (terminal_app_action_settings), }, 
    159167  { "quit", NULL, N_ ("Quit"), NULL, NULL, G_CALLBACK (terminal_app_action_quit), }, 
    160168}; 
     
    198206 "    <menuitem action='fullscreen'/>" 
    199207 "    <separator/>" 
    200208 "    <menuitem action='ctrl'/>" 
     209 "    <menuitem action='enter-passwd'/>" 
    201210 "    <separator/>" 
    202211 "    <menu action='font-menu'>" 
    203212 "      <menuitem action='-8pt'/>" 
     
    307316  attach_item(parent, actiongroup, accelgroup, "reset"); 
    308317  attach_item(parent, actiongroup, accelgroup, "reset-and-clear"); 
    309318  attach_item(parent, actiongroup, accelgroup, "ctrl"); 
     319  attach_item(parent, actiongroup, accelgroup, "enter-passwd"); 
    310320 
    311321  attach_item(menubar, actiongroup, accelgroup, "settings"); 
    312322 
     
    11141124 
    11151125 
    11161126static void 
     1127terminal_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 
     1181static void 
    11171182terminal_app_action_settings (GtkAction    *action, 
    11181183                              TerminalApp  *app) 
    11191184{ 
  • osso-xterm-0.13.mh24bora1/src/terminal-widget.c

    old new  
    17391739  } 
    17401740} 
    17411741 
    1742 static void 
     1742void 
    17431743terminal_widget_send_key(TerminalWidget *widget, 
    17441744                         guint keyval, 
    17451745                         guint state) 
  • osso-xterm-0.13.mh24bora1/src/terminal-widget.h

    old new  
    124124                                                       gint            y, 
    125125                                                       gint           *tag); 
    126126 
     127void 
     128terminal_widget_send_key(TerminalWidget *widget, 
     129                         guint keyval, 
     130                         guint state); 
     131 
     132 
    127133G_END_DECLS; 
    128134 
    129135#endif /* !__TERMINAL_WIDGET_H__ */