~andrewsomething/imagination/debian

« back to all changes in this revision

Viewing changes to src/main-window.c

  • Committer: Andrew Starr-Bochicchio
  • Date: 2009-10-20 00:11:10 UTC
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: a.starr.b@gmail.com-20091020001110-5kkkrlvk0u3pnw0w
Tags: upstream-2.1
ImportĀ upstreamĀ versionĀ 2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
static void img_slide_cut(GtkMenuItem * , img_window_struct *);
45
45
static void img_slide_copy(GtkMenuItem * , img_window_struct *);
46
46
static void img_slide_paste(GtkMenuItem* , img_window_struct *);
 
47
static void img_report_slides_transitions(img_window_struct *);
47
48
static void img_clear_audio_files(GtkButton *, img_window_struct *);
48
49
static void img_expand_button_clicked(GtkButton *, img_window_struct *);
49
50
static void img_on_drag_audio_data_received (GtkWidget *,GdkDragContext *, int, int, GtkSelectionData *, unsigned int, unsigned int, img_window_struct *);
57
58
static gint img_sort_none_before_other(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *, gpointer);
58
59
static void img_check_numeric_entry (GtkEditable *entry, gchar *text, gint lenght, gint *position, gpointer data);
59
60
static void img_show_uri(GtkMenuItem *, img_window_struct *);
 
61
static void img_select_slide_from_slide_report_dialog(GtkButton *, img_window_struct *);
 
62
static void img_show_slides_report_dialog(GtkMenuItem *, img_window_struct *);
60
63
 
