~ubuntu-branches/ubuntu/raring/totem/raring-proposed

« back to all changes in this revision

Viewing changes to src/totem-object.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2013-04-11 18:16:52 UTC
  • Revision ID: package-import@ubuntu.com-20130411181652-bq07kguvo1s9f30y
Tags: 3.6.3-0ubuntu6
* debian/patches/revert_shell_menu.patch: 
  - revert the use of a shell menu in raring since indicator-appmenu 
    doesn't handle the mix of technologies at the moment and we can't
    have those menu items missing (lp: #1131754)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1432
1432
window_state_event_cb (GtkWidget *window, GdkEventWindowState *event,
1433
1433
                       TotemObject *totem)
1434
1434
{
1435
 
        GAction *action;
1436
 
 
1437
1435
        if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) {
1438
1436
                totem->maximised = (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0;
1439
1437
                totem_action_set_sensitivity ("zoom-1-2", !totem->maximised);
1452
1450
 
1453
1451
                totem->controls_visibility = TOTEM_CONTROLS_FULLSCREEN;
1454
1452
                show_controls (totem, FALSE);
 
1453
                totem_action_set_sensitivity ("fullscreen", FALSE);
1455
1454
        } else {
1456
1455
                GtkAction *action;
1457
1456
 
1466
1465
                        totem->controls_visibility = TOTEM_CONTROLS_HIDDEN;
1467
1466
 
1468
1467
                show_controls (totem, TRUE);
 
1468
                totem_action_set_sensitivity ("fullscreen", TRUE);
1469
1469
        }
1470
1470
 
1471
 
        action = g_action_map_lookup_action (G_ACTION_MAP (totem), "fullscreen");
1472
 
        g_simple_action_set_state (G_SIMPLE_ACTION (action),
1473
 
                                   g_variant_new_boolean (totem->controls_visibility == TOTEM_CONTROLS_FULLSCREEN));
1474
 
 
1475
1471
        g_object_notify (G_OBJECT (totem), "fullscreen");
1476
1472
 
1477
1473
        return FALSE;
1512
1508
void
1513
1509
fs_exit1_activate_cb (GtkButton *button, TotemObject *totem)
1514
1510
{
1515
 
        GAction *action;
1516
 
 
1517
 
        action = g_action_map_lookup_action (G_ACTION_MAP (totem), "fullscreen");
1518
 
        g_action_change_state (action, g_variant_new_boolean (FALSE));
 
1511
        totem_action_fullscreen (totem, FALSE);
1519
1512
}
1520
1513
 
1521
1514
void
1725
1718
                /* Subtitle selection */
1726
1719
                totem_action_set_sensitivity ("select-subtitle", FALSE);
1727
1720
 
 
1721
                /* Fullscreen */
 
1722
                totem_action_set_sensitivity ("fullscreen", FALSE);
 
1723
 
1728
1724
                /* Set the logo */
1729
1725
                bacon_video_widget_set_logo_mode (totem->bvw, TRUE);
1730
1726
                update_mrl_label (totem, NULL);
1738
1734
                gdouble volume;
1739
1735
                char *user_agent;
1740
1736
                char *autoload_sub;
 
1737
                GdkWindowState window_state;
1741
1738
                GError *err = NULL;
1742
1739
 
1743
1740
                bacon_video_widget_set_logo_mode (totem->bvw, FALSE);
1777
1774
                /* Subtitle selection */
1778
1775
                totem_action_set_sensitivity ("select-subtitle", !totem_is_special_mrl (mrl) && retval);
1779
1776
 
 
1777
                /* Fullscreen */
 
1778
                window_state = gdk_window_get_state (gtk_widget_get_window (totem->win));
 
1779
                totem_action_set_sensitivity ("fullscreen", !(window_state & GDK_WINDOW_STATE_FULLSCREEN));
 
1780
 
1780
1781
                /* Set the playlist */
1781
1782
                play_pause_set_label (totem, retval ? STATE_PAUSED : STATE_STOPPED);
1782
1783
 
3269
3270
static void
3270
3271
playlist_repeat_toggle_cb (TotemPlaylist *playlist, gboolean repeat, TotemObject *totem)
3271
3272
{
3272
 
        GAction *action;
3273
 
 
3274
 
        action = g_action_map_lookup_action (G_ACTION_MAP (totem), "repeat");
3275
 
        g_simple_action_set_state (G_SIMPLE_ACTION (action),
3276
 
                                   g_variant_new_boolean (repeat));
 
3273
        GtkAction *action;
 
3274
 
 
3275
        action = gtk_action_group_get_action (totem->main_action_group, "repeat-mode");
 
3276
 
 
3277
        g_signal_handlers_block_matched (G_OBJECT (action), G_SIGNAL_MATCH_DATA, 0, 0,
 
3278
                        NULL, NULL, totem);
 
3279
 
 
3280
        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), repeat);
 
3281
 
 
3282
        g_signal_handlers_unblock_matched (G_OBJECT (action), G_SIGNAL_MATCH_DATA, 0, 0,
 
3283
                        NULL, NULL, totem);
3277
3284
}
3278
3285
 
