gnome-screensaver r1426 - in branches/gnome-2-20: . src



Author: mccann
Date: Mon Apr  7 23:16:56 2008
New Revision: 1426
URL: http://svn.gnome.org/viewvc/gnome-screensaver?rev=1426&view=rev

Log:
2008-04-07  William Jon McCann  <jmccann redhat com>

	* src/gs-lock-plug.c: (on_note_text_buffer_changed),
	(gs_lock_plug_init):
	Add a 160 char limit to the notes.
	Fixes #519447



Modified:
   branches/gnome-2-20/ChangeLog
   branches/gnome-2-20/src/gs-lock-plug.c

Modified: branches/gnome-2-20/src/gs-lock-plug.c
==============================================================================
--- branches/gnome-2-20/src/gs-lock-plug.c	(original)
+++ branches/gnome-2-20/src/gs-lock-plug.c	Mon Apr  7 23:16:56 2008
@@ -56,6 +56,9 @@
 #define GDM_FLEXISERVER_COMMAND "gdmflexiserver"
 #define GDM_FLEXISERVER_ARGS    "--startnew Standard"
 
+/* same as SMS ;) */
+#define NOTE_BUFFER_MAX_CHARS 160
+
 enum {
         AUTH_PAGE = 0,
 };
@@ -81,7 +84,6 @@
         GtkWidget   *auth_prompt_box;
         GtkWidget   *auth_capslock_label;
         GtkWidget   *auth_message_label;
-        GtkWidget   *switch_user_treeview;
         GtkWidget   *away_message_label;
 
         GtkWidget   *auth_unlock_button;
@@ -1578,6 +1580,18 @@
         gtk_clipboard_set_text (clipboard, "", -1);
 }
 
+static void
+on_note_text_buffer_changed (GtkTextBuffer *buffer,
+                             GSLockPlug    *plug)
+{
+        int len;
+
+        len = gtk_text_buffer_get_char_count (buffer);
+        if (len > NOTE_BUFFER_MAX_CHARS) {
+                gtk_widget_set_sensitive (plug->priv->note_text_view, FALSE);
+        }
+}
+
 #define INVISIBLE_CHAR_DEFAULT       '*'
 #define INVISIBLE_CHAR_BLACK_CIRCLE  0x25cf
 #define INVISIBLE_CHAR_WHITE_BULLET  0x25e6
@@ -1622,6 +1636,12 @@
                 gtk_widget_show_all (plug->priv->vbox);
         }
 
+        if (plug->priv->note_text_view != NULL) {
+                GtkTextBuffer *buffer;
+                buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (plug->priv->note_text_view));
+                g_signal_connect (buffer, "changed", G_CALLBACK (on_note_text_buffer_changed), plug);
+        }
+
         /* Layout indicator */
 #ifdef WITH_KBD_LAYOUT_INDICATOR
         if (plug->priv->auth_prompt_kbd_layout_indicator != NULL) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]