1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
Identiske underkataloger: src2/CVS og src/CVS
Identiske underkataloger: src2/.deps og src/.deps
Index: gaim/src/gtkgaim.h
===================================================================
--- gaim.orig/src/gtkgaim.h 2005-08-19 21:46:09.550560256 +0200
+++ gaim/src/gtkgaim.h 2005-08-19 21:47:37.276223928 +0200
@@ -66,5 +66,11 @@
*/
#define ICONS_IN_DIALOGS 0
+/**
+ * How many fields is there screen-space for vertically, before a scrollbar is needed?
+ */
+#define VERT_ITEMS 0
+
+
#endif /* _GAIM_GTKGAIM_H_ */
Index: gaim/src/gtkrequest.c
===================================================================
--- gaim.orig/src/gtkrequest.c 2005-08-19 21:46:09.550560256 +0200
+++ gaim/src/gtkrequest.c 2005-08-19 21:53:46.782050504 +0200
@@ -1381,6 +1381,8 @@
GtkWidget *img;
#endif
GtkWidget *sw;
+ GtkWidget *pri_label;
+ GtkWidget *sec_label;
GtkSizeGroup *sg;
GList *gl, *fl;
GaimRequestFieldGroup *group;
@@ -1450,6 +1452,7 @@
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
gtk_widget_show(label);
+ pri_label = label;
g_free(label_text);
}
@@ -1457,7 +1460,7 @@
gl = gl->next)
total_fields += g_list_length(gaim_request_field_group_get_fields(gl->data));
- if(total_fields > 9) {
+ if(total_fields > VERT_ITEMS) {
sw = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
@@ -1484,6 +1487,7 @@
gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
gtk_box_pack_start(GTK_BOX(vbox2), label, TRUE, TRUE, 0);
gtk_widget_show(label);
+ sec_label = label;
}
for (gl = gaim_request_fields_get_groups(fields);
@@ -1718,6 +1722,59 @@
gtk_widget_show(win);
+ //Wait for the window to have recieved its "configure_event",
+ //which means it has been resized by the WM
+ while (gtk_events_pending ()) gtk_main_iteration ();
+
+ //Get allocated size, and adjust widgets accordingly
+ int w, h, field_labels_w;
+ GtkRequisition sg_labels_req;
+ gtk_window_get_size(GTK_WINDOW(win), &w, &h);
+ field_labels_w = label->allocation.width + GAIM_HIG_BORDER*2; //The width of the largest field-label
+
+ printf("%d / %d\n", field_labels_w, w);
+
+ w = w - GAIM_HIG_BORDER * 2;
+ if (primary) gtk_widget_set_size_request(GTK_WIDGET(pri_label), w, -1);
+ if (secondary) gtk_widget_set_size_request(GTK_WIDGET(sec_label), w, -1);
+
+ //Determine what to do - add a scrollbar or resize the input fields?
+ if ((float)field_labels_w / w > 0.5) //if the labels fill more than half the screen add a horizontal scrollbar
+ {
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ }
+ else //resize the input fields
+ {
+ for (gl = gaim_request_fields_get_groups(fields);
+ gl != NULL;
+ gl = gl->next)
+ {
+ GList *field_list;
+ size_t field_count = 0;
+ size_t cols = 1;
+ size_t rows;
+ size_t col_num;
+ size_t row_num = 0;
+
+ group = gl->data;
+ field_list = gaim_request_field_group_get_fields(group);
+
+ for (row_num = 0, fl = field_list;
+ row_num < rows && fl != NULL;
+ row_num++)
+ {
+ for (col_num = 0;
+ col_num < cols && fl != NULL;
+ col_num++, fl = fl->next)
+ {
+ field = fl->data;
+ gtk_widget_set_size_request(GTK_WIDGET(field->ui_data), w-field_labels_w, -1);
+ }
+ }
+ }
+ }
+
return data;
}
|