~ubuntu-branches/ubuntu/vivid/mplayerplug-in/vivid

« back to all changes in this revision

Viewing changes to Source/plugin-ui.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ari Pollak
  • Date: 2006-08-06 14:28:57 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060806142857-rti2h4zrt8yvqwka
Tags: 3.30-1
* New upstream release
* Apply patch from upstream to fix media playing when LIRC is enabled in
  mplayer

Show diffs side-by-side

added added

removed removed

Lines of Context:
692
692
            g_idle_add(gtkgui_message, instance);
693
693
            gtk_widget_hide(GTK_WIDGET(instance->mediaprogress_bar));
694
694
        }
695
 
        if (instance->showlogo)
696
 
                if (GTK_IS_WIDGET(instance->image))
697
 
                        gtk_widget_show(GTK_WIDGET(instance->image));
698
 
                
699
 
        if (!instance->hidestatus)
700
 
                if (GTK_IS_WIDGET(instance->status))
701
 
                        gtk_widget_show(GTK_WIDGET(instance->status));
702
 
                
 
695
        if (instance->showlogo)
 
696
            if (GTK_IS_WIDGET(instance->image))
 
697
                gtk_widget_show(GTK_WIDGET(instance->image));
 
698
 
 
699
        if (!instance->hidestatus)
 
700
            if (GTK_IS_WIDGET(instance->status))
 
701
                gtk_widget_show(GTK_WIDGET(instance->status));
 
702
 
703
703
        gdk_flush();
704
704
    }
705
705
    if (widget != NULL)
714
714
        return;
715
715
    if (instance->panel_drawn == 0 && instance->controlsvisible == 1)
716
716
        return;