61
64
static void
62
65
img_create_export_menu( GtkWidget         *item,
82
85
img_toggle_mode( GtkCheckMenuItem  *item,
83
86
                                 img_window_struct *img );
84
87
 
 
88
static gint
 
89
img_sort_report_transitions( gconstpointer a,
 
90
                                                         gconstpointer b );
 
91
 
85
92
 
86
93
/* ****************************************************************************
87
94
 * Function definitions
94
101
        GtkWidget *menuitem1;
95
102
        GtkWidget *menu1;
96
103
        GtkWidget *imagemenuitem1;
97
 
        GtkWidget *imagemenuitem2;
98
104
        GtkWidget *imagemenuitem5;
99
105
        GtkWidget *separatormenuitem1;
100
106
        GtkWidget *menuitem2;
370
376
        tmp_image = gtk_image_new_from_stock (GTK_STOCK_DELETE,GTK_ICON_SIZE_MENU);
371
377
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (img_struct->remove_menu),tmp_image);
372
378
 
 
379
        img_struct->report_menu = gtk_image_menu_item_new_with_mnemonic (_("Repor_t"));
 
380
        gtk_container_add (GTK_CONTAINER (slide_menu), img_struct->report_menu);
 
381
        gtk_widget_add_accelerator( img_struct->report_menu, "activate", img_struct->accel_group, GDK_t, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE );
 
382
        g_signal_connect (G_OBJECT (img_struct->report_menu),"activate",G_CALLBACK (img_show_slides_report_dialog),img_struct);
 
383
 
 
384
        tmp_image = gtk_image_new_from_stock (GTK_STOCK_INDEX,GTK_ICON_SIZE_MENU);
 
385
        gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (img_struct->report_menu),tmp_image);
 
386
        
373
387
        pixbuf = gtk_icon_theme_load_icon(icon_theme,"object-rotate-left",GTK_ICON_SIZE_MENU,0,NULL);
374
388
        tmp_image = gtk_image_new_from_pixbuf(pixbuf);
375
389
        g_object_unref(pixbuf);
412
426
        menu1 = gtk_menu_new ();
413
427
        gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem1), menu1);
414
428
 
415
 
        imagemenuitem1 = gtk_radio_menu_item_new_with_label( NULL, _("Preview mode") );
416
 
        g_signal_connect( G_OBJECT( imagemenuitem1 ), "toggled",
 
429
        img_struct->menu_preview_mode = gtk_radio_menu_item_new_with_label( NULL, _("Preview mode") );
 
430
        g_signal_connect( G_OBJECT( img_struct->menu_preview_mode ), "toggled",
417
431
                                          G_CALLBACK( img_toggle_mode ), img_struct );
418
 
        gtk_menu_shell_append( GTK_MENU_SHELL( menu1 ), imagemenuitem1 );
 
432
        gtk_menu_shell_append( GTK_MENU_SHELL( menu1 ), img_struct->menu_preview_mode );
419
433
 
420
 
        imagemenuitem2 = gtk_radio_menu_item_new_with_label_from_widget( 
421
 
                                                        GTK_RADIO_MENU_ITEM( imagemenuitem1 ), _("Overview mode") );
422
 
        gtk_menu_shell_append( GTK_MENU_SHELL( menu1 ), imagemenuitem2 );
 
434
        img_struct->menu_overview_mode = gtk_radio_menu_item_new_with_label_from_widget( 
 
435
                                                        GTK_RADIO_MENU_ITEM( img_struct->menu_preview_mode ), _("Overview mode") );
 
436
        gtk_menu_shell_append( GTK_MENU_SHELL( menu1 ), img_struct->menu_overview_mode );
423
437
 
424
438
        menuitem3 = gtk_menu_item_new_with_mnemonic (_("_Help"));
425
439
        gtk_container_add (GTK_CONTAINER (menubar), menuitem3);
945
959
 
946
960
                /* First code snippet is in use for development version,
947
961
                 * while second is intendeded for releases */
948
 
                /* path = g_strconcat( "pixmaps/imagination-pos", NULL ); */
 
962
#if PLUGINS_INSTALLED
949
963
                path = g_strconcat( DATADIR, "/imagination/pixmaps/imagination-pos", NULL );
 
964
#else
 
965
                path = g_strconcat( "pixmaps/imagination-pos", NULL );
 
966
#endif
950
967
                for( i = 0; i < 9; i++ )
951
968
                {
952
969
                        gchar *file;
1122
1139
                gtk_cell_layout_pack_start( GTK_CELL_LAYOUT( icon ), cell, FALSE );
1123
1140
                img_struct->over_cell = G_OBJECT( cell );
1124
1141
 
 
1142
#if PLUGINS_INSTALLED
1125
1143
                path = g_strconcat( DATADIR,
1126
1144
                                                        "/imagination/pixmaps/imagination-text.png",
1127
1145
                                                        NULL );
 
1146
#else
 
1147
                path = g_strdup( "pixmaps/imagination-text.png" );
 
1148
#endif
1128
1149
                text = gdk_pixbuf_new_from_file( path, NULL );
1129
1150
                g_free( path );
1130
1151
                g_object_set( G_OBJECT( cell ), "ypad", 2,
1170
1191
                gchar     *path;
1171
1192
                GdkPixbuf *text;
1172
1193
 
 
1194
#if PLUGINS_INSTALLED
1173
1195
                path = g_strconcat( DATADIR,
1174
1196
                                                        "/imagination/pixmaps/imagination-text.png",
1175
1197
                                                        NULL );
 
1198
#else
 
1199
                path = g_strdup( "pixmaps/imagination-text.png" );
 
1200
#endif
1176
1201
                text = gdk_pixbuf_new_from_file( path, NULL );
1177
1202
                g_free( path );
1178
1203
                g_object_set( G_OBJECT( pixbuf_cell ), "width", 115,
1302
1327
                        {
1303
1328
                                /* Fill fields with fresh strings, since g_slice_copy cannot do
1304
1329
                                 * that for us. */
1305
 
                                pasted_slide->filename = g_strdup(info_slide->filename);
1306
 
                                pasted_slide->original_filename = g_strdup(info_slide->original_filename);
 
1330
                                pasted_slide->o_filename = g_strdup(info_slide->o_filename);
 
1331
                                pasted_slide->r_filename = g_strdup(info_slide->r_filename);
1307
1332
                                pasted_slide->resolution = g_strdup(info_slide->resolution);
1308
1333
                                pasted_slide->type = g_strdup(info_slide->type);
1309
1334
                                pasted_slide->path = g_strdup(info_slide->path);
1571
1596
        }
1572
1597
        else
1573
1598
        {
1574
 
                if (info_slide->filename != NULL)
 
1599
                if (info_slide->o_filename != NULL)
1575
1600
                {
1576
 
                        slide_info_msg = g_strdup_printf("%s    %s: %s    %s: %s",info_slide->filename, _("Resolution"), info_slide->resolution, _("Type"), info_slide->type);
 
1601
                        slide_info_msg = g_strdup_printf("%s    %s: %s    %s: %s",info_slide->o_filename, _("Resolution"), info_slide->resolution, _("Type"), info_slide->type);
1577
1602
                        gtk_statusbar_push(GTK_STATUSBAR (img->statusbar), img->context_id, slide_info_msg);
1578
1603
                        g_free(slide_info_msg);
1579
1604
                }
1591
1616
         * large image preview. */
1592
1617
        if( img->mode == 0 )
1593
1618
        {
1594
 
                if( ! info_slide->filename )
 
1619
                if( ! info_slide->r_filename )
1595
1620
                {
1596
1621
                        img_scale_gradient( info_slide->gradient,
1597
1622
                                                                info_slide->g_start_point,
1604
1629
                }
1605
1630
                /* Respect quality settings */
1606
1631
                else if( img->low_quality )
1607
 
                        img_scale_image( info_slide->filename,
 
1632
                        img_scale_image( info_slide->r_filename,
1608
1633
                                                         (gdouble)img->video_size[0] / img->video_size[1],
1609
1634
                                                         0, img->video_size[1], img->distort_images,
1610
1635
                                                         img->background_color, NULL, &img->current_image );
1611
1636
                else
1612
 
                        img_scale_image( info_slide->filename,
 
1637
                        img_scale_image( info_slide->r_filename,
1613
1638
                                                         (gdouble)img->video_size[0] / img->video_size[1],
1614
1639
                                                         0, 0, img->distort_images,
1615
1640
                                                         img->background_color, NULL, &img->current_image );
1618
1643
 
1619
1644
static void img_combo_box_transition_type_changed (GtkComboBox *combo, img_window_struct *img)
1620
1645
{
1621
 
        GList *selected, *bak;
1622
 
        GtkTreeIter iter;
 
1646
        GList        *selected,
 
1647
                                 *bak;
 
1648
        GtkTreeIter   iter;
1623
1649
        GtkTreeModel *model;
1624
 
        gpointer address;
 
1650
        gpointer      address;
1625
1651
        slide_struct *info_slide;
1626
 
        gint transition_id;
1627
 
        GtkTreePath *p;
1628
 
        gchar       *path;
1629
 
        GdkPixbuf   *pix;
1630
 
 
1631
 
        /* Get the address of the transition function stored in the model of the combo box*/
1632
 
        model = gtk_combo_box_get_model(combo);
1633
 
        gtk_combo_box_get_active_iter(combo, &iter);
1634
 
        gtk_tree_model_get(model, &iter, 0, &pix, 2, &address, 3, &transition_id, -1);
1635
 
 
1636
 
        /* Get index of currently selected item */
1637
 
        if (transition_id == -1)
1638
 
                gtk_widget_set_sensitive(img->trans_duration,FALSE);
 
1652
        gint          transition_id;
 
1653
        GtkTreePath  *p;
 
1654
        gchar        *path;
 
1655
        GdkPixbuf    *pix;
 
1656
 
 
1657
        /* Check if anything is selected and return if nothing is */
 
1658
        selected = gtk_icon_view_get_selected_items(
 
1659
                                        GTK_ICON_VIEW( img->active_icon ) );
 
1660
        if( selected == NULL )
 
1661
                return;
 
1662
 
 
1663
        /* Get information about selected transition */
 
1664
        model = gtk_combo_box_get_model( combo );
 
1665
        gtk_combo_box_get_active_iter( combo, &iter );
 
1666
        gtk_tree_model_get( model, &iter, 0, &pix,
 
1667
                                                                          2, &address,
 
1668
                                                                          3, &transition_id,
 
1669
                                                                          -1 );
 
1670
 
 
1671
        /* If user applied None transition, make duration combo insensitive */
 
1672
        if( transition_id == -1 )
 
1673
                gtk_widget_set_sensitive( img->trans_duration, FALSE );
1639
1674
        else
1640
 
                gtk_widget_set_sensitive(img->trans_duration,TRUE);
 
1675
                gtk_widget_set_sensitive( img->trans_duration, TRUE );
1641
1676
 
1642
1677
        /* If user selected group name, automatically select first transition
1643
1678
         * from this group. */
1645
1680
        {
1646
1681
                GtkTreeIter parent = iter;
1647
1682
                gtk_tree_model_iter_nth_child( model, &iter, &parent, 0 );
1648
 
                gtk_tree_model_get(model, &iter, 0, &pix, 2, &address, 3, &transition_id, -1);
1649
 
                g_signal_handlers_block_by_func(img->transition_type,
1650
 
                                                                                img_combo_box_transition_type_changed,
1651
 
                                                                                img);
1652
 
                gtk_combo_box_set_active_iter(GTK_COMBO_BOX(img->transition_type),
1653
 
                                                                          &iter );
1654
 
                g_signal_handlers_unblock_by_func(img->transition_type,
1655
 
                                                                                  img_combo_box_transition_type_changed,
1656
 
                                                                                  img);
 
1683
                gtk_tree_model_get( model, &iter, 0, &pix,
 
1684
                                                                                  2, &address,
 
1685
                                                                                  3, &transition_id,
 
1686
                                                                                  -1 );
 
1687
                g_signal_handlers_block_by_func( img->transition_type,
 
1688
                                                                                 img_combo_box_transition_type_changed,
 
1689
                                                                                 img);
 
1690
                gtk_combo_box_set_active_iter( GTK_COMBO_BOX( img->transition_type),
 
1691
                                                                           &iter );
 
1692
                g_signal_handlers_unblock_by_func( img->transition_type,
 
1693
                                                                                   img_combo_box_transition_type_changed,
 
1694
                                                                                   img);
1657
1695
        }
 
1696
 
 
1697
        /* Get string representation of the path, which will be
 
1698
         * saved inside slide */
1658
1699
        p = gtk_tree_model_get_path( model, &iter );
1659
1700
        path = gtk_tree_path_to_string( p );
1660
1701
        gtk_tree_path_free( p );
1661
1702
 
 
1703
        /* Update all selected slides */
1662
1704
        model = GTK_TREE_MODEL( img->thumbnail_model );
1663
 
        selected = gtk_icon_view_get_selected_items(GTK_ICON_VIEW (img->active_icon));
1664
 
        if (selected == NULL)
1665
 
        {
1666
 
                g_free( path );
1667
 
                return;
1668
 
        }
1669
 
 
1670
 
        /* Avoiding GList memory leak. */
1671
1705
        bak = selected;
1672
1706
        while (selected)
1673
1707
        {
1674
 
                gtk_tree_model_get_iter(model, &iter,selected->data);
1675
 
                gtk_tree_model_get(model, &iter,1,&info_slide,-1);
 
1708
                gtk_tree_model_get_iter( model, &iter, selected->data );
 
1709
                gtk_tree_model_get( model, &iter, 1, &info_slide, -1 );
1676
1710
                gtk_list_store_set( GTK_LIST_STORE( model ), &iter, 2, pix, -1 );
1677
 
                if( pix )
1678
 
                        g_object_unref( G_OBJECT( pix ) );
1679
1711
                info_slide->render = (ImgRender)address;
1680
1712
                info_slide->transition_id = transition_id;
1681
1713
                g_free( info_slide->path );
1689
1721
                selected = selected->next;
1690
1722
        }
1691
1723
        g_free( path );
 
1724
        if( pix )
 
1725
                g_object_unref( G_OBJECT( pix ) );
1692
1726
        img->project_is_modified = TRUE;
1693
 
        img_set_total_slideshow_duration(img);
1694
 
        g_list_foreach (bak, (GFunc)gtk_tree_path_free, NULL);
1695
 
        g_list_free(bak);
 
1727
        img_report_slides_transitions( img );
 
1728
        img_set_total_slideshow_duration( img );
 
1729
        g_list_foreach( bak, (GFunc)gtk_tree_path_free, NULL );
 
1730
        g_list_free( bak );
1696
1731
}
1697
1732
 
1698
1733
static void img_random_button_clicked(GtkButton *button, img_window_struct *img)
1780
1815
        /* Select proper iter in transition model */
1781
1816
        g_signal_handlers_block_by_func((gpointer)img->transition_type, (gpointer)img_combo_box_transition_type_changed, img);  
1782
1817
        gtk_combo_box_set_active_iter(GTK_COMBO_BOX(img->transition_type), &iter);
 
1818
        /* Update the slide dialog report in real time */
 
1819
        img_report_slides_transitions(img);
1783
1820
        g_signal_handlers_unblock_by_func((gpointer)img->transition_type, (gpointer)img_combo_box_transition_type_changed, img);        
1784
1821
 
1785
1822
        return( pix );
2412
2449
        g_list_free( selection );
2413
2450
}
2414
2451
 
 
2452
static void img_report_slides_transitions(img_window_struct *img)
 
2453
{
 
2454
        static GtkWidget *viewport;
 
2455
        GtkWidget        *label;
 
2456
        GHashTable       *trans_hash;
 
2457
        GList            *values,
 
2458
                                         *tmp;
 
2459
        GtkTreeModel     *model;
 
2460
        GtkTreeIter       iter;
 
2461
        gboolean          flag;
 
2462
        gint              i;
 
2463
 
 
2464
#define GIP( val ) GINT_TO_POINTER( ( val ) )
 
2465
#define GPI( val ) GPOINTER_TO_INT( ( val ) )
 
2466
 
 
2467
        if (img->report_dialog == NULL)
 
2468
        {
 
2469
                GtkWidget *action,
 
2470
                                  *vbox,
 
2471
                                  *swindow;
 
2472
 
 
2473
                img->report_dialog = gtk_dialog_new_with_buttons(
 
2474
                                        _("Slides Transitions Report Dialog"),
 
2475
                                        GTK_WINDOW( img->imagination_window ),
 
2476
                                        GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
 
2477
                                        GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT,
 
2478
                                        NULL );
 
2479
                gtk_container_set_border_width( GTK_CONTAINER( img->report_dialog ),
 
2480
                                                                                10 );           
 
2481
                gtk_window_set_default_size( GTK_WINDOW( img->report_dialog ),
 
2482
                                                                         480, 370 );
 
2483
                gtk_window_set_modal( GTK_WINDOW( img->report_dialog ), FALSE );
 
2484
 
 
2485
                action = gtk_dialog_get_action_area( GTK_DIALOG( img->report_dialog ) );
 
2486
                gtk_button_box_set_layout( GTK_BUTTON_BOX( action ),
 
2487
                                                                   GTK_BUTTONBOX_SPREAD);
 
2488
                g_signal_connect( G_OBJECT( img->report_dialog ), "delete-event",
 
2489
                                                  G_CALLBACK( gtk_widget_hide_on_delete ), NULL );
 
2490
                g_signal_connect( G_OBJECT( img->report_dialog ), "response",
 
2491
                                                  G_CALLBACK( gtk_widget_hide_on_delete ), NULL );
 
2492
 
 
2493
                vbox = gtk_dialog_get_content_area( GTK_DIALOG( img->report_dialog ) );
 
2494
                swindow = gtk_scrolled_window_new( NULL, NULL );
 
2495
                gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( swindow ),
 
2496
                                                                                GTK_POLICY_AUTOMATIC,
 
2497
                                                                                GTK_POLICY_AUTOMATIC);
 
2498
                gtk_box_pack_start( GTK_BOX( vbox ), swindow, TRUE, TRUE, 0 );
 
2499
 
 
2500
                viewport = gtk_viewport_new( NULL, NULL );
 
2501
                gtk_viewport_set_shadow_type( GTK_VIEWPORT( viewport ),
 
2502
                                                                          GTK_SHADOW_NONE);
 
2503
                gtk_container_add( GTK_CONTAINER( swindow ), viewport );
 
2504
        }
 
2505
 
 
2506
        /* Delete previous shown rows */
 
2507
        if( img->vbox_slide_report_rows )
 
2508
        {
 
2509
                gtk_widget_destroy( img->vbox_slide_report_rows );
 
2510
                img->vbox_slide_report_rows = NULL;
 
2511
        }
 
2512
 
 
2513
        model = GTK_TREE_MODEL(img->thumbnail_model);
 
2514
        if( gtk_tree_model_get_iter_first( model, &iter ) == 0)
 
2515
                return;
 
2516
 
 
2517
        /* Hash table is used only for quick way of accessing transition info.
 
2518
         * Information is stored inside array of 3 gpointers */
 
2519
        trans_hash = g_hash_table_new( g_direct_hash, NULL );
 
2520
 
 
2521
        for( flag = TRUE, i = 0;
 
2522
                 flag;
 
2523
                 flag = gtk_tree_model_iter_next( model, &iter ), i++ )
 
2524
        {
 
2525
                slide_struct *slide;
 
2526
                gpointer     *info;
 
2527
 
 
2528
                gtk_tree_model_get( model, &iter, 1, &slide, -1 );
 
2529
                if( slide->transition_id < 1 )
 
2530
                        continue;
 
2531
 
 
2532
                info = g_hash_table_lookup( trans_hash, GIP( slide->transition_id ) );
 
2533
                if( ! info )
 
2534
                {
 
2535
                        /* Create new info element */
 
2536
                        info = g_slice_alloc0( sizeof( gpointer ) * 3 );
 
2537
                        info[0] = GIP( slide->transition_id );
 
2538
                        g_hash_table_insert( trans_hash, GIP( slide->transition_id ),
 
2539
                                                                                         info );
 
2540
                }
 
2541
 
 
2542
                /* Increment counter */
 
2543
                info[1] = GIP( GPI( info[1] ) + 1 );
 
2544
 
 
2545
                /* Append another element to glist */
 
2546
                info[2] = g_list_append( (GList *)info[2], GIP( i ) );
 
2547
        }
 
2548
 
 
2549
        /* Set the vertical box container that was previously
 
2550
         * destroyed so to allow update in real time */
 
2551
        img->vbox_slide_report_rows = gtk_vbox_new( FALSE, 15 );
 
2552
        gtk_container_add( GTK_CONTAINER( viewport ), img->vbox_slide_report_rows );
 
2553
 
 
2554
        label = gtk_label_new( _("\n<span weight='bold'>Note:</span>\n\n"
 
2555
                                                         "Slides whose transition is applied only once are "
 
2556
                                                         "not shown here.\n"
 
2557
                                                         "Click on the slide to have Imagination "
 
2558
                                                         "automatically select it." ) );
 
2559
        gtk_misc_set_alignment( GTK_MISC( label ), 0.0, 0.5 );
 
2560
        gtk_label_set_use_markup( GTK_LABEL( label ), TRUE );
 
2561
        gtk_box_pack_start( GTK_BOX( img->vbox_slide_report_rows ), label,
 
2562
                                                FALSE, FALSE, 0);
 
2563
 
 
2564
        /* Get information and free hash table */
 
2565
        values = g_hash_table_get_values( trans_hash );
 
2566
        g_hash_table_destroy( trans_hash );
 
2567
 
 
2568
        /* Sort values list here */
 
2569
        values = g_list_sort( values, img_sort_report_transitions );
 
2570
 
 
2571
        /* Display results */
 
2572
        for( tmp = values; tmp; tmp = g_list_next( tmp ) )
 
2573
        {
 
2574
                gpointer *info = tmp->data;
 
2575
 
 
2576
                if( GPI( info[1] ) > 1 )
 
2577
                {
 
2578
                        GList     *tmp1;
 
2579
                        GtkWidget *hbox_rows,
 
2580
                                          *frame,
 
2581
                                          *image,
 
2582
                                          *nr_label;
 
2583
                        gchar     *filename,
 
2584
                                          *nr;
 
2585
 
 
2586
                        hbox_rows = gtk_hbox_new( FALSE, 15 );
 
2587
                        gtk_box_pack_start( GTK_BOX( img->vbox_slide_report_rows ),
 
2588
                                                                hbox_rows, FALSE, FALSE, 0 );
 
2589
 
 
2590
                        frame = gtk_frame_new( NULL );
 
2591
                        gtk_frame_set_shadow_type( GTK_FRAME( frame ), GTK_SHADOW_NONE );
 
2592
                        gtk_box_pack_start( GTK_BOX( hbox_rows ), frame, FALSE, FALSE, 0 );
 
2593
 
 
2594
#if PLUGINS_INSTALLED
 
2595
                        filename =
 
2596
                                g_strdup_printf( "%s/imagination/pixmaps/imagination-%d.png",
 
2597
                                                                 DATADIR, GPI( info[0] ) );
 
2598
#else /* PLUGINS_INSTALLED */
 
2599
                        filename =
 
2600
                                g_strdup_printf( "./pixmaps/imagination-%d.png",
 
2601
                                                                 GPI( info[0] ) );
 
2602
#endif
 
2603
                        image = gtk_image_new_from_file( filename );
 
2604
                        g_free( filename );
 
2605
                        gtk_container_add( GTK_CONTAINER( frame ), image );
 
2606
 
 
2607
                        nr = g_strdup_printf( "(%d)", GPI( info[1] ) );
 
2608
                        nr_label = gtk_label_new( nr );
 
2609
                        gtk_box_pack_start( GTK_BOX( hbox_rows ), nr_label,
 
2610
                                                                FALSE, FALSE, 0 );
 
2611
                        g_free( nr );
 
2612
 
 
2613
                        for( tmp1 = (GList *)info[2]; tmp1; tmp1 = g_list_next( tmp1 ) )
 
2614
                        {
 
2615
                                GtkWidget   *button,
 
2616
                                                        *image;
 
2617
                                GdkPixbuf   *pixbuf;
 
2618
                                GtkTreePath *path;
 
2619
                                GtkTreeIter  iter;
 
2620
 
 
2621
                                path = gtk_tree_path_new_from_indices( GPI( tmp1->data ), -1 );
 
2622
                                gtk_tree_model_get_iter( model, &iter, path );
 
2623
                                gtk_tree_path_free( path );
 
2624
 
 
2625
                                gtk_tree_model_get( model, &iter, 0, &pixbuf, -1 );
 
2626
 
 
2627
                                button = gtk_button_new();
 
2628
                                g_object_set_data( G_OBJECT( button ), "index", tmp1->data );
 
2629
                                g_signal_connect( G_OBJECT( button ), "clicked",
 
2630
                                                                  G_CALLBACK( img_select_slide_from_slide_report_dialog ), img );
 
2631
                                gtk_box_pack_start( GTK_BOX( hbox_rows ), button,
 
2632
                                                                        FALSE, FALSE, 0 );
 
2633
 
 
2634
                                image = gtk_image_new_from_pixbuf( pixbuf );
 
2635
                                g_object_unref( G_OBJECT( pixbuf ) );
 
2636
                                gtk_container_add( GTK_CONTAINER( button ), image );
 
2637
                        }
 
2638
                }
 
2639
                g_list_free( (GList *)info[2] );
 
2640
                g_slice_free1( sizeof( gpointer ) * 3, info );
 
2641
        }
 
2642
 
 
2643
        if( GTK_WIDGET_VISIBLE( img->report_dialog ) )
 
2644
                gtk_widget_show_all( img->report_dialog );
 
2645
 
 
2646
#undef GIP
 
2647
#undef GPI
 
2648
}
 
2649
 
 
2650
static void img_select_slide_from_slide_report_dialog(GtkButton *button, img_window_struct *img)
 
2651
{
 
2652
        GtkTreePath *path;
 
2653
        gint slide = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "index"));
 
2654
 
 
2655
        gtk_icon_view_unselect_all(GTK_ICON_VIEW (img->active_icon));
 
2656
        path = gtk_tree_path_new_from_indices(slide, -1);
 
2657
        gtk_icon_view_set_cursor (GTK_ICON_VIEW (img->active_icon), path, NULL, FALSE);
 
2658
        gtk_icon_view_select_path (GTK_ICON_VIEW (img->active_icon), path);
 
2659
        gtk_icon_view_scroll_to_path (GTK_ICON_VIEW (img->active_icon), path, FALSE, 0, 0);
 
2660
        gtk_tree_path_free (path);
 
2661
}
 
2662
 
 
2663
static void img_show_slides_report_dialog(GtkMenuItem *item, img_window_struct *img)
 
2664
{
 
2665
        img_report_slides_transitions(img);
 
2666
        gtk_widget_show_all(img->report_dialog);
 
2667
}
 
2668
 
 
2669
static gint
 
2670
img_sort_report_transitions( gconstpointer a,
 
2671
                                                         gconstpointer b )
 
2672
{
 
2673
        gint val_a = GPOINTER_TO_INT( ( (gpointer *)a )[1] ),
 
2674
                 val_b = GPOINTER_TO_INT( ( (gpointer *)b )[1] );
 
2675
 
 
2676
        return( val_a - val_b );
 
2677
}
 
2678