aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/shortcut-bar/test-shortcut-bar.c
blob: 9197fdf16e7b3b7b3e2653a1c80f95b8f633dd95 (plain) (blame)
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */

/* 
 * Author : 
 *  Damon Chaplin <damon@helixcode.com>
 *
 * Copyright 1999, Helix Code, Inc.
 *
 * This program is free software; you can redistribute it and/or 
 * modify it under the terms of the GNU General Public License as 
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 */

/*
 * This tests the ShortcutBar widget.
 */

#include <gnome.h>

#include "e-shortcut-bar.h"

#include <widgets/e-paned/e-hpaned.h>

#define NUM_SHORTCUT_TYPES 5
gchar *shortcut_types[NUM_SHORTCUT_TYPES] = {
    "folder:", "file:", "calendar:", "todo:", "contacts:"
};
gchar *icon_filenames[NUM_SHORTCUT_TYPES] = {
    "gnome-balsa2.png", "gnome-folder.png", "gnome-calendar.png",
    "gnome-cromagnon.png", "gnome-ccthemes.png"
};
GdkPixbuf *icon_pixbufs[NUM_SHORTCUT_TYPES];

GtkWidget *main_label;

static GdkPixbuf *icon_callback  (EShortcutBar *shortcut_bar,
                  const gchar  *url,
                  gpointer      data);

static void on_main_label_size_allocate (GtkWidget *widget,
                     GtkAllocation *allocation,
                     gpointer data);
static void quit (GtkWidget *window, GdkEvent *event, gpointer data);
static void add_test_groups (EShortcutBar *shortcut_bar);
static void add_test_group (EShortcutBar *shortcut_bar, gint i,
                gchar *group_name);
static gint get_random_int (gint max);

static void on_shortcut_bar_item_selected (EShortcutBar *shortcut_bar,
                       GdkEvent *event,
                       gint group_num,
                       gint item_num);
static void show_standard_popup (EShortcutBar *shortcut_bar,
                 GdkEvent *event,
                 gint group_num);
static void show_context_popup (EShortcutBar *shortcut_bar,
                GdkEvent *event,
                gint group_num,
                gint item_num);

static void set_large_icons (GtkWidget *menuitem,
                 EShortcutBar *shortcut_bar);
static void set_small_icons (GtkWidget *menuitem,
                 EShortcutBar *shortcut_bar);
static void remove_group (GtkWidget *menuitem,
              EShortcutBar *shortcut_bar);

static void rename_item (GtkWidget *menuitem,
             EShortcutBar *shortcut_bar);
static void remove_item (GtkWidget *menuitem,
             EShortcutBar *shortcut_bar);
static void on_set_group_button_clicked (GtkWidget *button,
                     EShortcutBar *shortcut_bar);
static void on_set_group_button_no_animation_clicked (GtkWidget *button,
                              EShortcutBar *shortcut_bar);
static void on_item_added (EShortcutModel *shortcut_model,
               gint group_num,
               gint item_num);
static void on_item_removed (EShortcutModel *shortcut_model,
                 gint group_num,
                 gint item_num);
static void on_group_added (EShortcutModel *shortcut_model,
                gint group_num);
static void on_group_removed (EShortcutModel *shortcut_model,
                  gint group_num);

