4
4
* Quick Lounge Applet
6
* Copyright (C) 2001 The Free Software Foundation, Inc.
6
* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
8
8
* This program is free software; you can redistribute it and/or modify
9
9
* it under the terms of the GNU General Public License as published by
188
188
min_columns = MAX (min_columns, 0);
190
190
max_columns = p->max_visible_cols;
191
max_columns = MAX (max_columns, 1);
191
max_columns = MAX (max_columns, 0);
192
192
max_columns = MAX (max_columns, min_columns);
258
258
&& QUICK_IS_SEPARATOR (child->widget)) {
260
260
if (max_column_height != 0) {
261
p->col_size[col - 1] = max_column_height + spacing;
262
p->buttons_on_col[col - 1] = row - 1;
263
cur_size += p->col_size[col - 1];
264
if (col == min_columns)
261
p->col_size[row - 1] = max_column_height + spacing;
262
p->buttons_on_col[row - 1] = col - 1;
263
cur_size += p->col_size[row - 1];
264
if (row == min_columns)
265
265
min_size = cur_size;
266
if (col == max_columns)
266
if (row == max_columns)
267
267
max_size = cur_size;
268
268
max_column_height = 0;
273
p->col_size[col - 1] = child_requisition.height + spacing;
274
p->buttons_on_col[col - 1] = 1;
275
cur_size += p->col_size[col - 1];
276
if (col == min_columns)
273
p->col_size[row - 1] = child_requisition.height + spacing;
274
p->buttons_on_col[row - 1] = 1;
275
cur_size += p->col_size[row - 1];
276
if (row == min_columns)
277
277
min_size = cur_size;
278
if (col == max_columns)
278
if (row == max_columns)
279
279
max_size = cur_size;
280
280
max_column_height = 0;
284
284
} else if ((orientation == GTK_ORIENTATION_VERTICAL)
285
285
&& QUICK_IS_BUTTON (child->widget)) {
287
287
max_column_height = MAX (max_column_height,
288
288
child_requisition.height);
290
if (row++ == p->rows) {
291
p->col_size[col - 1] = max_column_height + spacing;
292
p->buttons_on_col[col - 1] = row - 1;
293
cur_size += p->col_size[col - 1];
294
if (col == min_columns)
290
if (col++ == p->rows) {
291
p->col_size[row - 1] = max_column_height + spacing;
292
p->buttons_on_col[row - 1] = col - 1;
293
cur_size += p->col_size[row - 1];
294
if (row == min_columns)
295
295
min_size = cur_size;
296
if (col == max_columns)
296
if (row == max_columns)
297
297
max_size = cur_size;
298
298
max_column_height = 0;
312
312
if (max_column_height != 0) {
313
p->col_size[col - 1] = max_column_height + spacing;
314
p->buttons_on_col[col - 1] = row - 1;
315
cur_size += p->col_size[col - 1];
313
p->col_size[row - 1] = max_column_height + spacing;
314
p->buttons_on_col[row - 1] = col - 1;
315
cur_size += p->col_size[row - 1];
319
if (col <= min_columns)
321
if (col <= max_columns)
319
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
320
if (col <= min_columns)
322
if (col <= max_columns)
325
if (row <= min_columns)
327
if (row <= max_columns)
324
331
min_size += spacing + INITIAL_OFFSET * 2;
325
332
max_size += spacing + INITIAL_OFFSET * 2;
334
341
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
335
342
min_size += spacing + arrow_width;
336
343
max_size += spacing + arrow_width;
344
if (box->children == NULL) /* when the box is empty */
345
min_size = p->size / p->rows;
346
requisition->width = min_size;
347
requisition->height = MAX (p->size, arrow_height);
348
p->size_hint[SIZE_HINT_MAX] = max_size - requisition->width;
338
350
min_size += spacing + arrow_height;
339
351
max_size += spacing + arrow_height;
342
if (box->children == NULL) /* when the box is empty */
343
min_size = p->size / p->rows;
347
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
348
requisition->width = min_size;
349
requisition->height = MAX (p->size, arrow_height);
352
if (box->children == NULL) /* when the box is empty */
353
min_size = p->size / p->rows;
351
354
requisition->width = MAX (p->size, arrow_width);
352
355
requisition->height = min_size;
357
if (orientation == GTK_ORIENTATION_HORIZONTAL)
358
p->size_hint[SIZE_HINT_MAX] = max_size - requisition->width;
360
356
p->size_hint[SIZE_HINT_MAX] = max_size - requisition->height;
361
359
p->size_hint[SIZE_HINT_MIN] = 0;
374
372
requisition->width += GTK_CONTAINER (box)->border_width * 2;
375
373
requisition->height += GTK_CONTAINER (box)->border_width * 2;
376
g_print ("REQ [%d, %d]", requisition->width, requisition->height);
565
567
initial_y = (allocation->height - (get_child_size (quick_box) + ICON_SPACING) * quick_box->priv->rows) / 2;
568
initial_x = allocation->x + border_width;
570
570
/* center horizontally */
571
571
initial_x = (allocation->width - (get_child_size (quick_box) + ICON_SPACING) * quick_box->priv->rows) / 2;
573
573
initial_y = allocation->y + border_width + spacing + INITIAL_OFFSET;
589
589
current_width = initial_x;
590
590
current_height = initial_y;
592
under_arrow_children = children_under_the_arrow (quick_box, arrow_width);
592
if (orientation == GTK_ORIENTATION_HORIZONTAL)
593
under_arrow_children = children_under_the_arrow (quick_box, arrow_width);
595
under_arrow_children = children_under_the_arrow (quick_box, arrow_height);
593
596
ignoring_arrow = TRUE;
595
598
for (children = box->children; children; ) {
617
620
current_width += child_allocation.width;
623
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
621
g_print ("[X] %d <--> %d\n", x + child_allocation.width, max_width);
622
g_print ("[Y] %d <--> %d\n", current_height, max_height);
627
g_print ("[X] %d <--> %d\n", x + child_allocation.width, max_width);
628
g_print ("[Y] %d <--> %d\n", current_height, max_height);
625
if (orientation == GTK_ORIENTATION_HORIZONTAL) {
626
631
if (x + child_allocation.width > max_width) {
627
632
if (! do_not_fit) {
628
633
do_not_fit = TRUE;
634
639
hide_from_here = children;
636
641
x += max_line_width + spacing;
638
current_height = border_width;
643
current_height = border_width;
640
645
second_try = TRUE;
653
g_print ("[X] %d <--> %d\n", current_width, max_width);
654
g_print ("[Y] %d <--> %d\n", y + child_allocation.height, max_height);
645
658
if (y + child_allocation.height > max_height) {
646
659
if (! do_not_fit) {
647
660
do_not_fit = TRUE;
1083
1096
GList *children;
1084
1097
gboolean menu_empty = TRUE;
1099
gtk_tooltips_set_tip (quick_box->tooltips,
1100
GTK_WIDGET (tbutton),
1101
_("Hide launchers menu"),
1086
1104
if (quick_box->priv->popup_menu != NULL) {
1087
1105
gtk_menu_shell_deactivate (GTK_MENU_SHELL (quick_box->priv->popup_menu));
1227
1245
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (arrow), FALSE);
1246
gtk_tooltips_set_tip (quick_box->tooltips,
1248
_("Show hidden launchers"),
1229
1251
g_signal_handlers_unblock_by_func (G_OBJECT (arrow),
1230
1252
G_CALLBACK (arrow_button_pressed),
1249
1271
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
1250
1272
gtk_widget_set_parent (button, GTK_WIDGET (quick_box));
1274
gtk_tooltips_set_tip (quick_box->tooltips,
1276
_("Show hidden launchers"),
1252
1279
g_signal_connect (G_OBJECT (button),
1254
1281
G_CALLBACK (arrow_button_pressed),
1283
1310
priv->populate_menu_func = NULL;
1284
1311
priv->populate_menu_data = NULL;
1313
quick_box->tooltips = gtk_tooltips_new ();
1314
g_object_ref (quick_box->tooltips);
1315
gtk_object_sink (GTK_OBJECT (quick_box->tooltips));
1286
1317
priv->arrow_up = create_arrow_button (quick_box, GTK_ARROW_UP);
1287
1318
priv->arrow_down = create_arrow_button (quick_box, GTK_ARROW_DOWN);
1288
1319
priv->arrow_left = create_arrow_button (quick_box, GTK_ARROW_LEFT);
1289
1320
priv->arrow_right = create_arrow_button (quick_box, GTK_ARROW_RIGHT);
1291
quick_box->tooltips = gtk_tooltips_new ();
1292
g_object_ref (quick_box->tooltips);
1293
gtk_object_sink (GTK_OBJECT (quick_box->tooltips));