Esempio n. 1
0
static void
totem_movie_properties_plugin_file_opened (TotemObject *totem,
					   const char *mrl,
					   TotemMoviePropertiesPlugin *plugin)
{
	GtkWidget *bvw;

	bvw = totem_object_get_video_widget (totem);
	update_properties_from_bvw
		(BACON_VIDEO_WIDGET_PROPERTIES (plugin->priv->props), bvw);
	g_object_unref (bvw);
	gtk_widget_set_sensitive (plugin->priv->props, TRUE);
}
Esempio n. 2
0
static void
totem_movie_properties_plugin_metadata_updated (TotemObject *totem,
						const char *artist, 
						const char *title, 
						const char *album,
						guint track_num,
						TotemMoviePropertiesPlugin *plugin)
{
	GtkWidget *bvw;

	bvw = totem_object_get_video_widget (totem);
	update_properties_from_bvw
		(BACON_VIDEO_WIDGET_PROPERTIES (plugin->priv->props), bvw);
	g_object_unref (bvw);
}
static void rotation_plugin_real_activate (PeasActivatable* base) {
	RotationPlugin * self;
	TotemObject* t = NULL;
	GObject* _tmp0_ = NULL;
	GObject* _tmp1_ = NULL;
	gchar* mrl = NULL;
	TotemObject* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	GMenu* menu = NULL;
	TotemObject* _tmp4_ = NULL;
	GMenu* _tmp5_ = NULL;
	GMenu* _tmp6_ = NULL;
	TotemObject* _tmp7_ = NULL;
	GtkWidget* _tmp8_ = NULL;
	BaconVideoWidget* _tmp9_ = NULL;
	GSimpleAction* _tmp10_ = NULL;
	GSimpleAction* _tmp11_ = NULL;
	TotemObject* _tmp12_ = NULL;
	GSimpleAction* _tmp13_ = NULL;
	TotemObject* _tmp14_ = NULL;
	GSimpleAction* _tmp15_ = NULL;
	GSimpleAction* _tmp16_ = NULL;
	TotemObject* _tmp17_ = NULL;
	GSimpleAction* _tmp18_ = NULL;
	TotemObject* _tmp19_ = NULL;
	GMenuItem* item = NULL;
	const gchar* _tmp20_ = NULL;
	GMenuItem* _tmp21_ = NULL;
	GMenuItem* _tmp22_ = NULL;
	GMenu* _tmp23_ = NULL;
	GMenuItem* _tmp24_ = NULL;
	const gchar* _tmp25_ = NULL;
	GMenuItem* _tmp26_ = NULL;
	GMenuItem* _tmp27_ = NULL;
	GMenu* _tmp28_ = NULL;
	GMenuItem* _tmp29_ = NULL;
	const gchar* _tmp30_ = NULL;
	const gchar* _tmp33_ = NULL;
	TotemObject* _tmp35_ = NULL;
	TotemObject* _tmp36_ = NULL;
	self = (RotationPlugin*) base;
	g_object_get ((PeasActivatable*) self, "object", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	t = G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, totem_object_get_type (), TotemObject);
	_tmp2_ = t;
	_tmp3_ = totem_object_get_current_mrl (_tmp2_);
	mrl = _tmp3_;
	_tmp4_ = t;
	_tmp5_ = totem_object_get_menu_section (_tmp4_, "rotation-placeholder");
	_tmp6_ = _g_object_ref0 (_tmp5_);
	menu = _tmp6_;
	_tmp7_ = t;
	_tmp8_ = totem_object_get_video_widget (_tmp7_);
	_tmp9_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, BACON_TYPE_VIDEO_WIDGET) ? ((BaconVideoWidget*) _tmp8_) : NULL;
	if (_tmp9_ == NULL) {
		_g_object_unref0 (_tmp8_);
	}
	_g_object_unref0 (self->priv->bvw);
	self->priv->bvw = _tmp9_;
	_tmp10_ = g_simple_action_new ("rotate-left", NULL);
	_g_object_unref0 (self->priv->rotate_left_action);
	self->priv->rotate_left_action = _tmp10_;
	_tmp11_ = self->priv->rotate_left_action;
	g_signal_connect_object (_tmp11_, "activate", (GCallback) _rotation_plugin_cb_rotate_left_g_simple_action_activate, self, 0);
	_tmp12_ = t;
	_tmp13_ = self->priv->rotate_left_action;
	g_action_map_add_action ((GActionMap*) _tmp12_, (GAction*) _tmp13_);
	_tmp14_ = t;
	gtk_application_add_accelerator ((GtkApplication*) _tmp14_, "<Primary><Shift>R", "app.rotate-left", NULL);
	_tmp15_ = g_simple_action_new ("rotate-right", NULL);
	_g_object_unref0 (self->priv->rotate_right_action);
	self->priv->rotate_right_action = _tmp15_;
	_tmp16_ = self->priv->rotate_right_action;
	g_signal_connect_object (_tmp16_, "activate", (GCallback) _rotation_plugin_cb_rotate_right_g_simple_action_activate, self, 0);
	_tmp17_ = t;
	_tmp18_ = self->priv->rotate_right_action;
	g_action_map_add_action ((GActionMap*) _tmp17_, (GAction*) _tmp18_);
	_tmp19_ = t;
	gtk_application_add_accelerator ((GtkApplication*) _tmp19_, "<Primary>R", "app.rotate-right", NULL);
	_tmp20_ = _ ("_Rotate ↷");
	_tmp21_ = g_menu_item_new (_tmp20_, "app.rotate-right");
	item = _tmp21_;
	_tmp22_ = item;
	g_menu_item_set_attribute (_tmp22_, "accel", "s", "<Primary>R", NULL);
	_tmp23_ = menu;
	_tmp24_ = item;
	g_menu_append_item (_tmp23_, _tmp24_);
	_tmp25_ = _ ("Rotate ↶");
	_tmp26_ = g_menu_item_new (_tmp25_, "app.rotate-left");
	_g_object_unref0 (item);
	item = _tmp26_;
	_tmp27_ = item;
	g_menu_item_set_attribute (_tmp27_, "accel", "s", "<Primary><Shift>R", NULL);
	_tmp28_ = menu;
	_tmp29_ = item;
	g_menu_append_item (_tmp28_, _tmp29_);
	_tmp30_ = mrl;
	if (_tmp30_ == NULL) {
		GSimpleAction* _tmp31_ = NULL;
		GSimpleAction* _tmp32_ = NULL;
		_tmp31_ = self->priv->rotate_right_action;
		g_simple_action_set_enabled (_tmp31_, FALSE);
		_tmp32_ = self->priv->rotate_left_action;
		g_simple_action_set_enabled (_tmp32_, FALSE);
	}
	_tmp33_ = mrl;
	if (_tmp33_ != NULL) {
		const gchar* _tmp34_ = NULL;
		_tmp34_ = mrl;
		rotation_plugin_try_restore_state (self, _tmp34_, ____lambda6__gasync_ready_callback, g_object_ref (self));
	}
	_tmp35_ = t;
	g_signal_connect_object (_tmp35_, "file-closed", (GCallback) _rotation_plugin_cb_file_closed_totem_object_file_closed, self, 0);
	_tmp36_ = t;
	g_signal_connect_object (_tmp36_, "file-opened", (GCallback) _rotation_plugin_cb_file_opened_totem_object_file_opened, self, 0);
	_g_object_unref0 (item);
	_g_object_unref0 (menu);
	_g_free0 (mrl);
	_g_object_unref0 (t);
}
void
totem_setup_preferences (Totem *totem)
{
	GtkWidget *bvw;
	guint i, hidden;
	char *font, *encoding;
	GObject *item;
	GtkWidget *content_area;

	static struct {
		const char *name;
		BvwVideoProperty prop;
		const char *label;
		const gchar *key;
		const gchar *adjustment;
	} props[4] = {
		{ "tpw_contrast_scale", BVW_VIDEO_CONTRAST, "tpw_contrast_label", "contrast", "tpw_contrast_adjustment" },
		{ "tpw_saturation_scale", BVW_VIDEO_SATURATION, "tpw_saturation_label", "saturation", "tpw_saturation_adjustment" },
		{ "tpw_bright_scale", BVW_VIDEO_BRIGHTNESS, "tpw_brightness_label", "brightness", "tpw_bright_adjustment" },
		{ "tpw_hue_scale", BVW_VIDEO_HUE, "tpw_hue_label", "hue", "tpw_hue_adjustment" }
	};

	g_return_if_fail (totem->settings != NULL);
	g_return_if_fail (totem->prefs != NULL);

	content_area = POBJ ("tpw_dialog_vbox");
	g_return_if_fail (content_area != NULL);

	gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (totem->prefs))),
			content_area);

	bvw = totem_object_get_video_widget (totem);

	g_signal_connect (G_OBJECT (totem->prefs), "response",
			G_CALLBACK (gtk_widget_hide), NULL);
	g_signal_connect (G_OBJECT (totem->prefs), "delete-event",
			G_CALLBACK (gtk_widget_hide_on_delete), NULL);
        g_signal_connect (totem->prefs, "destroy",
                          G_CALLBACK (gtk_widget_destroyed), &totem->prefs);

	/* Disable deinterlacing */
	item = POBJ ("tpw_no_deinterlace_checkbutton");
	g_settings_bind (totem->settings, "disable-deinterlacing", item, "active", G_SETTINGS_BIND_DEFAULT);
	g_settings_bind (totem->settings, "disable-deinterlacing", bvw, "deinterlacing",
	                 G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY | G_SETTINGS_BIND_INVERT_BOOLEAN);

	/* Auto-load subtitles */
	item = POBJ ("tpw_auto_subtitles_checkbutton");
	g_settings_bind (totem->settings, "autoload-subtitles", item, "active", G_SETTINGS_BIND_DEFAULT);

	/* Auto-load external chapters */
	item = POBJ ("tpw_auto_chapters_checkbutton");
	g_settings_bind (totem->settings, "autoload-chapters", item, "active", G_SETTINGS_BIND_DEFAULT);

	/* Plugins button */
	item = POBJ ("tpw_plugins_button");
	g_signal_connect (G_OBJECT (item), "clicked",
			  G_CALLBACK (plugin_button_clicked_cb), totem);

	/* Brightness and all */
	hidden = 0;
	for (i = 0; i < G_N_ELEMENTS (props); i++) {
		int prop_value;

		item = POBJ (props[i].adjustment);
		g_settings_bind (totem->settings, props[i].key, item, "value", G_SETTINGS_BIND_DEFAULT);
		g_settings_bind (totem->settings, props[i].key, bvw, props[i].key, G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);

		prop_value = bacon_video_widget_get_video_property (totem->bvw, props[i].prop);
		if (prop_value < 0) {
			/* The property's unsupported, so hide the widget and its label */
			item = POBJ (props[i].name);
			gtk_range_set_value (GTK_RANGE (item), (gdouble) 65535/2);
			gtk_widget_hide (GTK_WIDGET (item));
			item = POBJ (props[i].label);
			gtk_widget_hide (GTK_WIDGET (item));
			hidden++;
		}
	}

	/* If all the properties have been hidden, hide their section box */
	if (hidden == G_N_ELEMENTS (props)) {
		item = POBJ ("tpw_bright_contr_vbox");
		gtk_widget_hide (GTK_WIDGET (item));
	}

	/* Sound output type */
	item = POBJ ("tpw_sound_output_combobox");
	g_settings_bind (totem->settings, "audio-output-type", bvw, "audio-output-type",
	                 G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY);
	g_settings_bind_with_mapping (totem->settings, "audio-output-type", item, "active", G_SETTINGS_BIND_DEFAULT,
	                              (GSettingsBindGetMapping) int_enum_get_mapping, (GSettingsBindSetMapping) int_enum_set_mapping,
	                              g_type_class_ref (BVW_TYPE_AUDIO_OUTPUT_TYPE), (GDestroyNotify) g_type_class_unref);

	/* Subtitle font selection */
	item = POBJ ("font_sel_button");
	gtk_font_button_set_title (GTK_FONT_BUTTON (item),
				   _("Select Subtitle Font"));
	font = g_settings_get_string (totem->settings, "subtitle-font");
	if (*font != '\0') {
		gtk_font_button_set_font_name (GTK_FONT_BUTTON (item), font);
		bacon_video_widget_set_subtitle_font (totem->bvw, font);
	}
	g_free (font);
	g_signal_connect (totem->settings, "changed::subtitle-font", (GCallback) font_changed_cb, totem);

	/* Subtitle encoding selection */
	item = POBJ ("subtitle_encoding_combo");
	totem_subtitle_encoding_init (GTK_COMBO_BOX (item));
	encoding = g_settings_get_string (totem->settings, "subtitle-encoding");
	/* Make sure the default is UTF-8 */
	if (*encoding == '\0') {
		g_free (encoding);
		encoding = g_strdup ("UTF-8");
	}
	totem_subtitle_encoding_set (GTK_COMBO_BOX(item), encoding);
	if (encoding && strcasecmp (encoding, "") != 0) {
		bacon_video_widget_set_subtitle_encoding (totem->bvw, encoding);
	}
	g_free (encoding);
	g_signal_connect (totem->settings, "changed::subtitle-encoding", (GCallback) encoding_changed_cb, totem);

	/* Disable keyboard shortcuts */
	totem->disable_kbd_shortcuts = g_settings_get_boolean (totem->settings, "disable-keyboard-shortcuts");
	g_signal_connect (totem->settings, "changed::disable-keyboard-shortcuts", (GCallback) disable_kbd_shortcuts_changed_cb, totem);

	g_object_unref (bvw);
}