int
main (int argc, char *argv[])
{
    GtkWidget *window, *hpaned, *shortcut_bar, *vbox, *button;
    EShortcutModel *shortcut_model;
    gchar *pathname;
    gint i;

    gnome_init ("test-shortcut-bar", "0.1", argc, argv);

    gtk_widget_push_visual (gdk_rgb_get_visual ());
    gtk_widget_push_colormap (gdk_rgb_get_cmap ());

    window = gnome_app_new ("TestShortcutBar", "TestShortCutBar");
    gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
    gtk_window_set_policy (GTK_WINDOW (window), FALSE, TRUE, FALSE);

    gtk_signal_connect (GTK_OBJECT (window), "delete-event",
                GTK_SIGNAL_FUNC (quit), NULL);

    hpaned = e_hpaned_new ();
    gnome_app_set_contents (GNOME_APP (window), hpaned);
    gtk_widget_show (hpaned);

    shortcut_model = e_shortcut_model_new ();

    shortcut_bar = e_shortcut_bar_new ();
    e_shortcut_bar_set_model (E_SHORTCUT_BAR (shortcut_bar),
                  shortcut_model);
    e_paned_pack1 (E_PANED (hpaned), shortcut_bar, FALSE, TRUE);
    gtk_widget_show (shortcut_bar);
    e_shortcut_bar_set_icon_callback (E_SHORTCUT_BAR (shortcut_bar),
                      icon_callback,
                      NULL);

    gtk_signal_connect (GTK_OBJECT (shortcut_model), "item_added",
                GTK_SIGNAL_FUNC (on_item_added), NULL);
    gtk_signal_connect (GTK_OBJECT (shortcut_model), "item_removed",
                GTK_SIGNAL_FUNC (on_item_removed), NULL);
    gtk_signal_connect (GTK_OBJECT (shortcut_model), "group_added",
                GTK_SIGNAL_FUNC (on_group_added), NULL);
    gtk_signal_connect (GTK_OBJECT (shortcut_model), "group_removed",
                GTK_SIGNAL_FUNC (on_group_removed), NULL);

#if 0
    gtk_container_set_border_width (GTK_CONTAINER (shortcut_bar), 4);
#endif

    e_paned_set_position (E_PANED (hpaned), 100);
    /*e_paned_set_gutter_size (E_PANED (hpaned), 12);*/

    vbox = gtk_vbox_new (FALSE, 0);
    e_paned_pack2 (E_PANED (hpaned), vbox, TRUE, TRUE);
    gtk_widget_show (vbox);


    main_label = gtk_label_new ("Main Application Window Goes Here");
    gtk_box_pack_start (GTK_BOX (vbox), main_label, TRUE, TRUE, 0);
    gtk_widget_show (main_label);
    gtk_signal_connect (GTK_OBJECT (main_label), "size_allocate",
                GTK_SIGNAL_FUNC (on_main_label_size_allocate),
                NULL);

    button = gtk_button_new_with_label ("Set current group to 3rd");
    gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
    gtk_widget_show (button);
    gtk_signal_connect (GTK_OBJECT (button), "clicked",
                GTK_SIGNAL_FUNC (on_set_group_button_clicked),
                shortcut_bar);

    button = gtk_button_new_with_label ("Set current group to 5th (no animation)");
    gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
    gtk_widget_show (button);
    gtk_signal_connect (GTK_OBJECT (button), "clicked",
                GTK_SIGNAL_FUNC (on_set_group_button_no_animation_clicked),
                shortcut_bar);


    gtk_widget_pop_visual ();
    gtk_widget_pop_colormap ();

    /* Load our default icons. */
    for (i = 0; i < NUM_SHORTCUT_TYPES; i++) {
        pathname = gnome_pixmap_file (icon_filenames[i]);
        if (pathname)
            icon_pixbufs[i] = gdk_pixbuf_new_from_file (pathname);
        else
            icon_pixbufs[i] = NULL;
    }

    add_test_groups (E_SHORTCUT_BAR (shortcut_bar));

    gtk_signal_connect (GTK_OBJECT (shortcut_bar), "item_selected",
                GTK_SIGNAL_FUNC (on_shortcut_bar_item_selected),
                NULL);

    gtk_widget_show (window);
    gtk_main ();
    return 0;
}


static GdkPixbuf*
icon_callback (EShortcutBar *shortcut_bar,
           const gchar *url,
           gpointer data)
{
    gint i;

    for (i = 0; i < NUM_SHORTCUT_TYPES; i++) {
        if (!strncmp (url, shortcut_types[i],
                  strlen (shortcut_types[i]))) {
            gdk_pixbuf_ref (icon_pixbufs[i]);
            return icon_pixbufs[i];
        }
    }

    return NULL;
}

static void
on_main_label_size_allocate (GtkWidget *widget,
                 GtkAllocation *allocation,
                 gpointer data)
{
    g_print ("In on_main_label_size_allocate\n");
}

static void
quit (GtkWidget *window, GdkEvent *event, gpointer data)
{
    gtk_widget_destroy (window);
    gtk_exit (0);
}


static void
add_test_groups (EShortcutBar *shortcut_bar)
{
    add_test_group (shortcut_bar, 1, "Shortcuts");
    add_test_group (shortcut_bar, 2, "My Shortcuts");
    add_test_group (shortcut_bar, 3, "Longer Shortcuts");
    add_test_group (shortcut_bar, 4, "Very Long Shortcuts");
    add_test_group (shortcut_bar, 5, "Incredibly Long Shortcuts");
}