717
 
    if (instance->controlsvisible == 1) {
 
717
    if (instance->controlsvisible == 1 && instance->mmsstream == 0) {
718
718
        if (instance->panel_height > 16)
719
719
            instance->panel_height = 16;
720
720
 
765
765
        return;
766
766
    if (instance->panel_drawn == 0 && instance->controlsvisible == 1)
767
767
        return;
768
 
    if (instance->controlsvisible == 1) {
 
768
    if (instance->controlsvisible == 1 && instance->mmsstream == 0) {
769
769
 
770
770
        if (instance->panel_height > 16)
771
771
            instance->panel_height = 16;
1057
1057
            instance->panel_height = 16;
1058
1058
    }
1059
1059
 
1060
 
    if (instance->panel_drawn == 0) {
 
1060
    if (instance->panel_drawn == 0 && instance->window != 0) {
1061
1061
        if (instance->mode == NP_FULL)
1062
1062
            instance->panel_height = instance->window_height;
1063
1063
        if (instance->panel_height > 16)
1064
1064
            instance->panel_height = 16;
1065
1065
        if (instance->panel_height <= 0)
1066
1066
            if (instance->showcontrols) {
1067
 
                instance->panel_height = 16;
 
1067
                instance->panel_height = 16;
1068
1068
            } else {
1069
 
                instance->panel_height = 0;
 
1069
                instance->panel_height = 0;
1070
1070
            }
1071
1071
        if (DEBUG) {
1072
1072
            printf("drawing panel\n height = %i panel= %i\n",
1136
1136
#endif
1137
1137
            multiplier = 0;
1138
1138
            // rewind
1139
 
            if ((instance->mmsstream == 0 && win_width > 126) || instance->targetplayer == 1) {
 
1139
            if ((instance->mmsstream == 0 && win_width > 126)
 
1140
                || instance->targetplayer == 1) {
1140
1141
                instance->rew_event_box = gtk_event_box_new();
1141
1142
                tooltip = gtk_tooltips_new();
1142
1143
                gtk_tooltips_set_tip(tooltip, instance->rew_event_box,
1267
1268
                gtk_widget_show(instance->stop_event_box);
1268
1269
            }
1269
1270
            // fastforward
1270
 
            if ((instance->mmsstream == 0 && win_width > 126) || instance->targetplayer == 1) {
 
1271
            if ((instance->mmsstream == 0 && win_width > 126)
 
1272
                || instance->targetplayer == 1) {
1271
1273
                instance->ff_event_box = gtk_event_box_new();
1272
1274
                tooltip = gtk_tooltips_new();
1273
1275
                gtk_tooltips_set_tip(tooltip, instance->ff_event_box,
1398
1400
        if (GTK_IS_LABEL(instance->status))
1399
1401
            gtk_label_set_text(instance->status, instance->lastmessage);        //GTK_LABEL
1400
1402
 
1401
 
    if (instance->js_state == JS_STATE_TRANSITIONING) { 
 
1403
    if (instance->js_state == JS_STATE_TRANSITIONING) {
1402
1404
        if (GTK_IS_WIDGET(instance->image) && instance->showlogo)
1403
1405
            gtk_widget_show(GTK_WIDGET(instance->image));
1404
 
        
 
1406
 
1405
1407
        if (GTK_IS_WIDGET(instance->status) && (!(instance->hidestatus)))
1406
1408
            gtk_widget_show(GTK_WIDGET(instance->status));
1407
1409
    }
1408
 
        
 
1410
 
1409
1411
    return FALSE;
1410
1412
}
1411
1413
 
1435
1437
        }
1436
1438
    }
1437
1439
 
1438
 
    if (instance->js_state == JS_STATE_TRANSITIONING) { 
 
1440
    if (instance->js_state == JS_STATE_TRANSITIONING) {
1439
1441
        if (GTK_IS_WIDGET(instance->image) && instance->showlogo)
1440
1442
            gtk_widget_show(GTK_WIDGET(instance->image));
1441
 
        
 
1443
 
1442
1444
        if (GTK_IS_WIDGET(instance->status) && (!(instance->hidestatus)))
1443
1445
            gtk_widget_show(GTK_WIDGET(instance->status));
1444
1446
    }
1459
1461
 
1460
1462
    new_width = instance->movie_width;
1461
1463
    new_height = instance->movie_height;
1462
 
        
 
1464
 
1463
1465
    if (DEBUG > 1)
1464
1466
        printf("in resize method\nNew size is %i x %i\n",
1465
1467
               instance->movie_width, instance->movie_height);
1474
1476
                    if (instance->fullscreen == 0) {
1475
1477
                        if (GTK_IS_CONTAINER(instance->fixed_container)) {
1476
1478
                            if (GTK_IS_WIDGET(instance->image))
1477
 
                                gtk_widget_hide(GTK_WIDGET(instance->image));
 
1479
                                gtk_widget_hide(GTK_WIDGET
 
1480
                                                (instance->image));
1478
1481
                            if (GTK_IS_WIDGET(instance->status))
1479
 
                                gtk_widget_hide(GTK_WIDGET(instance->status));
 
1482
                                gtk_widget_hide(GTK_WIDGET
 
1483
                                                (instance->status));
1480
1484
                            if (GTK_IS_WIDGET(instance->mediaprogress_bar))
1481
 
                                gtk_widget_hide(GTK_WIDGET(instance->mediaprogress_bar));
 
1485
                                gtk_widget_hide(GTK_WIDGET
 
1486
                                                (instance->
 
1487
                                                 mediaprogress_bar));
1482
1488
                            instance->showtracker = 0;
1483
 
                            gtk_fixed_put(GTK_FIXED
1484
 
                                          (instance->fixed_container),
1485
 
                                          instance->drawing_area, 0, 0);
 
1489
                            if (gtk_widget_get_parent_window(instance->drawing_area) == NULL) { 
 
1490
                                gtk_fixed_put(GTK_FIXED
 
1491
                                              (instance->fixed_container),
 
1492
                                              instance->drawing_area, 0, 0);
 
1493
                            }
1486
1494
                        }
1487
1495
                    }
1488
 
                } 
 
1496
                }
1489
1497
 
1490
1498
                if (instance->showcontrols) {
1491
1499
                    if (instance->movie_width > instance->window_width
1549
1557
                    gtk_fixed_put(GTK_FIXED(instance->fixed_container),
1550
1558
                                  instance->drawing_area, 0, 0);
1551
1559
                    if (GTK_IS_WIDGET(instance->image))
1552
 
                        gtk_widget_hide(GTK_WIDGET(instance->image));
 
1560
                        gtk_widget_hide(GTK_WIDGET(instance->image));
1553
1561
                    if (GTK_IS_WIDGET(instance->status))
1554
 
                        gtk_widget_hide(GTK_WIDGET(instance->status));
 
1562
                        gtk_widget_hide(GTK_WIDGET(instance->status));
1555
1563
                    if (GTK_IS_WIDGET(instance->mediaprogress_bar))
1556
 
                        gtk_widget_hide(GTK_WIDGET(instance->mediaprogress_bar));
 
1564
                        gtk_widget_hide(GTK_WIDGET
 
1565
                                        (instance->mediaprogress_bar));
1557
1566
 
1558
1567
                } else {
1559
 
                    gtk_fixed_put(GTK_FIXED
1560
 
                                  (instance->fixed_container),
1561
 
                                  instance->drawing_area, 10, 100);
 
1568
                    if (gtk_widget_get_parent_window(instance->drawing_area) == NULL) { 
 
1569
                        gtk_fixed_put(GTK_FIXED
 
1570
                                      (instance->fixed_container),
 
1571
                                      instance->drawing_area, 10, 100);
 
1572
                    }
1562
1573
                    if (GTK_IS_WIDGET(instance->image))
1563
1574
                        gtk_widget_show(GTK_WIDGET(instance->image));
1564
1575
                    if (GTK_IS_WIDGET(instance->status))
1565
 
                        gtk_widget_show(GTK_WIDGET(instance->status));
 
1576
                        gtk_widget_show(GTK_WIDGET(instance->status));
1566
1577
                }
1567
1578
 
1568
1579
            } else {
1569
 
                if (instance->targetplayer && instance->showcontrols) {
 
1580
                if (instance->targetplayer && instance->showcontrols) {
1570
1581
                    gtk_widget_set_usize(instance->drawing_area,
1571
1582
                                         instance->movie_width,
1572
 
                                         instance->movie_height + 16 );
1573
 
                
 
1583
                                         instance->movie_height + 16);
 
1584
 
1574
1585
                } else {
1575
1586
                    if (instance->showcontrols) {
1576
 
                        if (instance->movie_height > (instance->window_height - 16)) {
1577
 
                                gtk_widget_set_size_request(GTK_WIDGET(instance->drawing_area),instance->movie_width,instance->window_height -16);
 
1587
                        if (instance->movie_height >
 
1588
                            (instance->window_height - 16)) {
 
1589
                            gtk_widget_set_usize(GTK_WIDGET
 
1590
                                                 (instance->drawing_area),
 
1591
                                                 instance->movie_width,
 
1592
                                                 instance->window_height -
 
1593
                                                 16);
1578
1594
                        } else {
1579
 
                                gtk_widget_set_size_request(GTK_WIDGET(instance->drawing_area),instance->movie_width,instance->movie_height);
 
1595
                            gtk_widget_set_usize(GTK_WIDGET
 
1596
                                                 (instance->drawing_area),
 
1597
                                                 instance->movie_width,
 
1598
                                                 instance->movie_height);
1580
1599
                        }
1581
1600
                    } else {
1582
 
                        gtk_widget_set_size_request(GTK_WIDGET(instance->drawing_area),instance->movie_width,instance->movie_height);
 
1601
                        gtk_widget_set_usize(GTK_WIDGET
 
1602
                                             (instance->drawing_area),
 
1603
                                             instance->movie_width,
 
1604
                                             instance->movie_height);
1583
1605
                    }
1584
1606
 
1585
1607
                }
1707
1729
    nsPluginInstance *instance;
1708
1730
    int hour = 0, min = 0, length_hour = 0, length_min = 0;
1709
1731
    long int seconds, length_seconds;
1710
 
    char display[30];
 
1732
    char display[35];
1711
1733
 
1712
1734
    if (DEBUG > 1)
1713
1735
        printf("in drawMediaProgress method\n");
1753
1775
                            length_seconds =
1754
1776
                                length_seconds - (length_min * 60);
1755
1777
                        }
1756
 
                        if (hour == 0 && length_hour == 0) {
1757
 
                            snprintf(display, 30, "%2i:%02i / %2i:%02i",
1758
 
                                     min, (int) seconds, length_min,
1759
 
                                     (int) length_seconds);
 
1778
 
 
1779
                        if ((int) (instance->percent * 100) > 0
 
1780
                            && (int) (instance->percent * 100) < 99
 
1781
                            && instance->mmsstream == 0) {
 
1782
 
 
1783
                            if (hour == 0 && length_hour == 0) {
 
1784
                                snprintf(display, 30,
 
1785
                                         _
 
1786
                                         ("%2i:%02i / %2i:%02i | %2i%% \342\226\274"),
 
1787
                                         min, (int) seconds, length_min,
 
1788
                                         (int) length_seconds,
 
1789
                                         (int) (instance->percent * 100));
 
1790
                            } else {
 
1791
                                snprintf(display, 30,
 
1792
                                         _
 
1793
                                         ("%i:%02i:%02i / %i:%02i:%02i | %2i%% \342\226\274"),
 
1794
                                         hour, min, (int) seconds,
 
1795
                                         length_hour, length_min,
 
1796
                                         (int) length_seconds,
 
1797
                                         (int) (instance->percent * 100));
 
1798
                            }
 
1799
 
1760
1800
                        } else {
1761
 
                            snprintf(display, 30,
1762
 
                                     "%i:%02i:%02i / %i:%02i:%02i", hour,
1763
 
                                     min, (int) seconds, length_hour,
1764
 
                                     length_min, (int) length_seconds);
 
1801
 
 
1802
                            if (hour == 0 && length_hour == 0) {
 
1803
                                snprintf(display, 30,
 
1804
                                         "%2i:%02i / %2i:%02i", min,
 
1805
                                         (int) seconds, length_min,
 
1806
                                         (int) length_seconds);
 
1807
                            } else {
 
1808
                                snprintf(display, 30,
 
1809
                                         "%i:%02i:%02i / %i:%02i:%02i",
 
1810
                                         hour, min, (int) seconds,
 
1811
                                         length_hour, length_min,
 
1812
                                         (int) length_seconds);
 
1813
                            }
 
1814
 
1765
1815
                        }
1766
1816
 
1767
1817
                        gtk_progress_bar_set_text(instance->
1768
1818
                                                  mediaprogress_bar,
1769
1819
                                                  display);
1770
1820
                    } else {
1771
 
                        if (gtk_progress_bar_get_text
1772
 
                            (instance->mediaprogress_bar) != NULL)
1773
 
                            gtk_progress_bar_set_text(instance->
1774
 
                                                      mediaprogress_bar,
1775
 
                                                      NULL);
 
1821
                        if ((int) (instance->percent * 100) > 0
 
1822
                            && (int) (instance->percent * 100) < 99
 
1823
                            && instance->mmsstream == 0) {
 
1824
 
 
1825
                            snprintf(display, 30, _("%2i%% \342\226\274"),
 
1826
                                     (int) (instance->percent * 100));
 
1827
                            if (gtk_progress_bar_get_text
 
1828
                                (instance->mediaprogress_bar) != NULL)
 
1829
                                gtk_progress_bar_set_text(instance->
 
1830
                                                          mediaprogress_bar,
 
1831
                                                          display);
 
1832
 
 
1833
                        } else {
 
1834
 
 
1835
                            if (gtk_progress_bar_get_text
 
1836
                                (instance->mediaprogress_bar) != NULL)
 
1837
                                gtk_progress_bar_set_text(instance->
 
1838
                                                          mediaprogress_bar,
 
1839
                                                          NULL);
 
1840
                        }
1776
1841
                    }
1777
1842
#endif
1778
1843
 
1781
1846
                                    (instance->mediaprogress_bar));
1782
1847
                }
1783
1848
            } else {
1784
 
                gtk_widget_hide(GTK_WIDGET
1785
 
                                (instance->mediaprogress_bar));
 
1849
                gtk_widget_hide(GTK_WIDGET(instance->mediaprogress_bar));
1786
1850
            }
1787
1851
        }
1788
1852
    }
1887
1951
    }
1888
1952
 
1889
1953
    if (DEBUG)
1890
 
        printf("buttons are at %i x %i\n", win_height, win_width);
 
1954
        printf("buttons are at %i x %i\n", win_height, win_width);
1891
1955
 
1892
1956
    if (instance->panel_drawn == 1) {
1893
1957
        height = 16;
1907
1971
                }
1908
1972
            }
1909
1973
        } else {
1910
 
            gtk_widget_hide(GTK_WIDGET(instance->rew_event_box));
 
1974
            if (GTK_IS_WIDGET(instance->rew_event_box)) {
 
1975
                gtk_widget_hide(GTK_WIDGET(instance->rew_event_box));
 
1976
            }
1911
1977
        }
1912
1978
        gtk_fixed_move(GTK_FIXED(instance->fixed_container),
1913
1979
                       GTK_WIDGET(instance->play_event_box),
1930
1996
                }
1931
1997
            }
1932
1998
        } else {
1933
 
            gtk_widget_hide(GTK_WIDGET(instance->ff_event_box));
 
1999
            if (GTK_IS_WIDGET(instance->ff_event_box)) {
 
2000
                gtk_widget_hide(GTK_WIDGET(instance->ff_event_box));
 
2001
            }
1934
2002
        }
