[Pidgin] #4986: automatic chat input field resizing should be optional, regression from 2.3
Pidgin
trac at pidgin.im
Wed Mar 19 02:56:24 EDT 2008
#4986: automatic chat input field resizing should be optional, regression from 2.3
---------------------------+------------------------------------------------
Reporter: swbrown | Owner:
Type: enhancement | Status: new
Priority: minor | Milestone:
Component: pidgin (gtk) | Version: 2.4.0
Resolution: | Keywords: chat input resize
Pending: 0 |
---------------------------+------------------------------------------------
Comment (by nodashi):
I've patched current version of pidgin (2.4.0) with a following way:
1. Add a checkbox into a "Conversation" page of Preferences dialog to
implement /conversations/old_style_height parameter
2. Depending on this checkbox, input area in a conversation window may be
auto-resized as in a current release, or takes fixed size with a handle
and can be resized. When conversation closed, new size stored in a
configuration file.
The patch follows.
{{{
--- pidgin-2.4.0/pidgin/gtkconv.c.orig 2008-02-29 17:09:28.000000000
+0500
+++ pidgin-2.4.0/pidgin/gtkconv.c 2008-03-19 11:19:43.000000000
+0500
@@ -171,6 +171,8 @@
int width, int height);
static gboolean pidgin_conv_xy_to_right_infopane(PidginWindow *win, int
x, int y);
+static gboolean use_old_style_height();
+
static GdkColor *get_nick_color(PidginConversation *gtkconv, const char
*name) {
static GdkColor col;
GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml);
@@ -223,6 +225,10 @@
return FALSE;
}
+static gboolean use_old_style_height() {
+ return purple_prefs_get_bool(PIDGIN_PREFS_ROOT
"/conversations/old_style_height");
+}
+
static gboolean
close_conv_cb(GtkWidget *w, GdkEventButton *dontuse, PidginConversation
*gtkconv)
{
@@ -234,10 +240,17 @@
PurpleConversation *conv = gtkconv->active_conv;
PurpleAccount *account = purple_conversation_get_account(conv);
const char *name = purple_conversation_get_name(conv);
+ gboolean old_style = use_old_style_height();
switch (purple_conversation_get_type(conv)) {
case PURPLE_CONV_TYPE_IM:
{
+ /* When using old-style input area sizing, save
lower_hbox size on close */
+ if (old_style)
+ purple_prefs_set_int(
+ PIDGIN_PREFS_ROOT
"/conversations/im/entry_height",
+
GTK_WIDGET(gtkconv->lower_hbox)->allocation.height
+ );
if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT
"/conversations/im/close_immediately"))
close_this_sucker(gtkconv);
else
@@ -246,6 +259,12 @@
}
case PURPLE_CONV_TYPE_CHAT:
{
+ /* When using old-style input area sizing, save
lower_hbox size on close */
+ if (old_style)
+ purple_prefs_set_int(
+ PIDGIN_PREFS_ROOT
"/conversations/chat/entry_height",
+
GTK_WIDGET(gtkconv->lower_hbox)->allocation.height
+ );
PurpleChat *chat = purple_blist_find_chat(account,
name);
if (!chat ||
!purple_blist_node_get_bool(&chat->node, "gtk-persistent"))
@@ -4374,6 +4393,25 @@
int height, diff;
int pad_top, pad_inside, pad_bottom;
+ /* We can prefer old-style input area sizing */
+ if (use_old_style_height()) {
+
+ /* Find stored height */
+ height = (gtkconv->active_conv->type ==
PURPLE_CONV_TYPE_CHAT) ?
+ purple_prefs_get_int(PIDGIN_PREFS_ROOT
"/conversations/chat/entry_height")
+ :
+ purple_prefs_get_int(PIDGIN_PREFS_ROOT
"/conversations/im/entry_height");
+
+ /* if there is no such value, use 128 */
+ if (height<1)
+ height = 128;
+
+ gtk_widget_set_size_request( gtkconv->lower_hbox, -1,
height );
+
+ return FALSE;
+
+ }
+
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry));
wrapped_lines = 1;
@@ -4406,6 +4444,7 @@
gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
diff + gtkconv->lower_hbox->allocation.height);
+
return FALSE;
}
@@ -4599,16 +4638,27 @@
setup_common_pane(PidginConversation *gtkconv)
{
GtkWidget *vbox, *frame, *imhtml_sw, *event_box;
+ GtkWidget * vpaned = NULL;
GtkCellRenderer *rend;
GtkTreePath *path;
+ gboolean old_style = use_old_style_height();
PurpleConversation *conv = gtkconv->active_conv;
gboolean chat = (conv->type == PURPLE_CONV_TYPE_CHAT);
GtkPolicyType imhtml_sw_hscroll;
/* Setup the top part of the pane */
+
vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
gtk_widget_show(vbox);
+ /* Start of paned install step 1 */
+ if (old_style) {
+ vpaned = gtk_vpaned_new();
+ gtk_widget_show(vpaned);
+ gtk_paned_pack1(GTK_PANED(vpaned), vbox, TRUE, TRUE);
+ }
+ /* End of paned install step 1 */
+
/* Setup the info pane */
event_box = gtk_event_box_new();
#if GTK_CHECK_VERSION(2,4,0)
@@ -4700,7 +4750,13 @@
G_CALLBACK(refocus_entry_cb), gtkconv);
gtkconv->lower_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
- gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox, FALSE,
FALSE, 0);
+
+ if (old_style) {
+ gtk_paned_pack2(GTK_PANED(vpaned), gtkconv->lower_hbox,
FALSE, TRUE);
+ } else {
+ gtk_box_pack_start(GTK_BOX(vbox), gtkconv->lower_hbox,
FALSE, FALSE, 0);
+ }
+
gtk_widget_show(gtkconv->lower_hbox);
/* Setup the toolbar, entry widget and all signals */
@@ -4742,7 +4798,12 @@
default_formatize(gtkconv);
g_signal_connect_after(G_OBJECT(gtkconv->entry),
"format_function_clear",
G_CALLBACK(clear_formatting_cb), gtkconv);
- return vbox;
+
+ if (old_style) {
+ return vpaned;
+ } else {
+ return vbox;
+ }
}
static void
--- pidgin-2.4.0/pidgin/gtkprefs.c.orig 2008-02-29 17:09:29.000000000
+0500
+++ pidgin-2.4.0/pidgin/gtkprefs.c 2008-03-19 11:15:18.000000000
+0500
@@ -963,6 +963,7 @@
#endif
pidgin_prefs_checkbox(_("Use smooth-scrolling"), PIDGIN_PREFS_ROOT
"/conversations/use_smooth_scrolling", vbox);
+ pidgin_prefs_checkbox(_("Use old-style input area sizing"),
PIDGIN_PREFS_ROOT "/conversations/old_style_height", vbox);
#ifdef _WIN32
pidgin_prefs_checkbox(_("F_lash window when IMs are received"),
PIDGIN_PREFS_ROOT "/win32/blink_im", vbox);
}}}
--
Ticket URL: <http://developer.pidgin.im/ticket/4986#comment:135>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list