static void
add_test_group (EShortcutBar *shortcut_bar, gint i, gchar *group_name)
{
    gint group_num, item_num, num_items;
    gchar buffer[128];
    gint shortcut_type, j;

    group_num = e_shortcut_model_add_group (shortcut_bar->model, -1,
                        group_name);

    if (group_num % 2)
        e_shortcut_bar_set_view_type (shortcut_bar, group_num,
                          E_ICON_BAR_SMALL_ICONS);

    num_items = get_random_int (5) + 3;
    for (j = 1; j <= num_items; j++) {
        if (j == 1)
            sprintf (buffer, "A very long shortcut with proper words so I can test the wrapping and ellipsis behaviour");
        else if (j == 2)
            sprintf (buffer, "A very long shortcut with averylongworkinthemiddlesoIcantestthewrappingandellipsisbehaviour");
        else
            sprintf (buffer, "Item %i:%i\n", i, j);

        shortcut_type = get_random_int (NUM_SHORTCUT_TYPES);
        item_num = e_shortcut_model_add_item (shortcut_bar->model,
                              group_num, -1,
                              shortcut_types[shortcut_type],
                              buffer);
    }
}


/* Returns a random integer between 0 and max - 1. */
static gint
get_random_int (gint max)
{
    gint random_num;

    random_num = (int) (max * (rand () / (RAND_MAX + 1.0)));
#if 0
    g_print ("Random num (%i): %i\n", max, random_num);
#endif
    return random_num;
}


static void
on_shortcut_bar_item_selected (EShortcutBar *shortcut_bar,
                   GdkEvent *event, gint group_num, gint item_num)
{
    gchar buffer[256];

    if (event->button.button == 1) {
        sprintf (buffer, "Item Selected - %i:%i",
             group_num + 1, item_num + 1);
        gtk_label_set_text (GTK_LABEL (main_label), buffer);
    } else if (event->button.button == 3) {
        if (item_num == -1)
            show_standard_popup (shortcut_bar, event, group_num);
        else
            show_context_popup (shortcut_bar, event, group_num,
                        item_num);
    }
}


static void
show_standard_popup (EShortcutBar *shortcut_bar,
             GdkEvent *event,
             gint group_num)
{
    GtkWidget *menu, *menuitem;

    /* We don't have any commands if there aren't any groups yet. */
    if (group_num == -1)
        return;

    menu = gtk_menu_new ();

    menuitem = gtk_menu_item_new_with_label ("Large Icons");
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);
    gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
                GTK_SIGNAL_FUNC (set_large_icons), shortcut_bar);

    menuitem = gtk_menu_item_new_with_label ("Small Icons");
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);
    gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
                GTK_SIGNAL_FUNC (set_small_icons), shortcut_bar);

    menuitem = gtk_menu_item_new ();
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);

    menuitem = gtk_menu_item_new_with_label ("Add New Group");
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);

    menuitem = gtk_menu_item_new_with_label ("Remove Group");
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);
    gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
                GTK_SIGNAL_FUNC (remove_group), shortcut_bar);

    menuitem = gtk_menu_item_new_with_label ("Rename Group");
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);

    menuitem = gtk_menu_item_new ();
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);

    menuitem = gtk_menu_item_new_with_label ("Add Shortcut...");
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);

    menuitem = gtk_menu_item_new ();
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);

    menuitem = gtk_menu_item_new_with_label ("Hide Shortcut Bar");
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);

    /* Save the group num so we can get it in the callbacks. */
    gtk_object_set_data (GTK_OBJECT (menu), "group_num",
                 GINT_TO_POINTER (group_num));

    /* FIXME: Destroy menu when finished with it somehow? */
    gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
            event->button.button, event->button.time);
}


static void
set_large_icons (GtkWidget *menuitem,
         EShortcutBar *shortcut_bar)
{
    GtkWidget *menu;
    gint group_num;

    menu = menuitem->parent;
    g_return_if_fail (GTK_IS_MENU (menu));

    group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
                              "group_num"));

    e_shortcut_bar_set_view_type (shortcut_bar, group_num,
                      E_ICON_BAR_LARGE_ICONS);
}


static void
set_small_icons (GtkWidget *menuitem,
         EShortcutBar *shortcut_bar)
{
    GtkWidget *menu;
    gint group_num;

    menu = menuitem->parent;
    g_return_if_fail (GTK_IS_MENU (menu));

    group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
                              "group_num"));

    e_shortcut_bar_set_view_type (shortcut_bar, group_num,
                      E_ICON_BAR_SMALL_ICONS);
}


