summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <resiak@pidgin.im>2008-05-03 17:36:17 +0000
committerWill Thompson <resiak@pidgin.im>2008-05-03 17:36:17 +0000
commit7d4acd6900e87bd56737a17b96572a7bbcf903b7 (patch)
treea665d45cc3bc0aa7ea2e0ab38744358a8b93dcb4
parentc41633e1cbed5a0cc33f2e5555ab673f5196b95f (diff)
downloadpidgin-7d4acd6900e87bd56737a17b96572a7bbcf903b7.tar.gz
Add a "minimum lines" pref for the im entry box thing; up to 8 lines.
* This uses a spinbutton for the prefs; who wants to make this a slider? * The string is clumsy. Sorry. * The example imhtml in the prefs dialog doesn't change size to match the pref; I think Sadrul wanted this to happen?
-rw-r--r--pidgin/gtkconv.c28
-rw-r--r--pidgin/gtkprefs.c6
2 files changed, 32 insertions, 2 deletions
diff --git a/pidgin/gtkconv.c b/pidgin/gtkconv.c
index 1d758d3005..0aae905550 100644
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -4460,6 +4460,7 @@ static gboolean resize_imhtml_cb(PidginConversation *gtkconv)
int pad_top, pad_inside, pad_bottom;
int total_height = (gtkconv->imhtml->allocation.height + gtkconv->entry->allocation.height);
int max_height = total_height / 2;
+ int min_lines = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines");
int min_height;
pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry));
@@ -4481,10 +4482,10 @@ static gboolean resize_imhtml_cb(PidginConversation *gtkconv)
} while (gtk_text_iter_forward_line(&iter));
height += lines * (oneline.height + pad_top + pad_bottom);
- /* Make sure there's enough room for at least two lines. Allocate enough space to
+ /* Make sure there's enough room for at least min_lines. Allocate enough space to
* prevent scrolling when the second line is a continuation of the first line, or
* is the beginning of a new paragraph. */
- min_height = 2 * (oneline.height + MAX(pad_inside, pad_top + pad_bottom));
+ min_height = min_lines * (oneline.height + MAX(pad_inside, pad_top + pad_bottom));
height = CLAMP(height, min_height, max_height);
diff = height - gtkconv->entry->allocation.height;
@@ -4498,6 +4499,25 @@ static gboolean resize_imhtml_cb(PidginConversation *gtkconv)
}
static void
+minimum_entry_lines_pref_cb(const char *name,
+ PurplePrefType type,
+ gconstpointer value,
+ gpointer data)
+{
+ GList *l = purple_get_conversations();
+ PurpleConversation *conv;
+ while (l != NULL)
+ {
+ conv = (PurpleConversation *)l->data;
+
+ if (PIDGIN_IS_PIDGIN_CONVERSATION(conv))
+ resize_imhtml_cb(PIDGIN_CONVERSATION(conv));
+
+ l = l->next;
+ }
+}
+
+static void
setup_chat_topic(PidginConversation *gtkconv, GtkWidget *vbox)
{
PurpleConversation *conv = gtkconv->active_conv;
@@ -7745,6 +7765,7 @@ pidgin_conversations_init(void)
purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline", FALSE);
purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/spellcheck", TRUE);
purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_incoming_formatting", TRUE);
+ purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines", 2);
purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", TRUE);
purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", TRUE);
@@ -7809,6 +7830,9 @@ pidgin_conversations_init(void)
conv_placement_pref_cb, NULL);
purple_prefs_trigger_callback(PIDGIN_PREFS_ROOT "/conversations/placement");
+ purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines",
+ minimum_entry_lines_pref_cb, NULL);
+
/* IM callbacks */
purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/animate_buddy_icons",
animate_buddy_icons_pref_cb, NULL);
diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c
index 1439ad5c9c..253ea52175 100644
--- a/pidgin/gtkprefs.c
+++ b/pidgin/gtkprefs.c
@@ -1074,6 +1074,12 @@ conv_page(void)
pidgin_prefs_checkbox(_("Minimi_ze new conversation windows"), PIDGIN_PREFS_ROOT "/win32/minimize_new_convs", vbox);
#endif
+ pidgin_prefs_labeled_spin_button(vbox,
+ _("Minimum lines of text to show in message input"),
+ PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines",
+ 1, 8, NULL);
+
+
#if GTK_CHECK_VERSION(2,4,0)
vbox = pidgin_make_frame(ret, _("Font"));
if (purple_running_gnome())