3279
3286
static void
3280
3287
playlist_shuffle_toggle_cb (TotemPlaylist *playlist, gboolean shuffle, TotemObject *totem)
3281
3288
{
3282
 
        GAction *action;
3283
 
 
3284
 
        action = g_action_map_lookup_action (G_ACTION_MAP (totem), "shuffle");
3285
 
        g_simple_action_set_state (G_SIMPLE_ACTION (action),
3286
 
                                   g_variant_new_boolean (shuffle));
 
3289
        GtkAction *action;
 
3290
 
 
3291
        action = gtk_action_group_get_action (totem->main_action_group, "shuffle-mode");
 
3292
 
 
3293
        g_signal_handlers_block_matched (G_OBJECT (action), G_SIGNAL_MATCH_DATA, 0, 0,
 
3294
                        NULL, NULL, totem);
 
3295
 
 
3296
        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), shuffle);
 
3297
 
 
3298
        g_signal_handlers_unblock_matched (G_OBJECT (action), G_SIGNAL_MATCH_DATA, 0, 0,
 
3299
                        NULL, NULL, totem);
3287
3300
}
3288
3301
 
3289
3302
/**
3998
4011
        GtkAction *action;
3999
4012
        GtkActionGroup *action_group;
4000
4013
        GtkBox *box;
4001
 
        GAction *gaction;
4002
4014
 
4003
4015
        /* Menu items */
4004
 
        gaction = g_action_map_lookup_action (G_ACTION_MAP (totem), "repeat");
4005
 
        g_simple_action_set_state (G_SIMPLE_ACTION (gaction),
4006
 
                                   g_variant_new_boolean (totem_playlist_get_repeat (totem->playlist)));
4007
 
        gaction = g_action_map_lookup_action (G_ACTION_MAP (totem), "shuffle");
4008
 
        g_simple_action_set_state (G_SIMPLE_ACTION (gaction),
4009
 
                                   g_variant_new_boolean (totem_playlist_get_shuffle (totem->playlist)));
 
4016
        action = gtk_action_group_get_action (totem->main_action_group, "repeat-mode");
 
4017
        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
 
4018
                totem_playlist_get_repeat (totem->playlist));
 
4019
        action = gtk_action_group_get_action (totem->main_action_group, "shuffle-mode");
 
4020
        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
 
4021
                totem_playlist_get_shuffle (totem->playlist));
4010
4022
 
4011
4023
        /* Controls */
4012
4024
        box = GTK_BOX (gtk_builder_get_object (totem->xml, "tmw_buttons_hbox"));
4045
4057
        gtk_box_pack_start (box, item, FALSE, FALSE, 0);
4046
4058
 
4047
4059
        /* Fullscreen button */
 
4060
        action = gtk_action_group_get_action (totem->main_action_group,
 
4061
                        "fullscreen");
 
4062
        item = gtk_action_create_tool_item (action);
4048
4063
        /* Translators: this is the tooltip text for the fullscreen button in the controls box in Totem's main window. */
4049
 
        item = GTK_WIDGET (gtk_toggle_tool_button_new ());
4050
 
        gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "view-fullscreen-symbolic");
4051
4064
        gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item), _("Fullscreen"));
4052
4065
        /* Translators: this is the accessibility text for the fullscreen button in the controls box in Totem's main window. */
4053
4066
        atk_object_set_name (gtk_widget_get_accessible (item), _("Fullscreen"));
4054
 
        gtk_actionable_set_action_name (GTK_ACTIONABLE (item), "app.fullscreen");
4055
 
        gtk_widget_show (item);
4056
4067
        gtk_box_pack_start (box, item, FALSE, FALSE, 0);
4057
4068
 
4058
4069
        /* Sidebar button (Drag'n'Drop) */
4127
4138
         * and skip-* are back in the main action group. */
4128
4139
        /*totem_action_set_sensitivity ("skip-forward", FALSE);
4129
4140
        totem_action_set_sensitivity ("skip-backwards", FALSE);*/
 
4141
        totem_action_set_sensitivity ("fullscreen", FALSE);
4130
4142
 
4131
4143
        action_group = GTK_ACTION_GROUP (gtk_builder_get_object (totem->xml, "skip-action-group"));
4132
4144