pidgin: 64894e11: Add a "minimum lines" pref for the im en...
resiak at soc.pidgin.im
resiak at soc.pidgin.im
Sat May 3 13:40:47 EDT 2008
-----------------------------------------------------------------
Revision: 64894e11d0fa1bbfb2fdada9b6d752138f305600
Ancestor: 5a477c18d16e2607bb3c21769668885c69b0bc55
Author: resiak at soc.pidgin.im
Date: 2008-05-03T17:36:17
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/64894e11d0fa1bbfb2fdada9b6d752138f305600
Modified files:
pidgin/gtkconv.c pidgin/gtkprefs.c
ChangeLog:
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?
-------------- next part --------------
============================================================
--- pidgin/gtkconv.c c122337a14eb60106a91d7167247a9e3789edebd
+++ pidgin/gtkconv.c 547a089c6576a73b28458c15851a94c4defa7135
@@ -4460,6 +4460,7 @@ static gboolean resize_imhtml_cb(PidginC
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(PidginC
} 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 void
}
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);
============================================================
--- pidgin/gtkprefs.c 2215fae05d3abb1dc6fc2860834b40b6c3c79a75
+++ pidgin/gtkprefs.c c1f78490b79293d78dae1b68988e958b00107128
@@ -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())
More information about the Commits
mailing list