static void
remove_group (GtkWidget *menuitem,
          EShortcutBar *shortcut_bar)
{
    GtkWidget *menu;
    gint group_num;

    menu = menuitem->parent;
    g_return_if_fail (GTK_IS_MENU (menu));

    group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
                              "group_num"));
    
    e_shortcut_model_remove_group (shortcut_bar->model, group_num);
}


static void
show_context_popup (EShortcutBar *shortcut_bar,
            GdkEvent *event,
            gint group_num,
            gint item_num)
{
    GtkWidget *menu, *menuitem, *label, *pixmap;

    menu = gtk_menu_new ();

    menuitem = gtk_pixmap_menu_item_new ();
    label = gtk_label_new ("Open Folder");
    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
    gtk_widget_show (label);
    gtk_container_add (GTK_CONTAINER (menuitem), label);
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);
    pixmap = gnome_stock_pixmap_widget (menu, GNOME_STOCK_MENU_OPEN);
    if (pixmap) {
        gtk_widget_show(pixmap);
        gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (menuitem), pixmap);
    }

    menuitem = gtk_menu_item_new_with_label ("Open in New Window");
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);

    menuitem = gtk_menu_item_new_with_label ("Advanced Find");
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);

    menuitem = gtk_menu_item_new ();
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);

    menuitem = gtk_menu_item_new_with_label ("Remove from Shortcut Bar");
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);
    gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
                GTK_SIGNAL_FUNC (remove_item), shortcut_bar);

    menuitem = gtk_menu_item_new_with_label ("Rename Shortcut");
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);
    gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
                GTK_SIGNAL_FUNC (rename_item), shortcut_bar);

    menuitem = gtk_menu_item_new ();
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);

    menuitem = gtk_menu_item_new_with_label ("Properties");
    gtk_widget_set_sensitive (menuitem, FALSE);
    gtk_widget_show (menuitem);
    gtk_menu_append (GTK_MENU (menu), menuitem);


    /* Save the group & item nums so we can get them in the callbacks. */
    gtk_object_set_data (GTK_OBJECT (menu), "group_num",
                 GINT_TO_POINTER (group_num));
    gtk_object_set_data (GTK_OBJECT (menu), "item_num",
                 GINT_TO_POINTER (item_num));

    /* FIXME: Destroy menu when finished with it somehow? */
    gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
            event->button.button, event->button.time);
}


static void
rename_item (GtkWidget *menuitem,
         EShortcutBar *shortcut_bar)
{
    GtkWidget *menu;
    gint group_num, item_num;

    menu = menuitem->parent;
    g_return_if_fail (GTK_IS_MENU (menu));

    group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
                              "group_num"));
    item_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
                             "item_num"));
    
    e_shortcut_bar_start_editing_item (shortcut_bar, group_num, item_num);
}


static void
remove_item (GtkWidget *menuitem,
         EShortcutBar *shortcut_bar)
{
    GtkWidget *menu;
    gint group_num, item_num;

    menu = menuitem->parent;
    g_return_if_fail (GTK_IS_MENU (menu));

    group_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
                              "group_num"));
    item_num = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menu),
                             "item_num"));
    
    e_shortcut_model_remove_item (shortcut_bar->model, group_num,
                      item_num);
}


static void
on_set_group_button_clicked (GtkWidget *button,
                 EShortcutBar *shortcut_bar)
{
    g_print ("In on_set_group_button_clicked\n");

    e_group_bar_set_current_group_num (E_GROUP_BAR (shortcut_bar),
                       2, TRUE);
}


static void
on_set_group_button_no_animation_clicked (GtkWidget *button,
                      EShortcutBar *shortcut_bar)
{
    g_print ("In on_set_group_button_no_animation_clicked\n");

    e_group_bar_set_current_group_num (E_GROUP_BAR (shortcut_bar),
                       4, FALSE);
}


static void
on_item_added (EShortcutModel *shortcut_model,
           gint group_num,
           gint item_num)
{
    g_print ("In on_item_added Group:%i Item:%i\n", group_num, item_num);
}


static void
on_item_removed (EShortcutModel *shortcut_model,
         gint group_num,
         gint item_num)
{
    g_print ("In on_item_removed Group:%i Item:%i\n", group_num, item_num);
}


static void
on_group_added (EShortcutModel *shortcut_model,
        gint group_num)
{
    g_print ("In on_group_added Group:%i\n", group_num);
}


static void
on_group_removed (EShortcutModel *shortcut_model,
          gint group_num)
{
    g_print ("In on_group_removed Group:%i\n", group_num);
}