1935
2003
        gtk_fixed_move(GTK_FIXED(instance->fixed_container),
1936
2004
                       GTK_WIDGET(instance->mediaprogress_bar),
2033
2101
 
2034
2102
}
2035
2103
 
2036
 
void menuitem_save_callback(GtkMenuItem * menuitem,
2037
 
                            nsPluginInstance * instance)
 
2104
void store_filename(GtkWidget * widget, nsPluginInstance * instance)
2038
2105
{
2039
 
    char *filename;
2040
 
    char newname[1024];
2041
 
    char mmsplaylist[1024];
2042
 
    FILE *playlist;
 
2106
    const gchar *filename;
2043
2107
    FILE *fin, *fout;
2044
2108
    char buffer[1000];
2045
2109
    int count;
2046
2110
    Node *n, *lastplayed;
2047
2111
 
2048
 
 
2049
2112
    if (instance->mInitialized == FALSE)
2050
2113
        return;
2051
2114
    pthread_mutex_lock(&(instance->playlist_mutex));
2063
2126
        }
2064
2127
    }
2065
2128
 
 
2129
    if (DEBUG)
 
2130
        printf("lastplayed = %p\n", lastplayed);
 
2131
 
2066
2132
    if (lastplayed != NULL) {
2067
 
        filename = getURLFilename(lastplayed->url);
 
2133
        filename =
 
2134
            gtk_file_selection_get_filename(GTK_FILE_SELECTION
 
2135
                                            (instance->file_selector));
 
2136
        if (DEBUG)
 
2137
            printf("filename = %s\n", filename);
 
2138
 
2068
2139
        if (filename) {
2069
2140
            if (lastplayed->retrieved == 1) {
2070
 
                snprintf(newname, 1024, "%s/%s",
2071
 
                         instance->download_dir, filename);
2072
 
                if (rename(lastplayed->fname, newname) == 0) {
2073
 
                    snprintf(lastplayed->fname, 1024, "%s/%s",
2074
 
                             instance->download_dir, filename);
 
2141
                if (DEBUG) {
 
2142
                    printf("lastplayed->fname = %s\n", lastplayed->fname);
 
2143
                }
 
2144
 
 
2145
                if (rename(lastplayed->fname, filename) == 0) {
 
2146
                    snprintf(lastplayed->fname, 1024, "%s", filename);
2075
2147
                    lastplayed->remove = 0;
2076
2148
                } else {
 
2149
 
2077
2150
                    // rename failed (probably cross partitions), copy the file
2078
2151
                    fin = fopen(lastplayed->fname, "rb");
2079
 
                    fout = fopen(newname, "wb");
 
2152
                    fout = fopen(filename, "wb");
2080
2153
                    if (fin != NULL && fout != NULL) {
2081
2154
                        while (!feof(fin)) {
2082
2155
                            count = fread(buffer, 1, 1000, fin);
2087
2160
                    }
2088
2161
                }
2089
2162
            }
2090
 
            NPN_MemFree(filename);
 
2163
        }
 
2164
    }
 
2165
    pthread_mutex_unlock(&(instance->playlist_mutex));
 
2166
    gtk_widget_destroy(instance->file_selector);
 
2167
    instance->file_selector = NULL;
 
2168
}
 
2169
 
 
2170
 
 
2171
 
 
2172
void menuitem_save_callback(GtkMenuItem * menuitem,
 
2173
                            nsPluginInstance * instance)
 
2174
{
 
2175
    const gchar *filename;
 
2176
    char mmsplaylist[1024];
 
2177
    FILE *playlist;
 
2178
    Node *n, *lastplayed;
 
2179
 
 
2180
    if (instance->mInitialized == FALSE)
 
2181
        return;
 
2182
    pthread_mutex_lock(&(instance->playlist_mutex));
 
2183
 
 
2184
    lastplayed = NULL;
 
2185
 
 
2186
    if (instance->currentnode != NULL) {
 
2187
        lastplayed = instance->currentnode;
 
2188
    } else {
 
2189
        n = instance->list;
 
2190
        while (n != NULL) {
 
2191
            if (n->played == 1)
 
2192
                lastplayed = n;
 
2193
            n = n->next;
 
2194
        }
 
2195
    }
 
2196
 
 
2197
    if (lastplayed != NULL) {
 
2198
        filename = getURLFilename(lastplayed->url);
 
2199
        if (filename) {
 
2200
            instance->file_selector =
 
2201
                gtk_file_selection_new
 
2202
                (_("Save As..."));
 
2203
 
 
2204
            gtk_file_selection_set_filename(GTK_FILE_SELECTION
 
2205
                                            (instance->file_selector),
 
2206
                                            filename);
 
2207
#ifdef GTK2_ENABLED
 
2208
            g_signal_connect(GTK_FILE_SELECTION(instance->file_selector)->
 
2209
                             ok_button, "clicked",
 
2210
                             G_CALLBACK(store_filename), instance);
 
2211
 
 
2212
            g_signal_connect_swapped(GTK_FILE_SELECTION
 
2213
                                     (instance->file_selector)->ok_button,
 
2214
                                     "clicked",
 
2215
                                     G_CALLBACK(gtk_widget_destroy),
 
2216
                                     instance->file_selector);
 
2217
 
 
2218
            g_signal_connect_swapped(GTK_FILE_SELECTION
 
2219
                                     (instance->file_selector)->
 
2220
                                     cancel_button, "clicked",
 
2221
                                     G_CALLBACK(gtk_widget_destroy),
 
2222
                                     instance->file_selector);
 
2223
#endif
 
2224
#ifdef GTK1_ENABLED
 
2225
            gtk_signal_connect(GTK_OBJECT
 
2226
                               (GTK_FILE_SELECTION
 
2227
                                (instance->file_selector)->ok_button),
 
2228
                               "clicked", GTK_SIGNAL_FUNC(store_filename),
 
2229
                               instance);
 
2230
 
 
2231
            gtk_signal_connect_object(GTK_OBJECT
 
2232
                                      (GTK_FILE_SELECTION
 
2233
                                       (instance->file_selector)->
 
2234
                                       ok_button), "clicked",
 
2235
                                      GTK_SIGNAL_FUNC(gtk_widget_destroy),
 
2236
                                      GTK_OBJECT(instance->file_selector));
 
2237
 
 
2238
            gtk_signal_connect_object(GTK_OBJECT
 
2239
                                      (GTK_FILE_SELECTION
 
2240
                                       (instance->file_selector)->
 
2241
                                       cancel_button), "clicked",
 
2242
                                      GTK_SIGNAL_FUNC(gtk_widget_destroy),
 
2243
                                      GTK_OBJECT(instance->file_selector));
 
2244
 
 
2245
 
 
2246
#endif
 
2247
            /* Display that dialog */
 
2248
 
 
2249
            gtk_widget_show(instance->file_selector);
 
2250
 
2091
2251
        }
2092
2252
        if (lastplayed->mmsstream) {
2093
2253
            snprintf(mmsplaylist, sizeof(mmsplaylist),
2131
2291
    if (lastplayed != NULL) {
2132
2292
        fullyQualifyURL(instance, lastplayed->url, localurl);
2133
2293
#ifdef GTK2_ENABLED
2134
 
        clipboard = gtk_clipboard_get(GDK_NONE);
2135
 
        gtk_clipboard_set_text(clipboard, localurl, strlen(localurl));
 
2294
        clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
 
2295
        gtk_clipboard_set_text(clipboard, localurl, -1);
 
2296
        clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
 
2297
        gtk_clipboard_set_text(clipboard, localurl, -1);
2136
2298
#endif
2137
2299
#ifdef GTK1_ENABLED
2138
2300
        ge = gtk_entry_new_with_max_length(strlen(localurl));
2216
2378
    instance->enable_gmp =
2217
2379
        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
2218
2380
                                     (instance->conf_enable_gmp));
 
2381
    instance->enable_dvx =
 
2382
        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
 
2383
                                     (instance->conf_enable_dvx));
2219
2384
    instance->enable_mpeg =
2220
2385
        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
2221
2386
                                     (instance->conf_enable_mpeg));
2290
2455
        fprintf(output, "enable-qt=%i\n", instance->enable_qt);
2291
2456
        fprintf(output, "enable-rm=%i\n", instance->enable_rm);
2292
2457
        fprintf(output, "enable-gmp=%i\n", instance->enable_gmp);
 
2458
        fprintf(output, "enable-dvx=%i\n", instance->enable_dvx);
2293
2459
        fprintf(output, "enable-mpeg=%i\n", instance->enable_mpeg);
2294
2460
        fprintf(output, "enable-mp3=%i\n", instance->enable_mp3);
2295
2461
        fprintf(output, "enable-ogg=%i\n", instance->enable_ogg);
2319
2485
            } else if (strncasecmp(buffer, "enable-pls", 10) == 0) {
2320
2486
            } else if (strncasecmp(buffer, "enable-ogg", 10) == 0) {
2321
2487
            } else if (strncasecmp(buffer, "enable-gmp", 10) == 0) {
 
2488
            } else if (strncasecmp(buffer, "enable-dvx", 10) == 0) {
2322
2489
            } else if (strncasecmp(buffer, "enable-smil", 11) == 0) {
2323
2490
            } else if (strncasecmp(buffer, "enable-helix", 12) == 0) {
2324
2491
            } else if (strncasecmp(buffer, "nomediacache", 12) == 0) {
2367
2534
            fprintf(output, "enable-qt=%i\n", instance->enable_qt);
2368
2535
            fprintf(output, "enable-rm=%i\n", instance->enable_rm);
2369
2536
            fprintf(output, "enable-gmp=%i\n", instance->enable_gmp);
 
2537
            fprintf(output, "enable-dvx=%i\n", instance->enable_dvx);
2370
2538
            fprintf(output, "enable-mpeg=%i\n", instance->enable_mpeg);
2371
2539
            fprintf(output, "enable-mp3=%i\n", instance->enable_mp3);
2372
2540
            fprintf(output, "enable-midi=%i\n", instance->enable_midi);
2396
2564
    strlcat(buffer, "/.mozilla/pluginreg.dat", 1000);
2397
2565
    unlink(buffer);
2398
2566
    snprintf(buffer, 1000, "%s", getenv("HOME"));
 
2567
    strlcat(buffer, "/.firefox/pluginreg.dat", 1000);
 
2568
    unlink(buffer);
 
2569
    snprintf(buffer, 1000, "%s", getenv("HOME"));
2399
2570
    strlcat(buffer, "/.mozilla/firefox/pluginreg.dat", 1000);
2400
2571
    unlink(buffer);
2401
2572
    NPN_ReloadPlugins(FALSE);
2712
2883
                                 instance->enable_pls);
2713
2884
    gtk_widget_show(instance->conf_enable_pls);
2714
2885
 
 
2886
    instance->conf_enable_dvx =
 
2887
        gtk_check_button_new_with_label(_("Enable DivX Support"));
 
2888
    gtk_table_attach_defaults(GTK_TABLE(conf_table),
 
2889
                              instance->conf_enable_dvx, 1, 2, row,
 
2890
                              row + 1);
 
2891
    row++;
 
2892
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
 
2893
                                 (instance->conf_enable_dvx),
 
2894
                                 instance->enable_dvx);
 
2895
    gtk_widget_show(instance->conf_enable_dvx);
 
2896
 
2715
2897
    instance->conf_nomediacache =
2716
2898
        gtk_check_button_new_with_label(_
2717
2899
                                        ("Play media directly from site (No Caching)"));
2906
3088
        printf("In srcToButton\n");
2907
3089
 
2908
3090
    // try to load the file natively
2909
 
    
 
3091
 
2910
3092
    instance->pb_src = gdk_pixbuf_new_from_file(url, &error);
2911
 
    
 
3093
 
2912
3094
    if (instance->pb_src == NULL) {
2913
3095
        // setup tmp directory
2914
3096
        dirname =
2915
3097
            g_strdup_printf("%s", tempnam("/tmp", "mplayerplug-inXXXXXX"));
2916
3098
        filename = g_strdup_printf("%s/00000001.jpg", dirname);
2917
 
    
 
3099
 
2918
3100
        // run mplayer and try to get the first frame and convert it to a jpeg
2919
3101
        command =
2920
3102
            g_strdup_printf("mplayer -vo jpeg:outdir=%s -frames 1 %s",
2923
3105
            (command, NULL, NULL, &exit_status, &error))
2924
3106
            printf("Error when running When running command: %s\n%s\n",
2925
3107
                   command, error->message);
2926
 
    
 
3108
 
2927
3109
        if (fexists(filename)) {
2928
3110
            error = NULL;
2929
3111
            instance->pb_src = gdk_pixbuf_new_from_file(filename, &error);
2931
3113
            instance->pb_src =
2932
3114
                gdk_pixbuf_new_from_xpm_data((const char **) start);
2933
3115
        }
2934
 
    
 
3116
 
2935
3117
    }
2936
3118
 
2937
3119
    if (instance->pb_src != NULL) {
2992
3174
            gtk_widget_show(instance->gtkwidget);
2993
3175
        result = FALSE;
2994
3176
    }
2995
 
    remove(filename);
2996
 
    remove(dirname);
2997
 
 
2998
 
    g_free(filename);
2999
 
    g_free(dirname);
 
3177
 
 
3178
    if (filename != NULL) {
 
3179
        remove(filename);
 
3180
        g_free(filename);
 
3181
    }
 
3182
 
 
3183
    if (dirname != NULL) {
 
3184
        remove(dirname);
 
3185
        g_free(dirname);
 
3186
    }
 
3187
 
3000
3188
    return result;
3001
3189
 
3002
3190
#endif