~swem/totem/assignment

« back to all changes in this revision

Viewing changes to browser-plugin/totem-plugin-viewer.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2010-02-25 19:11:33 UTC
  • mfrom: (1.4.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100225191133-7bonpywglovrzohq
Tags: 2.29.91-1
* New upstream development release:
  + debian/patches/90_autotools.patch:
    - Refreshed for the new version.
  + debian/control.in:
    - Update build dependencies and dependencies.
* debian/patches/99_gst-bus_flush.patch:
  + Patch from upstream GIT to fix automatic codec installation
    and random errors showing up from previous tracks.
* debian/control.in:
  + Add ATK build dependency to allow buildds to actually install
    the correct version instead of producing an error.

Show diffs side-by-side

added added

removed removed

Lines of Context:
330
330
totem_embedded_set_state (TotemEmbedded *emb, TotemStates state)
331
331
{
332
332
        GtkWidget *image;
333
 
        gchar *id;
 
333
        const gchar *id;
334
334
 
335
335
        if (state == emb->state)
336
336
                return;
348
348
                        (TOTEM_TIME_LABEL (emb->fs->time_label), 0, 0);
349
349
                if (emb->href_uri != NULL && emb->hidden == FALSE) {
350
350
                        gdk_window_set_cursor
351
 
                                (GTK_WIDGET (emb->bvw)->window,
 
351
                                (gtk_widget_get_window (GTK_WIDGET (emb->bvw)),
352
352
                                 emb->cursor);
353
353
                }
354
354
                break;
361
361
                totem_statusbar_set_text (emb->statusbar, _("Playing"));
362
362
                if (emb->href_uri == NULL && emb->hidden == FALSE) {
363
363
                        gdk_window_set_cursor
364
 
                                (GTK_WIDGET (emb->bvw)->window,
 
364
                                (gtk_widget_get_window (GTK_WIDGET (emb->bvw)),
365
365
                                 NULL);
366
366
                }
367
367
                break;
538
538
                g_free (embedded->href_uri);
539
539
                embedded->href_uri = NULL;
540
540
                gdk_window_set_cursor
541
 
                        (GTK_WIDGET (embedded->bvw)->window, NULL);
 
541
                        (gtk_widget_get_window (GTK_WIDGET (embedded->bvw)), NULL);
542
542
        }
543
543
 
544
544
        if (target != NULL) {
758
758
                /* Move the fullscreen window to the screen where the
759
759
                 * video widget currently is */
760
760
                monitor = gdk_screen_get_monitor_at_window (gtk_widget_get_screen (GTK_WIDGET (emb->bvw)),
761
 
                                                            GTK_WIDGET (emb->bvw)->window);
 
761
                                                            gtk_widget_get_window (GTK_WIDGET (emb->bvw)));
762
762
                gdk_screen_get_monitor_geometry (gtk_widget_get_screen (GTK_WIDGET (emb->bvw)),
763
763
                                                 monitor, &rect);
764
764
                gtk_window_move (GTK_WINDOW (emb->fs_window), rect.x, rect.y);
949
949
                             GError **error)
950
950
{
951
951
        char *file_uri;
952
 
        char *tmpfile;
 
952
        char *tmp_file;
953
953
        GError *err = NULL;
954
954
        GFile *src, *dst;
955
955
        int fd;
963
963
         * parse from memory or 
964
964
         * https://bugzilla.gnome.org/show_bug.cgi?id=598702 is fixed */
965
965
        fd = g_file_open_tmp ("totem-browser-plugin-playlist-XXXXXX",
966
 
                              &tmpfile,
 
966
                              &tmp_file,
967
967
                              &err);
968
968
        if (fd < 0) {
969
969
                g_warning ("Couldn't open temporary file for playlist: %s",
972
972
                return TRUE;
973
973
        }
974
974
        src = g_file_new_for_path (path);
975
 
        dst = g_file_new_for_path (tmpfile);
 
975
        dst = g_file_new_for_path (tmp_file);
976
976
        if (g_file_copy (src, dst, G_FILE_COPY_OVERWRITE | G_FILE_COPY_TARGET_DEFAULT_PERMS, NULL, NULL, NULL, &err) == FALSE) {
977
977
                g_warning ("Failed to copy playlist '%s' to '%s': %s",
978
 
                           path, tmpfile, err->message);
 
978
                           path, tmp_file, err->message);
979
979
                g_error_free (err);
980
980
                g_object_unref (src);
981
981
                g_object_unref (dst);
982
 
                g_free (tmpfile);
 
982
                g_free (tmp_file);
983
983
                close (fd);
984
984
                return TRUE;
985
985
        }
986
 
        g_free (tmpfile);
 
986
        g_free (tmp_file);
987
987
 
988
988
        file_uri = g_file_get_uri (dst);
989
989
 
1200
1200
        GtkWidget *widget = GTK_WIDGET (button);
1201
1201
        GtkRequisition menu_req;
1202
1202
        GtkTextDirection direction;
 
1203
        GtkAllocation allocation;
1203
1204
 
1204
1205
        gtk_widget_size_request (GTK_WIDGET (menu), &menu_req);
1205
1206
 
1206
1207
        direction = gtk_widget_get_direction (widget);
1207
1208
 
1208
 
        gdk_window_get_origin (widget->window, x, y);
1209
 
        *x += widget->allocation.x;
1210
 
        *y += widget->allocation.y;
 
1209
        gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
 
1210
        gtk_widget_get_allocation (widget, &allocation);
 
1211
        *x += allocation.x;
 
1212
        *y += allocation.y;
1211
1213
 
1212
1214
        if (direction == GTK_TEXT_DIR_LTR)
1213
 
                *x += MAX (widget->allocation.width - menu_req.width, 0);
1214
 
        else if (menu_req.width > widget->allocation.width)
1215
 
                *x -= menu_req.width - widget->allocation.width;
 
1215
                *x += MAX (allocation.width - menu_req.width, 0);
 
1216
        else if (menu_req.width > allocation.width)
 
1217
                *x -= menu_req.width - allocation.width;
1216
1218
 
1217
1219
        /* This might not work properly if the popup button is right at the
1218
1220
         * top of the screen, but really, what are the chances */
1240
1242
 
1241
1243
        menu = GTK_MENU (gtk_builder_get_object (emb->menuxml, "menu"));
1242
1244
 
1243
 
        if (gtk_toggle_button_get_active (button) && !GTK_WIDGET_VISIBLE (menu)) {
 
1245
        if (gtk_toggle_button_get_active (button) && !gtk_widget_get_visible (GTK_WIDGET (menu))) {
1244
1246
                /* we get here only when the menu is activated by a key
1245
1247
                 * press, so that we can select the first menu item */
1246
1248
                popup_menu_over_arrow (button, menu, NULL);
1257
1259
                GtkMenu *menu;
1258
1260
 
1259
1261
                menu = GTK_MENU (gtk_builder_get_object (emb->menuxml, "menu"));
1260
 
                if (!GTK_WIDGET_VISIBLE (menu)) {
 
1262
                if (!gtk_widget_get_visible (GTK_WIDGET (menu))) {
1261
1263
                        popup_menu_over_arrow (button, menu, event);
1262
1264
                        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
1263
1265
                } else {
1426
1428
                        totem_interface_error (_("An error occurred"), emb->error->message, (GtkWindow *) (emb->window));
1427
1429
                        g_error_free (emb->error);
1428
1430
                        emb->error = NULL;
1429
 
                } else if (!GTK_WIDGET_VISIBLE (menu)) {
 
1431
                } else if (!gtk_widget_get_visible (GTK_WIDGET (menu))) {
1430
1432
                        g_message ("emitting signal");
1431
1433
                        g_signal_emit (emb, signals[BUTTON_PRESS], 0,
1432
1434
                                       event->time,
1759
1761
                                         GTK_WINDOW (emb->window), emb);
1760
1762
        g_assert (emb->xml);
1761
1763
 
1762
 
 
1763
1764
        if (xid != 0) {
1764
1765
                g_assert (!emb->hidden);
1765
1766
 
1895
1896
                          G_CALLBACK (on_popup_button_toggled), emb);
1896
1897
        g_signal_connect (G_OBJECT (popup_button), "button-press-event",
1897
1898
                          G_CALLBACK (on_popup_button_button_pressed), emb);
1898
 
        menu = GTK_WIDGET (gtk_builder_get_object (emb->menuxml, "menu"));
1899
 
        g_signal_connect (G_OBJECT (menu), "unmap",
1900
 
                          G_CALLBACK (on_popup_menu_unmap), emb);
1901
1899
 
1902
1900
        gc = gconf_client_get_default ();
1903
1901
        volume = ((double) gconf_client_get_int (gc, GCONF_PREFIX"/volume", NULL)) / 100.0;
1970
1968
                                             GTK_WINDOW (emb->window), emb);
1971
1969
        g_assert (emb->menuxml);
1972
1970
 
 
1971
        menu = GTK_WIDGET (gtk_builder_get_object (emb->menuxml, "menu"));
 
1972
        g_signal_connect (G_OBJECT (menu), "unmap",
 
1973
                          G_CALLBACK (on_popup_menu_unmap), emb);
 
1974
 
1973
1975
        /* Set the logo and the button glow */
1974
1976
        if (!emb->hidden && emb->autostart == FALSE) {
1975
1977
                totem_glow_button_set_glow (TOTEM_GLOW_BUTTON (emb->pp_button), TRUE);
2247
2249
 
2248
2250
                env = g_getenv ("TOTEM_EMBEDDED_GDB");
2249
2251
                if (env && g_ascii_strtoull (env, NULL, 10) == 1) {
2250
 
                        char *gdbargv[6];
2251
 
                        char pid[32];
 
2252
                        char *gdbargv[4];
 
2253
                        char *gdb;
2252
2254
                        GError *gdberr = NULL;
2253
2255
                        int gdbargc = 0;
2254
2256
 
2255
 
                        g_snprintf (pid, sizeof (pid), "%d", getpid ());
 
2257
                        gdb = g_strdup_printf ("gdb %s %d", argv[0], getpid ());
2256
2258
 
2257
 
                        gdbargv[gdbargc++] = "/usr/bin/xterm";
 
2259
                        gdbargv[gdbargc++] = "/usr/bin/gnome-terminal";
2258
2260
                        gdbargv[gdbargc++] = "-e";
2259
 
                        gdbargv[gdbargc++] = "gdb";
2260
 
                        gdbargv[gdbargc++] = argv[0];
2261
 
                        gdbargv[gdbargc++] = pid;
 
2261
                        gdbargv[gdbargc++] = gdb;
2262
2262
                        gdbargv[gdbargc++] = NULL;
2263
2263
 
2264
2264
                        if (!g_spawn_async (NULL,