#include <glib.h>
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkdialog.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkcomboboxentry.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkcheckbutton.h>
+#include <gtk/gtk.h>
#include "inputdialog.h"
#include "manage_window.h"
return input_dialog_open(title, message, NULL, default_string, FALSE, NULL);
}
+gchar *input_dialog_with_invisible_checkbtn(const gchar *title, const gchar *message,
+ const gchar *default_string, const gchar *checkbtn_label,
+ gboolean *checkbtn_state)
+{
+ if (dialog && GTK_WIDGET_VISIBLE(dialog)) return NULL;
+
+ if (!dialog)
+ input_dialog_create(TRUE);
+
+ type = INPUT_DIALOG_INVISIBLE;
+ gtk_widget_hide(combo);
+ gtk_widget_show(entry);
+
+ if (checkbtn_label && checkbtn_state) {
+ gtk_widget_show(remember_checkbtn);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remember_checkbtn), *checkbtn_state);
+ }
+ else {
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(remember_checkbtn), FALSE);
+ gtk_widget_hide(remember_checkbtn);
+ }
+
+ gtk_widget_hide(icon_q);
+ gtk_widget_show(icon_p);
+ is_pass = TRUE;
+ gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
+#ifdef MAEMO
+ hildon_gtk_entry_set_input_mode(GTK_ENTRY(entry),
+ HILDON_GTK_INPUT_MODE_FULL | HILDON_GTK_INPUT_MODE_INVISIBLE);
+#endif
+
+ return input_dialog_open(title, message, checkbtn_label, default_string, *checkbtn_state, checkbtn_state);
+}
+
gchar *input_dialog_combo(const gchar *title, const gchar *message,
const gchar *default_string, GList *list)
{
gchar *message;
gchar *pass;
- message = g_strdup_printf(_("Input password for %s on %s:"),
+ if (server && user)
+ message = g_strdup_printf(_("Input password for %s on %s:"),
user, server);
+ else if (server)
+ message = g_strdup_printf(_("Input password for %s:"),
+ server);
+ else if (user)
+ message = g_strdup_printf(_("Input password for %s:"),
+ user);
+ else
+ message = g_strdup_printf(_("Input password:"));
pass = input_dialog_with_invisible(_("Input password"), message, NULL);
g_free(message);
return pass;
}
+gchar *input_dialog_query_password_keep(const gchar *server, const gchar *user, gchar **keep)
+{
+ gchar *message;
+ gchar *pass;
+
+ if (server && user)
+ message = g_strdup_printf(_("Input password for %s on %s:"),
+ user, server);
+ else if (server)
+ message = g_strdup_printf(_("Input password for %s:"),
+ server);
+ else if (user)
+ message = g_strdup_printf(_("Input password for %s:"),
+ user);
+ else
+ message = g_strdup_printf(_("Input password:"));
+ if (keep) {
+ if (*keep != NULL) {
+ pass = g_strdup (*keep);
+ }
+ else {
+ gboolean state = prefs_common.session_passwords;
+ pass = input_dialog_with_invisible_checkbtn(_("Input password"),
+ message, NULL,
+ _("Remember password for this session"),
+ &state);
+ if (state) {
+ *keep = g_strdup (pass);
+ debug_print("keeping session password for account\n");
+ }
+ prefs_common.session_passwords = state;
+ }
+ }
+ else {
+ pass = input_dialog_with_invisible(_("Input password"), message, NULL);
+ }
+ g_free(message);
+
+ return pass;
+}
+
static void input_dialog_create(gboolean is_password)
{
static PangoFontDescription *font_desc;
combo = gtk_combo_box_entry_new_text();
gtk_box_pack_start(GTK_BOX(vbox), combo, FALSE, FALSE, 0);
- g_signal_connect(G_OBJECT(GTK_BIN(combo)->child), "activate",
+ g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN((combo)))), "activate",
G_CALLBACK(combo_activated), NULL);
remember_checkbtn = gtk_check_button_new_with_label(_("Remember this"));
GtkEditable *editable;
if (type == INPUT_DIALOG_COMBO)
- editable = GTK_EDITABLE(GTK_BIN(combo)->child);
+ editable = GTK_EDITABLE(gtk_bin_get_child(GTK_BIN((combo))));
else
editable = GTK_EDITABLE(entry);
GtkWidget *entry_;
if (type == INPUT_DIALOG_COMBO)
- entry_ = GTK_BIN(combo)->child;
+ entry_ = gtk_bin_get_child(GTK_BIN((combo)));
else
entry_ = entry;