[totem] main: Remove auto-resize and zoom to video size

From: Bastien Nocera <hadess src gnome org>

To: commits-list gnome org

Cc:

Subject: [totem] main: Remove auto-resize and zoom to video size

Date: Wed, 6 Mar 2013 16:56:40 +0000 (UTC)

commit 866751fd985463b28f72854242671ac86593f762 Author: Bastien Nocera <hadess hadess net> Date: Fri Feb 22 16:08:57 2013 +0100 main: Remove auto-resize and zoom to video size Those will not make much sense anymore when we want Totem to be maximised most of the time, as per the new designs. https://bugzilla.gnome.org/show_bug.cgi?id=694457 README | 2 - data/org.gnome.totem.gschema.xml.in.in | 4 - data/preferences.ui | 32 --------- data/totem.convert | 1 - data/totem.ui | 26 ------- docs/reference/totem-sections.txt | 4 - src/backend/bacon-video-widget.c | 116 -------------------------------- src/backend/bacon-video-widget.h | 7 -- src/backend/video-utils.c | 74 -------------------- src/backend/video-utils.h | 6 -- src/totem-menu.c | 21 ------ src/totem-object.c | 33 --------- src/totem-preferences.c | 5 -- src/totem.h | 1 - 14 files changed, 0 insertions(+), 332 deletions(-) --- diff --git a/README b/README index 5fd7855..dab604b 100644 --- a/README +++ b/README @@ -35,8 +35,6 @@ Escape (in full screen mode): Switch to windowed mode Ctrl+F: Toggle full screen -0/½, 1, 2: - Zoom respectively to 50%, 100% and 200% of the video's original size Left arrow: Go back 15 seconds Right arrow: diff --git a/data/org.gnome.totem.gschema.xml.in.in b/data/org.gnome.totem.gschema.xml.in.in index 671e016..4f9cde5 100644 --- a/data/org.gnome.totem.gschema.xml.in.in +++ b/data/org.gnome.totem.gschema.xml.in.in @@ -31,10 +31,6 @@ <default>32767</default> <_summary>The saturation of the video</_summary> </key> - <key name="auto-resize" type="b"> - <default>false</default> - <_summary>Resize the canvas automatically on file load</_summary> - </key> <key name="repeat" type="b"> <default>false</default> <_summary>Repeat mode</_summary> diff --git a/data/preferences.ui b/data/preferences.ui index 5509555..fa3f997 100644 --- a/data/preferences.ui +++ b/data/preferences.ui @@ -597,38 +597,6 @@ </child> <child> - <object class="GtkAlignment" id="alignment4"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">1</property> - <property name="yscale">1</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">12</property> - <property name="right_padding">0</property> - - <child> - <object class="GtkCheckButton" id="tpw_display_checkbutton"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Resize the window when a new video is loaded</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </object> - </child> - </object> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - <child> <object class="GtkAlignment" id="alignment9"> <property name="visible">True</property> <property name="left_padding">12</property> diff --git a/data/totem.convert b/data/totem.convert index 9d6bfad..86d0e71 100644 --- a/data/totem.convert +++ b/data/totem.convert @@ -6,7 +6,6 @@ brightness = /apps/totem/brightness contrast = /apps/totem/contrast hue = /apps/totem/hue saturation = /apps/totem/saturation -auto-resize = /apps/totem/auto_resize repeat = /apps/totem/repeat shuffle = /apps/totem/shuffle disable-deinterlacing = /apps/totem/disable_deinterlacing diff --git a/data/totem.ui b/data/totem.ui index e3dcbed..c54503d 100644 --- a/data/totem.ui +++ b/data/totem.ui @@ -117,27 +117,6 @@ </object> </child> <child> - <object class="GtkAction" id="zoom-1-2"> - <property name="label" translatable="yes">_Resize 1∶2</property> - <property name="tooltip" translatable="yes">Resize to half the original video size</property> - <signal name="activate" handler="zoom_1_2_action_callback"/> - </object> - </child> - <child> - <object class="GtkAction" id="zoom-1-1"> - <property name="label" translatable="yes">Resize _1∶1</property> - <property name="tooltip" translatable="yes">Resize to the original video size</property> - <signal name="activate" handler="zoom_1_1_action_callback"/> - </object> - </child> - <child> - <object class="GtkAction" id="zoom-2-1"> - <property name="label" translatable="yes">Resize _2∶1</property> - <property name="tooltip" translatable="yes">Resize to double the original video size</property> - <signal name="activate" handler="zoom_2_1_action_callback"/> - </object> - </child> - <child> <object class="GtkAction" id="aspect-ratio-menu"> <property name="label" translatable="yes">_Aspect Ratio</property> </object> @@ -393,11 +372,6 @@ <menuitem name="plugins" action="plugins"/> </menu> <menu name="view" action="view-menu"> - <menu name="zoom-window" action="zoom-window-menu"> - <menuitem name="zoom-1-2" action="zoom-1-2"/> - <menuitem name="zoom-1-1" action="zoom-1-1"/> - <menuitem name="zoom-2-1" action="zoom-2-1"/> - </menu> <menuitem name="zoom-toggle" action="zoom-toggle"/> <separator/> <menu name="aspect-ratio" action="aspect-ratio-menu"> diff --git a/docs/reference/totem-sections.txt b/docs/reference/totem-sections.txt index cfde337..fba0ff7 100644 --- a/docs/reference/totem-sections.txt +++ b/docs/reference/totem-sections.txt @@ -33,7 +33,6 @@ totem_action_volume_toggle_mute totem_action_toggle_aspect_ratio totem_action_get_aspect_ratio totem_action_set_aspect_ratio -totem_action_set_scale_ratio totem_action_set_playlist_index totem_object_action_remote totem_is_fullscreen @@ -162,8 +161,6 @@ bacon_video_widget_get_aspect_ratio bacon_video_widget_set_aspect_ratio bacon_video_widget_get_audio_output_type bacon_video_widget_set_audio_output_type -bacon_video_widget_get_auto_resize -bacon_video_widget_set_auto_resize bacon_video_widget_get_current_frame bacon_video_widget_get_current_time bacon_video_widget_get_deinterlacing @@ -181,7 +178,6 @@ bacon_video_widget_get_position bacon_video_widget_set_referrer bacon_video_widget_get_rotation bacon_video_widget_set_rotation -bacon_video_widget_set_scale_ratio bacon_video_widget_get_show_cursor bacon_video_widget_set_show_cursor bacon_video_widget_set_show_visualizations diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c index c38881e..2be39e5 100644 --- a/src/backend/bacon-video-widget.c +++ b/src/backend/bacon-video-widget.c @@ -224,7 +224,6 @@ struct BaconVideoWidgetPrivate gboolean logo_mode; gboolean cursor_shown; gboolean fullscreen_mode; - gboolean auto_resize; gboolean uses_audio_fakesink; gdouble volume; gboolean is_menu; @@ -234,8 +233,6 @@ struct BaconVideoWidgetPrivate gint video_width; /* Movie width */ gint video_height; /* Movie height */ - gboolean window_resized; /* Whether the window has already been resized - for this media */ gint movie_par_n; /* Movie pixel aspect ratio numerator */ gint movie_par_d; /* Movie pixel aspect ratio denominator */ gint video_width_pixels; /* Scaled movie width */ @@ -912,17 +909,6 @@ bacon_video_widget_class_init (BaconVideoWidgetClass * klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** - * BaconVideoWidget:auto-resize: - * - * Whether to automatically resize the video widget to the video size when loading a new video. - **/ - g_object_class_install_property (object_class, PROP_AUTO_RESIZE, - g_param_spec_boolean ("auto-resize", "Auto resize?", - "Whether to automatically resize the video widget to the video size.", FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** * BaconVideoWidget:deinterlacing: * * Whether to automatically deinterlace videos. @@ -1240,12 +1226,6 @@ bvw_handle_application_message (BaconVideoWidget *bvw, GstMessage *msg) get_media_size (bvw, &w, &h); clutter_actor_set_size (bvw->priv->texture, w, h); - if (bvw->priv->auto_resize - && !bvw->priv->fullscreen_mode - && !bvw->priv->window_resized) { - bacon_video_widget_set_scale_ratio (bvw, 0.0); - } - bvw->priv->window_resized = TRUE; set_current_actor (bvw); } else { g_debug ("Unhandled application message %s", msg_name); @@ -2633,9 +2613,6 @@ bacon_video_widget_set_property (GObject * object, guint property_id, case PROP_VOLUME: bacon_video_widget_set_volume (bvw, g_value_get_double (value)); break; - case PROP_AUTO_RESIZE: - bacon_video_widget_set_auto_resize (bvw, g_value_get_boolean (value)); - break; case PROP_DEINTERLACING: bacon_video_widget_set_deinterlacing (bvw, g_value_get_boolean (value)); break; @@ -2705,9 +2682,6 @@ bacon_video_widget_get_property (GObject * object, guint property_id, case PROP_DOWNLOAD_FILENAME: g_value_set_string (value, bvw->priv->download_filename); break; - case PROP_AUTO_RESIZE: - g_value_set_boolean (value, bvw->priv->auto_resize); - break; case PROP_DEINTERLACING: g_value_set_boolean (value, bacon_video_widget_get_deinterlacing (bvw)); break; @@ -3804,7 +3778,6 @@ bacon_video_widget_close (BaconVideoWidget * bvw) bvw->priv->is_live = FALSE; bvw->priv->is_menu = FALSE; bvw->priv->has_angles = FALSE; - bvw->priv->window_resized = FALSE; bvw->priv->rate = FORWARD_RATE; bvw->priv->current_time = 0; @@ -4683,43 +4656,6 @@ bacon_video_widget_set_visualization_quality (BaconVideoWidget * bvw, } /** - * bacon_video_widget_get_auto_resize: - * @bvw: a #BaconVideoWidget - * - * Returns whether the widget will automatically resize to fit videos. - * - * Return value: %TRUE if the widget will resize, %FALSE otherwise - **/ -gboolean -bacon_video_widget_get_auto_resize (BaconVideoWidget * bvw) -{ - g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE); - - return bvw->priv->auto_resize; -} - -/** - * bacon_video_widget_set_auto_resize: - * @bvw: a #BaconVideoWidget - * @auto_resize: %TRUE to automatically resize for new videos, %FALSE otherwise - * - * Sets whether the widget should automatically resize to fit to new videos when - * they are loaded. Changes to this will take effect when the next media file is - * loaded. - **/ -void -bacon_video_widget_set_auto_resize (BaconVideoWidget * bvw, - gboolean auto_resize) -{ - g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw)); - - bvw->priv->auto_resize = auto_resize; - - /* this will take effect when the next media file loads */ - g_object_notify (G_OBJECT (bvw), "auto-resize"); -} - -/** * bacon_video_widget_set_aspect_ratio: * @bvw: a #BaconVideoWidget * @ratio: the new aspect ratio @@ -4761,57 +4697,6 @@ bacon_video_widget_get_aspect_ratio (BaconVideoWidget *bvw) } /** - * bacon_video_widget_set_scale_ratio: - * @bvw: a #BaconVideoWidget - * @ratio: the new scale ratio - * - * Sets the ratio by which the widget will scale videos when they are - * displayed. If @ratio is set to <code class="literal">0</code>, the highest ratio possible will - * be chosen. - **/ -void -bacon_video_widget_set_scale_ratio (BaconVideoWidget * bvw, gfloat ratio) -{ - GtkWidget *toplevel; - gint w, h; - - g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw)); - g_return_if_fail (GST_IS_ELEMENT (bvw->priv->play)); - - GST_DEBUG ("ratio = %.2f", ratio); - - if (!bvw->priv->media_has_video && bvw->priv->show_vfx) { - get_visualization_size (bvw, &w, &h, NULL, NULL); - } else { - get_media_size (bvw, &w, &h); - } - - if (ratio == 0.0) { - if (totem_ratio_fits_screen (GTK_WIDGET (bvw), w, h, 2.0)) - ratio = 2.0; - else if (totem_ratio_fits_screen (GTK_WIDGET (bvw), w, h, 1.0)) - ratio = 1.0; - else if (totem_ratio_fits_screen (GTK_WIDGET (bvw), w, h, 0.5)) - ratio = 0.5; - else - return; - } else { - if (!totem_ratio_fits_screen (GTK_WIDGET (bvw), w, h, ratio)) { - GST_DEBUG ("movie doesn't fit on screen @ %.1fx (%dx%d)", w, h, ratio); - return; - } - } - w = (gfloat) w * ratio; - h = (gfloat) h * ratio; - - GST_DEBUG ("setting preferred size %dx%d", w, h); - - toplevel = gtk_widget_get_toplevel (GTK_WIDGET (bvw)); - if (gtk_widget_is_toplevel (toplevel)) - gtk_window_resize_to_geometry (GTK_WINDOW (toplevel), w, h); -} - -/** * bacon_video_widget_set_zoom: * @bvw: a #BaconVideoWidget * @mode: the #BvwZoomMode @@ -5956,7 +5841,6 @@ bacon_video_widget_initable_init (GInitable *initable, bvw->priv->cursor_shown = TRUE; bvw->priv->logo_mode = FALSE; - bvw->priv->auto_resize = FALSE; bvw->priv->stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (bvw)); clutter_actor_set_background_color (CLUTTER_ACTOR (bvw->priv->stage), CLUTTER_COLOR_Black); diff --git a/src/backend/bacon-video-widget.h b/src/backend/bacon-video-widget.h index a9d2f5c..c286c11 100644 --- a/src/backend/bacon-video-widget.h +++ b/src/backend/bacon-video-widget.h @@ -179,10 +179,6 @@ void bacon_video_widget_set_show_cursor (BaconVideoWidget *bvw, gboolean show_cursor); gboolean bacon_video_widget_get_show_cursor (BaconVideoWidget *bvw); -gboolean bacon_video_widget_get_auto_resize (BaconVideoWidget *bvw); -void bacon_video_widget_set_auto_resize (BaconVideoWidget *bvw, - gboolean auto_resize); - void bacon_video_widget_set_subtitle_font (BaconVideoWidget *bvw, const char *font); void bacon_video_widget_set_subtitle_encoding (BaconVideoWidget *bvw, @@ -356,9 +352,6 @@ void bacon_video_widget_set_aspect_ratio (BaconVideoWidget *bvw, BvwAspectRatio bacon_video_widget_get_aspect_ratio (BaconVideoWidget *bvw); -void bacon_video_widget_set_scale_ratio (BaconVideoWidget *bvw, - float ratio); - void bacon_video_widget_set_zoom (BaconVideoWidget *bvw, BvwZoomMode mode); BvwZoomMode bacon_video_widget_get_zoom (BaconVideoWidget *bvw); diff --git a/src/backend/video-utils.c b/src/backend/video-utils.c index 05cc311..8ea3ff3 100644 --- a/src/backend/video-utils.c +++ b/src/backend/video-utils.c @@ -56,77 +56,3 @@ totem_gdk_window_set_waiting_cursor (GdkWindow *window) gdk_flush (); } - -static gboolean -totem_ratio_fits_screen_helper (GtkWidget *video_widget, - int new_w, int new_h, - gfloat ratio) -{ - GdkScreen *screen; - GdkRectangle work_rect, mon_rect; - GdkWindow *window; - int monitor; - - window = gtk_widget_get_window (video_widget); - g_return_val_if_fail (window != NULL, FALSE); - - screen = gtk_widget_get_screen (video_widget); - window = gtk_widget_get_window (video_widget); - monitor = gdk_screen_get_monitor_at_window (screen, window); - - gdk_screen_get_monitor_workarea (screen, monitor, &work_rect); - gdk_screen_get_monitor_geometry (screen, - gdk_screen_get_monitor_at_window (screen, window), - &mon_rect); - gdk_rectangle_intersect (&mon_rect, &work_rect, &work_rect); - - if (new_w > work_rect.width || new_h > work_rect.height) - return FALSE; - - return TRUE; -} - -static void -get_window_size (GtkWidget *widget, - int *width, - int *height) -{ - GdkWindow *window; - GdkRectangle rect; - - window = gtk_widget_get_window (widget); - gdk_window_get_frame_extents (window, &rect); - *width = rect.width; - *height = rect.height; -} - -gboolean -totem_ratio_fits_screen (GtkWidget *video_widget, - int video_width, int video_height, - gfloat ratio) -{ - int new_w, new_h; - GtkWidget *window; - - if (video_width <= 0 || video_height <= 0) - return TRUE; - - new_w = video_width * ratio; - new_h = video_height * ratio; - - /* Now add the width of the rest of the movie player UI */ - window = gtk_widget_get_toplevel (video_widget); - if (gtk_widget_is_toplevel (window)) { - GdkWindow *video_win; - int win_w, win_h; - - get_window_size (window, &win_w, &win_h); - video_win = gtk_widget_get_window (video_widget); - - new_w += win_w - gdk_window_get_width (video_win); - new_h += win_h - gdk_window_get_height (video_win); - } - - return totem_ratio_fits_screen_helper (video_widget, new_w, new_h, ratio); -} - diff --git a/src/backend/video-utils.h b/src/backend/video-utils.h index 0ab73c2..eb777dd 100644 --- a/src/backend/video-utils.h +++ b/src/backend/video-utils.h @@ -30,9 +30,3 @@ void totem_gdk_window_set_invisible_cursor (GdkWindow *window); void totem_gdk_window_set_waiting_cursor (GdkWindow *window); - -gboolean totem_ratio_fits_screen (GtkWidget *widget, - int video_width, - int video_height, - gfloat ratio); - diff --git a/src/totem-menu.c b/src/totem-menu.c index 9e82ffe..2366057 100644 --- a/src/totem-menu.c +++ b/src/totem-menu.c @@ -47,9 +47,6 @@ G_MODULE_EXPORT void eject_action_callback (GtkAction *action, Totem *totem); G_MODULE_EXPORT void properties_action_callback (GtkAction *action, Totem *totem); G_MODULE_EXPORT void play_action_callback (GtkAction *action, Totem *totem); G_MODULE_EXPORT void quit_action_callback (GtkAction *action, Totem *totem); -G_MODULE_EXPORT void zoom_1_2_action_callback (GtkAction *action, Totem *totem); -G_MODULE_EXPORT void zoom_1_1_action_callback (GtkAction *action, Totem *totem); -G_MODULE_EXPORT void zoom_2_1_action_callback (GtkAction *action, Totem *totem); G_MODULE_EXPORT void zoom_toggle_action_callback (GtkToggleAction *action, Totem *totem); G_MODULE_EXPORT void next_angle_action_callback (GtkAction *action, Totem *totem); G_MODULE_EXPORT void dvd_root_menu_action_callback (GtkAction *action, Totem *totem); @@ -657,24 +654,6 @@ quit_action_callback (GtkAction *action, Totem *totem) } void -zoom_1_2_action_callback (GtkAction *action, Totem *totem) -{ - totem_action_set_scale_ratio (totem, 0.5); -} - -void -zoom_1_1_action_callback (GtkAction *action, Totem *totem) -{ - totem_action_set_scale_ratio (totem, 1); -} - -void -zoom_2_1_action_callback (GtkAction *action, Totem *totem) -{ - totem_action_set_scale_ratio (totem, 2); -} - -void zoom_toggle_action_callback (GtkToggleAction *action, Totem *totem) { diff --git a/src/totem-object.c b/src/totem-object.c index aff3026..883c9c5 100644 --- a/src/totem-object.c +++ b/src/totem-object.c @@ -1431,14 +1431,6 @@ window_state_event_cb (GtkWidget *window, GdkEventWindowState *event, { GAction *action; - if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) { - totem->maximised = (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0; - totem_action_set_sensitivity ("zoom-1-2", !totem->maximised); - totem_action_set_sensitivity ("zoom-1-1", !totem->maximised); - totem_action_set_sensitivity ("zoom-2-1", !totem->maximised); - return FALSE; - } - if ((event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) == 0) return FALSE; @@ -2100,20 +2092,6 @@ totem_action_get_aspect_ratio (TotemObject *totem) return (bacon_video_widget_get_aspect_ratio (totem->bvw)); } -/** - * totem_action_set_scale_ratio: - * @totem: a #TotemObject - * @ratio: the scale ratio to use - * - * Sets the video scale ratio, as a float where, for example, - * 1.0 is 1:1 and 2.0 is 2:1. - **/ -void -totem_action_set_scale_ratio (TotemObject *totem, gfloat ratio) -{ - bacon_video_widget_set_scale_ratio (totem->bvw, ratio); -} - void totem_action_show_help (TotemObject *totem) { @@ -3580,17 +3558,6 @@ totem_action_handle_key_press (TotemObject *totem, GdkEventKey *event) case GDK_KEY_0: if (event->state & GDK_CONTROL_MASK) totem_action_set_zoom (totem, FALSE); - else - totem_action_set_scale_ratio (totem, 0.5); - break; - case GDK_KEY_onehalf: - totem_action_set_scale_ratio (totem, 0.5); - break; - case GDK_KEY_1: - totem_action_set_scale_ratio (totem, 1); - break; - case GDK_KEY_2: - totem_action_set_scale_ratio (totem, 2); break; case GDK_KEY_Menu: totem_action_menu_popup (totem, 0); diff --git a/src/totem-preferences.c b/src/totem-preferences.c index 7c26abe..a305054 100644 --- a/src/totem-preferences.c +++ b/src/totem-preferences.c @@ -320,11 +320,6 @@ totem_setup_preferences (Totem *totem) g_settings_bind (totem->settings, "remember-position", item, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (totem->settings, "remember-position", totem, "remember-position", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); - /* Auto-resize */ - item = POBJ ("tpw_display_checkbutton"); - g_settings_bind (totem->settings, "auto-resize", item, "active", G_SETTINGS_BIND_DEFAULT); - g_settings_bind (totem->settings, "auto-resize", bvw, "auto-resize", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); - /* Screensaver audio locking */ lock_screensaver_on_audio = g_settings_get_boolean (totem->settings, "lock-screensaver-on-audio"); if (lock_screensaver_on_audio != FALSE) diff --git a/src/totem.h b/src/totem.h index 3904cae..78084e3 100644 --- a/src/totem.h +++ b/src/totem.h @@ -219,7 +219,6 @@ void totem_action_set_aspect_ratio (TotemObject *totem, int ratio); int totem_action_get_aspect_ratio (TotemObject *totem); void totem_action_next_angle (TotemObject *totem); -void totem_action_set_scale_ratio (TotemObject *totem, gfloat ratio); #define totem_action_error totem_object_action_error void totem_object_action_error (TotemObject *totem, const char *title,